[Osip] some code review

Aymeric Moizard jack at atosc.org
Sat Apr 4 16:08:02 CEST 2009




On Thu, 2 Apr 2009, KURTH Christoph wrote:

> hi,
>
> ... since I am right now having a look into the eXosip code,
> here is some more review feedback.
> the following section does not make sense to me:
>
> --------------------------------------------------
> int
> _eXosip_pub_init (eXosip_pub_t ** pub, const char *aor, const char *exp)
> {
>  static int p_id;
>  eXosip_pub_t *jpub;
>
>  if (p_id > 1000000)           /* keep it non-negative */
>    p_id = 0;
>
> .....
>
> --------------------------------------------------
>
> since the variable p_id is int, I assume its
> range of values between -32768 and 32767.
> thus it will never become greater than 1000000,
> and the if-statement for keeping it non-negative does not work.


well,

You seems to be right that in some case, INT_MAX is definitly
the range you said... But in most cases it's not: what I can see
in my windows and linux limits.h, both contains:

#  define INT_MAX	2147483647

I have replaced the code and used 32767 which appears
enough and would fit any definition of int on all systems.

tks,
Aymeric MOIZARD / ANTISIP
amsip - http://www.antisip.com
osip2 - http://www.osip.org
eXosip2 - http://savannah.nongnu.org/projects/exosip/

> br,
> christoph.
>
>
> _______________________________________________
> Osip mailing list
> Osip at atosc.org
> http://www.atosc.org/mailinglist/listinfo/osip
>


More information about the Osip mailing list