cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_INFILESIZE_LARGE & CURLOPT_INFILESIZE

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 31 Mar 2005 15:10:01 +0200 (CEST)

On Thu, 31 Mar 2005 delphine.menjikoff_at_orsyp.com wrote:

> Uploaded unaligned file size (1154730 out of 4617634290435464874 bytes)

> I have 4617634290435464874 value (????), because SIZEOF_CURL_OFF_T > 4
> (SIZE_CURL_OFF_T = 8 from config.h) so

No, it is not only because of that. It would also mean that your off_t in the
test program is 32bit (the size field in the stat struct) when libcurl was
built with a 64bit curl_off_t.

> (So, with FORMAT_OFF_T = "ld", I have 1154730 value instead of
> 4617634290435464874 )

Yes, in that particular output. But you'd still get an error. Right?

> My question: this is a problem from the configure which set
> SIZEOF_CURL_OFF_T to 8 value (instead 4 value maybe) or this is a problem of
> my Linux OS configuration (I know that my Linux OS is pretty old).

Yes, I think it looks like a 32bit off_t in app and 64bit in lib problem. If
you truly have a 32 bit off_t, then you can simply use CURLOPT_INFILESIZE
instead of CURLOPT_INFILESIZE_LARGE to work around this.

> long long_size = file_info.st_size;
>
> curl_easy_setopt(curl, CURLOPT_INFILESIZE, long_size);
>
> This is working fine.

Yes, I would say that this indicates that my analysis is right.

> I can satisfy myself with CURLOPT_INFILESIZE option. But when I'll have big
> file size, is it better to use CURLOPT_INFILESIZE_LARGE?

Since you build your app with a 32 bit off_t, you *can't* have a large file
(in the sense that it is bigger than 2GB).

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-03-31