From 554f62000190dead7a2d16e272138cc6e24ee57f Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 24 Jul 2005 19:01:28 +0000 Subject: Constify to remove a bunch of warnings. Add some casts to squelch (presumably-)harmless-but-otherwise-unremovable const-to-nonconst warnings. In the TACACS dissector, clean up the variables used in option parsing to avoid some const-to-nonconst warnings. Clean up some white space. svn path=/trunk/; revision=15043 --- epan/dissectors/packet-aim.h | 2 +- epan/dissectors/packet-dcerpc-epm.c | 2 +- epan/dissectors/packet-dcerpc-samr.c | 2 +- epan/dissectors/packet-dcerpc.c | 6 +++--- epan/dissectors/packet-dcerpc.h | 6 +++--- epan/dissectors/packet-dcom.c | 6 +++--- epan/dissectors/packet-dcom.h | 2 +- epan/dissectors/packet-diameter.c | 4 ++-- epan/dissectors/packet-giop.h | 2 +- epan/dissectors/packet-ieee80211.c | 4 ++-- epan/dissectors/packet-k12.c | 8 ++++---- epan/dissectors/packet-ntlmssp.c | 2 +- epan/dissectors/packet-portmap.c | 3 ++- epan/dissectors/packet-pres.c | 2 +- epan/dissectors/packet-radius.c | 4 ++-- epan/dissectors/packet-rpc.c | 6 +++--- epan/dissectors/packet-rpc.h | 4 ++-- epan/dissectors/packet-snmp.c | 4 ++-- epan/dissectors/packet-spnego.c | 2 +- epan/dissectors/packet-tacacs.c | 33 ++++++++++++++++----------------- epan/dissectors/packet-tzsp.c | 2 +- epan/dissectors/packet-user_encap.c | 6 +++--- epan/packet.c | 8 ++++---- epan/packet.h | 6 +++--- epan/prefs-int.h | 2 +- epan/prefs.c | 2 +- epan/proto.c | 28 ++++++++++++++-------------- epan/proto.h | 6 +++--- 28 files changed, 82 insertions(+), 82 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-aim.h b/epan/dissectors/packet-aim.h index b30556173b..12f13c624c 100644 --- a/epan/dissectors/packet-aim.h +++ b/epan/dissectors/packet-aim.h @@ -53,7 +53,7 @@ typedef struct _aim_family { int proto_id; protocol_t *proto; guint16 family; - char *name; + const char *name; const aim_subtype *subtypes; } aim_family; diff --git a/epan/dissectors/packet-dcerpc-epm.c b/epan/dissectors/packet-dcerpc-epm.c index fb97716e3c..26b90c71cd 100644 --- a/epan/dissectors/packet-dcerpc-epm.c +++ b/epan/dissectors/packet-dcerpc-epm.c @@ -367,7 +367,7 @@ epm_dissect_tower_data (tvbuff_t *tvb, int offset, { guint16 version = tvb_get_ntohs(tvb, offset+17); - char *service = dcerpc_get_proto_name(&uuid, version); + const char *service = dcerpc_get_proto_name(&uuid, version); if (service) proto_item_append_text(tr, "UUID: %s", service); else diff --git a/epan/dissectors/packet-dcerpc-samr.c b/epan/dissectors/packet-dcerpc-samr.c index e32c5aff58..43634d7c0c 100644 --- a/epan/dissectors/packet-dcerpc-samr.c +++ b/epan/dissectors/packet-dcerpc-samr.c @@ -195,7 +195,7 @@ static e_uuid_t uuid_dcerpc_samr = { static guint16 ver_dcerpc_samr = 1; /* Configuration variables */ -static char *nt_password = NULL; +static const char *nt_password = NULL; /* Dissect connect specific access rights */ diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 220095290d..46db718396 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -680,7 +680,7 @@ dcerpc_init_uuid (int proto, int ett, e_uuid_t *uuid, guint16 ver, /* try to get registered name for this uuid */ -gchar *dcerpc_get_uuid_name(e_uuid_t *uuid, guint16 ver) +const gchar *dcerpc_get_uuid_name(e_uuid_t *uuid, guint16 ver) { dcerpc_uuid_key key; dcerpc_uuid_value *sub_proto; @@ -703,7 +703,7 @@ gchar *dcerpc_get_uuid_name(e_uuid_t *uuid, guint16 ver) /* Function to find the name of a registered protocol * or NULL if the protocol/version is not known to ethereal. */ -char * +const char * dcerpc_get_proto_name(e_uuid_t *uuid, guint16 ver) { dcerpc_uuid_key key; @@ -2174,7 +2174,7 @@ dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, dcerpc_uuid_value *sub_proto; proto_tree *volatile sub_tree = NULL; dcerpc_sub_dissector *proc; - gchar *name = NULL; + const gchar *name = NULL; dcerpc_dissect_fnct_t *volatile sub_dissect; const char *volatile saved_proto; void *volatile saved_private_data; diff --git a/epan/dissectors/packet-dcerpc.h b/epan/dissectors/packet-dcerpc.h index 0410be2b91..b3374cdb3a 100644 --- a/epan/dissectors/packet-dcerpc.h +++ b/epan/dissectors/packet-dcerpc.h @@ -245,7 +245,7 @@ typedef struct _dcerpc_sub_dissector { /* registration function for subdissectors */ void dcerpc_init_uuid (int proto, int ett, e_uuid_t *uuid, guint16 ver, dcerpc_sub_dissector *procs, int opnum_hf); -char *dcerpc_get_proto_name(e_uuid_t *uuid, guint16 ver); +const char *dcerpc_get_proto_name(e_uuid_t *uuid, guint16 ver); int dcerpc_get_proto_hf_opnum(e_uuid_t *uuid, guint16 ver); dcerpc_sub_dissector *dcerpc_get_proto_sub_dissector(e_uuid_t *uuid, guint16 ver); @@ -254,7 +254,7 @@ dcerpc_sub_dissector *dcerpc_get_proto_sub_dissector(e_uuid_t *uuid, guint16 ver value_string *value_string_from_subdissectors(dcerpc_sub_dissector *sd); /* try to get protocol name registered for this uuid */ -gchar *dcerpc_get_uuid_name(e_uuid_t *uuid, guint16 ver); +const gchar *dcerpc_get_uuid_name(e_uuid_t *uuid, guint16 ver); /* Private data passed to subdissectors from the main DCERPC dissector. */ typedef struct _dcerpc_call_value { @@ -306,7 +306,7 @@ typedef struct _dcerpc_uuid_value { protocol_t *proto; int proto_id; int ett; - gchar *name; + const gchar *name; dcerpc_sub_dissector *procs; int opnum_hf; } dcerpc_uuid_value; diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c index 23e8e65565..8c0ab83222 100644 --- a/epan/dissectors/packet-dcom.c +++ b/epan/dissectors/packet-dcom.c @@ -658,8 +658,8 @@ dissect_dcom_simple_resp(tvbuff_t *tvb, int offset, Returns the associated string ptr on a match. Formats uuid number and returns the resulting string, on failure. (copied from val_to_str) */ -gchar* dcom_uuid_to_str(e_uuid_t *uuid) { - gchar *ret; +const gchar* dcom_uuid_to_str(e_uuid_t *uuid) { + const gchar *ret; static gchar str[3][64]; static gchar *cur; @@ -1154,7 +1154,7 @@ dissect_dcom_append_UUID(tvbuff_t *tvb, int offset, int hfindex, gchar *field_name, int field_index) { e_uuid_t uuid; - gchar *uuid_name; + const gchar *uuid_name; offset = dissect_dcom_UUID(tvb, offset, pinfo, tree, drep, diff --git a/epan/dissectors/packet-dcom.h b/epan/dissectors/packet-dcom.h index cfa8072d3f..97d6fdb87d 100644 --- a/epan/dissectors/packet-dcom.h +++ b/epan/dissectors/packet-dcom.h @@ -60,7 +60,7 @@ extern int dissect_dcom_append_UUID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hfindex, gchar *field_name, int field_index); -extern gchar* dcom_uuid_to_str(e_uuid_t *uuid); +extern const gchar* dcom_uuid_to_str(e_uuid_t *uuid); extern int dissect_dcom_indexed_WORD(tvbuff_t *tvb, int offset, packet_info *pinfo, diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index f2fdc99664..04117acb36 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -248,7 +248,7 @@ static gboolean allow_zero_as_app_id = FALSE; static gboolean suppress_console_output = TRUE; #define DICT_FN "diameter/dictionary.xml" -static gchar *gbl_diameterDictionary; +static const gchar *gbl_diameterDictionary; typedef struct _e_diameterhdr_v16 { guint32 versionLength; @@ -316,7 +316,7 @@ static gchar *diameter_vendor_to_str(guint32 vendorId, gboolean longName); * the xmlsoft examples. */ static xmlDocPtr -xmlParseFilePush( char *filename, int checkValid +xmlParseFilePush( const char *filename, int checkValid #ifndef ETHEREAL_XML_DO_VALIDITY_CHECKING _U_ #endif diff --git a/epan/dissectors/packet-giop.h b/epan/dissectors/packet-giop.h index e6f837f3ab..beb877ba51 100644 --- a/epan/dissectors/packet-giop.h +++ b/epan/dissectors/packet-giop.h @@ -105,7 +105,7 @@ typedef gboolean (giop_sub_dissector_t)(tvbuff_t *, packet_info *, proto_tree *, typedef struct giop_sub_handle { giop_sub_dissector_t *sub_fn; /* ptr to sub dissector function */ - gchar *sub_name; /* subdissector string name */ + const gchar *sub_name; /* subdissector string name */ protocol_t *sub_proto; /* protocol_t for subprotocol */ } giop_sub_handle_t; diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index 2dd6686e7a..9bd4d07d7d 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -110,7 +110,7 @@ static int weak_iv(guchar *iv); */ #ifndef USE_ENV -static char *wep_keystr[] = {NULL, NULL, NULL, NULL}; +static const char *wep_keystr[] = {NULL, NULL, NULL, NULL}; #endif /* ************************************************************************* */ @@ -3589,7 +3589,7 @@ static int wep_decrypt(guint8 *buf, guint32 len, int key_override) { } static void init_wepkeys(void) { - char *tmp; + const char *tmp; int i; GByteArray *bytes; gboolean res; diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index 2a1f230d3c..fc561a5414 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -55,7 +55,7 @@ static dissector_handle_t data_handle; static module_t *k12_module; -static char* k12_config_filename = ""; +static const char* k12_config_filename = ""; static GHashTable* k12_cfg = NULL; @@ -119,7 +119,7 @@ static gboolean free_just_key (gpointer k, gpointer v _U_, gpointer p _U_) { } -static GHashTable* k12_load_config(gchar* filename) { +static GHashTable* k12_load_config(const gchar* filename) { FILE* fp; gchar buffer[0x10000]; size_t len; @@ -193,8 +193,8 @@ static void k12_load_prefs(void) { } if (*k12_config_filename != '\0') { - k12_cfg = k12_load_config(k12_config_filename); - return; + k12_cfg = k12_load_config(k12_config_filename); + return; } } diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c index 88fd3ad430..1a48a3ef7f 100644 --- a/epan/dissectors/packet-ntlmssp.c +++ b/epan/dissectors/packet-ntlmssp.c @@ -213,7 +213,7 @@ static gint ett_ntlmssp_ntlmv2_response = -1; static gint ett_ntlmssp_ntlmv2_response_name = -1; /* Configuration variables */ -static char *nt_password = NULL; +static const char *nt_password = NULL; #define MAX_BLOB_SIZE 256 typedef struct _ntlmssp_blob { diff --git a/epan/dissectors/packet-portmap.c b/epan/dissectors/packet-portmap.c index a620b7ef6f..6d938e782d 100644 --- a/epan/dissectors/packet-portmap.c +++ b/epan/dissectors/packet-portmap.c @@ -78,7 +78,8 @@ dissect_getport_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, { guint32 proto, version; guint32 prog; - char *prog_name, *proto_name; + const char *prog_name; + char *proto_name; /* make sure we remember protocol type until the reply packet */ if(!pinfo->fd->flags.visited){ diff --git a/epan/dissectors/packet-pres.c b/epan/dissectors/packet-pres.c index 8cf3721dd8..afe3ee7d34 100644 --- a/epan/dissectors/packet-pres.c +++ b/epan/dissectors/packet-pres.c @@ -1084,7 +1084,7 @@ static void dissect_parse_error(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *field_name, int ret) { - char *errstr; + const char *errstr; errstr = asn1_err_to_str(ret); if (tree != NULL) diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index 99d81190ff..d6bf313d63 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -134,7 +134,7 @@ radius_attr_info_t no_dictionary_entry = {"Unknown-Attribute",0,FALSE,FALSE,radi dissector_handle_t eap_fragment_handle; -static gchar* shared_secret = ""; +static const gchar* shared_secret = ""; static guint8 authenticator[AUTHENTICATOR_LENGTH]; @@ -201,7 +201,7 @@ radius_decrypt_avp(gchar *dest,tvbuff_t *tvb,int offset,int length) totlen = 1; md5_init(&md_ctx); - md5_append(&md_ctx,(guint8*)shared_secret,strlen(shared_secret)); + md5_append(&md_ctx,(const guint8*)shared_secret,strlen(shared_secret)); md5_append(&md_ctx,authenticator, AUTHENTICATOR_LENGTH); md5_finish(&md_ctx,digest); diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c index a26b8eae07..9999b35750 100644 --- a/epan/dissectors/packet-rpc.c +++ b/epan/dissectors/packet-rpc.c @@ -424,9 +424,9 @@ int rpc_prog_hf(guint32 prog, guint32 vers) /* return the name associated with a previously registered program. This should probably eventually be expanded to use the rpc YP/NIS map so that it can give names for programs not handled by ethereal */ -char *rpc_prog_name(guint32 prog) +const char *rpc_prog_name(guint32 prog) { - char *progname = NULL; + const char *progname = NULL; rpc_prog_info_key rpc_prog_key; rpc_prog_info_value *rpc_prog; @@ -1657,7 +1657,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned int reject_state; const char *msg_type_name = NULL; - char *progname = NULL; + const char *progname = NULL; const char *procname = NULL; static char procname_static[20]; diff --git a/epan/dissectors/packet-rpc.h b/epan/dissectors/packet-rpc.h index 3f2d97e76f..5dadf15fc8 100644 --- a/epan/dissectors/packet-rpc.h +++ b/epan/dissectors/packet-rpc.h @@ -120,7 +120,7 @@ extern const value_string rpc_auth_flavor[]; extern void rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table, int procedure_hf); extern void rpc_init_prog(int proto, guint32 prog, int ett); -extern char *rpc_prog_name(guint32 prog); +extern const char *rpc_prog_name(guint32 prog); extern char *rpc_proc_name(guint32 prog, guint32 vers, guint32 proc); extern int rpc_prog_hf(guint32 prog, guint32 vers); @@ -167,7 +167,7 @@ typedef struct _rpc_prog_info_value { protocol_t *proto; int proto_id; int ett; - char* progname; + const char* progname; GArray *procedure_hfs; } rpc_prog_info_value; diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index ba5ff32714..bd2f887d47 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -131,7 +131,7 @@ static int proto_snmp = -1; # define DEF_MIB_MODULES "IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:UCD-SNMP-MIB" #endif /* _WIN32 */ -static gchar *mib_modules = DEF_MIB_MODULES; +static const gchar *mib_modules = DEF_MIB_MODULES; static gboolean display_oid = TRUE; /* Subdissector tables */ @@ -534,7 +534,7 @@ static void dissect_snmp_parse_error(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *field_name, int ret) { - char *errstr; + const char *errstr; errstr = asn1_err_to_str(ret); diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c index 609a013d26..715adee18f 100644 --- a/epan/dissectors/packet-spnego.c +++ b/epan/dissectors/packet-spnego.c @@ -198,7 +198,7 @@ static void dissect_parse_error(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *field_name, int ret) { - char *errstr; + const char *errstr; errstr = asn1_err_to_str(ret); diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index f7a2435aa2..07c6cc02d0 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -69,7 +69,7 @@ #include #include "packet-tacacs.h" -static void md5_xor( guint8 *data, char *key, int data_len, guint8 *session_id, guint8 version, guint8 seq_no ); +static void md5_xor( guint8 *data, const char *key, int data_len, guint8 *session_id, guint8 version, guint8 seq_no ); static int proto_tacacs = -1; static int hf_tacacs_version = -1; @@ -88,7 +88,7 @@ static int hf_tacacs_result3 = -1; static gint ett_tacacs = -1; -static char *tacplus_opt_key; +static const char *tacplus_opt_key; static GSList *tacplus_keys = NULL; #define VERSION_TACACS 0x00 @@ -343,7 +343,7 @@ typedef struct _tacplus_key_entry { } tacplus_key_entry; static gint -tacplus_decrypted_tvb_setup( tvbuff_t *tvb, tvbuff_t **dst_tvb, packet_info *pinfo, guint32 len, guint8 version, char *key ) +tacplus_decrypted_tvb_setup( tvbuff_t *tvb, tvbuff_t **dst_tvb, packet_info *pinfo, guint32 len, guint8 version, const char *key ) { guint8 *buff; guint8 session_id[4]; @@ -828,7 +828,7 @@ cmp_conv_address( gconstpointer p1, gconstpointer p2 ) return ret; } -static char* +static const char* find_key( address *srv, address *cln ) { tacplus_key_entry data; @@ -892,9 +892,9 @@ free_tacplus_keys( gpointer data, gpointer user_data _U_ ) static void -parse_tacplus_keys( char *keys_from_option ) +parse_tacplus_keys( const char *keys_from_option ) { - char *s1,*s; + char *key_copy,*s,*s1; /* Drop old keys */ if( tacplus_keys ) { @@ -907,16 +907,15 @@ parse_tacplus_keys( char *keys_from_option ) /* option not in client/server=key format */ return ; } - s=strdup(keys_from_option); - s1=s; - keys_from_option = s; - while(keys_from_option){ - if( (s=strchr( keys_from_option, ' ' )) != NULL ) - *s++='\0'; - parse_tuple( keys_from_option ); - keys_from_option=s; + key_copy=strdup(keys_from_option); + s=key_copy; + while(s){ + if( (s1=strchr( s, ' ' )) != NULL ) + *s1++='\0'; + parse_tuple( s ); + s=s1; } - g_free( s1 ); + g_free( key_copy ); #ifdef DEB_TACPLUS g_slist_foreach( tacplus_keys, tacplus_print_key_entry, GINT_TO_POINTER(1) ); #endif @@ -934,7 +933,7 @@ dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *tmp_pi; guint32 len; gboolean request=( pinfo->destport == TCP_PORT_TACACS ); - char *key=NULL; + const char *key=NULL; if( request ) { key=find_key( &pinfo->dst, &pinfo->src ); @@ -1111,7 +1110,7 @@ proto_reg_handoff_tacplus(void) #define MD5_LEN 16 static void -md5_xor( guint8 *data, char *key, int data_len, guint8 *session_id, guint8 version, guint8 seq_no ) +md5_xor( guint8 *data, const char *key, int data_len, guint8 *session_id, guint8 version, guint8 seq_no ) { int i,j,md5_len; md5_byte_t *md5_buff; diff --git a/epan/dissectors/packet-tzsp.c b/epan/dissectors/packet-tzsp.c index 79bbfe6a6c..29bb63f7cc 100644 --- a/epan/dissectors/packet-tzsp.c +++ b/epan/dissectors/packet-tzsp.c @@ -286,7 +286,7 @@ dissect_tzsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 encapsulation = 0; int wtap_encap; dissector_handle_t encap_dissector; - char *encap_name; + const char *encap_name; const char *info; guint8 type; diff --git a/epan/dissectors/packet-user_encap.c b/epan/dissectors/packet-user_encap.c index d8a43c1ed1..5bdcbb3c82 100644 --- a/epan/dissectors/packet-user_encap.c +++ b/epan/dissectors/packet-user_encap.c @@ -42,9 +42,9 @@ typedef struct _user_encap_t { gchar* abbr; gchar* long_name; - gchar* payload; - gchar* header; - gchar* trailer; + const gchar* payload; + const gchar* header; + const gchar* trailer; guint header_size; guint trailer_size; diff --git a/epan/packet.c b/epan/packet.c index f47faeae63..bb33f54b88 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -937,7 +937,7 @@ dissector_add_string(const char *name, const gchar *pattern, dtbl_entry->initial = dtbl_entry->current; /* do the table insertion */ - g_hash_table_insert( sub_dissectors->hash_table, pattern, + g_hash_table_insert( sub_dissectors->hash_table, (gpointer)pattern, (gpointer)dtbl_entry); /* @@ -1417,7 +1417,7 @@ register_dissector_table(const char *name, const char *ui_name, ftenum_t type, return sub_dissectors; } -char * +const char * get_dissector_table_ui_name(const char *name) { dissector_table_t sub_dissectors = find_dissector_table( name); @@ -1583,7 +1583,7 @@ static GHashTable *registered_dissectors = NULL; /* Get the short name of the protocol for a dissector handle, if it has a protocol. */ -char * +const char * dissector_handle_get_short_name(dissector_handle_t handle) { if (handle->protocol == NULL) { @@ -1758,7 +1758,7 @@ dissector_dump_decodes_display(gchar *table_name, ftenum_t selector_type _U_, dtbl_entry_t *dtbl_entry; dissector_handle_t handle; gint proto_id; - gchar *decode_as; + const gchar *decode_as; g_assert(sub_dissectors); switch (sub_dissectors->type) { diff --git a/epan/packet.h b/epan/packet.h index 05f6195eb7..04df470356 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -142,7 +142,7 @@ typedef void (*DATFunc) (gchar *table_name, ftenum_t selector_type, gpointer key, gpointer value, gpointer user_data); typedef void (*DATFunc_handle) (gchar *table_name, gpointer value, gpointer user_data); -typedef void (*DATFunc_table) (gchar *table_name, gchar *ui_name, +typedef void (*DATFunc_table) (gchar *table_name, const gchar *ui_name, gpointer user_data); /* Opaque structure - provides type checking but no access to components */ @@ -169,7 +169,7 @@ extern dissector_table_t register_dissector_table(const char *name, extern dissector_table_t find_dissector_table(const char *name); /* Get the UI name for a sub-dissector table, given its internal name */ -extern char *get_dissector_table_ui_name(const char *name); +extern const char *get_dissector_table_ui_name(const char *name); /* Get the field type for values of the selector for a dissector table, given the table's internal name */ @@ -284,7 +284,7 @@ extern void new_register_dissector(const char *name, new_dissector_t dissector, int proto); /* Get the short name of the protocol for a dissector handle. */ -extern char *dissector_handle_get_short_name(dissector_handle_t handle); +extern const char *dissector_handle_get_short_name(dissector_handle_t handle); /* Get the index of the protocol for a dissector handle. */ extern int dissector_handle_get_protocol_index(dissector_handle_t handle); diff --git a/epan/prefs-int.h b/epan/prefs-int.h index cbcec1d52a..e3aaabddfd 100644 --- a/epan/prefs-int.h +++ b/epan/prefs-int.h @@ -67,7 +67,7 @@ struct preference { guint *uint; gboolean *boolp; gint *enump; - char **string; + const char **string; range_t **range; } varp; /* pointer to variable storing the value */ union { diff --git a/epan/prefs.c b/epan/prefs.c index 58750e152c..a2dcc2019d 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -2046,7 +2046,7 @@ set_pref(gchar *pref_name, gchar *value) case PREF_STRING: if (strcmp(*pref->varp.string, value) != 0) { module->prefs_changed = TRUE; - g_free(*pref->varp.string); + g_free((void *)*pref->varp.string); *pref->varp.string = g_strdup(value); } break; diff --git a/epan/proto.c b/epan/proto.c index f080b69ad8..3b6a284afd 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -165,14 +165,14 @@ int hf_text_only = -1; /* Structure for information about a protocol */ struct _protocol { - char *name; /* long description */ - char *short_name; /* short description */ - char *filter_name; /* name of this protocol in filters */ - int proto_id; /* field ID for this protocol */ - GList *fields; /* fields for this protocol */ - GList *last_field; /* pointer to end of list of fields */ - gboolean is_enabled; /* TRUE if protocol is enabled */ - gboolean can_toggle; /* TRUE if is_enabled can be changed */ + const char *name; /* long description */ + const char *short_name; /* short description */ + const char *filter_name; /* name of this protocol in filters */ + int proto_id; /* field ID for this protocol */ + GList *fields; /* fields for this protocol */ + GList *last_field; /* pointer to end of list of fields */ + gboolean is_enabled; /* TRUE if protocol is enabled */ + gboolean can_toggle; /* TRUE if is_enabled can be changed */ }; /* List of all protocols */ @@ -2648,7 +2648,7 @@ proto_register_protocol(const char *name, const char *short_name, const char *fi g_error("Duplicate protocol name \"%s\"!" " This might be caused by an inappropriate plugin or a development error.", name); } - g_hash_table_insert(proto_names, key, name); + g_hash_table_insert(proto_names, key, (gpointer)name); key = g_malloc (sizeof(gint)); *key = g_str_hash(short_name); @@ -2657,7 +2657,7 @@ proto_register_protocol(const char *name, const char *short_name, const char *fi g_error("Duplicate protocol short_name \"%s\"!" " This might be caused by an inappropriate plugin or a development error.", short_name); } - g_hash_table_insert(proto_short_names, key, short_name); + g_hash_table_insert(proto_short_names, key, (gpointer)short_name); found_invalid = FALSE; for (i = 0; i < strlen(filter_name); i++) { @@ -2679,7 +2679,7 @@ proto_register_protocol(const char *name, const char *short_name, const char *fi g_error("Duplicate protocol filter_name \"%s\"!" " This might be caused by an inappropriate plugin or a development error.", filter_name); } - g_hash_table_insert(proto_filter_names, key, filter_name); + g_hash_table_insert(proto_filter_names, key, (gpointer)filter_name); /* Add this protocol to the list of known protocols; the list is sorted by protocol short name. */ @@ -2813,7 +2813,7 @@ int proto_get_id_by_filter_name(const gchar* filter_name) return protocol->proto_id; } -char * +const char * proto_get_protocol_name(int proto_id) { protocol_t *protocol; @@ -2822,7 +2822,7 @@ proto_get_protocol_name(int proto_id) return protocol->name; } -char * +const char * proto_get_protocol_short_name(protocol_t *protocol) { if (protocol == NULL) @@ -2830,7 +2830,7 @@ proto_get_protocol_short_name(protocol_t *protocol) return protocol->short_name; } -char * +const char * proto_get_protocol_filter_name(int proto_id) { protocol_t *protocol; diff --git a/epan/proto.h b/epan/proto.h index c8675054a4..859c484f74 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -1058,7 +1058,7 @@ extern protocol_t *find_protocol_by_id(int proto_id); /** Get the protocol's name for the given protocol's item number. @param proto_id protocol id (0-indexed) @return its name */ -extern char *proto_get_protocol_name(int proto_id); +extern const char *proto_get_protocol_name(int proto_id); /** Get the protocol's item number, for the given protocol's "protocol_t". @return its proto_id */ @@ -1066,7 +1066,7 @@ extern int proto_get_id(protocol_t *protocol); /** Get the protocol's short name, for the given protocol's "protocol_t". @return its short name. */ -extern char *proto_get_protocol_short_name(protocol_t *protocol); +extern const char *proto_get_protocol_short_name(protocol_t *protocol); /** Is protocol's decoding enabled ? @param protocol @@ -1076,7 +1076,7 @@ extern gboolean proto_is_protocol_enabled(protocol_t *protocol); /** Get a protocol's filter name by it's item number. @param proto_id protocol id (0-indexed) @return its filter name. */ -extern char *proto_get_protocol_filter_name(int proto_id); +extern const char *proto_get_protocol_filter_name(int proto_id); /** Enable / Disable protocol of the given item number. @param proto_id protocol id (0-indexed) -- cgit v1.2.3