> I have been working on converting the file functions in the gf
> driver into FT specific stream functions.  [...]
> 
>   unsigned long
>   gf_read_uintn(FT_Stream stream, int size)
>   {
>     unsigned long  v;
>     FT_Error error = FT_Err_Ok;
>     v = 0L;
>     while (size >= 1)
>     {
>       v = v*256L + (unsigned long)FT_Stream_ReadULong(stream, &error);
>       stream->pos-=3;

???  The `v*256' only makes sense if you read a single byte in the
loop!  If you read 4 bytes in a loop, the value must be
v*256*256*256*256.

>       --size;
>     }
>     return v;
>   }

You also have to take care of the byte order in GF files if you read
more than a single byte.

Finally, it's not clear to me why you directly use
`FT_Stream_ReadULong' and not one of the many macros like
`FT_READ_ULONG' (or `FT_READ_ULONG_LE').  I strongly suggest that you
imitate code present in other font modules.  Don't reinvent the
wheel...


    Werner

_______________________________________________
Freetype-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to