cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [ curl-Bugs-1083542 ] file:// can't be used for 8GB+ files

From: Gisle Vanem <giva_at_bgnett.no>
Date: Sun, 12 Dec 2004 15:20:05 +0100

"Daniel Stenberg" wrote:

> I'm pretty sure this fails on Windows because we use fstat() unconditionally
> to get the file size, and that will probably not be good for files larger than
> 2 or perhaps 4 GB...

It's the same isse as with lseek(). Must use _fstati64() for those who have
it (Borland doesn't). I don't have any >2GB file ATM to test with, but here is
a patch:

RCS file: /cvsroot/curl/curl/lib/file.c,v
retrieving revision 1.66
diff -u -r1.66 file.c
--- file.c 9 Nov 2004 14:57:11 -0000 1.66
+++ file.c 12 Dec 2004 14:19:34 -0000
@@ -169,6 +169,8 @@

 #if defined(WIN32) && (SIZEOF_CURL_OFF_T > 4)
 #define lseek(x,y,z) _lseeki64(x, y, z)
+#define stat _stati64 /* for struct stat */
+#define fstat(fd,st) _fstati64(fd,st)
 #endif

 CURLcode Curl_file_done(struct connectdata *conn,

--gv
Received on 2004-12-12