Hi all,
I have been working on converting the file functions in the gf driver
into FT specific stream functions. Till now I have converted most
of the part and it is working fine. I am facing issues with `READ_UINT4'
function which is `gf_read_uintn' with size 4.
* This is the one with file functions,...
unsigned long
gf_read_uintn(FILE* fp, int size)
{
unsigned long v;
v = 0L;
while (size >= 1)
{
v = v*256L + (unsigned long)getc(fp);
--size;
}
return v;
}
...used to read different number of bytes with different size values from the i/p file.
* Now the problem is I converted it to this...
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;
--size;
}
return v;
}
...for using stream, it works fine for size 1, but returns errors with size 4. I tried figuring
the error but could not do so. I am getting confused about the relation between file pointer
and stream position and the usage of getc vs FT_Stream_ReadULong.
Please help me with this.