Markus Metz wrote: > >> 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.
Okay; maybe that's just the internal default. I'm looking at dig_init_portable(), which copies the *_cnvrt arrays for big-endian and reverses them for little-endian. I don't know why that code needs to be so obtuse. > > 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. I'm assuming that the individual words are treated as unsigned. -- Glynn Clements <gl...@gclements.plus.com> _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev