Wireshark-bugs: [Wireshark-bugs] [Bug 7827] New: Explicitly declare/cast 'unsigned <variable>' a

Date: Tue, 9 Oct 2012 12:06:55 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7827

           Summary: Explicitly declare/cast 'unsigned <variable>' as
                    'unsigned int <variable>'
           Product: Wireshark
           Version: 1.8.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: Low
         Component: Common utilities (libwsutil)
        AssignedTo: bugzilla-admin@xxxxxxxxxxxxx
        ReportedBy: wp02855@xxxxxxxxx


Created attachment 9329
  --> https://bugs.wireshark.org/bugzilla/attachment.cgi?id=9329
Patch files for wireshark 1.8.2 generated by diff -u

Build Information:
odie:/usr/local/src/wireshark-1.8.2 # ./wireshark -v
wireshark 1.8.2 (SVN Rev Unknown from unknown)

Copyright 1998-2012 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with GTK+ 2.22.1, with Cairo 1.10.2, with Pango 1.28.3, with
GLib 2.28.0, with libpcap, with libz 1.2.5, without POSIX capabilities, without
SMI, without c-ares, without ADNS, without Lua, without Python, with GnuTLS
2.8.6, with Gcrypt 1.4.6, with MIT Kerberos, without GeoIP, without PortAudio,
with AirPcap.

Running on Linux 2.6.37.6-0.7-desktop, with locale POSIX, with libpcap version
1.1.1, with libz 1.2.5, GnuTLS 2.8.6, Gcrypt 1.4.6, without AirPcap.

Built using gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585].

--
In reviewing variable declarations and casts used in Wireshark 1.8.2,
I found some instances where the declaration of 'unsigned <foo>' was
used, and in some places 'unsigned int <foo>' is used.  The patches
below are designed to explicitly define 'unsigned <foo>' as 
'unsigned int <foo>' so that consistency is maintained.

I know that in C the definition of 'unsigned <foo>' is the same
as 'unsigned int <foo>', but in the code, the bulk of the variable
declarations and casts are of the form 'unsigned int <foo>'.

In Wireshark 1.8.2/1.8.3 modifications are needed in files:

--- packet-pw-atm.c.orig        2012-10-08 16:08:09.873072625 -0700
+++ packet-pw-atm.c     2012-10-08 16:09:39.267521119 -0700
@@ -349,7 +349,7 @@
 prepare_pseudo_header_atm(
        union wtap_pseudo_header * const ph,
        const pwatm_private_data_t * const pdata,
-       const unsigned aal)
+       const unsigned int aal)
 {
        DISSECTOR_ASSERT(NULL != pdata);
        DISSECTOR_ASSERT(NULL != ph);
@@ -1158,17 +1158,17 @@
        if (NULL == item) return;
        DISSECTOR_ASSERT(NULL != pd);
        if (pd->cwb3.m   >= 0)
-               proto_item_append_text(item, "M:%.1u  "  ,
(unsigned)(pd->cwb3.m));
+               proto_item_append_text(item, "M:%.1u  "  , (unsigned
int)(pd->cwb3.m));
        if (pd->cwb3.v   >= 0)
-               proto_item_append_text(item, "V:%.1u  "  ,
(unsigned)(pd->cwb3.v));
+               proto_item_append_text(item, "V:%.1u  "  , (unsigned
int)(pd->cwb3.v));
        if (pd->cwb3.rsv >= 0)
-               proto_item_append_text(item, "RSV:%.1u  ",
(unsigned)(pd->cwb3.rsv));
+               proto_item_append_text(item, "RSV:%.1u  ", (unsigned
int)(pd->cwb3.rsv));
        if (pd->cwb3.u >= 0)
-               proto_item_append_text(item, "U:%.1u  "  ,
(unsigned)(pd->cwb3.u));
+               proto_item_append_text(item, "U:%.1u  "  , (unsigned
int)(pd->cwb3.u));
        if (pd->cwb3.e >= 0)
-               proto_item_append_text(item, "EFCI:%.1u 
",(unsigned)(pd->cwb3.e));
+               proto_item_append_text(item, "EFCI:%.1u  ",(unsigned
int)(pd->cwb3.e));
        if (pd->cwb3.clp >= 0)
-               proto_item_append_text(item, "CLP:%.1u  ",
(unsigned)(pd->cwb3.clp));
+               proto_item_append_text(item, "CLP:%.1u  ", (unsigned
int)(pd->cwb3.clp));
        return;
 }

@@ -1499,11 +1499,11 @@
                        proto_item_append_text(item, " [%.3d]",
pd->pw_cell_number);
                        proto_item_append_text(item, ", ");
                        if (pd->vpi >= 0)
-                               proto_item_append_text(item, "VPI:%.4u  ",
(unsigned)(pd->vpi));
+                               proto_item_append_text(item, "VPI:%.4u  ",
(unsigned int)(pd->vpi));
                        if (pd->vci >= 0)
-                               proto_item_append_text(item, "VCI:%.5u  ",
(unsigned)(pd->vci));
+                               proto_item_append_text(item, "VCI:%.5u  ",
(unsigned int)(pd->vci));
                        if (pd->pti >= 0)
-                               proto_item_append_text(item, "PTI:%.1u  ",
(unsigned)(pd->pti));
+                               proto_item_append_text(item, "PTI:%.1u  ",
(unsigned int)(pd->pti));
                        proto_item_append_text_cwb3_fields(item, pd);
                }

@@ -1516,8 +1516,8 @@
                                if (MODE_N1(pd->mode)
                                    || ((pd->mode == PWATM_MODE_AAL5_SDU) &&
(pd->submode == PWATM_SUBMODE_ADMIN_CELL)))
                                {
-                                       proto_tree_add_uint(tree2,
hf_cell_h_vpi, tvb, 0, 2, (unsigned)pd->vpi);
-                                       proto_tree_add_uint(tree2,
hf_cell_h_vci, tvb, 1, 3, (unsigned)pd->vci);
+                                       proto_tree_add_uint(tree2,
hf_cell_h_vpi, tvb, 0, 2, (unsigned int)pd->vpi);
+                                       proto_tree_add_uint(tree2,
hf_cell_h_vci, tvb, 1, 3, (unsigned int)pd->vci);

                                        item2 = proto_tree_add_item(tree2,
hf_cell_h_pti, tvb, 3, 1, ENC_BIG_ENDIAN);
                                        if (NULL == match_strval(pd->pti,
atm_pt_vals))
@@ -1602,7 +1602,7 @@
                                        if (PWATM_MODE_11_VPC == pd->mode)
                                        {
                                                proto_tree_add_uint(tree2,
hf_cell_h_vci, tvb, 1, 2
-                                                       ,(unsigned)pd->vci);
+                                                       ,(unsigned
int)pd->vci);
                                        }
                                }
                                else

--- packet-rdm.c.orig   2012-10-08 16:10:18.588669757 -0700
+++ packet-rdm.c        2012-10-08 16:10:47.357715200 -0700
@@ -662,10 +662,10 @@
 static int ett_rdm = -1;

 static guint16
-rdm_checksum(tvbuff_t *tvb, unsigned length)
+rdm_checksum(tvbuff_t *tvb, unsigned int length)
 {
        guint16 sum = RDM_SC_RDM;
-       unsigned i;
+       unsigned int i;
        for (i = 0; i < length; i++)
                sum += tvb_get_guint8(tvb, i);
        return sum;
@@ -2048,7 +2048,7 @@
                gint padding_size;
                guint16 man_id;
                guint32 dev_id;
-               unsigned message_length, checksum, checksum_shouldbe, offset =
0;
+               unsigned int message_length, checksum, checksum_shouldbe,
offset = 0;
                proto_item *item;
                proto_tree *checksum_tree;

--- packet-rlc.c.orig   2012-10-08 16:13:08.227603870 -0700
+++ packet-rlc.c        2012-10-08 16:14:01.372216944 -0700
@@ -1318,8 +1318,8 @@
                                                ti =
proto_tree_add_bits_ret_val(sufi_tree, hf_rlc_sufi_l, tvb, bit_offset, 4, &l,
ENC_BIG_ENDIAN);
                                                if (l) {
                                                       
proto_item_append_text(ti, " (all consecutive AMD PDUs up to SN %u not
correctly received)",
-                                                                             
(unsigned)(sn+l)&0xfff);
-                                                      
col_append_fstr(pinfo->cinfo, COL_INFO,  "%u-%u ", (guint16)sn,
(unsigned)(sn+l)&0xfff);
+                                                                             
(unsigned int)(sn+l)&0xfff);
+                                                      
col_append_fstr(pinfo->cinfo, COL_INFO,  "%u-%u ", (guint16)sn, (unsigned
int)(sn+l)&0xfff);
                                                }
                                                else {
                                                       
col_append_fstr(pinfo->cinfo, COL_INFO,  "%u ", (guint16)sn);
@@ -1351,8 +1351,8 @@
                                        bits = tvb_get_bits8(tvb, bit_offset,
8);
                                        for (l=0, j=0; l<8; l++) {
                                                if ((bits << l) & 0x80) {
-                                                       j +=
g_snprintf(&buff[j], BUFF_SIZE-j, "%04u,", (unsigned)(sn+(8*i)+l)&0xfff);
-                                                      
col_append_fstr(pinfo->cinfo, COL_INFO, " %u", (unsigned)(sn+(8*i)+l)&0xfff);
+                                                       j +=
g_snprintf(&buff[j], BUFF_SIZE-j, "%04u,", (unsigned int)(sn+(8*i)+l)&0xfff);
+                                                      
col_append_fstr(pinfo->cinfo, COL_INFO, " %u", (unsigned
int)(sn+(8*i)+l)&0xfff);
                                                       
number_of_bitmap_entries++;
                                                } else {
                                                        j +=
g_snprintf(&buff[j], BUFF_SIZE-j, "    ,");
@@ -1390,8 +1390,8 @@
                                        ti = proto_tree_add_text(sufi_tree,
tvb, previous_bit_offset/8, (bit_offset-previous_bit_offset)/8, "Decoded
list:");
                                        rlist_tree = proto_item_add_subtree(ti,
ett_rlc_rlist);
                                        proto_tree_add_text(rlist_tree, tvb,
(previous_bit_offset+4)/8, 12/8,
-                                                           "Sequence Number =
%u (AMD PDU not correctly received)",(unsigned)sn);
-                                       col_append_fstr(pinfo->cinfo, COL_INFO,
" RLIST=(%u", (unsigned)sn);
+                                                           "Sequence Number =
%u (AMD PDU not correctly received)",(unsigned int)sn);
+                                       col_append_fstr(pinfo->cinfo, COL_INFO,
" RLIST=(%u", (unsigned int)sn);

                                        for (i=0, isErrorBurstInd=FALSE, j=0,
previous_sn=(guint16)sn, value=0; i<len; i++) {
                                                if (cw[i] == 0x01) {

--- packet-rlc-lte.c.orig       2012-10-08 16:11:31.816414116 -0700
+++ packet-rlc-lte.c    2012-10-08 16:12:27.105255501 -0700
@@ -325,10 +325,10 @@
 /* Channel key */
 typedef struct
 {
-    unsigned  ueId : 16;
-    unsigned  channelType : 3;
-    unsigned  channelId : 5;
-    unsigned  direction : 1;
+    unsigned int ueId : 16;
+    unsigned int channelType : 3;
+    unsigned int channelId : 5;
+    unsigned int direction : 1;
 } channel_hash_key;


@@ -830,10 +830,10 @@

 typedef struct {
     guint32            frameNumber;
-    unsigned           SN :             10;
-    unsigned           channelType :    2;
-    unsigned           channelId:       5;
-    unsigned           direction:       1;
+    unsigned int       SN :             10;
+    unsigned int       channelType :    2;
+    unsigned int       channelId:       5;
+    unsigned int       direction:       1;
 } rlc_result_hash_key;

 static gint rlc_result_hash_equal(gconstpointer v, gconstpointer v2)

--- packet-rpc.c.orig   2012-10-08 16:14:33.224582808 -0700
+++ packet-rpc.c        2012-10-08 16:15:13.094798061 -0700
@@ -3588,7 +3588,7 @@
                ulRecMark = pntohl (pbWholeBuf + ibSearchStart -
ibPatternStart);

                if ((ulMsgType == RPC_REPLY) &&
-                        ((ulRecMark & ~0x80000000) <= (unsigned)
max_rpc_tcp_pdu_size)) {
+                        ((ulRecMark & ~0x80000000) <= (unsigned int)
max_rpc_tcp_pdu_size)) {
                        /* looks ok, try dissect */
                        return (offset + ibSearchStart - ibPatternStart);
                }

--- packet-rtsp.c.orig  2012-10-08 16:15:50.826785137 -0700
+++ packet-rtsp.c       2012-10-08 16:16:55.354602517 -0700
@@ -445,7 +445,7 @@
 static gboolean
 is_rtsp_request_or_reply(const guchar *line, size_t linelen, rtsp_type_t
*type)
 {
-       unsigned        ii;
+       unsigned int    ii;
        const guchar *next_token;
        int tokenlen;
        gchar response_chars[4];
@@ -1280,7 +1280,7 @@
        proto_tree              *sub_tree = NULL;
        proto_item              *ti = NULL;
        const guchar    *lineend = data + linelen;
-       unsigned                ii;
+       unsigned int            ii;
        const guchar    *url;
        const guchar    *url_start;
        guchar                  *tmp_url;

--- packet-sir.c.orig   2012-10-08 16:33:46.185423119 -0700
+++ packet-sir.c        2012-10-08 16:34:02.889187343 -0700
@@ -150,7 +150,7 @@
                                data_offset, eof_offset - data_offset, -1);
                        next_tvb = unescape_data(next_tvb, pinfo);
                        if (root) {
-                               unsigned data_len = tvb_length(next_tvb) < 2 ?
0 :
+                               unsigned int data_len = tvb_length(next_tvb) <
2 ? 0 :
                                        tvb_length(next_tvb) - 2;
                                proto_tree* ti =
proto_tree_add_protocol_format(root,
                                                proto_sir, tvb, offset,
eof_offset - offset + 1,

--- packet-ssl-utils.h.orig     2012-10-08 16:23:42.715650662 -0700
+++ packet-ssl-utils.h  2012-10-08 16:24:13.090859335 -0700
@@ -370,11 +370,11 @@

 gint ssl_get_keyex_alg(gint cipher);

-gboolean ssldecrypt_uat_fld_ip_chk_cb(void*, const char*, unsigned, const
void*, const void*, const char** err);
-gboolean ssldecrypt_uat_fld_port_chk_cb(void*, const char*, unsigned, const
void*, const void*, const char** err);
-gboolean ssldecrypt_uat_fld_protocol_chk_cb(void*, const char*, unsigned,
const void*, const void*, const char** err);
-gboolean ssldecrypt_uat_fld_fileopen_chk_cb(void*, const char*, unsigned,
const void*, const void*, const char** err);
-gboolean ssldecrypt_uat_fld_password_chk_cb(void*, const char*, unsigned,
const void*, const void*, const char** err);
+gboolean ssldecrypt_uat_fld_ip_chk_cb(void*, const char*, unsigned int, const
void*, const void*, const char** err);
+gboolean ssldecrypt_uat_fld_port_chk_cb(void*, const char*, unsigned int,
const void*, const void*, const char** err);
+gboolean ssldecrypt_uat_fld_protocol_chk_cb(void*, const char*, unsigned int,
const void*, const void*, const char** err);
+gboolean ssldecrypt_uat_fld_fileopen_chk_cb(void*, const char*, unsigned int,
const void*, const void*, const char** err);
+gboolean ssldecrypt_uat_fld_password_chk_cb(void*, const char*, unsigned int,
const void*, const void*, const char** err);

 /** Initialize decryption engine/ssl layer. To be called once per execution */
 extern void

--- packet-teredo.c.orig        2012-10-08 16:18:43.752065326 -0700
+++ packet-teredo.c     2012-10-08 16:18:59.910765559 -0700
@@ -85,7 +85,7 @@
 parse_teredo_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                        int offset, e_teredohdr *teredoh)
 {
-       unsigned idlen, aulen;
+       unsigned int idlen, aulen;

        if (check_col(pinfo->cinfo, COL_INFO))
                col_append_sep_str (pinfo->cinfo, COL_INFO, ", ",

--- packet-vicp.c.orig  2012-10-08 16:19:34.658438138 -0700
+++ packet-vicp.c       2012-10-08 16:19:48.800933190 -0700
@@ -50,7 +50,7 @@
    proto_tree *vicp_tree;
    ptvcursor_t* cursor;

-   unsigned len;
+   unsigned int len;

    if (tvb_reported_length_remaining(tvb, 0) < 8)
    {

--- packet-x11.c.orig   2012-10-08 16:20:26.269889900 -0700
+++ packet-x11.c        2012-10-08 16:22:07.758617310 -0700
@@ -1354,7 +1354,7 @@

 static void colorFlags(tvbuff_t *tvb, int *offsetp, proto_tree *t)
 {
-      unsigned do_red_green_blue = VALUE8(tvb, *offsetp);
+      unsigned int do_red_green_blue = VALUE8(tvb, *offsetp);
       proto_item *ti;
       proto_tree *tt;

@@ -1542,7 +1542,7 @@
       while(length--) {
             proto_item *tti;
             proto_tree *ttt;
-            unsigned do_red_green_blue;
+            unsigned int do_red_green_blue;
             guint16 red, green, blue;
             emem_strbuf_t *buffer;
             const char *sep;
@@ -2021,7 +2021,7 @@
       proto_tree *tt = proto_item_add_subtree(ti, ett_x11_list_of_rectangle);
       while(length--) {
             gint16 x, y;
-            unsigned width, height;
+            unsigned int width, height;
             proto_item *tti;
             proto_tree *ttt;

@@ -2108,7 +2108,7 @@
       tt = proto_item_add_subtree(ti, ett_x11_list_of_string8);

       while(length--) {
-            unsigned l = VALUE8(tvb, *offsetp);
+            unsigned int l = VALUE8(tvb, *offsetp);
             if (allocated < (l + 1)) {
                   s = ep_alloc(l + 1);
                   allocated = l + 1;
@@ -2121,7 +2121,7 @@

 #define STRING16_MAX_DISPLAYED_LENGTH 150

-static int stringIsActuallyAn8BitString(tvbuff_t *tvb, int offset, unsigned
length)
+static int stringIsActuallyAn8BitString(tvbuff_t *tvb, int offset, unsigned
int length)
 {
       if (length > STRING16_MAX_DISPLAYED_LENGTH) length =
STRING16_MAX_DISPLAYED_LENGTH;
       for(; length > 0; offset += 2, length--) {
@@ -2135,12 +2135,12 @@

 static void string16_with_buffer_preallocated(tvbuff_t *tvb, proto_tree *t,
                                               int hf, int hf_bytes,
-                                              int offset, unsigned length,
+                                              int offset, unsigned int length,
                                               char **s, int *sLength,
                                               guint byte_order)
 {
       int truncated = FALSE;
-      unsigned l = length / 2;
+      unsigned int l = length / 2;

       if (stringIsActuallyAn8BitString(tvb, offset, l)) {
             char *dp;
@@ -2203,7 +2203,7 @@
       tt = proto_item_add_subtree(ti, ett_x11_list_of_text_item);

       while(n--) {
-            unsigned l = VALUE8(tvb, *offsetp);
+            unsigned int l = VALUE8(tvb, *offsetp);
             if (l == 255) { /* Item is a font */
                   fid = tvb_get_ntohl(tvb, *offsetp + 1);
                   proto_tree_add_uint(tt, hf_x11_textitem_font, tvb, *offsetp,
5, fid);
@@ -2213,7 +2213,7 @@
                   proto_tree *ttt;
                   gint8 delta = VALUE8(tvb, *offsetp + 1);
                   if (sizeIs16) l += l;
-                  if ((unsigned) allocated < l + 1) {
+                  if ((unsigned int) allocated < l + 1) {
                         s = ep_alloc(l + 1);
                         allocated = l + 1;
                   }
@@ -2486,7 +2486,7 @@
 }

 static void string8(tvbuff_t *tvb, int *offsetp, proto_tree *t,
-    int hf, unsigned length)
+    int hf, unsigned int length)
 {
       const guint8 *p;
       char *s;
@@ -2501,7 +2501,7 @@
 /* The length is the length of the _byte_zone_ (twice the length of the
string) */

 static void string16(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf,
-    int hf_bytes, unsigned length, guint byte_order)
+    int hf_bytes, unsigned int length, guint byte_order)
 {
       char *s = NULL;
       gint l = 0;

--- packet-zebra.c.orig 2012-10-08 16:22:42.626297710 -0700
+++ packet-zebra.c      2012-10-08 16:23:02.561406881 -0700
@@ -282,7 +282,7 @@

                        prefix4 = 0;
                        tvb_memcpy(tvb, (guint8 *)&prefix4, offset,
-                           MIN((unsigned) PSIZE(prefixlen), sizeof prefix4));
+                           MIN((unsigned int) PSIZE(prefixlen), sizeof
prefix4));
                        proto_tree_add_ipv4(tree, hf_zebra_prefix4,
                                tvb, offset, PSIZE(prefixlen), prefix4);
                        offset += PSIZE(prefixlen);
@@ -359,7 +359,7 @@

                        memset(buffer6, '\0', sizeof buffer6);
                        tvb_memcpy(tvb, buffer6, offset,
-                           MIN((unsigned) PSIZE(prefixlen), sizeof buffer6));
+                           MIN((unsigned int) PSIZE(prefixlen), sizeof
buffer6));
                        proto_tree_add_ipv6(tree, hf_zebra_prefix6,
                                tvb, offset, PSIZE(prefixlen), buffer6);
                        offset += PSIZE(prefixlen);

--- snoop.c.orig        2012-10-08 16:50:20.118457467 -0700
+++ snoop.c     2012-10-08 16:50:45.486139701 -0700
@@ -622,7 +622,7 @@
        padbytes = rec_size - ((guint)sizeof hdr + packet_size);
        while (padbytes != 0) {
                bytes_to_read = padbytes;
-               if ((unsigned)bytes_to_read > sizeof padbuf)
+               if ((unsigned int)bytes_to_read > sizeof padbuf)
                        bytes_to_read = sizeof padbuf;
                errno = WTAP_ERR_CANT_READ;
                bytes_read = file_read(padbuf, bytes_to_read, wth->fh);
@@ -885,7 +885,7 @@
        if (encap == WTAP_ENCAP_PER_PACKET)
                return WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED;

-       if (encap < 0 || (unsigned)encap >= NUM_WTAP_ENCAPS ||
wtap_encap[encap] == -1)
+       if (encap < 0 || (unsigned int)encap >= NUM_WTAP_ENCAPS ||
wtap_encap[encap] == -1)
                return WTAP_ERR_UNSUPPORTED_ENCAP;

        return 0;

--- uat.h.orig  2012-10-08 15:44:51.213267476 -0700
+++ uat.h       2012-10-08 15:49:57.526638647 -0700
@@ -118,7 +118,7 @@
  * optional, if not given any input is considered OK and the set cb will be
called
  * chk(record, ptr, len, chk_data, fld_data, &error)
  */
-typedef gboolean (*uat_fld_chk_cb_t)(void*, const char*, unsigned, const
void*, const void*, const char**);
+typedef gboolean (*uat_fld_chk_cb_t)(void*, const char*, unsigned int, const
void*, const void*, const char**);

 /*
  * Set Field CB
@@ -130,14 +130,14 @@
  * it is mandatory
  * set(record, ptr, len, set_data, fld_data)
  */
-typedef void (*uat_fld_set_cb_t)(void*, const char*, unsigned, const void*,
const void*);
+typedef void (*uat_fld_set_cb_t)(void*, const char*, unsigned int, const
void*, const void*);

 /*
  * given a record returns a string representation of the field
  * mandatory
  * tostr(record, &out_ptr, &out_len, tostr_data, fld_data)
  */
-typedef void (*uat_fld_tostr_cb_t)(void*, const char**, unsigned*, const
void*, const void*);
+typedef void (*uat_fld_tostr_cb_t)(void*, const char**, unsigned int*, const
void*, const void*);

 /***********
  * Text Mode
@@ -302,16 +302,16 @@
 /*
  * Some common uat_fld_chk_cbs
  */
-gboolean uat_fld_chk_str(void*, const char*, unsigned, const void*, const
void*, const char** err);
-gboolean uat_fld_chk_oid(void*, const char*, unsigned, const void*, const
void*, const char** err);
-gboolean uat_fld_chk_proto(void*, const char*, unsigned, const void*, const
void*, const char** err);
-gboolean uat_fld_chk_num_dec(void*, const char*, unsigned, const void*, const
void*, const char** err);
-gboolean uat_fld_chk_num_hex(void*, const char*, unsigned, const void*, const
void*, const char** err);
-gboolean uat_fld_chk_enum(void*, const char*, unsigned, const void*, const
void*, const char**);
-gboolean uat_fld_chk_range(void*, const char*, unsigned, const void*, const
void*, const char**);
+gboolean uat_fld_chk_str(void*, const char*, unsigned int, const void*, const
void*, const char** err);
+gboolean uat_fld_chk_oid(void*, const char*, unsigned int, const void*, const
void*, const char** err);
+gboolean uat_fld_chk_proto(void*, const char*, unsigned int, const void*,
const void*, const char** err);
+gboolean uat_fld_chk_num_dec(void*, const char*, unsigned int, const void*,
const void*, const char** err);
+gboolean uat_fld_chk_num_hex(void*, const char*, unsigned int, const void*,
const void*, const char** err);
+gboolean uat_fld_chk_enum(void*, const char*, unsigned int, const void*, const
void*, const char**);
+gboolean uat_fld_chk_range(void*, const char*, unsigned int, const void*,
const void*, const char**);

 #define CHK_STR_IS_DECL(what) \
-gboolean uat_fld_chk_str_ ## what (void*, const char*, unsigned, const void*,
const void*, const char**)
+gboolean uat_fld_chk_str_ ## what (void*, const char*, unsigned int, const
void*, const void*, const char**)

 typedef void (*uat_cb_t)(void* uat,void* user_data);
 void uat_foreach_table(uat_cb_t cb,void* user_data);
@@ -330,7 +330,7 @@
 CHK_STR_IS_DECL(isxdigit);

 #define CHK_STR_IS_DEF(what) \
-gboolean uat_fld_chk_str_ ## what (void* u1 _U_, const char* strptr, unsigned
len, const void* u2 _U_, const void* u3 _U_, const char** err) { \
+gboolean uat_fld_chk_str_ ## what (void* u1 _U_, const char* strptr, unsigned
int len, const void* u2 _U_, const void* u3 _U_, const char** err) { \
        guint i; for (i=0;i<len;i++) { \
                char c = strptr[i]; \
                        if (! what((int)c)) { \
@@ -349,14 +349,14 @@
  *    a simple c-string contained in (((rec_t*)rec)->(field_name))
  */
 #define UAT_CSTRING_CB_DEF(basename,field_name,rec_t) \
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned int len, const void* u1 _U_, const void* u2 _U_) {\
     char* new_buf = g_strndup(buf,len); \
        g_free((((rec_t*)rec)->field_name)); \
        (((rec_t*)rec)->field_name) = new_buf; } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned int* out_len, const void* u1 _U_, const void* u2 _U_) {\
                if (((rec_t*)rec)->field_name ) { \
                        *out_ptr = (((rec_t*)rec)->field_name); \
-                       *out_len =
(unsigned)strlen((((rec_t*)rec)->field_name)); \
+                       *out_len = (unsigned
int)strlen((((rec_t*)rec)->field_name)); \
                } else { \
                        *out_ptr = ""; *out_len = 0; } }

@@ -397,14 +397,14 @@
  * LSTRING MACROS
  */
 #define UAT_LSTRING_CB_DEF(basename,field_name,rec_t,ptr_element,len_element)
\
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned int len, const void* u1 _U_, const void* u2 _U_) {\
        char* new_val = uat_unesc(buf,len,&(((rec_t*)rec)->len_element)); \
         g_free((((rec_t*)rec)->ptr_element)); \
        (((rec_t*)rec)->ptr_element) = new_val; }\
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned int* out_len, const void* u1 _U_, const void* u2 _U_) {\
        if (((rec_t*)rec)->ptr_element ) { \
                *out_ptr = uat_esc(((rec_t*)rec)->ptr_element,
(((rec_t*)rec)->len_element)); \
-               *out_len = (unsigned)strlen(*out_ptr); \
+               *out_len = (unsigned int)strlen(*out_ptr); \
        } else { \
                *out_ptr = ""; *out_len = 0; } }

@@ -419,12 +419,12 @@
  *  XXX: UNTESTED and probably BROKEN
  */
 #define UAT_BUFFER_CB_DEF(basename,field_name,rec_t,ptr_element,len_element) \
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned int len, const void* u1 _U_, const void* u2 _U_) {\
         char* new_buf = len ? g_memdup(buf,len) : NULL; \
        g_free((((rec_t*)rec)->ptr_element)); \
        (((rec_t*)rec)->ptr_element) = new_buf; \
        (((rec_t*)rec)->len_element) = len; } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned int* out_len, const void* u1 _U_, const void* u2 _U_) {\
        *out_ptr = ((rec_t*)rec)->ptr_element ?
ep_memdup(((rec_t*)rec)->ptr_element,((rec_t*)rec)->len_element) : ""; \
        *out_len = ((rec_t*)rec)->len_element; }

@@ -437,11 +437,11 @@
  *   a decimal number contained in
  */
 #define UAT_DEC_CB_DEF(basename,field_name,rec_t) \
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned int len, const void* u1 _U_, const void* u2 _U_) {\
        ((rec_t*)rec)->field_name = strtol(ep_strndup(buf,len),NULL,10); } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned int* out_len, const void* u1 _U_, const void* u2 _U_) {\
        *out_ptr = ep_strdup_printf("%d",((rec_t*)rec)->field_name); \
-       *out_len = (unsigned)strlen(*out_ptr); }
+       *out_len = (unsigned int)strlen(*out_ptr); }

 #define UAT_FLD_DEC(basename,field_name,title,desc) \
        {#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_num_dec,basename ##
_ ## field_name ## _set_cb,basename ## _ ## field_name ##
_tostr_cb},{0,0,0},0,desc,FLDFILL}
@@ -452,11 +452,11 @@
  *   an hexadecimal number contained in
  */
 #define UAT_HEX_CB_DEF(basename,field_name,rec_t) \
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned int len, const void* u1 _U_, const void* u2 _U_) {\
        ((rec_t*)rec)->field_name = strtol(ep_strndup(buf,len),NULL,16); } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned int* out_len, const void* u1 _U_, const void* u2 _U_) {\
        *out_ptr = ep_strdup_printf("%x",((rec_t*)rec)->field_name); \
-       *out_len = (unsigned)strlen(*out_ptr); }
+       *out_len = (unsigned int)strlen(*out_ptr); }

 #define UAT_FLD_HEX(basename,field_name,title,desc) \
 {#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_num_hex,basename ## _ ##
field_name ## _set_cb,basename ## _ ## field_name ##
_tostr_cb},{0,0,0},0,desc,FLDFILL}
@@ -470,34 +470,34 @@
  *        value
  */
 #define UAT_VS_DEF(basename,field_name,rec_t,default_val,default_str) \
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned len, const void* vs, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned int len, const void* vs, const void* u2 _U_) {\
        guint i; \
        char* str = ep_strndup(buf,len); \
        const char* cstr; ((rec_t*)rec)->field_name = default_val; \
        for(i=0; ( cstr = ((value_string*)vs)[i].strptr ) ;i++) { \
                if (g_str_equal(cstr,str)) { \
                        ((rec_t*)rec)->field_name =
((value_string*)vs)[i].value; return; } } } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned* out_len, const void* vs, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned int* out_len, const void* vs, const void* u2 _U_) {\
        guint i; \
        *out_ptr = ep_strdup(default_str); \
-       *out_len = (unsigned)strlen(default_str);\
+       *out_len = (unsigned int)strlen(default_str);\
        for(i=0;((value_string*)vs)[i].strptr;i++) { \
                if ( ((value_string*)vs)[i].value == ((rec_t*)rec)->field_name
) { \
                        *out_ptr = ep_strdup(((value_string*)vs)[i].strptr); \
-                       *out_len = (unsigned)strlen(*out_ptr); return; } } }
+                       *out_len = (unsigned int)strlen(*out_ptr); return; } }
}

 #define UAT_VS_CSTRING_DEF(basename,field_name,rec_t,default_val,default_str)
\
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned len, const void* vs, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned int len, const void* vs, const void* u2 _U_) {\
        guint i; \
        char* str = ep_strndup(buf,len); \
        const char* cstr; ((rec_t*)rec)->field_name = default_val; \
        for(i=0; ( cstr = ((value_string*)vs)[i].strptr ) ;i++) { \
                if (g_str_equal(cstr,str)) { \
                  ((rec_t*)rec)->field_name =
g_strdup(((value_string*)vs)[i].strptr); return; } } } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned* out_len, const void* vs _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned int* out_len, const void* vs _U_, const void* u2 _U_) {\
                if (((rec_t*)rec)->field_name ) { \
                        *out_ptr = (((rec_t*)rec)->field_name); \
-                       *out_len =
(unsigned)strlen((((rec_t*)rec)->field_name)); \
+                       *out_len = (unsigned
int)strlen((((rec_t*)rec)->field_name)); \
                } else { \
                        *out_ptr = ""; *out_len = 0; } }

@@ -510,7 +510,7 @@
  */

 #define UAT_PROTO_DEF(basename, field_name, dissector_field, name_field,
rec_t) \
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned int len, const void* u1 _U_, const void* u2 _U_) {\
        if (len) { \
                gchar *tmp = g_strndup(buf,len); \
                ((rec_t*)rec)->name_field = g_ascii_strdown(tmp, -1); \
@@ -521,10 +521,10 @@
                ((rec_t*)rec)->dissector_field = find_dissector("data"); \
                ((rec_t*)rec)->name_field = NULL; \
                } } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned int* out_len, const void* u1 _U_, const void* u2 _U_) {\
        if ( ((rec_t*)rec)->name_field ) { \
                *out_ptr = (((rec_t*)rec)->name_field); \
-               *out_len = (unsigned)strlen(*out_ptr); \
+               *out_len = (unsigned int)strlen(*out_ptr); \
        } else { \
                *out_ptr = ""; *out_len = 0; } }

@@ -537,14 +537,14 @@
  */

 #define UAT_RANGE_CB_DEF(basename,field_name,rec_t) \
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned len, const void* u1 _U_, const void* u2) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf,
unsigned int len, const void* u1 _U_, const void* u2) {\
        char* rng = ep_strndup(buf,len);\
                range_convert_str(&(((rec_t*)rec)->field_name),
rng,GPOINTER_TO_UINT(u2)); \
        } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char**
out_ptr, unsigned int* out_len, const void* u1 _U_, const void* u2 _U_) {\
        if ( ((rec_t*)rec)->field_name ) { \
                *out_ptr = range_convert_range(((rec_t*)rec)->field_name); \
-               *out_len = (unsigned)strlen(*out_ptr); \
+               *out_len = (unsigned int)strlen(*out_ptr); \
        } else { \
                *out_ptr = ""; *out_len = 0; } }

--- wimaxasncp_dict.h.orig      2012-10-08 16:35:07.581025540 -0700
+++ wimaxasncp_dict.h   2012-10-08 16:35:24.395801930 -0700
@@ -75,7 +75,7 @@

 struct _wimaxasncp_dict_namecode_t {
     gchar *name;
-    unsigned code;
+    unsigned int code;
     struct _wimaxasncp_dict_namecode_t *next;
 };

--- wslua_dumper.c.orig 2012-10-08 16:25:11.358018791 -0700
+++ wslua_dumper.c      2012-10-08 16:25:28.365817149 -0700
@@ -291,8 +291,8 @@

        if (! ba) WSLUA_ARG_ERROR(Dumper_dump,BYTEARRAY,"must be a ByteArray");

-       pkthdr.ts.secs = (unsigned)floor(ts);
-       pkthdr.ts.nsecs = (unsigned)floor((ts - (double)pkthdr.ts.secs) *
1000000000);
+       pkthdr.ts.secs = (unsigned int)floor(ts);
+       pkthdr.ts.nsecs = (unsigned int)floor((ts - (double)pkthdr.ts.secs) *
1000000000);

     pkthdr.len  = ba->len;
     pkthdr.caplen  = ba->len;

All of the above code compiles cleanly under wireshark-1.8.2 via 'make'

Here is a list of files contained within the file attachment for
this bug report:

-rw-r--r-- bill/users     3010 2012-10-08 16:10 packet-pw-atm.c.patch
-rw-r--r-- bill/users      692 2012-10-08 16:11 packet-rdm.c.patch
-rw-r--r-- bill/users     2121 2012-10-08 16:14 packet-rlc.c.patch
-rw-r--r-- bill/users      981 2012-10-08 16:12 packet-rlc-lte.c.patch
-rw-r--r-- bill/users      476 2012-10-08 16:15 packet-rpc.c.patch
-rw-r--r-- bill/users      566 2012-10-08 16:17 packet-rtsp.c.patch
-rw-r--r-- bill/users      506 2012-10-08 16:34 packet-sir.c.patch
-rw-r--r-- bill/users     1482 2012-10-08 16:24 packet-ssl-utils.h.patch
-rw-r--r-- bill/users      398 2012-10-08 16:19 packet-teredo.c.patch
-rw-r--r-- bill/users      284 2012-10-08 16:20 packet-vicp.c.patch
-rw-r--r-- bill/users     3669 2012-10-08 16:22 packet-x11.c.patch
-rw-r--r-- bill/users      800 2012-10-08 16:23 packet-zebra.c.patch
-rw-r--r-- bill/users      789 2012-10-08 16:51 snoop.c.patch
-rw-r--r-- bill/users    13954 2012-10-08 15:50 uat.h.patch
-rw-r--r-- bill/users      294 2012-10-08 16:36 wimaxasncp_dict.h.patch
-rw-r--r-- bill/users      524 2012-10-08 16:25 wslua_dumper.c.patch

Bill Parker

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.