cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: [PATCH 1/7] Comment and debug output fixes.

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Sun, 9 Nov 2014 17:46:39 +0000

On Tue, 4 Oct 2011, Carlo Wood wrote:

> > 'connection_id' is a 'long', not an 'int', needs a '%ld' format
> > specifier.
>
> True, and num_connections is a size_t which is an unsigned long.

As I'm sure you're aware a size_t is 32-bits on x86 platforms and 64-bits on x64, however, a long is always 32-bits on LLP64 platforms such as Windows :(

As such it would be better to use our predefined printf format and cast the variable to a curl_off_t (as I don’t believe we have one for a size_t).

Also note that the reason some of the code used "0x%p" is that %p may or may not contain the 0x (depending on platform and runtime implementation) and the original author of this code was probably running curl on a platform that didn't, however, I must admit having 0x0xdeaddead does look very odd ;-)

> I copied the DEBUGF line where removal is printed - which uses also
> %d for the num_connections. Maybe Daniel can fix this when applying
> the patch, or do you want me to generate a new diff (which isn't a
> natural way to use git-- and therefore not very trivial :/).

Attached updated patch enclosed.

You will note from my patch that I tried to put your commit comments into our standard format. Could you please use this in future? For more info please see:

http://curl.haxx.se/dev/contribute.html

Additionally, could I also ask that you attach your patches to emails as well please? Whilst I appreciate it is easier to have the patch contents in an email (and this is how I understand the git email functionality works) so folk can review it without leaving the email software, it makes reviewing the patch through git and applying it much more difficult - certainly for us Windows users anyway (part of the problem is the line endings aren't maintained in emails but also Outlook / Hotmail likes to reformat some of the email, which is why I don't normally go near this type of patch :-/

Kind Regards

Steve

Received on 2014-11-09