May 5, 2011
9:43 a.m.
On Thu, May 5, 2011 at 11:33 AM, Victor Stinner <victor.stinner@haypocalc.com> wrote:
Le mercredi 04 mai 2011 à 15:40 -0700, Ethan Furman a écrit :
The comment says 'check that inputs of 2 GB are handled correctly' but the file created is 1 byte short of 2Gb. Is the test wrong, or just wrongly commented? Or am I not understanding?
If you write a byte after 2 GB of zeros, the file size is 2 GB+the few bytes. This trick is to create quickly a large file: some OSes support sparse files, zeros are not written on disk. But on Mac OS X and Windows, you really write 2 GB+some bytes.
Ethan's point is that 0x7FFFFFFF is not 2GB - it is (2G-1) bytes. So the test and the preceding comment are inconsistent.