Subject: Re: spring cleaning step #1

Re: spring cleaning step #1

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 17 Apr 2010 16:41:28 +0200 (CEST)

On Sat, 17 Apr 2010, Alexander Lamaison wrote:

> I notice also that you changed many non-size unsigned longs to ints. What
> was the motivation for this? (I'm not suggesting its wrong - just that my
> understanding of the practical implications of signed v unsigned in C is
> hazy at best).

I changed the types according to this:

'size_t' - for all data sizes, as they often are calculated using pointer
arithmetic and long is not portable enough for this.

'uint32_t' - for variables that are known to be exactly 32 bits, mostly those
are data fields specific to the actual SSH protocol.

'int' - for variables that are just counters and generic values that are not
likely to be extremely large (ie they will always be less than 2 billion).

As this is mostly manual edits I may of course have done it wrongly at some
place, but I've tried to apply the guidelines above. There are still a bunch
of 'unsigned long' left in the code, and most of them can be changed to one of
the above over time.

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-04-17