cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: MSVC 6 warnings related to curl_off_t

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 9 Apr 2004 11:17:10 +0200 (CEST)

On Thu, 8 Apr 2004, David Byron wrote:

> I'm building main.c (1.252) with MSVC 6 and I'm getting the following
> warnings:

[snip]

> Looks like we're half way through a change to curl_off_t in some places.

Yes. I needed to change to curl_off_t to allow --limit-rate to use really high
speeds.

> This is not so hard to resolve, but there are enough choices here that I
> thought I'd ask before submitting a patch. Basically, if we change the type
> of a few variables, and the signature of my_fread and go_sleep, we're there.

go_sleep() can indeed be changed, but my_fread() cannot. The latter is a
callback called from libcurl and it has a fixed signature like that.

> Only problem is, fread wants a size_t where we'd pass it a curl_off_t.

fread() only takes a size_t so we must be sure we pass such a type.

> Same for Sleep(). The sleep is pretty easy -- if the number is too big,
> sleep multiple times, etc.

Yes, that same limit goes for the whole go_sleep() as none of the involved
functions I think can deal with really large numbers (except for platforms
that have 64bit longs). But we could also just make sure that go_sleep() only
gets called with a 'long' number of milliseconds. I believe 32bit milliseconds
is 48 days or something, so I think that should be enough! ;-)

> In the end, some casting may be enough. I'm not sure I can justify it
> though. The root of all this appears to be the argument to --limit-rate.
> That's handled as a curl_off_t....

Yes, I modified it to that just a few days ago to allow "--limit-rate 3G" etc.
It wasn't that important, but I couldn't resist now when we have proper large
file support. :-)

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-04-09