From 1bc049906a35c3490532ab68fcbf90750c225f77 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 23 Apr 2007 10:59:26 +0000 Subject: Add some GCC warnings to the standard set, and add some others to the --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. svn path=/trunk/; revision=21526 --- epan/address.h | 2 +- epan/dfilter/dfilter-macro.c | 8 ++-- epan/dfilter/dfilter-macro.h | 5 ++- epan/dfilter/dfilter.c | 2 +- epan/dfilter/dfilter.h | 2 +- epan/dfilter/dfunctions.h | 2 +- epan/dissectors/packet-3g-a11.c | 2 +- epan/dissectors/packet-alcap.c | 68 ++++++++++++++++----------------- epan/dissectors/packet-bacapp.c | 4 +- epan/dissectors/packet-ber.c | 12 +++--- epan/dissectors/packet-ber.h | 2 +- epan/dissectors/packet-bittorrent.c | 4 +- epan/dissectors/packet-bootp.c | 27 ++++++------- epan/dissectors/packet-bssap.c | 32 ++++++++-------- epan/dissectors/packet-bssgp.c | 28 +++++++------- epan/dissectors/packet-cimd.c | 2 +- epan/dissectors/packet-cups.c | 2 +- epan/dissectors/packet-dcerpc-samr.c | 24 ++++++------ epan/dissectors/packet-dcerpc-spoolss.c | 6 +-- epan/dissectors/packet-dcerpc-svcctl.c | 8 ++-- epan/dissectors/packet-dcm.c | 30 ++++++++------- epan/dissectors/packet-dcom.c | 2 +- epan/dissectors/packet-dcom.h | 2 +- epan/dissectors/packet-diameter.c | 32 +++++++++------- epan/dissectors/packet-dns.c | 47 ++++++++++++----------- epan/dissectors/packet-dns.h | 2 +- epan/dissectors/packet-enip.c | 4 +- epan/dissectors/packet-fcswils.c | 16 ++++---- epan/dissectors/packet-fix.c | 2 +- epan/dissectors/packet-icmpv6.c | 2 +- epan/dissectors/packet-isup.c | 2 +- epan/dissectors/packet-k12.c | 4 +- epan/dissectors/packet-nbns.c | 5 ++- epan/dissectors/packet-sccp.c | 48 +++++++++++------------ epan/dissectors/packet-scsi-osd.c | 2 +- epan/dissectors/packet-snmp.c | 2 +- epan/dissectors/packet-ssl-utils.c | 12 +++--- epan/dissectors/packet-user_encap.c | 2 +- epan/emem.c | 4 +- epan/emem.h | 6 +-- epan/funnel.h | 2 +- epan/packet.c | 6 +-- epan/packet.h | 8 ++-- epan/tvbuff.c | 6 +-- epan/tvbuff.h | 2 +- epan/uat-int.h | 8 ++-- epan/uat.c | 20 +++++----- epan/uat.h | 48 +++++++++++------------ epan/uat_load.l | 6 +-- epan/xmlstub.h | 2 +- 50 files changed, 295 insertions(+), 281 deletions(-) (limited to 'epan') diff --git a/epan/address.h b/epan/address.h index 3a0074a043..551d4af0e3 100644 --- a/epan/address.h +++ b/epan/address.h @@ -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); \ } /* diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c index c260a6b1d3..21d50b8916 100644 --- a/epan/dfilter/dfilter-macro.c +++ b/epan/dfilter/dfilter-macro.c @@ -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++) { diff --git a/epan/dfilter/dfilter-macro.h b/epan/dfilter/dfilter-macro.h index bf30cbc53e..50c1cec04c 100644 --- a/epan/dfilter/dfilter-macro.h +++ b/epan/dfilter/dfilter-macro.h @@ -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); diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c index 775321076f..e0ac2a194f 100644 --- a/epan/dfilter/dfilter.c +++ b/epan/dfilter/dfilter.c @@ -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); diff --git a/epan/dfilter/dfilter.h b/epan/dfilter/dfilter.h index 401cd75812..7be98cae20 100644 --- a/epan/dfilter/dfilter.h +++ b/epan/dfilter/dfilter.h @@ -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 */ diff --git a/epan/dfilter/dfunctions.h b/epan/dfilter/dfunctions.h index 8abf520ecc..f324e159c4 100644 --- a/epan/dfilter/dfunctions.h +++ b/epan/dfilter/dfunctions.h @@ -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; diff --git a/epan/dissectors/packet-3g-a11.c b/epan/dissectors/packet-3g-a11.c index 5a86226663..1f28e73d22 100644 --- a/epan/dissectors/packet-3g-a11.c +++ b/epan/dissectors/packet-3g-a11.c @@ -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 */ diff --git a/epan/dissectors/packet-alcap.c b/epan/dissectors/packet-alcap.c index 582c1cc982..71d9173844 100644 --- a/epan/dissectors/packet-alcap.c +++ b/epan/dissectors/packet-alcap.c @@ -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); diff --git a/epan/dissectors/packet-bacapp.c b/epan/dissectors/packet-bacapp.c index 876f8750cd..635c281b3f 100644 --- a/epan/dissectors/packet-bacapp.c +++ b/epan/dissectors/packet-bacapp.c @@ -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; diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index 82b3ec0a02..00f2bc7df7 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -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; diff --git a/epan/dissectors/packet-ber.h b/epan/dissectors/packet-ber.h index 359feb3bd9..381d281956 100644 --- a/epan/dissectors/packet-ber.h +++ b/epan/dissectors/packet-ber.h @@ -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); diff --git a/epan/dissectors/packet-bittorrent.c b/epan/dissectors/packet-bittorrent.c index 43da881a68..f2ae482b58 100644 --- a/epan/dissectors/packet-bittorrent.c +++ b/epan/dissectors/packet-bittorrent.c @@ -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[] = { diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index c6df2214b2..346517cf61 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -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"); } } diff --git a/epan/dissectors/packet-bssap.c b/epan/dissectors/packet-bssap.c index cb110374df..011d102c52 100644 --- a/epan/dissectors/packet-bssap.c +++ b/epan/dissectors/packet-bssap.c @@ -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); diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 8d05b6c1da..d314efc59a 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -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"); diff --git a/epan/dissectors/packet-cimd.c b/epan/dissectors/packet-cimd.c index 623e816e3c..60dda2d45e 100644 --- a/epan/dissectors/packet-cimd.c +++ b/epan/dissectors/packet-cimd.c @@ -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*/ diff --git a/epan/dissectors/packet-cups.c b/epan/dissectors/packet-cups.c index d5d86085c4..85982095ef 100644 --- a/epan/dissectors/packet-cups.c +++ b/epan/dissectors/packet-cups.c @@ -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); diff --git a/epan/dissectors/packet-dcerpc-samr.c b/epan/dissectors/packet-dcerpc-samr.c index a75c55c91d..87d565fbbd 100644 --- a/epan/dissectors/packet-dcerpc-samr.c +++ b/epan/dissectors/packet-dcerpc-samr.c @@ -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( diff --git a/epan/dissectors/packet-dcerpc-spoolss.c b/epan/dissectors/packet-dcerpc-spoolss.c index 4ac5800691..a6eeab7ecb 100644 --- a/epan/dissectors/packet-dcerpc-spoolss.c +++ b/epan/dissectors/packet-dcerpc-spoolss.c @@ -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( diff --git a/epan/dissectors/packet-dcerpc-svcctl.c b/epan/dissectors/packet-dcerpc-svcctl.c index 92c6448168..49fb39f525 100644 --- a/epan/dissectors/packet-dcerpc-svcctl.c +++ b/epan/dissectors/packet-dcerpc-svcctl.c @@ -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( diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index 88a50451ee..e664b9b8b6 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -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: diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c index 2320f5b7e6..c258231800 100644 --- a/epan/dissectors/packet-dcom.c +++ b/epan/dissectors/packet-dcom.c @@ -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); diff --git a/epan/dissectors/packet-dcom.h b/epan/dissectors/packet-dcom.h index a381cced7a..9859c44294 100644 --- a/epan/dissectors/packet-dcom.h +++ b/epan/dissectors/packet-dcom.h @@ -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 { diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index 29f780d59f..f6facf5301 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -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=""; + const gchar *flagstr=""; 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=""; } @@ -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=""; + const gchar *flagstr=""; 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=""; } diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 7f564c6b8a..44ef9aee28 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -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); diff --git a/epan/dissectors/packet-dns.h b/epan/dissectors/packet-dns.h index 81d884f853..b97ef4a954 100644 --- a/epan/dissectors/packet-dns.h +++ b/epan/dissectors/packet-dns.h @@ -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 */ diff --git a/epan/dissectors/packet-enip.c b/epan/dissectors/packet-enip.c index d7112f3312..59daefc5c6 100644 --- a/epan/dissectors/packet-enip.c +++ b/epan/dissectors/packet-enip.c @@ -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 */ diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index 90b2be19b7..892e2d21ac 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -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"; diff --git a/epan/dissectors/packet-fix.c b/epan/dissectors/packet-fix.c index d52490a4a0..b5ce04907b 100644 --- a/epan/dissectors/packet-fix.c +++ b/epan/dissectors/packet-fix.c @@ -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"); } diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c index 3bbb4fe4b2..987b34b915 100644 --- a/epan/dissectors/packet-icmpv6.c +++ b/epan/dissectors/packet-icmpv6.c @@ -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; diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c index 15823a2c19..65ee548d11 100644 --- a/epan/dissectors/packet-isup.c +++ b/epan/dissectors/packet-isup.c @@ -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]; diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index cfc7c4a8c0..1bf3d78a64 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -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; diff --git a/epan/dissectors/packet-nbns.c b/epan/dissectors/packet-nbns.c index 32ee7e72a8..3af5691d22 100644 --- a/epan/dissectors/packet-nbns.c +++ b/epan/dissectors/packet-nbns.c @@ -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; diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c index a4e2efd17e..9e9fb3350b 100644 --- a/epan/dissectors/packet-sccp.c +++ b/epan/dissectors/packet-sccp.c @@ -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; diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c index 61252243df..be3acea50f 100644 --- a/epan/dissectors/packet-scsi-osd.c +++ b/epan/dissectors/packet-scsi-osd.c @@ -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[] = { diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index c0f9cd8e8c..4be98f1a22 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -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(""); diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index e6350a03a2..32636c849f 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -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; (ldata_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; (lcb.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)); diff --git a/epan/uat.h b/epan/uat.h index fe7f819d17..73957ec98b 100644 --- a/epan/uat.h +++ b/epan/uat.h @@ -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;ifield_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 { \ diff --git a/epan/uat_load.l b/epan/uat_load.l index 86c1eec758..364a5e5b9e 100644 --- a/epan/uat_load.l +++ b/epan/uat_load.l @@ -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 {newline} { void* rec; - gchar* err = NULL; + const gchar* err = NULL; linenum++; diff --git a/epan/xmlstub.h b/epan/xmlstub.h index d126f6e77b..feb7e27820 100644 --- a/epan/xmlstub.h +++ b/epan/xmlstub.h @@ -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 -- cgit v1.2.1