Add some GCC warnings to the standard set, and add some others to the
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 23 Apr 2007 10:59:26 +0000 (10:59 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 23 Apr 2007 10:59:26 +0000 (10:59 +0000)
--enable-extra-gcc-checks set.

If we turn on -pedantic, try turning on -Wno-long-long as well, so that
it's not *so* pedantic that it rejects the 64-bit integral data types
that we explicitly require.

Constify a bunch of stuff, and make some other changes, to get rid of
warnings.

Clean up some indentation.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21526 f5534014-38df-0310-8fa8-9805f1628bb7

56 files changed:
asn1/snmp/packet-snmp-template.c
configure.in
epan/address.h
epan/dfilter/dfilter-macro.c
epan/dfilter/dfilter-macro.h
epan/dfilter/dfilter.c
epan/dfilter/dfilter.h
epan/dfilter/dfunctions.h
epan/dissectors/packet-3g-a11.c
epan/dissectors/packet-alcap.c
epan/dissectors/packet-bacapp.c
epan/dissectors/packet-ber.c
epan/dissectors/packet-ber.h
epan/dissectors/packet-bittorrent.c
epan/dissectors/packet-bootp.c
epan/dissectors/packet-bssap.c
epan/dissectors/packet-bssgp.c
epan/dissectors/packet-cimd.c
epan/dissectors/packet-cups.c
epan/dissectors/packet-dcerpc-samr.c
epan/dissectors/packet-dcerpc-spoolss.c
epan/dissectors/packet-dcerpc-svcctl.c
epan/dissectors/packet-dcm.c
epan/dissectors/packet-dcom.c
epan/dissectors/packet-dcom.h
epan/dissectors/packet-diameter.c
epan/dissectors/packet-dns.c
epan/dissectors/packet-dns.h
epan/dissectors/packet-enip.c
epan/dissectors/packet-fcswils.c
epan/dissectors/packet-fix.c
epan/dissectors/packet-icmpv6.c
epan/dissectors/packet-isup.c
epan/dissectors/packet-k12.c
epan/dissectors/packet-nbns.c
epan/dissectors/packet-sccp.c
epan/dissectors/packet-scsi-osd.c
epan/dissectors/packet-snmp.c
epan/dissectors/packet-ssl-utils.c
epan/dissectors/packet-user_encap.c
epan/emem.c
epan/emem.h
epan/funnel.h
epan/packet.c
epan/packet.h
epan/tvbuff.c
epan/tvbuff.h
epan/uat-int.h
epan/uat.c
epan/uat.h
epan/uat_load.l
epan/xmlstub.h
gtk/decode_as_dlg.c
gtk/funnel_stat.c
gtk/uat_gui.c
tshark.c

index fb9ae8d546985f156647746e017b6cf228f808dc..4c6e273f5cfa84ca4daa056ab5e26951561cf4c1 100644 (file)
@@ -1975,7 +1975,7 @@ static void snmp_users_free_cb(void* p) {
        if (ue->engine.data) g_free(ue->engine.data);
 }
 
-static void snmp_users_update_cb(void* p _U_, char** err) {
+static void snmp_users_update_cb(void* p _U_, const char** err) {
        snmp_ue_assoc_t* ue = p;
        GString* es = g_string_new("");
 
index 1f49064ee01e71ba0c141174f5cd90afbc3fbe9e..6a28b0905ce49028f84b26eaf3ca3097903fa3e5 100644 (file)
@@ -157,19 +157,22 @@ AC_ARG_ENABLE(extra-gcc-checks,
        wireshark_extra_gcc_flags=$enableval
        if test $enableval != no
        then
-         AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-qual)
-         AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align)
-         AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wbad-function-cast)
-         AC_WIRESHARK_GCC_CFLAGS_CHECK(-pedantic)
-         AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wstrict-prototypes)
-         AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-declarations)
-         AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wwrite-strings)
+               AC_WIRESHARK_GCC_CFLAGS_CHECK(-pedantic)
+               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-long-long)
+               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wbad-function-cast)
+               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-qual)
+               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wwrite-strings)
+               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshorten-64-to-32)
+               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wstrict-prototypes)
+               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-declarations)
        fi
 ],)
 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wall -W)
-AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpointer-arith)
 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wdeclaration-after-statement)
+AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wendif-labels)
+AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpointer-arith)
 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-pointer-sign)
+AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align)
 
 #
 # If we're running gcc add '-D_U_="__attribute__((unused))"' to CFLAGS as well,
index 3a0074a04389e28f572ebc11e5e671265bab71c8..551d4af0e36b4bd3715b48f86d32b975ad875102 100644 (file)
@@ -66,7 +66,7 @@ typedef struct _address {
 #define        SET_ADDRESS(addr, addr_type, addr_len, addr_data) { \
        (addr)->type = (addr_type); \
        (addr)->len = (addr_len); \
-       (addr)->data = (void *)(addr_data); \
+       (addr)->data = (const void *)(addr_data); \
        }
 
 /*
index c260a6b1d3133bd9930fa439db9c24505dcd7cbd..21d50b8916b274c7af6b80df489e3eb9ea2e5038 100644 (file)
@@ -97,7 +97,7 @@ void dfilter_macro_dump(void) {
 #endif
 }
 
-static gchar* dfilter_macro_resolve(gchar* name, gchar** args, gchar** error) {
+static gchar* dfilter_macro_resolve(gchar* name, gchar** args, const gchar** error) {
        GString* text;
        int argc = 0;
        dfilter_macro_t* m = NULL;
@@ -148,7 +148,7 @@ static gchar* dfilter_macro_resolve(gchar* name, gchar** args, gchar** error) {
 }
 
 
-gchar* dfilter_macro_apply(const gchar* text, guint depth, gchar** error) {
+gchar* dfilter_macro_apply(const gchar* text, guint depth, const gchar** error) {
        enum { OUTSIDE, STARTING, NAME, ARGS } state = OUTSIDE;
        GString* out;
        GString* name = NULL;
@@ -318,7 +318,7 @@ on_error:
                }
 }
 
-static void macro_update(void* mp, gchar** error) {
+static void macro_update(void* mp, const gchar** error) {
        dfilter_macro_t* m = mp;
        GPtrArray* parts;
        GArray* args_pos;
@@ -445,7 +445,7 @@ static void* macro_copy(void* dest, const void* orig, unsigned len _U_) {
 }
 
 
-gboolean macro_name_chk(void* r _U_, const char* in_name, unsigned name_len, void* u1 _U_, void* u2 _U_, char** error) {
+static gboolean macro_name_chk(void* r _U_, const char* in_name, unsigned name_len, void* u1 _U_, void* u2 _U_, const char** error) {
        guint i;
        
        for (i=0; i < name_len; i++) {
index bf30cbc53ea680ca08e804fec3b1cab4b30cbf65..50c1cec04ce7756409656b26b6bb285f3c6386f3 100644 (file)
@@ -41,11 +41,14 @@ typedef struct _dfilter_macro_t {
 typedef void (*dfilter_macro_cb_t)(dfilter_macro_t*, void*);
 void dfilter_macro_foreach(dfilter_macro_cb_t, void*);
 
+/* save dfilter macros to a file */
+void dfilter_macro_save(const gchar*, gchar**);
+
 /* dumps the macros in the list (debug info, not formated as in the macros file) */
 void dfilter_macro_dump(void);
 
 /* applies all macros to the given text and returns the resulting string or NULL on failure */
-gchar* dfilter_macro_apply(const gchar* text, guint depth, gchar** error);
+gchar* dfilter_macro_apply(const gchar* text, guint depth, const gchar** error);
 
 void dfilter_macro_init(void);
 
index 775321076fc1c2a2dc3843851198e19d1a892884..e0ac2a194fd5503ef336566a39b8492dfe54ad54 100644 (file)
@@ -41,7 +41,7 @@
 
 /* Global error message space for dfilter_compile errors */
 static gchar dfilter_error_msg_buf[1024];
-gchar *dfilter_error_msg;      /* NULL when no error resulted */
+const gchar *dfilter_error_msg;        /* NULL when no error resulted */
 
 /* From scanner.c */
 void df_scanner_text(const char *text);
index 401cd75812545fbf0939413246fa708d49623dcd..7be98cae203539e0e7e516d83d931848b0b377cf 100644 (file)
@@ -69,7 +69,7 @@ dfilter_free(dfilter_t *df);
  * libwireshark.dll, we need a special declaration.
  */
 
-WS_VAR_IMPORT gchar *dfilter_error_msg;
+WS_VAR_IMPORT const gchar *dfilter_error_msg;
 
 
 /* Apply compiled dfilter */
index 8abf520ecc09b1279c0a4f097e1d5186b8974e1e..f324e159c45e1f7a97d6585c08b0e671fbba4282 100644 (file)
@@ -42,7 +42,7 @@ typedef void (*DFSemCheckType)(int param_num, stnode_t *st_node);
 /* This is a "function definition" record, holding everything
  * we need to know about a function */
 typedef struct {
-    char            *name;
+    const char      *name;
     DFFuncType      function;
     ftenum_t        retval_ftype;
     guint           min_nargs;
index 5a86226663a8a3e5c8ba0dd0f7317e76c7c9fa66..1f28e73d223a98e97df32b23e589ad886d942242 100644 (file)
@@ -417,7 +417,7 @@ decode_sse(proto_tree* ext_tree, tvbuff_t* tvb, int offset, size_t ext_len)
     guint8 msid_num_digits = 0;
     guint8 msid_index = 0;
     guint8 msid_digits[A11_MSG_MSID_LEN_MAX+2];
-    guint8* p_msid = 0;
+    const guint8* p_msid = 0;
     gboolean odd_even_ind = 0;
 
     /* Decode Protocol Type */
index 582c1cc98287af122c86d19be1c708037d7e9227..71d9173844054436971f214e237773617443b550 100644 (file)
@@ -408,13 +408,13 @@ emem_tree_t* legs_by_dsaid = NULL;
 emem_tree_t* legs_by_osaid = NULL;
 emem_tree_t* legs_by_bearer = NULL;
 
-static gchar* dissect_fields_unknown(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_unknown(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     proto_item* pi = proto_tree_add_item(tree,hf_alcap_unknown,tvb,offset,len,FALSE);
     proto_item_set_expert_flags(pi, PI_UNDECODED, PI_WARN);
     return NULL;
 }
 
-static gchar* dissect_fields_cau(packet_info* pinfo, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info) {
+static const gchar* dissect_fields_cau(packet_info* pinfo, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info) {
     /*
      * Q.2630.1 -> 7.3.1 Cause
      *
@@ -486,7 +486,7 @@ static gchar* dissect_fields_cau(packet_info* pinfo, tvbuff_t *tvb, proto_tree *
     return ret_str;
 }
 
-static gchar* dissect_fields_ceid(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info) {
+static const gchar* dissect_fields_ceid(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info) {
     /*
      * Q.2630.1 -> 7.3.2 Connection Element Identifier
      *
@@ -521,7 +521,7 @@ static gchar* dissect_fields_ceid(packet_info* pinfo _U_, tvbuff_t *tvb, proto_t
     }    
 }
 
-static gchar* dissect_fields_desea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_desea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.1 -> 7.3.3 Destination E.164 service endpoint address
      *
@@ -548,7 +548,7 @@ static gchar* dissect_fields_desea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_oesea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_oesea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.23 Origination E.164 service endpoint address
      *
@@ -575,7 +575,7 @@ static gchar* dissect_fields_oesea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_dnsea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_dnsea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.1 -> 7.3.4 Destination NSAP service endpoint address
      *
@@ -596,7 +596,7 @@ static gchar* dissect_fields_dnsea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_onsea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_onsea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.24 Origination NSAP service endpoint address
      *
@@ -617,7 +617,7 @@ static gchar* dissect_fields_onsea(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_alc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_alc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.1 -> 7.3.5 Link characteristics
      *
@@ -645,7 +645,7 @@ static gchar* dissect_fields_alc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tr
     return NULL;
 }
 
-static gchar* dissect_fields_plc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_plc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.2 -> 7.3.19 Preferred Link characteristics
      *
@@ -673,7 +673,7 @@ static gchar* dissect_fields_plc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tr
     return NULL;
 }
 
-static gchar* dissect_fields_osaid(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_osaid(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.1 -> 7.3.6 Originating signalling association identifier
      *
@@ -692,7 +692,7 @@ static gchar* dissect_fields_osaid(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_sugr(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_sugr(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.1 -> 7.3.7 Served user generated reference
      *
@@ -711,7 +711,7 @@ static gchar* dissect_fields_sugr(packet_info* pinfo _U_, tvbuff_t *tvb, proto_t
     return NULL;
 }
 
-static gchar* dissect_fields_suci(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_suci(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.2 -> 7.3.22 Served user correlation ID
      *
@@ -728,7 +728,7 @@ static gchar* dissect_fields_suci(packet_info* pinfo _U_, tvbuff_t *tvb, proto_t
     return NULL;
 }
 
-static gchar* dissect_fields_ssia(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_ssia(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.2 -> 7.3.9 Service specific information (Audio)
      *
@@ -760,7 +760,7 @@ static gchar* dissect_fields_ssia(packet_info* pinfo _U_, tvbuff_t *tvb, proto_t
     return NULL;
 }
 
-static gchar* dissect_fields_ssim(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_ssim(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.1 -> 7.3.10 Service specific information (Multirate)
      *
@@ -779,7 +779,7 @@ static gchar* dissect_fields_ssim(packet_info* pinfo _U_, tvbuff_t *tvb, proto_t
     return NULL;
 }
 
-static gchar* dissect_fields_ssisa(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_ssisa(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.1 -> 7.3.11 Service specific information (SAR-assured)
      *
@@ -803,7 +803,7 @@ static gchar* dissect_fields_ssisa(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_ssisu(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_ssisu(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.1 -> 7.3.12 Service specific information (SAR-unassured)
      *
@@ -823,7 +823,7 @@ static gchar* dissect_fields_ssisu(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_none(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_none(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * used for parameters that have no fields, just checks if len==0
      *
@@ -842,7 +842,7 @@ static gchar* dissect_fields_none(packet_info* pinfo _U_, tvbuff_t *tvb, proto_t
     return NULL;
 }
 
-static gchar* dissect_fields_ssiae(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_ssiae(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.2 -> 7.3.15 Service specific information (Audio Extended)
      *
@@ -878,7 +878,7 @@ static gchar* dissect_fields_ssiae(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_pssiae(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_pssiae(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.2 -> 7.3.17 Preferred service specific information (Audio Extended)
      *
@@ -914,7 +914,7 @@ static gchar* dissect_fields_pssiae(packet_info* pinfo _U_, tvbuff_t *tvb, proto
     return NULL;
 }
 
-static gchar* dissect_fields_ssime(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_ssime(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.2 -> 7.3.16 Service specific information (Multirate Extended)
      *
@@ -934,7 +934,7 @@ static gchar* dissect_fields_ssime(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_pssime(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_pssime(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.2 -> 7.3.18 Preferred service specific information (Multirate Extended)
      *
@@ -954,7 +954,7 @@ static gchar* dissect_fields_pssime(packet_info* pinfo _U_, tvbuff_t *tvb, proto
     return NULL;
 }
 
-static gchar* dissect_fields_acc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_acc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.25 Automatic congestion control
      *
@@ -971,7 +971,7 @@ static gchar* dissect_fields_acc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tr
 }
 
 
-static gchar* dissect_fields_cp(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_cp(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.26 Connection Priority
      *
@@ -987,7 +987,7 @@ static gchar* dissect_fields_cp(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tre
     return NULL;
 }
 
-static gchar* dissect_fields_pt(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_pt(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.2 -> 7.3.14 Path Type
      *
@@ -1004,7 +1004,7 @@ static gchar* dissect_fields_pt(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tre
 }
 
 
-static gchar* dissect_fields_hc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_hc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.27 Hop counter
      *
@@ -1021,7 +1021,7 @@ static gchar* dissect_fields_hc(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tre
 }
 
 
-static gchar* dissect_fields_fbw(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_fbw(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.32 Fixed bandwidth transfer capability
      *
@@ -1045,7 +1045,7 @@ static gchar* dissect_fields_fbw(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tr
     return NULL;
 }
 
-static gchar* dissect_fields_pfbw(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_pfbw(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.29 Preferred fixed bandwidth transfer capability
      *
@@ -1069,7 +1069,7 @@ static gchar* dissect_fields_pfbw(packet_info* pinfo _U_, tvbuff_t *tvb, proto_t
     return NULL;
 }
 
-static gchar* dissect_fields_vbws(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_vbws(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.33 Variable bandwidth stringent transfer capability
      *
@@ -1096,7 +1096,7 @@ static gchar* dissect_fields_vbws(packet_info* pinfo _U_, tvbuff_t *tvb, proto_t
     return NULL;
 }
 
-static gchar* dissect_fields_pvbws(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_pvbws(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.30 Preferred variable bandwidth stringent transfer capability
      *
@@ -1124,7 +1124,7 @@ static gchar* dissect_fields_pvbws(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
 }
 
 
-static gchar* dissect_fields_pvbwt(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_pvbwt(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.31 Preferred variable bandwidth tolerant transfer capability
      *
@@ -1159,7 +1159,7 @@ static gchar* dissect_fields_pvbwt(packet_info* pinfo _U_, tvbuff_t *tvb, proto_
     return NULL;
 }
 
-static gchar* dissect_fields_vbwt(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_vbwt(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.3 -> 7.3.34 Variable bandwidth tolerant transfer capability
      *
@@ -1193,7 +1193,7 @@ static gchar* dissect_fields_vbwt(packet_info* pinfo _U_, tvbuff_t *tvb, proto_t
     return NULL;
 }
 
-static gchar* dissect_fields_sut(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
+static const gchar* dissect_fields_sut(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) {
     /*
      * Q.2630.1 -> 7.3.8 Served user transport
      *
@@ -1215,7 +1215,7 @@ static gchar* dissect_fields_sut(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tr
     return NULL;
 }
 
-typedef gchar* (*alcap_parameter_dissector_t) (packet_info* pinfo, tvbuff_t*, proto_tree*, int, int, alcap_message_info_t*);
+typedef const gchar* (*alcap_parameter_dissector_t) (packet_info* pinfo, tvbuff_t*, proto_tree*, int, int, alcap_message_info_t*);
 
 typedef struct _alcap_param_info_t {
     gint ett;
@@ -1408,7 +1408,7 @@ static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
         guint param_len = tvb_get_guint8(tvb,offset+2);
         const alcap_param_info_t* param_info = GET_PARAM_INFO(param_id);
         proto_tree* param_tree;
-        gchar* colinfo_str = NULL;
+        const gchar* colinfo_str = NULL;
         
         pi = proto_tree_add_item(alcap_tree,hf_alcap_param_id,tvb,offset,1,FALSE);
         param_tree = proto_item_add_subtree(pi,param_info->ett);
index 876f8750cd3fac4c0523482bce556359cdd21273..635c281b3f41cf714e1b38164d2de266b348d236 100644 (file)
@@ -1690,7 +1690,7 @@ fRealTag (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label)
        guint8 tag_no, tag_info;
        guint32 lvt;
        guint tag_len;
-       gfloat f_val = 0.0;
+       gfloat f_val;
        proto_item *ti;
        proto_tree *subtree;
 
@@ -1710,7 +1710,7 @@ fDoubleTag (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label)
        guint8 tag_no, tag_info;
        guint32 lvt;
        guint tag_len;
-       gdouble d_val = 0.0;
+       gdouble d_val;
        proto_item *ti;
        proto_tree *subtree;
 
index 82b3ec0a0220afb1686db04e111bbc2145347bf7..00f2bc7df7878636f6445ab057fefe2ae7a8b149 100644 (file)
@@ -223,7 +223,7 @@ register_ber_oid_syntax(const char *oid, const char *name, const char *syntax)
 {
 
   if(syntax && *syntax)
-    g_hash_table_insert(syntax_table, (gpointer)oid, (gpointer)syntax);
+    g_hash_table_insert(syntax_table, (const gpointer)oid, (const gpointer)syntax);
 
   if(name && *name)
     register_ber_oid_name(oid, name);
@@ -256,7 +256,7 @@ void ber_decode_as_foreach(GHFunc func, gpointer user_data)
 
 }
 
-void ber_decode_as(gchar *syntax)
+void ber_decode_as(const gchar *syntax)
 {
 
   if(decode_as_syntax) {
@@ -269,7 +269,7 @@ void ber_decode_as(gchar *syntax)
 }
 
 /* Get oid syntax from hash table to get translation in proto dissection(packet-per.c) */
-const gchar *
+static const gchar *
 get_ber_oid_syntax(const char *oid)
 {
        return g_hash_table_lookup(syntax_table, oid);
@@ -290,7 +290,7 @@ void ber_set_filename(gchar *filename)
 
     if((ptr = strrchr(ber_filename, '.')) != NULL) {
       
-      ber_decode_as((gchar *)get_ber_oid_syntax(ptr));
+      ber_decode_as(get_ber_oid_syntax(ptr));
 
     }
   }
@@ -2434,7 +2434,7 @@ int dissect_ber_bitstring(gboolean implicit_tag, packet_info *pinfo, proto_tree
        proto_item *cause;
        proto_tree *tree = NULL;
        const asn_namedbit *nb;
-       char *sep;
+       const char *sep;
        gboolean term;
 
        if(!implicit_tag){
@@ -2546,7 +2546,7 @@ int dissect_ber_bitstring32(gboolean implicit_tag, packet_info *pinfo, proto_tre
        guint32 val;
        int **bf;
        header_field_info *hfi;
-       char *sep;
+       const char *sep;
        gboolean term;
        unsigned int i, tvb_len;
 
index 359feb3bd946a783042045f67fce7669f0c9efbd..381d2819562dfd9bbe20209435657d98eb69d054 100644 (file)
@@ -192,7 +192,7 @@ void register_ber_oid_syntax(const char *oid, const char *name, const char *synt
 void dissect_ber_oid_NULL_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
 
 void ber_decode_as_foreach(GHFunc func, gpointer user_data); /* iterate through known syntaxes */
-void ber_decode_as(gchar *syntax); /* decode the current capture as this syntax */
+void ber_decode_as(const gchar *syntax); /* decode the current capture as this syntax */
 void ber_set_filename(gchar *filename); /* name of current BER-encoded file */
 
 gboolean oid_has_dissector(const char *oid);
index 43da881a68ae2a5eca185d461c13fe253d4eebb1..f2ae482b58076133f2f1d80108d2baed79fb220b 100644 (file)
@@ -103,7 +103,7 @@ static const value_string azureus_priorities[] = {
 
 
 struct amp_message {
-  char *name;
+  const char *name;
   guint32 value;
 };
 
@@ -170,7 +170,7 @@ static gboolean decode_client_information = FALSE;
 
 struct client_information {
    char id[4];
-   char *name;
+   const char *name;
 };
 
 static struct client_information peer_id[] = {
index c6df2214b2a99b56ba67ab03bfd934a9b7e69ee8..346517cf6178972294d71e2e90983c922d801b2d 100644 (file)
@@ -842,7 +842,7 @@ bootp_option(tvbuff_t *tvb, proto_tree *bp_tree, int voff, int eoff,
 
                /* PXE protocol 2.1 as described in the intel specs */
                if (*vendor_class_id_p != NULL &&
-                   strncmp((gchar*)*vendor_class_id_p, "PXEClient", strlen((gchar*)"PXEClient")) == 0) {
+                   strncmp((const gchar*)*vendor_class_id_p, "PXEClient", strlen("PXEClient")) == 0) {
                        proto_item_append_text(vti, " (PXEClient)");
                        v_tree = proto_item_add_subtree(vti, ett_bootp_option);
 
@@ -852,9 +852,9 @@ bootp_option(tvbuff_t *tvb, proto_tree *bp_tree, int voff, int eoff,
                                        tvb, optoff, optend);
                        }
                } else if (*vendor_class_id_p != NULL &&
-                          ((strncmp((gchar*)*vendor_class_id_p, "pktc", strlen((gchar*)"pktc")) == 0) ||
-                            (strncmp((gchar*)*vendor_class_id_p, "docsis", strlen((gchar*)"docsis")) == 0) ||
-                            (strncmp((gchar*)*vendor_class_id_p, "CableHome", strlen((gchar*)"CableHome")) == 0))) {
+                          ((strncmp((const gchar*)*vendor_class_id_p, "pktc", strlen("pktc")) == 0) ||
+                            (strncmp((const gchar*)*vendor_class_id_p, "docsis", strlen("docsis")) == 0) ||
+                            (strncmp((const gchar*)*vendor_class_id_p, "CableHome", strlen("CableHome")) == 0))) {
                        /* CableLabs standard - see www.cablelabs.com/projects */
                        proto_item_append_text(vti, " (CableLabs)");
 
@@ -941,19 +941,19 @@ bootp_option(tvbuff_t *tvb, proto_tree *bp_tree, int voff, int eoff,
                 */
                proto_item_append_text(vti, " = \"%s\"",
                        tvb_format_stringzpad(tvb, optoff, consumed-2));
-               if ((tvb_memeql(tvb, optoff, (guint8*)PACKETCABLE_MTA_CAP10, 
+               if ((tvb_memeql(tvb, optoff, (const guint8*)PACKETCABLE_MTA_CAP10, 
                                      strlen(PACKETCABLE_MTA_CAP10)) == 0)
                    ||
-                   (tvb_memeql(tvb, optoff, (guint8*)PACKETCABLE_MTA_CAP15, 
+                   (tvb_memeql(tvb, optoff, (const guint8*)PACKETCABLE_MTA_CAP15, 
                                      strlen(PACKETCABLE_MTA_CAP10)) == 0)) 
                {
                        dissect_packetcable_mta_cap(v_tree, tvb, optoff, optlen);
                } 
                else {
-                 if (tvb_memeql(tvb, optoff, (guint8*)PACKETCABLE_CM_CAP11, 
+                 if (tvb_memeql(tvb, optoff, (const guint8*)PACKETCABLE_CM_CAP11, 
                                      strlen(PACKETCABLE_CM_CAP11)) == 0
                      ||
-                     tvb_memeql(tvb, optoff, (guint8*)PACKETCABLE_CM_CAP20, 
+                     tvb_memeql(tvb, optoff, (const guint8*)PACKETCABLE_CM_CAP20, 
                                      strlen(PACKETCABLE_CM_CAP20)) == 0 ) 
                  {
                        dissect_docsis_cm_cap(v_tree, tvb, optoff, optlen);
@@ -2821,7 +2821,8 @@ dissect_packetcable_ietf_ccc(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
        proto_tree *pkt_s_tree;
        proto_item *vti;
        int max_timer_val = 255, i;
-       char *dns_name, bit_fld[24];
+       const char *dns_name;
+       char bit_fld[24];
 
        subopt = tvb_get_guint8(tvb, suboptoff);
        suboptoff++;
@@ -3135,7 +3136,7 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                }
 
                /* The server host name is optional */
-               if (tvb_get_guint8(tvb, 44) != '\0') {
+               if (tvb_get_guint8(tvb, SERVER_NAME_OFFSET) != '\0') {
                        proto_tree_add_item(bp_tree, hf_bootp_server, tvb,
                                                   SERVER_NAME_OFFSET,
                                                   SERVER_NAME_LEN, FALSE);
@@ -3144,12 +3145,12 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        proto_tree_add_string_format(bp_tree, hf_bootp_server, tvb,
                                                   SERVER_NAME_OFFSET,
                                                   SERVER_NAME_LEN,
-                                                  (gchar*)tvb_get_ptr(tvb, SERVER_NAME_OFFSET, 1),
+                                                  (const gchar*)tvb_get_ptr(tvb, SERVER_NAME_OFFSET, 1),
                                                   "Server host name not given");
                }
 
                /* Boot file */
-               if (tvb_get_guint8(tvb, 108) != '\0') {
+               if (tvb_get_guint8(tvb, FILE_NAME_OFFSET) != '\0') {
                        proto_tree_add_item(bp_tree, hf_bootp_file, tvb,
                                                   FILE_NAME_OFFSET,
                                                   FILE_NAME_LEN, FALSE);
@@ -3158,7 +3159,7 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        proto_tree_add_string_format(bp_tree, hf_bootp_file, tvb,
                                                   FILE_NAME_OFFSET,
                                                   FILE_NAME_LEN,
-                                                  (gchar*)tvb_get_ptr(tvb, FILE_NAME_OFFSET, 1),
+                                                  (const gchar*)tvb_get_ptr(tvb, FILE_NAME_OFFSET, 1),
                                                   "Boot file name not given");
                }
        }
index cb110374dff0cc1946016c7cd3b5a2ac9507fb31..011d102c52a25c0e3490c08fd8b4f3c8a7e042bb 100644 (file)
@@ -624,7 +624,7 @@ static dgt_set_t Dgt1_9_bcd = {
 };
 /* Assumes the rest of the tvb contains the digits to be turned into a string 
  */
-static char*
+static const char*
 unpack_digits(tvbuff_t *tvb, int offset,dgt_set_t *dgt,gboolean skip_first){
 
        int length;
@@ -959,11 +959,11 @@ dissect_bssap_Gs_cause(tvbuff_t *tvb, proto_tree *tree, int offset)
 static int
 dissect_bssap_imei(tvbuff_t *tvb, proto_tree *tree, int offset)
 {
-    proto_item *item = NULL;
-    proto_tree *ie_tree = NULL;
+       proto_item *item = NULL;
+       proto_tree *ie_tree = NULL;
        guint8 ie_len;
        tvbuff_t *ie_tvb;
-       char *digit_str;
+       const char *digit_str;
 
        ie_len = tvb_get_guint8(tvb,offset+1);
        item = proto_tree_add_item(tree, hf_bssap_imei_ie, tvb, offset, ie_len+2, FALSE);
@@ -987,11 +987,11 @@ dissect_bssap_imei(tvbuff_t *tvb, proto_tree *tree, int offset)
 static int
 dissect_bssap_imesiv(tvbuff_t *tvb, proto_tree *tree, int offset)
 {
-    proto_item *item = NULL;
-    proto_tree *ie_tree = NULL;
+       proto_item *item = NULL;
+       proto_tree *ie_tree = NULL;
        guint8 ie_len;
        tvbuff_t *ie_tvb;
-       char *digit_str;
+       const char *digit_str;
        
        ie_len = tvb_get_guint8(tvb,offset+1);
        item = proto_tree_add_item(tree, hf_bssap_imesiv_ie, tvb, offset, ie_len+2, FALSE);
@@ -1021,11 +1021,11 @@ dissect_bssap_imesiv(tvbuff_t *tvb, proto_tree *tree, int offset)
 static int
 dissect_bssap_imsi(tvbuff_t *tvb, proto_tree *tree, int offset)
 {
-    proto_item *item = NULL;
-    proto_tree *ie_tree = NULL;
+       proto_item *item = NULL;
+       proto_tree *ie_tree = NULL;
        guint8 ie_len;
        tvbuff_t *ie_tvb;
-       char *digit_str;
+       const char *digit_str;
        
        ie_len = tvb_get_guint8(tvb,offset+1);
        item = proto_tree_add_item(tree, hf_bssap_imsi_ie, tvb, offset, ie_len+2, FALSE);
@@ -1389,11 +1389,11 @@ static const true_false_string bssap_extension_value = {
 static int
 dissect_bssap_sgsn_number(tvbuff_t *tvb, proto_tree *tree, int offset)
 {
-    proto_item *item = NULL;
-    proto_tree *ie_tree = NULL;
+       proto_item *item = NULL;
+       proto_tree *ie_tree = NULL;
        guint8 ie_len;
        tvbuff_t *number_tvb;
-       char *digit_str;
+       const char *digit_str;
        
        ie_len = tvb_get_guint8(tvb,offset+1);
        item = proto_tree_add_item(tree, hf_bssap_sgsn_nr_ie, tvb, offset, ie_len+2, FALSE);
@@ -1540,11 +1540,11 @@ dissect_bssap_ulink_tunnel_payload_control_and_info(tvbuff_t *tvb, packet_info *
 static int
 dissect_bssap_vlr_number(tvbuff_t *tvb, proto_tree *tree, int offset)
 {
-    proto_item *item = NULL;
-    proto_tree *ie_tree = NULL;
+       proto_item *item = NULL;
+       proto_tree *ie_tree = NULL;
        guint8 ie_len;
        tvbuff_t *number_tvb;
-       char *digit_str;
+       const char *digit_str;
        
        ie_len = tvb_get_guint8(tvb,offset+1);
        item = proto_tree_add_item(tree, hf_bssap_vlr_number_ie, tvb, offset, ie_len+2, FALSE);
index 8d05b6c1da0d844bb74adb5eca32d0e75a93e53c..d314efc59a607e6e327544c6a43829787c8156ad 100644 (file)
@@ -4375,8 +4375,6 @@ decode_iei_global_cn_id(bssgp_ie_t *ie, build_info_t *bi, int ie_start_offset) {
 static void
 decode_ie(bssgp_ie_t *ie, build_info_t *bi) {
   int org_offset = bi->offset;
-  const char *iename = val_to_str(ie->iei, tab_bssgp_ie_types, "Unknown");
-  gboolean use_default_ie_name = (ie->name == NULL);
 
   if (tvb_length_remaining(bi->tvb, bi->offset) < 1) {
 /* TODO This code does not work well with omitted Optional elements 
@@ -4415,10 +4413,6 @@ decode_ie(bssgp_ie_t *ie, build_info_t *bi) {
     ;
   }
 
-  if (use_default_ie_name) {
-    ie->name = g_strdup(iename);
-  }
-
   switch (ie->iei) {
   case BSSGP_IEI_ALIGNMENT_OCTETS:
     decode_iei_alignment_octets(ie, bi, org_offset);
@@ -4655,11 +4649,6 @@ decode_ie(bssgp_ie_t *ie, build_info_t *bi) {
   default:
     ;
   }
-  if (use_default_ie_name) {
-    /* Memory has been allocated; free it */
-    g_free( (gpointer) ie->name);
-    ie->name = NULL;
-  }
 }
 
 static void 
@@ -4670,9 +4659,7 @@ decode_pdu_general(bssgp_ie_t *ies, int num_ies, build_info_t *bi) {
   }
 }
 
-static void 
-decode_pdu_dl_unitdata(build_info_t *bi) {
-  bssgp_ie_t ies[] = {
+static bssgp_ie_t ies[] = {
     { BSSGP_IEI_TLLI, "TLLI (current)",
       BSSGP_IE_PRESENCE_M, BSSGP_IE_FORMAT_V, BSSGP_UNKNOWN, 4 },
 
@@ -4711,7 +4698,10 @@ decode_pdu_dl_unitdata(build_info_t *bi) {
 
     { BSSGP_IEI_LLC_PDU, NULL, 
       BSSGP_IE_PRESENCE_M, BSSGP_IE_FORMAT_TLV, BSSGP_UNKNOWN, BSSGP_UNKNOWN},
-  };
+};
+
+static void 
+decode_pdu_dl_unitdata(build_info_t *bi) {
   bi->dl_data = TRUE;
   bi->ul_data = FALSE;
 
@@ -6030,6 +6020,7 @@ dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 void
 proto_register_bssgp(void)
 {                 
+  size_t i;
   static hf_register_info hf[] = {
     { &hf_bssgp_pdu_type,
       { "PDU Type", "bssgp.pdu_type",
@@ -6191,6 +6182,13 @@ proto_register_bssgp(void)
     &ett_bssgp_tmsi_ptmsi,
   };
 
+  /* Fill in name field of the the IE table */
+  for (i = 0; i < (sizeof ies / sizeof ies[0]); i++) {
+    if (ies[i].name == NULL)
+      ies[i].name = match_strval(ies[i].iei, tab_bssgp_ie_types);
+      g_assert(ies[i].name != NULL);
+  }
+
   /* Register the protocol name and description */
   proto_bssgp = proto_register_protocol("Base Station Subsystem GPRS Protocol", "BSSGP", "bssgp");
 
index 623e816e3c8adf7b52874dd1c9dde7d89c829dfe..60dda2d45e0563dbb1dca10fe238ce0a111fe112 100644 (file)
@@ -285,7 +285,7 @@ static void dissect_cimd_ud(tvbuff_t *tvb, proto_tree *tree, gint pindex, gint s
   gint g_offset, g_size;
   gchar token[4];  
   gchar ch;
-  char* mapping[128] = {
+  const char* mapping[128] = {
     "_Oa","_L-", "", "_Y-", "_e`", "_e'", "_u`", "_i`", "_o`","_C,", /*10*/
     "", "_O/", "_o/", "", "_A*", "_a*","_gd", "_--", "_gf", "_gg", "_gl", /*21*/
     "_go", "_gp","_gi", "_gs", "_gt", "_gx", "_XX","_AE","_ae", "_ss","_E'", /*32*/
index d5d86085c473b1930b5e52f58115855939d73076..85982095efde9f0377bc63c466854f9d1aad890e 100644 (file)
@@ -340,7 +340,7 @@ get_unquoted_string(tvbuff_t *tvb, gint offset, gint *next_offset, guint *len)
        guint l = 0;
        gint o;
 
-       o = tvb_pbrk_guint8(tvb, offset, -1, (guint8*)" \t\r\n");
+       o = tvb_pbrk_guint8(tvb, offset, -1, (const guint8*)" \t\r\n");
        if (o != -1) {
                l = o - offset;
                s = tvb_get_ptr(tvb, offset, l);
index a75c55c91d78bd6e306de9c5e2711929e3ed0452..87d565fbbd1722ec102001a8bafc9b4e4a5b32bd 100644 (file)
@@ -575,7 +575,7 @@ samr_dissect_open_user_reply(tvbuff_t *tvb, int offset,
                                  hf_samr_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -1107,7 +1107,7 @@ samr_dissect_connect2_rqst(tvbuff_t *tvb, int offset,
 {
        dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
        dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
-       char *sn;
+       const char *sn;
 
        /* ServerName */
        dcv->private_data=NULL;
@@ -1141,7 +1141,7 @@ samr_dissect_connect3_4_rqst(tvbuff_t *tvb, int offset,
 {
        dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
        dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
-       char *sn;
+       const char *sn;
 
        /* ServerName */
        dcv->private_data=NULL;
@@ -1190,7 +1190,7 @@ samr_dissect_connect2_reply(tvbuff_t *tvb, int offset,
                                  hf_samr_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -1228,7 +1228,7 @@ samr_dissect_connect3_reply(tvbuff_t *tvb, int offset,
                                  hf_samr_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -1266,7 +1266,7 @@ samr_dissect_connect4_reply(tvbuff_t *tvb, int offset,
                                  hf_samr_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -1434,7 +1434,7 @@ samr_dissect_open_domain_rqst(tvbuff_t *tvb, int offset,
 {
        dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
        dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
-       char *sid;
+       const char *sid;
 
         offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
                                       hf_samr_hnd, NULL, NULL, FALSE, FALSE);
@@ -1484,7 +1484,7 @@ samr_dissect_open_domain_reply(tvbuff_t *tvb, int offset,
                                  hf_samr_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -4661,7 +4661,7 @@ samr_dissect_open_group_reply(tvbuff_t *tvb, int offset,
                        hf_samr_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -4730,7 +4730,7 @@ samr_dissect_open_alias_reply(tvbuff_t *tvb, int offset,
                        hf_samr_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -4954,7 +4954,7 @@ samr_dissect_connect5_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo,
 {
        dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
        dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
-       char *sn;
+       const char *sn;
 
        /* ServerName */
        dcv->private_data=NULL;
@@ -5027,7 +5027,7 @@ samr_dissect_connect5_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                  hf_samr_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
index 4ac58006914c01813e7e6a466918a9d15a2b42fe..a6eeab7ecb64a23b1ee39495ec3d51fbd39d2e26 100644 (file)
@@ -2582,7 +2582,7 @@ static int SpoolssOpenPrinterEx_r(tvbuff_t *tvb, int offset,
                tvb, offset, pinfo, tree, drep, hf_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -3206,7 +3206,7 @@ static int SpoolssReplyOpenPrinter_r(tvbuff_t *tvb, int offset,
                tvb, offset, pinfo, tree, drep, hf_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -3714,7 +3714,7 @@ static int SpoolssAddPrinterEx_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
                tvb, offset, pinfo, tree, drep, hf_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
index 92c6448168cb65d925c5ea68e5c16dba814691d3..49fb39f5254779979cc8f58315860d81da320d11 100644 (file)
@@ -117,7 +117,7 @@ svcctl_dissect_OpenSCManager_rqst(tvbuff_t *tvb, int offset,
 {
        dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
        dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
-       char *mn, *dn;
+       const char *mn, *dn;
 
        /* MachineName */
        dcv->private_data=NULL;
@@ -177,7 +177,7 @@ svcctl_dissect_OpenSCManager_reply(tvbuff_t *tvb, int offset,
                tvb, offset, pinfo, tree, drep, hf_svcctl_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
@@ -203,7 +203,7 @@ svcctl_dissect_OpenSCManagerW_rqst(tvbuff_t *tvb, int offset,
 {
        dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
        dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
-       char *mn, *dn;
+       const char *mn, *dn;
 
        /* MachineName */
        dcv->private_data=NULL;
@@ -263,7 +263,7 @@ svcctl_dissect_OpenSCManagerW_reply(tvbuff_t *tvb, int offset,
                tvb, offset, pinfo, tree, drep, hf_svcctl_rc, &status);
 
        if( status == 0 ){
-               char *pol_name;
+               const char *pol_name;
 
                if (dcv->se_data){
                        pol_name = ep_strdup_printf(
index 88a50451ee2861cd855997763116ba28caa92e86..e664b9b8b65c5530084ad72dbc501ccc8ac6e63e 100644 (file)
@@ -201,7 +201,7 @@ typedef struct dcmTag dcmTag_t;
 
 static GHashTable *dcm_tagTable = NULL;
 
-dcmItem_t * lookupCtx(dcmState_t *dd, guint8 ctx);
+static dcmItem_t * lookupCtx(dcmState_t *dd, guint8 ctx);
 
 static dcmTag_t tagData[] = {
     {  0x1,    DCM_TRET,  "(Ret) Length to End" },
@@ -710,13 +710,12 @@ dissect_dcm_assoc(dcmState_t *dcm_data, proto_item *ti, tvbuff_t *tvb, int offse
     }
 }
 
-dcmItem_t *
+static dcmItem_t *
 lookupCtx(dcmState_t *dd, guint8 ctx)
 {
     dcmItem_t *di = dd->first;
-    static dcmItem_t dunk = { NULL, NULL, 0, -1, 
-       "not found - click on ASSOC Request", 
-       "not found - click on ASSOC Request", DCM_UNK };
+    static char notfound[] = "not found - click on ASSOC Request";
+    static dcmItem_t dunk = { NULL, NULL, 0, -1, notfound, notfound, DCM_UNK };
     while (di) {
        if (ctx == di->id)
            break;
@@ -990,7 +989,8 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     dcmState_t *dcm_data;
     proto_tree *dcm_tree;
     conversation_t *conv;
-    char *buf=NULL;
+    char *buf;
+    const char *info_str = NULL;
     int offset = 0;
 
     if (NULL == (conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
@@ -1023,6 +1023,7 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        buf = ep_alloc(128);
        g_snprintf(buf, 128, "DCM ASSOC Request %s <-- %s",
            dcm_data->orig, dcm_data->targ);
+       info_str = buf;
        offset = 74;
        break;
     case 2:                            /* ASSOC Accept */
@@ -1030,6 +1031,7 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        buf = ep_alloc(128);
        g_snprintf(buf, 128, "DCM ASSOC Accept %s <-- %s (%s)",
            dcm_data->orig, dcm_data->targ, dcm_data->resp);
+       info_str = buf;
        offset = 74; 
        break;
     case 3:                                    /* ASSOC Reject */
@@ -1042,18 +1044,19 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
            dcm_result2str(dcm_data->result),
            dcm_source2str(dcm_data->source),
            dcm_reason2str(dcm_data->source, dcm_data->reason));
+       info_str = buf;
        offset = 10;
        break;
     case 4:                                    /* DATA */
        offset = 6; 
-       buf="DCM Data";
+       info_str="DCM Data";
        break;
     case 5:                                    /* RELEASE Request */
-       buf="DCM RELEASE Request";
+       info_str="DCM RELEASE Request";
        offset = 6; 
        break;
     case 6:                                    /* RELEASE Response */
-       buf="DCM RELEASE Response";
+       info_str="DCM RELEASE Response";
        offset = 6; 
        break;
     case 7:                                    /* ABORT */
@@ -1065,14 +1068,15 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
            (dcm_data->source == 1) ? "USER" :
                (dcm_data->source == 2) ? "PROVIDER" : "",
            dcm_data->source == 1 ? dcm_abort2str(dcm_data->reason) : "");
+       info_str = buf;
        break;
     default:
-       buf="DCM Continuation";
+       info_str="DCM Continuation";
        offset = -1;                            /* cannot continue parsing */
        break;
     }
     if (check_col(pinfo->cinfo, COL_INFO)) 
-       col_set_str(pinfo->cinfo, COL_INFO, buf);
+       col_set_str(pinfo->cinfo, COL_INFO, info_str);
 
 /* In the interest of speed, if "tree" is NULL, don't do any work not
    necessary to generate protocol tree items. */
@@ -1092,11 +1096,11 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     case 5:                                    /* RELEASE Request */
     case 6:                                    /* RELEASE Response */
     case 7:                                    /* ABORT */
-       tf = proto_tree_add_string(dcm_tree, hf_dcm_pdu_type, tvb, 0, dcm_data->tlen, buf);
+       tf = proto_tree_add_string(dcm_tree, hf_dcm_pdu_type, tvb, 0, dcm_data->tlen, info_str);
        dissect_dcm_assoc(dcm_data, tf, tvb, offset);
        break;
     case 4:                                    /* DATA */
-       tf = proto_tree_add_string(dcm_tree, hf_dcm_pdu_type, tvb, 0, dcm_data->tlen, buf);
+       tf = proto_tree_add_string(dcm_tree, hf_dcm_pdu_type, tvb, 0, dcm_data->tlen, info_str);
        dissect_dcm_data(dcm_data, tf, tvb);
        break;
     default:
index 2320f5b7e651d1f726c7a27c3e2239950315a5a8..c258231800d4a9a809ff93347ca8292997ae08f1 100644 (file)
@@ -331,7 +331,7 @@ dcom_interface_t *dcom_interface_new(packet_info *pinfo, const guint8 *ip, e_uui
     /* create new machine if not found */
     if(dcom_iter == NULL) {
         machine = se_alloc(sizeof(dcom_machine_t));
-        memcpy( (void *) (machine->ip), ip, 4);
+        memcpy(machine->ip, ip, 4);
         machine->objects = NULL;
         machine->first_packet = pinfo->fd->num;
         dcom_machines = g_list_append(dcom_machines, machine);
index a381cced7a968047bfc09bc57c10806109bb4866..9859c44294334390f557604eab34af9c5140d3c4 100644 (file)
@@ -46,7 +46,7 @@ typedef struct dcom_machine_s {
     GList           *objects;
     gint            first_packet;
 
-    const guint8    ip[4];
+    guint8          ip[4];
 } dcom_machine_t;
 
 typedef struct dcom_object_s {
index 29f780d59f20d9f69d00d20c995a47b6b8b09cac..f6facf530149abd7263b1a7102a0ba6ec691b53e 100644 (file)
@@ -1255,9 +1255,9 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   int              BadPacket = FALSE;
   guint32          commandCode=0, pktLength=0;
   guint8           version=0, flags=0;
-  gchar            *flagstr="<None>";
+  const gchar     *flagstr="<None>";
   const gchar     *fstr[] = {"RSVD7", "RSVD6", "RSVD5", "RSVD4", "RSVD3", "Error", "Proxyable", "Request" };
-  gchar            *commandString=NULL, *vendorName=NULL, *applicationName=NULL, *commandStringType=NULL;
+  const gchar     *commandString=NULL, *vendorName=NULL, *applicationName=NULL, *commandStringType=NULL;
   gint        i;
   guint      bpos;
   static  int initialized=FALSE;
@@ -1342,23 +1342,25 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
   /* Set up our flags */
   if (check_col(pinfo->cinfo, COL_INFO) || tree) {
+       char *flagbuf;
        int fslen;
 
 #define FLAG_STR_LEN 64
-       flagstr=ep_alloc(FLAG_STR_LEN);
-       flagstr[0]=0;
+       flagbuf=ep_alloc(FLAG_STR_LEN);
+       flagbuf[0]=0;
        fslen=0;
        for (i = 0; i < 8; i++) {
          bpos = 1 << i;
          if (flags & bpos) {
-               if (flagstr[0]) {
+               if (flagbuf[0]) {
                  fslen+=MIN(FLAG_STR_LEN-fslen,
-                            g_snprintf(flagstr+fslen, FLAG_STR_LEN-fslen, ", "));
+                            g_snprintf(flagbuf+fslen, FLAG_STR_LEN-fslen, ", "));
                }
                fslen+=MIN(FLAG_STR_LEN-fslen,
-                          g_snprintf(flagstr+fslen, FLAG_STR_LEN-fslen, "%s", fstr[i]));
+                          g_snprintf(flagbuf+fslen, FLAG_STR_LEN-fslen, "%s", fstr[i]));
          }
        }
+       flagstr = flagbuf;
        if (flagstr[0] == 0) {
          flagstr="<None>";
        }
@@ -1635,7 +1637,7 @@ static void dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree
        const gchar *avpNameString;
        const gchar *valstr;
        guint32 vendorId=0;
-       gchar    *vendorName;
+       const gchar *vendorName;
        int hdrLength;
        int fixAmt;
        proto_tree *avpi_tree;
@@ -1654,7 +1656,7 @@ static void dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree
        gint32 packetLength;
        size_t avpDataLength;
        int avpType;
-       gchar *flagstr="<None>";
+       const gchar *flagstr="<None>";
        const gchar *fstr[] = {"RSVD7", "RSVD6", "RSVD5", "RSVD4", "RSVD3", "Protected", "Mandatory", "Vendor-Specific" };
        gint       i;
        guint      bpos;
@@ -1695,23 +1697,25 @@ static void dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree
        
                /* Set up our flags string */
                if (check_col(pinfo->cinfo, COL_INFO) || avp_tree) {
+                       char *flagbuf;
                        int fslen;
 
 #define FLAG_STR_LEN 64
-                       flagstr=ep_alloc(FLAG_STR_LEN);
-                       flagstr[0]=0;
+                       flagbuf=ep_alloc(FLAG_STR_LEN);
+                       flagbuf[0]=0;
                        fslen=0;
                        for (i = 0; i < 8; i++) {
                                bpos = 1 << i;
                                if (flags & bpos) {
-                                       if (flagstr[0]) {
+                                       if (flagbuf[0]) {
                                                fslen+=MIN(FLAG_STR_LEN-fslen,
-                                                          g_snprintf(flagstr+fslen, FLAG_STR_LEN-fslen, ", "));
+                                                          g_snprintf(flagbuf+fslen, FLAG_STR_LEN-fslen, ", "));
                                        }
                                        fslen+=MIN(FLAG_STR_LEN-fslen,
-                                                      g_snprintf(flagstr+fslen, FLAG_STR_LEN-fslen, "%s", fstr[i]));
+                                                      g_snprintf(flagbuf+fslen, FLAG_STR_LEN-fslen, "%s", fstr[i]));
                                }
                        }
+                       flagstr = flagbuf;
                        if (flagstr[0] == 0) {
                                flagstr="<None>";
                        }
index 7f564c6b8aacdf1457db1dadf9ae5f4dff3e3d02..44ef9aee28388bef575ff5d7cfb7b468d7458ece 100644 (file)
@@ -546,7 +546,7 @@ dns_class_name(int class)
  */
 int
 get_dns_name(tvbuff_t *tvb, int offset, int dns_data_offset,
-    char **name)
+    const char **name)
 {
   int start_offset = offset;
   char *np;
@@ -563,8 +563,8 @@ get_dns_name(tvbuff_t *tvb, int offset, int dns_data_offset,
         * to put the dissector into a loop.  Instead we throw an exception */
 
   maxname=MAXDNAME;
-  *name=ep_alloc(maxname);
-  np=*name;
+  np=ep_alloc(maxname);
+  *name=np;
 
   maxname--;   /* reserve space for the trailing '\0' */
   for (;;) {
@@ -714,7 +714,7 @@ get_dns_name(tvbuff_t *tvb, int offset, int dns_data_offset,
 
 static int
 get_dns_name_type_class(tvbuff_t *tvb, int offset, int dns_data_offset,
-    char **name_ret, int *name_len_ret, int *type_ret, int *class_ret)
+    const char **name_ret, int *name_len_ret, int *type_ret, int *class_ret)
 {
   int len;
   int name_len;
@@ -790,7 +790,7 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset,
   column_info *cinfo, proto_tree *dns_tree, gboolean is_mdns)
 {
   int len;
-  char *name;
+  const char *name;
   char *name_out;
   int name_len;
   int type;
@@ -1000,7 +1000,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
   gboolean is_mdns)
 {
   int len;
-  char *name;
+  const char *name;
   char *name_out;
   int name_len;
   int type;
@@ -1097,7 +1097,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
 
   case T_NS:
     {
-      char *ns_name;
+      const char *ns_name;
       int ns_name_len;
 
       ns_name_len = get_dns_name(tvb, cur_offset, dns_data_offset, &ns_name);
@@ -1114,7 +1114,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
 
   case T_CNAME:
     {
-      char *cname;
+      const char *cname;
       int cname_len;
 
       cname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &cname);
@@ -1131,9 +1131,9 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
 
   case T_SOA:
     {
-      char *mname;
+      const char *mname;
       int mname_len;
-      char *rname;
+      const char *rname;
       int rname_len;
       guint32 serial;
       guint32 refresh;
@@ -1186,7 +1186,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
 
   case T_PTR:
     {
-      char *pname;
+      const char *pname;
       int pname_len;
 
       pname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &pname);
@@ -1318,7 +1318,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
   case T_MX:
     {
       guint16 preference = 0;
-      char *mx_name;
+      const char *mx_name;
       int mx_name_len;
 
       preference = tvb_get_ntohs(tvb, cur_offset);
@@ -1361,7 +1361,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
       int rr_len = data_len;
       guint16 type_covered;
       nstime_t nstime;
-      char *signer_name;
+      const char *signer_name;
       int signer_name_len;
 
       if (dns_tree != NULL) {
@@ -1523,7 +1523,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
       int rr_len = data_len;
       guint8 gw_type, algo;
       const guint8 *addr;
-      char *gw;
+      const char *gw;
       int gw_name_len;
       static const value_string gw_algo[] = {
          { 1,     "DSA" },
@@ -1616,7 +1616,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
       unsigned short pre_len;
       unsigned short suf_len;
       unsigned short suf_octet_count;
-      char *pname;
+      const char *pname;
       int pname_len;
       int a6_offset;
       int suf_offset;
@@ -1675,7 +1675,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
 
   case T_DNAME:
     {
-      char *dname;
+      const char *dname;
       int dname_len;
 
       dname_len = get_dns_name(tvb, cur_offset, dns_data_offset,
@@ -1733,7 +1733,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
   case T_NSEC:
     {
       int rr_len = data_len;
-      char *next_domain_name;
+      const char *next_domain_name;
       int next_domain_name_len;
       int rr_type;
       guint8 bits;
@@ -1781,7 +1781,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
   case T_NXT:
     {
       int rr_len = data_len;
-      char *next_domain_name;
+      const char *next_domain_name;
       int next_domain_name_len;
       int rr_type;
       guint8 bits;
@@ -1822,7 +1822,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
   case T_KX:
     {
       guint16 preference = 0;
-      char *kx_name;
+      const char *kx_name;
       int kx_name_len;
 
       preference = tvb_get_ntohs(tvb, cur_offset);
@@ -1931,7 +1931,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
 
   case T_TKEY:
     {
-      char *tkey_algname;
+      const char *tkey_algname;
       int tkey_algname_len;
       guint16 tkey_mode, tkey_error, tkey_keylen, tkey_otherlen;
       int rr_len = data_len;
@@ -2067,7 +2067,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
     {
       guint16 tsig_error, tsig_timehi, tsig_siglen, tsig_otherlen;
       guint32 tsig_timelo;
-      char *tsig_raw_algname, *tsig_algname;
+      const char *tsig_raw_algname;
+      char *tsig_algname;
       int tsig_algname_len;
       nstime_t nstime;
       int rr_len = data_len;
@@ -2228,7 +2229,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
       guint32 local_flag;
       guint32 lookup_timeout;
       guint32 cache_timeout;
-      char *dname;
+      const char *dname;
       int dname_len;
 
       if (rr_len < 4)
@@ -2278,7 +2279,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
       guint16 priority = 0;
       guint16 weight = 0;
       guint16 port = 0;
-      char *target;
+      const char *target;
       int target_len;
 
       priority = tvb_get_ntohs(tvb, cur_offset);
index 81d884f853dd7df95a64dc0b0acbb4811f0bfbf5..b97ef4a95452a709c346a16e63145cfafa8ac28e 100644 (file)
@@ -29,7 +29,7 @@
 
 const char *dns_class_name(int class);
 
-int get_dns_name(tvbuff_t *, int, int, char **);
+int get_dns_name(tvbuff_t *, int, int, const char **);
 
 #define MAXDNAME        1025            /* maximum domain name length */
 
index d7112f3312a163d484ba880d5f57a2091071ebb3..59daefc5c675c4b0feebae979d1a50f2438f1bcb 100644 (file)
@@ -226,7 +226,7 @@ add_byte_array_text_to_proto_tree( proto_tree *tree, tvbuff_t *tvb, gint start,
       tmp2_length = ( length * 2 ) + 1;
    }
 
-   tmp = (char *)tvb_get_ptr( tvb, start, tmp_length );
+   tmp = (const char *)tvb_get_ptr( tvb, start, tmp_length );
    tmp2 = (char *)ep_alloc( tmp2_length );
 
    tmp2start = tmp2;
@@ -549,7 +549,7 @@ dissect_enip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
    int    packet_type;
    guint16  encap_cmd, encap_data_length;
-   char     *pkt_type_str = "";
+   const char *pkt_type_str = "";
    guint32  ifacehndl;
 
    /* Set up structures needed to add the protocol subtree and manage it */
index 90b2be19b73252fb48bd6accab0a891edd5d4c3e..892e2d21ac55dc958ace6742deb7e89bc333aa5b 100644 (file)
@@ -715,7 +715,7 @@ dissect_swils_elp (tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_)
     
     /* Set up structures needed to add the protocol subtree and manage it */
     int offset = 0;
-    gchar *flags;
+    const gchar *flags;
     fcswils_elp elp;
 
     /* Response i.e. SW_ACC for an ELP has the same format as the request */
@@ -771,27 +771,29 @@ dissect_swils_elp (tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_)
        flags="";
         if (elp.cls1_svcparm[0] & 0x80) {
 #define MAX_FLAGS_LEN 40
+            char *flagsbuf;
             size_t stroff, returned_length;
 
-            flags=ep_alloc(MAX_FLAGS_LEN);
+            flagsbuf=ep_alloc(MAX_FLAGS_LEN);
             stroff = 0;
-           flags[stroff]=0;
+           flagsbuf[stroff]=0;
 
-            returned_length = g_snprintf (flags+stroff, MAX_FLAGS_LEN-stroff,
+            returned_length = g_snprintf (flagsbuf+stroff, MAX_FLAGS_LEN-stroff,
                "Class 1 Valid");
            stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
             if (elp.cls1_svcparm[0] & 0x40) {
-                returned_length = g_snprintf (flags+stroff, MAX_FLAGS_LEN-stroff, " | IMX");
+                returned_length = g_snprintf (flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | IMX");
                stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
             }
             if (elp.cls1_svcparm[0] & 0x20) {
-                returned_length = g_snprintf (flags+stroff, MAX_FLAGS_LEN-stroff, " | IPS");
+                returned_length = g_snprintf (flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | IPS");
                stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
             }
             if (elp.cls1_svcparm[0] & 0x10) {
-                returned_length = g_snprintf (flags+stroff, MAX_FLAGS_LEN-stroff, " | LKS");
+                returned_length = g_snprintf (flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | LKS");
                stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
             }
+            flags=flagsbuf;
         }
         else {
             flags="Class 1 Invalid";
index d52490a4a06728af0210f7358c15a7da61260471..b5ce04907b86f9b7d0e2ca49ecb99799d48f01e8 100644 (file)
@@ -833,7 +833,7 @@ static void dissect_fix_init(void) {
     g_datalist_set_data(&msg_types, "BE", "User Request");
     g_datalist_set_data(&msg_types, "BF", "User Response");
     g_datalist_set_data(&msg_types, "BG", "Collateral Inquiry Ack");
-    g_datalist_set_data(&msg_types, "BH", "Confirmation Request");
+    g_datalist_set_data(&msg_types, "BH", (gpointer)(void *)"Confirmation Request");
 
 }
 
index 3bbb4fe4b22f50754a8ec338f8aa4975954028b1..987b34b915a68501e76cfdb00b8e91d310e3e141 100644 (file)
@@ -731,7 +731,7 @@ dissect_nodeinfo(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
     unsigned int j;
     int i, n, l, p;
     guint16 flags;
-    char *dname;
+    const char *dname;
     guint32 ipaddr;
 
     ni = &icmp6_nodeinfo;
index 15823a2c19c507a4d905c073febd97fb91220af4..65ee548d113f12569dfdae1b3e11e7155001bc43 100644 (file)
@@ -6896,7 +6896,7 @@ static void msg_stats_tree_init(stats_tree* st) {
 }
 
 static int msg_stats_tree_packet(stats_tree *st  , packet_info *pinfo, epan_dissect_t *edt _U_, const void *p ) {
-       const gchar* msg = match_strval(((isup_tap_rec_t*)p)->message_type, isup_message_type_value_acro);
+       const gchar* msg = match_strval(((const isup_tap_rec_t*)p)->message_type, isup_message_type_value_acro);
        gchar src[MAX_ADDR_STR_LEN];
        gchar dst[MAX_ADDR_STR_LEN];
        gchar dir[MAX_ADDR_STR_LEN];
index cfc7c4a8c04a5e9d97688222cdf56ab4d2271399..1bf3d78a64cbfb24ed4c303dc6011753c8e37958 100644 (file)
@@ -286,7 +286,7 @@ static void dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) {
        call_dissector(sub_handle, tvb, pinfo, tree);
 }
 
-static void k12_update_cb(void* r, char** err) {
+static void k12_update_cb(void* r, const char** err) {
        k12_handles_t* h = r;
        gchar** protos;
        guint num_protos, i;
@@ -333,7 +333,7 @@ static void k12_free_cb(void* r) {
 }
 
 
-static gboolean protos_chk_cb(void* r _U_, const char* p, unsigned len, void* u1 _U_, void* u2 _U_, char** err) {
+static gboolean protos_chk_cb(void* r _U_, const char* p, unsigned len, void* u1 _U_, void* u2 _U_, const char** err) {
        gchar** protos;
        gchar* line = ep_strndup(p,len);
        guint num_protos, i;
index 32ee7e72a8ac3871cc9c1985e699e82c4c2a2afd..3af5691d2271f62152ec8e565c7e4db09077a2d5 100644 (file)
@@ -275,9 +275,10 @@ get_nbns_name(tvbuff_t *tvb, int offset, int nbns_data_offset,
     char *name_ret, int name_ret_len, int *name_type_ret)
 {
        int name_len;
-       char *name;
+       const char *name;
        char *nbname;
-       char *pname, cname, cnbname;
+       const char *pname;
+       char cname, cnbname;
        int name_type;
        char *pname_ret;
        size_t index = 0;
index a4e2efd17e188af4c4c052bcbbd7c90b935c8d31..9e9fb3350bba2ca4c88cdf11c0f11a703bd04e0f 100644 (file)
@@ -1509,30 +1509,30 @@ dissect_sccp_data_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     const mtp3_addr_pc_t* dpc;
     const mtp3_addr_pc_t* opc;
        
-       if (trace_sccp && assoc && assoc != &no_assoc) {
-               pinfo->sccp_info = assoc->curr_msg;
-       } else {
-               pinfo->sccp_info = NULL;
-       }
+    if (trace_sccp && assoc && assoc != &no_assoc) {
+       pinfo->sccp_info = assoc->curr_msg;
+    } else {
+       pinfo->sccp_info = NULL;
+    }
 
-       switch (pinfo->p2p_dir) {
-               case P2P_DIR_SENT:
-                       ssn = assoc->calling_ssn;
-                       dpc = (mtp3_addr_pc_t*)pinfo->dst.data;
-                       opc = (mtp3_addr_pc_t*)pinfo->src.data;
-                       break;
-               case P2P_DIR_RECV:
-                       ssn = assoc->called_ssn;
-                       dpc = (mtp3_addr_pc_t*)pinfo->src.data;
-                       opc = (mtp3_addr_pc_t*)pinfo->dst.data;
-                       break;
-               default:
-                       ssn = assoc->called_ssn;
-                       other_ssn = assoc->calling_ssn;
-                       dpc = (mtp3_addr_pc_t*)pinfo->dst.data;
-                       opc = (mtp3_addr_pc_t*)pinfo->src.data;
-                       break;
-       }
+    switch (pinfo->p2p_dir) {
+       case P2P_DIR_SENT:
+               ssn = assoc->calling_ssn;
+               dpc = (const mtp3_addr_pc_t*)pinfo->dst.data;
+               opc = (const mtp3_addr_pc_t*)pinfo->src.data;
+               break;
+       case P2P_DIR_RECV:
+               ssn = assoc->called_ssn;
+               dpc = (const mtp3_addr_pc_t*)pinfo->src.data;
+               opc = (const mtp3_addr_pc_t*)pinfo->dst.data;
+               break;
+       default:
+               ssn = assoc->called_ssn;
+               other_ssn = assoc->calling_ssn;
+               dpc = (const mtp3_addr_pc_t*)pinfo->dst.data;
+               opc = (const mtp3_addr_pc_t*)pinfo->src.data;
+               break;
+    }
 
     
     if (num_sccp_users && pinfo->src.type == AT_SS7PC) {
@@ -2606,7 +2606,7 @@ static struct _sccp_ul {
        {0,FALSE,NULL}
 };
 
-static void sccp_users_update_cb(void* r, char** err _U_) {
+static void sccp_users_update_cb(void* r, const char** err _U_) {
        sccp_user_t* u = r;
        struct _sccp_ul* c;
                
index 61252243dffe33a220bd8f09def9edbc72288959..be3acea50f4081a91d186fbde454ff0c042a6775 100644 (file)
@@ -214,7 +214,7 @@ typedef void (*attribute_dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tre
 
 typedef struct _attribute_page_numbers_t {
     guint32    number;
-    char       *name;
+    const char *name;
     attribute_dissector dissector;
 } attribute_page_numbers_t;
 static const attribute_page_numbers_t user_object_info_attributes[] = {
index c0f9cd8e8cdc7644a68cd231b379780a511edc04..4be98f1a22c9d39a2c27e85b131c0cb25717f296 100644 (file)
@@ -3791,7 +3791,7 @@ static void snmp_users_free_cb(void* p) {
        if (ue->engine.data) g_free(ue->engine.data);
 }
 
-static void snmp_users_update_cb(void* p _U_, char** err) {
+static void snmp_users_update_cb(void* p _U_, const char** err) {
        snmp_ue_assoc_t* ue = p;
        GString* es = g_string_new("");
 
index e6350a03a251b4e4a877a80bb8d30c7c48d83869..32636c849f5233ad68704b38da1599083692e2cc 100644 (file)
@@ -1974,11 +1974,11 @@ guint
 ssl_hash  (gconstpointer v)
 {    
   guint l,hash;
-  StringInfo* id;
-  guint* cur;
+  const StringInfo* id;
+  const guint* cur;
   hash = 0;
-  id = (StringInfo*) v;
-  cur = (guint*) id->data;
+  id = (const StringInfo*) v;
+  cur = (const guint*) id->data;
 
   for (l=4; (l<id->data_len); l+=4, cur++)
     hash = hash ^ (*cur);
@@ -2006,11 +2006,11 @@ ssl_private_key_hash  (gconstpointer v)
 {    
   const SslService *key;
   guint l, hash, len ;
-  guint* cur;
+  const guint* cur;
   key = (const SslService *)v;
   hash = key->port;
   len = key->addr.len;
-  cur = (guint*) key->addr.data;
+  cur = (const guint*) key->addr.data;
 
   for (l=4; (l<len); l+=4, cur++)
     hash = hash ^ (*cur);
index ee59c7d4eae08a2b4be5e01e150de611524ca734..8ec2011cd76a942290beaa8f2300c7a71073b84e 100644 (file)
@@ -123,7 +123,7 @@ static void dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
        }
 }
 
-static void user_update_cb(void* r _U_, char** err _U_) {
+static void user_update_cb(void* r _U_, const char** err _U_) {
 }
 
 UAT_VS_DEF(user_encap, encap, user_encap_t, WTAP_ENCAP_USER0, ENCAP0_STR)
index f8d00ae6026f5a954750e3cf31593ab1aa220c2d..5b66e90c3815cf6572ffb9cab4b366126f09c454 100644 (file)
@@ -866,7 +866,7 @@ void print_tree(emem_tree_node_t *node){
 emem_tree_t *se_trees=NULL;
 
 emem_tree_t *
-se_tree_create(int type, char *name)
+se_tree_create(int type, const char *name)
 {
        emem_tree_t *tree_list;
 
@@ -1321,7 +1321,7 @@ static void* lookup_or_insert32(emem_tree_t *se_tree, guint32 key, void*(*func)(
  * never existed including all metadata associated with the tree.
  */
 emem_tree_t *
-se_tree_create_non_persistent(int type, char *name)
+se_tree_create_non_persistent(int type, const char *name)
 {
        emem_tree_t *tree_list;
 
index e3066abbe69cb51a9586c6717e7952eb4b68939f..e834caa6c9835f7802ebc613b2197c46cc9a95f7 100644 (file)
@@ -188,7 +188,7 @@ typedef struct _emem_tree_node_t {
 typedef struct _emem_tree_t {
        struct _emem_tree_t *next;
        int type;
-       char *name;    /* just a string to make debugging easier */
+       const char *name;    /* just a string to make debugging easier */
        emem_tree_node_t *tree;
        void *(*malloc)(size_t);
 } emem_tree_t;
@@ -208,7 +208,7 @@ extern emem_tree_t *se_trees;
  *
  * type is : EMEM_TREE_TYPE_RED_BLACK for a standard red/black tree.
  */
-emem_tree_t *se_tree_create(int type, char *name);
+emem_tree_t *se_tree_create(int type, const char *name);
 
 /* This function is similar to the se_tree_create() call but with the
  * difference that when the se memory is release everything including the 
@@ -219,7 +219,7 @@ emem_tree_t *se_tree_create(int type, char *name);
  * another structure that is also se allocated so that when the structure is
  * released, the tree will be completely released as well.
  */
-emem_tree_t *se_tree_create_non_persistent(int type, char *name);
+emem_tree_t *se_tree_create_non_persistent(int type, const char *name);
 
 /* se_tree_insert32 
  * Insert data into the tree and key it by a 32bit integer value
index d93b52cbb3ac95667b70020995a7fcb9e82663b4..f4f46746857759530f0e48e4d857cc8f589c7aca 100644 (file)
@@ -82,7 +82,7 @@ typedef struct _funnel_ops_t {
        void (*retap_packets)(void);
        void (*copy_to_clipboard)(GString *str);
        void (*set_filter)(const char*);
-       gboolean (*open_file)(const char* fname, const char* filter, char** error);
+       gboolean (*open_file)(const char* fname, const char* filter, const char** error);
        void (*reload)(void);
        void (*apply_filter)(void);
        gboolean (*browser_open_url)(const gchar *url);
index 0c2d81c467e6f345fd86b1e2c513be1831de9cc9..00573ed53f5a0ca3c309655c5c6df17ad1f07657 100644 (file)
@@ -1170,7 +1170,7 @@ typedef struct dissector_foreach_info {
   gpointer     caller_data;
   DATFunc      caller_func;
   GHFunc       next_func;
-  gchar       *table_name;
+  const gchar  *table_name;
   ftenum_t     selector_type;
 } dissector_foreach_info_t;
 
@@ -1244,7 +1244,7 @@ dissector_all_tables_foreach (DATFunc func,
  * on each entry.
  */
 void
-dissector_table_foreach (char *name,
+dissector_table_foreach (const char *name,
                         DATFunc func,
                         gpointer user_data)
 {
@@ -1321,7 +1321,7 @@ dissector_all_tables_foreach_changed (DATFunc func,
  * any entry that has been changed from its original state.
  */
 void
-dissector_table_foreach_changed (char *name,
+dissector_table_foreach_changed (const char *name,
                                 DATFunc func,
                                 gpointer user_data)
 {
index 2968e1ac088011a84a006c4d50bdfd11201b9ee9..353069879d98ae4995a8e961db506bc25fa0d70f 100644 (file)
@@ -131,11 +131,11 @@ typedef int (*new_dissector_t)(tvbuff_t *, packet_info *, proto_tree *);
 typedef gboolean (*heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
        proto_tree *tree);
 
-typedef void (*DATFunc) (gchar *table_name, ftenum_t selector_type,
+typedef void (*DATFunc) (const gchar *table_name, ftenum_t selector_type,
     gpointer key, gpointer value, gpointer user_data);
 typedef void (*DATFunc_handle) (const gchar *table_name, gpointer value,
     gpointer user_data);
-typedef void (*DATFunc_table) (gchar *table_name, const gchar *ui_name,
+typedef void (*DATFunc_table) (const gchar *table_name, const gchar *ui_name,
     gpointer user_data);
 
 /* Opaque structure - provides type checking but no access to components */
@@ -143,9 +143,9 @@ typedef struct dtbl_entry dtbl_entry_t;
 
 extern dissector_handle_t dtbl_entry_get_handle (dtbl_entry_t *dtbl_entry);
 extern dissector_handle_t dtbl_entry_get_initial_handle (dtbl_entry_t * entry);
-extern void dissector_table_foreach_changed (char *name, DATFunc func,
+extern void dissector_table_foreach_changed (const char *name, DATFunc func,
     gpointer user_data);
-extern void dissector_table_foreach (char *name, DATFunc func,
+extern void dissector_table_foreach (const char *name, DATFunc func,
     gpointer user_data);
 extern void dissector_all_tables_foreach_changed (DATFunc func,
     gpointer user_data);
index cfa330501f93cf2ebc73295e6cf71f2ab168178c..6189960fe33e069b594a5c3fe35e837476864157 100644 (file)
@@ -1516,7 +1516,7 @@ tvb_find_guint8(tvbuff_t *tvb, gint offset, gint maxlength, guint8 needle)
  * in that case, -1 will be returned if the boundary is reached before
  * finding needle. */
 gint
-tvb_pbrk_guint8(tvbuff_t *tvb, gint offset, gint maxlength, guint8 *needles)
+tvb_pbrk_guint8(tvbuff_t *tvb, gint offset, gint maxlength, const guint8 *needles)
 {
        const guint8    *result;
        guint           abs_offset, junk_length;
@@ -2114,7 +2114,7 @@ tvb_find_line_end(tvbuff_t *tvb, gint offset, int len, gint *next_offset,
        /*
         * Look either for a CR or an LF.
         */
-       eol_offset = tvb_pbrk_guint8(tvb, offset, len, (guint8 *)"\r\n");
+       eol_offset = tvb_pbrk_guint8(tvb, offset, len, (const guint8 *)"\r\n");
        if (eol_offset == -1) {
                /*
                 * No CR or LF - line is presumably continued in next packet.
@@ -2243,7 +2243,7 @@ tvb_find_line_end_unquoted(tvbuff_t *tvb, gint offset, int len,
                         * Look either for a CR, an LF, or a '"'.
                         */
                        char_offset = tvb_pbrk_guint8(tvb, cur_offset, len,
-                           (guint8 *)"\r\n\"");
+                           (const guint8 *)"\r\n\"");
                }
                if (char_offset == -1) {
                        /*
index 795745630224ec7e04603cedb9242910a8849e38..58d60f9c5077f9fab19c44c778b5f77ae010fc32 100644 (file)
@@ -391,7 +391,7 @@ extern gint tvb_find_guint8(tvbuff_t*, gint offset, gint maxlength,
  * maxlength exceeds boundary of tvbuff; in that case, -1 will be returned if
  * the boundary is reached before finding needle. */
 extern gint tvb_pbrk_guint8(tvbuff_t *, gint offset, gint maxlength,
-    guint8 *needles);
+    const guint8 *needles);
 
 /** Find size of stringz (NUL-terminated string) by looking for terminating
  * NUL.  The size of the string includes the terminating NUL.
index 5bf22be9dc3bf4b1944cf31640169eafaefd01dc..8735cd672ac54a4f6745cde2055e5d357594fc3f 100644 (file)
@@ -46,11 +46,11 @@ typedef struct _fld_data_t {
 } fld_data_t;
 
 struct _uat_t {
-       char* name;     
+       const char* name;       
        size_t record_size;
-       char* filename;
-       char* help;
-       char* category;
+       const char* filename;
+       const char* help;
+       const char* category;
        void** user_ptr;
        guint* nrows_p;
        uat_copy_cb_t copy_cb;
index 85f8d4cb3fc8142a7884c44eee33c3cde0058464..cd180f329deecb47973c5ab78a21935f05fda0e0 100644 (file)
@@ -54,11 +54,11 @@ void uat_init(void) {
 
 uat_t* uat_new(const char* name,
                           size_t size,
-                          char* filename,
+                          const char* filename,
                           void** data_ptr,
                           guint* numitems_ptr,
-                          char* category,
-                          char* help,
+                          const char* category,
+                          const char* help,
                           uat_copy_cb_t copy_cb,
                           uat_update_cb_t update_cb,
                           uat_free_cb_t free_cb,
@@ -172,7 +172,7 @@ gchar* uat_get_actual_filename(uat_t* uat, gboolean for_writing) {
 
 static void putfld(FILE* fp, void* rec, uat_field_t* f) {
        guint fld_len;
-       char* fld_ptr;
+       const char* fld_ptr;
        
        f->cb.tostr(rec,&fld_ptr,&fld_len,f->cbdata.tostr,f->fld_data);
        
@@ -318,7 +318,7 @@ void uat_load_all(void) {
 }
 
 
-gboolean uat_fld_chk_str(void* u1 _U_, const char* strptr, unsigned len _U_, void* u2 _U_, void* u3 _U_, char** err) {
+gboolean uat_fld_chk_str(void* u1 _U_, const char* strptr, unsigned len _U_, void* u2 _U_, void* u3 _U_, const char** err) {
        if (strptr == NULL) {
                *err = "NULL pointer";
                return FALSE;
@@ -328,7 +328,7 @@ gboolean uat_fld_chk_str(void* u1 _U_, const char* strptr, unsigned len _U_, voi
        return TRUE;
 }
 
-gboolean uat_fld_chk_proto(void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, char** err) {
+gboolean uat_fld_chk_proto(void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, const char** err) {
        if (len) {
                char* name = ep_strndup(strptr,len);
                g_strdown(name);
@@ -347,7 +347,7 @@ gboolean uat_fld_chk_proto(void* u1 _U_, const char* strptr, unsigned len, void*
        }
 }
 
-gboolean uat_fld_chk_num_dec(void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, char** err) {
+gboolean uat_fld_chk_num_dec(void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, const char** err) {
        char* str = ep_strndup(strptr,len);
        long i = strtol(str,&str,10);
        
@@ -360,7 +360,7 @@ gboolean uat_fld_chk_num_dec(void* u1 _U_, const char* strptr, unsigned len, voi
        return TRUE;
 }
 
-gboolean uat_fld_chk_num_hex(void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, char** err) {
+gboolean uat_fld_chk_num_hex(void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, const char** err) {
        char* str = ep_strndup(strptr,len);
        long i = strtol(str,&str,16);
        
@@ -373,7 +373,7 @@ gboolean uat_fld_chk_num_hex(void* u1 _U_, const char* strptr, unsigned len, voi
        return TRUE;
 }
 
-gboolean uat_fld_chk_enum(void* u1 _U_, const char* strptr, unsigned len, void* v, void* u3 _U_, char** err) {
+gboolean uat_fld_chk_enum(void* u1 _U_, const char* strptr, unsigned len, void* v, void* u3 _U_, const char** err) {
        char* str = ep_strndup(strptr,len);
        guint i;
        value_string* vs = v;
@@ -389,7 +389,7 @@ gboolean uat_fld_chk_enum(void* u1 _U_, const char* strptr, unsigned len, void*
        return FALSE;
 }
 
-gboolean uat_fld_chk_range(void* u1 _U_, const char* strptr, unsigned len, void* v _U_, void* u3, char** err) {
+gboolean uat_fld_chk_range(void* u1 _U_, const char* strptr, unsigned len, void* v _U_, void* u3, const char** err) {
        char* str = ep_strndup(strptr,len);
        range_t* r = NULL;
        convert_ret_t ret = range_convert_str(&r, str,GPOINTER_TO_UINT(u3));
index fe7f819d174d32a571855ecd950664d9f4db2f9b..73957ec98bf531ac1b2816b8aeb524f35d8de5c1 100644 (file)
@@ -88,7 +88,7 @@ typedef void (*uat_free_cb_t)(void*);
  * optional, record will be updated always if not given
  * update(record,&error)
  */
-typedef void (*uat_update_cb_t)(void* , char** );
+typedef void (*uat_update_cb_t)(void* , const char** );
 
 
 /*******
@@ -104,7 +104,7 @@ typedef void (*uat_update_cb_t)(void* , char** );
  * 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, void*, void*, char**);
+typedef gboolean (*uat_fld_chk_cb_t)(void*, const char*, unsigned, void*, void*, const char**);
 
 /*
  * Set Field CB
@@ -123,7 +123,7 @@ typedef void (*uat_fld_set_cb_t)(void*, const char*, unsigned, void*, void*);
  * mandatory
  * tostr(record, &out_ptr, &out_len, tostr_data, fld_data)
  */
-typedef void (*uat_fld_tostr_cb_t)(void*, char**, unsigned*, void*, void*);
+typedef void (*uat_fld_tostr_cb_t)(void*, const char**, unsigned*, void*, void*);
 
 /*********** 
  * Text Mode
@@ -194,7 +194,7 @@ typedef struct _uat_field_t {
        
        void* fld_data;
        
-       char* desc;
+       const char* desc;
        struct _fld_data_t* priv;
 } uat_field_t;
 
@@ -232,11 +232,11 @@ typedef struct _uat_field_t {
  */
 uat_t* uat_new(const char* name,
                           size_t size,
-                          char* filename,
+                          const char* filename,
                           void** data_ptr,
                           guint* num_items,
-                          char* category,
-                          char* help,
+                          const char* category,
+                          const char* help,
                           uat_copy_cb_t copy_cb,
                           uat_update_cb_t update_cb,
                           uat_free_cb_t free_cb,
@@ -256,15 +256,15 @@ void* uat_se_dup(uat_t*, guint* len_p);
 /*
  * Some common uat_fld_chk_cbs 
  */
-gboolean uat_fld_chk_str(void*, const char*, unsigned, void*,void*, char** err);
-gboolean uat_fld_chk_proto(void*, const char*, unsigned, void*,void*, char** err);
-gboolean uat_fld_chk_num_dec(void*, const char*, unsigned, void*, void*, char** err);
-gboolean uat_fld_chk_num_hex(void*, const char*, unsigned, void*, void*, char** err);
-gboolean uat_fld_chk_enum(void*, const char*, unsigned, void*, void*, char**);
-gboolean uat_fld_chk_range(void*, const char*, unsigned, void*, void*, char**);
+gboolean uat_fld_chk_str(void*, const char*, unsigned, void*,void*, const char** err);
+gboolean uat_fld_chk_proto(void*, const char*, unsigned, void*,void*, const char** err);
+gboolean uat_fld_chk_num_dec(void*, const char*, unsigned, void*, void*, const char** err);
+gboolean uat_fld_chk_num_hex(void*, const char*, unsigned, void*, void*, const char** err);
+gboolean uat_fld_chk_enum(void*, const char*, unsigned, void*, void*, const char**);
+gboolean uat_fld_chk_range(void*, const char*, unsigned, void*, void*, const char**);
 
 #define CHK_STR_IS_DECL(what) \
-gboolean uat_fld_chk_str_ ## what (void*, const char*, unsigned, void*, void*, char**)
+gboolean uat_fld_chk_str_ ## what (void*, const char*, unsigned, void*, void*, const char**)
 
 typedef void (*uat_cb_t)(void* uat,void* user_data);
 void uat_foreach_table(uat_cb_t cb,void* user_data);
@@ -282,7 +282,7 @@ CHK_STR_IS_DECL(isdigit);
 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, void* u2 _U_, void* u3 _U_, char** err) { \
+gboolean uat_fld_chk_str_ ## what (void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, const char** err) { \
        guint i; for (i=0;i<len;i++) { \
                char c = strptr[i]; \
                        if (! what((int)c)) { \
@@ -304,7 +304,7 @@ gboolean uat_fld_chk_str_ ## what (void* u1 _U_, const char* strptr, unsigned le
 static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, void* u1 _U_, void* u2 _U_) {\
        if ((((rec_t*)rec)->field_name)) g_free((((rec_t*)rec)->field_name)); \
        (((rec_t*)rec)->field_name) = g_strndup(buf,len); } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
                if (((rec_t*)rec)->field_name ) { \
                        *out_ptr = (((rec_t*)rec)->field_name); *out_len = strlen((((rec_t*)rec)->field_name)); \
                } else { \
@@ -326,7 +326,7 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr,
 static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, void* u1 _U_, void* u2 _U_) {\
        if ((((rec_t*)rec)->ptr_element)) g_free((((rec_t*)rec)->ptr_element)); \
        (((rec_t*)rec)->ptr_element) = uat_unesc(buf,len,&(((rec_t*)rec)->len_element)); }\
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, 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 = strlen(*out_ptr); \
@@ -348,7 +348,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, u
                if ((((rec_t*)rec)->ptr_element) ) g_free((((rec_t*)rec)->ptr_element)); \
                        (((rec_t*)rec)->ptr_element) = len ? g_memdup(buf,len) : NULL; \
                        (((rec_t*)rec)->len_element) = len; } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, 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; }
 
@@ -363,7 +363,7 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr,
 #define UAT_DEC_CB_DEF(basename,field_name,rec_t) \
 static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, void* u1 _U_, void* u2 _U_) {\
        ((rec_t*)rec)->field_name = strtol(ep_strndup(buf,len),NULL,10); } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
        *out_ptr = ep_strdup_printf("%d",((rec_t*)rec)->field_name); \
        *out_len = strlen(*out_ptr); }
 
@@ -378,7 +378,7 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr,
 #define UAT_HEX_CB_DEF(basename,field_name,rec_t) \
 static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, void* u1 _U_, void* u2 _U_) {\
        ((rec_t*)rec)->field_name = strtol(ep_strndup(buf,len),NULL,16); } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
        *out_ptr = ep_strdup_printf("%x",((rec_t*)rec)->field_name); \
        *out_len = strlen(*out_ptr); }
 
@@ -401,7 +401,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, u
        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, char** out_ptr, unsigned* out_len, void* vs, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* vs, void* u2 _U_) {\
        guint i; \
        *out_ptr = ep_strdup(default_str); *out_len = strlen(default_str);\
        for(i=0;((value_string*)vs)[i].strptr;i++) { \
@@ -424,9 +424,9 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, u
                char* name = ep_strndup(buf,len); g_strdown(name); g_strchug(name); \
                ((rec_t*)rec)->field_name = find_dissector(name); \
        } else { ((rec_t*)rec)->field_name = find_dissector("data"); } } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
        if ( ((rec_t*)rec)->field_name ) { \
-               *out_ptr = ep_strdup(dissector_handle_get_short_name(((rec_t*)rec)->field_name)); g_strdown(*out_ptr); \
+               char *name = ep_strdup(dissector_handle_get_short_name(((rec_t*)rec)->field_name)); g_strdown(name); *out_ptr = name; \
                *out_len = strlen(*out_ptr); \
        } else { \
                *out_ptr = ""; *out_len = 0; } } 
@@ -444,7 +444,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, u
        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, char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
        if ( ((rec_t*)rec)->field_name ) { \
                *out_ptr = range_convert_range(((rec_t*)rec)->field_name);  *out_len = strlen(*out_ptr); \
        } else { \
index 86c1eec7582f79da4cb1c794a1812916d2c7d8dd..364a5e5b9eff7bd121e1b01de0721c46366ece0e 100644 (file)
@@ -59,7 +59,7 @@
 #define ERROR(fmtd) do { error = ep_strdup_printf("%s:%d: %s",uat->filename,linenum,ep_strdup_printf fmtd); yyterminate(); } while(0)
 
 #define SET_FIELD() \
-       { gchar* err; \
+       { const gchar* err; \
        if (uat->fields[colnum].cb.chk) { \
                if ( ! uat->fields[colnum].cb.chk(record, ptr, len, uat->fields[colnum].cbdata.chk, uat->fields[colnum].fld_data, &err) ) { \
                        ERROR(("%s",err)); \
@@ -67,7 +67,7 @@
        }\
        uat->fields[colnum].cb.set(record, ptr, len, uat->fields[colnum].cbdata.chk, uat->fields[colnum].fld_data);\
        g_free(ptr);\
-               colnum++; \
+       colnum++; \
        } while(0)
 
 #ifdef DEBUG_UAT_LOAD
@@ -183,7 +183,7 @@ comment #[^\n]*\n
 
 <END_OF_RECORD>{newline} {
        void* rec;
-       gchar* err = NULL;
+       const gchar* err = NULL;
        
        linenum++;
 
index d126f6e77b1edf96355d9e93022b1595c04932fd..feb7e2782048ef4499c298689b8ae965d345f547 100644 (file)
@@ -1092,7 +1092,7 @@ typedef struct {
        xmlNodePtr         (*xmlDocGetRootElement)(xmlDocPtr);
        void             (*xmlFreeDoc)(xmlDocPtr);
        char            *(*xmlNodeListGetString)(xmlDocPtr, xmlNodePtr, int);
-       char            *(*xmlGetProp)(xmlNodePtr, char *);
+       char            *(*xmlGetProp)(xmlNodePtr, const char *);
        int              (*xmlKeepBlanksDefault)(int);
        int              (*xmlSubstituteEntitiesDefault)(int);
 #ifdef WIRESHARK_XML_DO_VALIDITY_CHECKING
index e8e36223cfb48bcab4bbeb8c9656912d15dbd2d6..1beacd4994b482e77198fcfaa8395cf7794b4fbc 100644 (file)
@@ -186,7 +186,7 @@ GSList *dissector_reset_list = NULL;
  * @param user_data Unused.
  */
 static void
-decode_build_reset_list (gchar *table_name, ftenum_t selector_type,
+decode_build_reset_list (const gchar *table_name, ftenum_t selector_type,
                         gpointer key, gpointer value _U_,
                         gpointer user_data _U_)
 {
@@ -319,7 +319,7 @@ const gchar *current_proto_name)
  * should be stored.
  */
 static void
-decode_build_show_list (gchar *table_name, ftenum_t selector_type,
+decode_build_show_list (const gchar *table_name, ftenum_t selector_type,
                        gpointer key, gpointer value, gpointer user_data)
 {
     dissector_handle_t current, initial;
index b3366f5efc6041554dcb9d93011f6f87a1834997..c96d052e1f1af4af39db96847490c8c1618e9663 100644 (file)
@@ -549,7 +549,7 @@ static void funnel_retap_packets(void) {
        cf_retap_packets(&cfile, FALSE);
 }
 
-static gboolean funnel_open_file(const char* fname, const char* filter, char** err_str) {
+static gboolean funnel_open_file(const char* fname, const char* filter, const char** err_str) {
        int err = 0;
        dfilter_t   *rfcode = NULL;
        
index b032d0858f619a0fe8870807fff9259473099421..34390dde8d9c78b71b900e58d463fb0aa9e37342 100644 (file)
@@ -145,7 +145,7 @@ static void set_buttons(uat_t* uat, gint row) {
 
 static char* fld_tostr(void* rec, uat_field_t* f) {
        guint len;
-       char* ptr;
+       const char* ptr;
        char* out;
        
        f->cb.tostr(rec,&ptr,&len,f->cbdata.tostr,f->fld_data);
@@ -216,7 +216,7 @@ static void reset_row(uat_t* uat, guint idx) {
 
 }
 
-static guint8* unhexbytes(const char* si, guint len, guint* len_p, char** err) {
+static guint8* unhexbytes(const char* si, guint len, guint* len_p, const char** err) {
        guint8* buf;
        guint8* p;
        const guint8* s = (void*)si;
@@ -280,7 +280,7 @@ static gboolean uat_dlg_cb(GtkWidget *win _U_, gpointer user_data) {
        struct _uat_dlg_data* dd = user_data;
        guint ncols = dd->uat->ncols;
        uat_field_t* f = dd->uat->fields;
-       char* err = NULL;
+       const char* err = NULL;
        guint colnum;
 
        for ( colnum = 0; colnum < ncols; colnum++ ) {
index 937b23d3944fd82b68035687eece0ded012a2c50..71d3b2eee1bd282b2b3aa3e884fef82e6d289306 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -306,7 +306,7 @@ print_usage(gboolean print_ver)
  * descriptive name.
  */
 static void
-display_dissector_table_names(char *table_name, const char *ui_name,
+display_dissector_table_names(const char *table_name, const char *ui_name,
                               gpointer output)
 {
   fprintf((FILE *)output, "\t%s (%s)\n", table_name, ui_name);