Glynn Clements wrote:
I have added G_fseek() and G_ftell() to 7.0 in r35818.
:-)
I got confused by this endian-ness and confused low/high word with first/second word. With the current code, the low word would be the second word when doing 2 32bit reads on a 64bit sized buffer, independent on a endian-ness mismatch. In this case, the libs would have to check if the high word is != 0 and then exit with an ERROR message, right?

Right. The files are always written big-endian, so the high word will
always be first in the file.
I'm not so sure about that, why is byte order stored in the topo header? Byte order for writing out is determined just before writing topo/cidx.
As well as checking that the high word is zero, you also need to check
that the low word is <= 0x7fffffff (off_t is signed, hence the limit
being 2GiB not 4GiB).
OK. Additionally the whole thing should not be negative, that would be an invalid offset.

The issue is whether the coor file size is known at the point that you
start writing the topo/cidx files. If the files are generated
concurrently, then it isn't feasible. If the coor file is generated
first, then it is.
You're right, the coor file is generated first. Since we will have a flexible off_t size for the topo and cidx file, we can set it just before writing out these files.

_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to