FS#9838 - Filesize > 2GB reported negative

Attached to Project: Rockbox
Opened by Thomas Martitz (kugel.) - Tuesday, 27 January 2009, 22:38 GMT
Last edited by Marcin Bukat (MarcinBukat) - Sunday, 05 June 2011, 12:40 GMT
Task Type Patches
Category Operating System/Drivers
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Version 3.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


My windows 7 beta image is reported to be of a size of -937,678,848 (Rockbox file properties plugin). The correct filesize is 3,357,288,448

Besides that it's entirely wrong, being negative is weird on top.

Looking through the code shows that the dircache_entry's size member is of type long, making negative values possible.

Changing it to unsigned long/size_t results in the correct filesize. Compilation was warning-less.

Can an expert comment on this and if the change is good and won't break anything.
This task depends upon

Closed by  Marcin Bukat (MarcinBukat)
Sunday, 05 June 2011, 12:40 GMT
Reason for closing:  Wont Fix
Additional comments about closing:  general 32bit issue
Comment by Steve Bavin (pondlife) - Wednesday, 28 January 2009, 07:50 GMT
filesize should certainly be an unsigned value. I'd go with unsigned long rather than size_t though:

I'm unsure what 64-bit compilers make of size_t vs unsigned long, however - that might favour size_t...
Comment by Thomas Martitz (kugel.) - Wednesday, 28 January 2009, 11:49 GMT
Well, the standard says size_t is unsigned, so...I'm not entirely sure what the problem of that guy was in that article.

amiconn however said, that filesize must me signed.