cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Compilation warning in ftp.c

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Wed, 25 Sep 2013 19:50:34 +0100

On Tue, 24 Sep 2013, Daniel Stenberg wrote:

> > Should we be using curlx_uztosi() instead of curlx_sztosi() as per my
> > proposed and attached fix?
>
> Yes I think so. I think the current code is just an honest mistake. Go
> ahead and push I say!

Pushed this morning... Cheers.

So that brings me to what I think is the last warning (hopefully)...

tool_urlglob.c on line 293: The variables being passed into the multiply()
function are A) an unsigned long pointer and B) an unsigned long
respectively, however, the function is declared with the second parameter as
a (signed) long :(

I think this should be also an unsigned long - especially when you consider
that the first parameter is an in / out parameter so can only return an
unsigned long as the result - If a negative second parameter was input then
the output would be negative as well.

However, fixing that up potentially causes a warning on the "other" usage of
multiply() on line 114 as its second parameter "size" is declared as an int
- as per the "content" union in "URLPattern". This variable appears to be
unsigned in usage although is compared against "ptr_s" which is also
declared as an int but,, again, appears to be unsigned in usage.

After all of that... I guess I have two questions:

1) Should I fix them up?
2) Is unsigned long the best choice for all of these? Should they be
unsigned long, unsigned int or size_t?

Oh.... I guess that ended up being three questions ;-)

Cheers

Steve

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-09-25