[PATCH] sfnt2fnt: Fix broken .fon files on !x86 architectures

André Hentschel nerv at dawncrow.de
Fri Jun 15 13:27:46 CDT 2012


Am 15.06.2012 19:52, schrieb Hilko Bengen:
> * Alexandre Julliard:
> 
>> Hilko Bengen <bengen at hilluzination.de> writes:
>>
>>> So, do I need to define my own htobe16 and htobe32 functions or macros
>>> based on whether WORDS_BIGENDIAN is defined or not?
>>
>> Yes.
> 
> I have tested these macros on Linux/PowerPC and they still produce the
> same results as on i386.
> 
> Is this form okay?
> 
> -Hilko
> 
> diff --git a/tools/sfnt2fnt.c b/tools/sfnt2fnt.c
> index df9260f..9ce503a 100644
> --- a/tools/sfnt2fnt.c
> +++ b/tools/sfnt2fnt.c
> @@ -46,7 +46,20 @@
>  
>  #include "pshpack1.h"
>  
> -#include <endian.h>
> +#if !defined(htole16) || !defined(htole32)
> +#include "basetsd.h"
> +#if defined(WORDS_BIGENDIAN)
> +#define htole16(_x) ( (((_x) & 0xff) << 8) |            \
> +                      (((_x) & 0xff00) >> 8) )
> +#define htole32(_x) ( (((_x) & 0xff) << 24) |           \
> +                      (((_x) & 0xff00) << 8) |          \
> +                      (((_x) & 0xff0000) >> 8) |        \
> +                      (((_x) & 0xff000000) >> 24) )
> +#else
> +#define htole16(_x) (_x)
> +#define htole32(_x) (_x)
> +#endif
> +#endif
>  
>  typedef struct
>  {
> 
> 

-intendation would make this more readable (even for review)
-maybe one block per function








-- 

Best Regards, André Hentschel





More information about the wine-devel mailing list