Re: [hatari-devel] ACSI max disk size

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On 21/05/2016 à 13:00, Thomas Huth wrote:
Hmm, I just google a little bit for Cygwin large file support, and it
sounds like it should be in there ... could you please check
sizeof(off_t) there to see whether it is 4 or 8 bytes?

It is 8 bytes. Cygwin fully supports files >= 4 GB, even on 32-bit systems.

*BUT* I found something in Cygwin which really looks like a bug (or feature?).

In Hatari src/file.c, function File_Length().
The code calls ftello() to determine the current position. But it used the 32-bit fseek() to got to the end of file. In this case, ftello() returns a wrong value. If I use fseeko() instead, then ftello() returns the right value. And IDE works on my image.

More precisely:
My IDE image file is exactly 4009549824 bytes, 0xEEFCE000 in hexadecimal.
- After fseeko(), ftello() returns 0x00000000EEFCE000 as expected.
- After fseek(), ftello() returns 0xFFFFFFFFEEFCE000: that's bogus, it is as if the file offset was considered as signed 32-bit, then sign-extended to 64-bit.

So:

1) In Hatari, please use fseeko() whenever you are going to call ftello(), specially in File_Length(). It is more consistent, doesn't hurt, and that's a workaround for Cygwin.

2) I will file a bug for this issue at Cygwin. If this strange result is expected, it should at least be documented.

--
Vincent Rivière



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/