Ethereal-dev: Re: [Ethereal-dev] Assigning -1 to unsigned int

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Albert Chin <ethereal-dev@xxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Feb 2002 01:54:21 -0600
On Mon, Feb 25, 2002 at 01:37:34AM -0600, Albert Chin wrote:
> packet-icq.c from 0.9.1 has lines like:
>   919: guint16 x1 = -1;
>   964: guint32 uin = -1;
>   1304: unsigned char num = -1;
>   1391: guint16 pktLen = -1;
>   ...

We also have things like the following in packet-ypserv.c:
  static const value_string ypstat[] =
  {
          {       1,      "YP_TRUE"       },
          {       2,      "YP_NOMORE"     },
          {       0,      "YP_FALSE"      },
          {       -1,     "YP_NOMAP"      },
          {       -2,     "YP_NODOM"      },
          {       -3,     "YP_NOKEY"      },
	  ...

  static const value_string xfrstat[] =
  {
          {       1,      "YPXFR_SUCC"    },
          {       2,      "YPXFR_AGE"     },
          {       -1,     "YPXFR_NOMAP"   },
          {       -2,     "YPXFR_NODOM"   },
	  ...

when epan/value_string.h defines value_string as:
  typedef struct _value_string {
    guint32  value;
    gchar   *strptr;
  } value_string;

-- 
albert chin (china@xxxxxxxxxxxxxxxxxx)