|
From: | Parth Wazurkar |
Subject: | Re: [ft-devel] Issues regarding converting READ_UINT4 function into FT. |
Date: | Mon, 25 Jun 2018 19:23:45 +0530 |
> 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); ??? The `v*256' only makes sense if you read a single byte in the
> stream->pos-=3;
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...
[Prev in Thread] | Current Thread | [Next in Thread] |