diff options
author | Jörg Mayer <jmayer@loplof.de> | 2005-07-23 11:41:25 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2005-07-23 11:41:25 +0000 |
commit | 30a855786822f15108e3a9d4dbd5579cd656abba (patch) | |
tree | 88cde02c2a8b79acb9a58e94d44b2cc686e12e9e /epan | |
parent | cb4ac62893d38d74efc89f5d5c90c7451dc421a4 (diff) |
More 'char*' -> 'const char*' changes to fix warnings.
svn path=/trunk/; revision=15015
Diffstat (limited to 'epan')
-rw-r--r-- | epan/addr_resolv.c | 4 | ||||
-rw-r--r-- | epan/asn1.c | 6 | ||||
-rw-r--r-- | epan/asn1.h | 2 | ||||
-rw-r--r-- | epan/column.c | 22 | ||||
-rw-r--r-- | epan/column.h | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-dcerpc.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-giop.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-giop.h | 2 | ||||
-rw-r--r-- | epan/filesystem.c | 10 | ||||
-rw-r--r-- | epan/filesystem.h | 4 | ||||
-rw-r--r-- | epan/packet.c | 8 | ||||
-rw-r--r-- | epan/packet.h | 6 | ||||
-rw-r--r-- | epan/packet_info.h | 2 | ||||
-rw-r--r-- | epan/prefs.c | 2 | ||||
-rw-r--r-- | epan/prefs.h | 2 | ||||
-rw-r--r-- | epan/proto.c | 4 | ||||
-rw-r--r-- | epan/proto.h | 2 | ||||
-rw-r--r-- | epan/stats_tree.c | 6 | ||||
-rw-r--r-- | epan/stats_tree.h | 6 | ||||
-rw-r--r-- | epan/tap.c | 8 | ||||
-rw-r--r-- | epan/tap.h | 6 | ||||
-rw-r--r-- | epan/to_str.c | 6 | ||||
-rw-r--r-- | epan/xdlc.c | 4 |
23 files changed, 63 insertions, 61 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index b1ca1b97e2..32e83cf427 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -277,7 +277,7 @@ static gchar *serv_name_lookup(guint port, port_type proto) int hash_idx; hashport_t *tp; hashport_t **table; - char *serv_proto = NULL; + const char *serv_proto = NULL; struct servent *servp; switch(proto) { @@ -524,7 +524,7 @@ static gchar *host_name_lookup6(struct e_in6_addr *addr, gboolean *found) } /* host_name_lookup6 */ -const gchar *solve_address_to_name(address *addr) +static const gchar *solve_address_to_name(address *addr) { guint32 ipv4_addr; struct e_in6_addr ipv6_addr; diff --git a/epan/asn1.c b/epan/asn1.c index f9ff91f85c..e976866bbd 100644 --- a/epan/asn1.c +++ b/epan/asn1.c @@ -1039,7 +1039,7 @@ done: /* * NAME: asn1_err_to_str [API] - * SYNOPSIS: char *asn1_err_to_str + * SYNOPSIS: const char *asn1_err_to_str * ( * int err * ) @@ -1048,10 +1048,10 @@ done: * err: the error code * RETURNS: string for the error */ -char * +const char * asn1_err_to_str(int err) { - char *errstr; + const char *errstr; char errstrbuf[14+1+1+11+1+1]; /* "Unknown error (%d)\0" */ switch (err) { diff --git a/epan/asn1.h b/epan/asn1.h index 5d751ff7fd..2352b416ee 100644 --- a/epan/asn1.h +++ b/epan/asn1.h @@ -145,6 +145,6 @@ extern int asn1_oid_decode (ASN1_SCK *asn1, subid_t **oid, guint *len, guint *nbytes); extern int asn1_sequence_decode (ASN1_SCK *asn1, guint *seq_len, guint *nbytes); -extern char *asn1_err_to_str (int err); +extern const char *asn1_err_to_str (int err); #endif diff --git a/epan/column.c b/epan/column.c index c11e96da5d..83d96d0004 100644 --- a/epan/column.c +++ b/epan/column.c @@ -46,14 +46,16 @@ /* Given a format number (as defined in packet.h), returns its equivalent string */ -gchar * +const gchar * col_format_to_string(gint fmt) { - gchar *slist[] = { "%m", "%t", "%Rt", "%At", "%Yt", "%Tt", "%s", "%rs", - "%us","%hs", "%rhs", "%uhs", "%ns", "%rns", "%uns", "%d", - "%rd", "%ud", "%hd", "%rhd", "%uhd", "%nd", "%rnd", - "%und", "%S", "%rS", "%uS", "%D", "%rD", "%uD", "%p", - "%i", "%L", "%B", "%XO", "%XR", "%I", "%c", "%Xs", - "%Xd", "%V", "%x", "%e", "%H", "%P", "%y" }; + const gchar *slist[] = { + "%m", "%t", "%Rt", "%At", "%Yt", "%Tt", "%s", "%rs", + "%us","%hs", "%rhs", "%uhs", "%ns", "%rns", "%uns", "%d", + "%rd", "%ud", "%hd", "%rhd", "%uhd", "%nd", "%rnd", + "%und", "%S", "%rS", "%uS", "%D", "%rD", "%uD", "%p", + "%i", "%L", "%B", "%XO", "%XR", "%I", "%c", "%Xs", + "%Xd", "%V", "%x", "%e", "%H", "%P", "%y" +}; if (fmt < 0 || fmt >= NUM_COL_FMTS) return NULL; @@ -63,7 +65,7 @@ col_format_to_string(gint fmt) { /* Given a format number (as defined in packet.h), returns its description */ -static gchar *dlist[NUM_COL_FMTS] = { +static const gchar *dlist[NUM_COL_FMTS] = { "Number", "Time (format as specified)", "Relative time", @@ -112,7 +114,7 @@ static gchar *dlist[NUM_COL_FMTS] = { "DCE/RPC call (cn_call_id / dg_seqnum)", }; -gchar * +const gchar * col_format_desc(gint fmt) { g_assert((fmt >= 0) && (fmt < NUM_COL_FMTS)); return(dlist[fmt]); @@ -224,7 +226,7 @@ get_column_format_matches(gboolean *fmt_list, gint format) { is done, and given that the width for COL...SRC and COL...DST columns is somewhat arbitrary in any case. We should probably clean that up eventually, though. */ -char * +const char * get_column_longest_string(gint format) { switch (format) { diff --git a/epan/column.h b/epan/column.h index 45a7b4ce29..3cd972d2b7 100644 --- a/epan/column.h +++ b/epan/column.h @@ -30,13 +30,13 @@ typedef struct _fmt_data { gchar *fmt; } fmt_data; -gchar *col_format_to_string(gint); -gchar *col_format_desc(gint); +const gchar *col_format_to_string(gint); +const gchar *col_format_desc(gint); gint get_column_format(gint); void get_column_format_matches(gboolean *, gint); gint get_column_format_from_str(gchar *); gchar *get_column_title(gint); -char *get_column_longest_string(gint); +const char *get_column_longest_string(gint); gint get_column_char_width(gint format); #endif /* column.h */ diff --git a/epan/dissectors/packet-dcerpc.h b/epan/dissectors/packet-dcerpc.h index 3f467ed9ad..0410be2b91 100644 --- a/epan/dissectors/packet-dcerpc.h +++ b/epan/dissectors/packet-dcerpc.h @@ -238,7 +238,7 @@ int dissect_ndr_wchar_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, typedef struct _dcerpc_sub_dissector { guint16 num; - gchar *name; + const gchar *name; dcerpc_dissect_fnct_t *dissect_rqst; dcerpc_dissect_fnct_t *dissect_resp; } dcerpc_sub_dissector; diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index b7fb1c517c..4b93d45262 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -1288,7 +1288,7 @@ static int giop_getline(FILE *fp, gchar *line, int maxlen) { * and store in object key hash */ -static void read_IOR_strings_from_file(gchar *name, int max_iorlen) { +static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) { guchar *buf; /* NOTE reused for every line */ int len; int ior_val_len; /* length after unstringifying. */ @@ -1436,7 +1436,7 @@ static void giop_init(void) { * */ -void register_giop_user(giop_sub_dissector_t *sub, gchar *name, int sub_proto) { +void register_giop_user(giop_sub_dissector_t *sub, const gchar *name, int sub_proto) { giop_sub_handle_t *subh; diff --git a/epan/dissectors/packet-giop.h b/epan/dissectors/packet-giop.h index 928bbf6eeb..e6f837f3ab 100644 --- a/epan/dissectors/packet-giop.h +++ b/epan/dissectors/packet-giop.h @@ -118,7 +118,7 @@ extern gboolean dissect_giop(tvbuff_t *, packet_info *, proto_tree *); /* new in * This is for heuristic dissection */ -extern void register_giop_user(giop_sub_dissector_t *sub, gchar *name, +extern void register_giop_user(giop_sub_dissector_t *sub, const gchar *name, int sub_proto); /* diff --git a/epan/filesystem.c b/epan/filesystem.c index 8bb384087a..f87644969d 100644 --- a/epan/filesystem.c +++ b/epan/filesystem.c @@ -351,7 +351,7 @@ get_persconffile_dir(void) char *appdatadir; char *userprofiledir; #else - char *homedir; + const char *homedir; struct passwd *pwd; #endif static char *pf_dir = NULL; @@ -647,10 +647,10 @@ char *get_tempfile_path(const char *filename) * Return an error message for UNIX-style errno indications on open or * create operations. */ -char * +const char * file_open_error_message(int err, gboolean for_writing) { - char *errmsg; + const char *errmsg; static char errmsg_errno[1024+1]; switch (err) { @@ -698,10 +698,10 @@ file_open_error_message(int err, gboolean for_writing) * Return an error message for UNIX-style errno indications on write * operations. */ -char * +const char * file_write_error_message(int err) { - char *errmsg; + const char *errmsg; static char errmsg_errno[1024+1]; switch (err) { diff --git a/epan/filesystem.h b/epan/filesystem.h index 534cfe384a..060937ef16 100644 --- a/epan/filesystem.h +++ b/epan/filesystem.h @@ -119,13 +119,13 @@ gboolean deletefile (const char *path); * Return an error message for UNIX-style errno indications on open or * create operations. */ -char *file_open_error_message(int err, gboolean for_writing); +const char *file_open_error_message(int err, gboolean for_writing); /* * Return an error message for UNIX-style errno indications on write * operations. */ -char *file_write_error_message(int err); +const char *file_write_error_message(int err); /* * Check, if file is existing. diff --git a/epan/packet.c b/epan/packet.c index a012ef7c2d..f47faeae63 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -187,7 +187,7 @@ static GMemChunk *data_source_chunk = NULL; * the tvbuff for the data source and its name. */ void -add_new_data_source(packet_info *pinfo, tvbuff_t *tvb, char *name) +add_new_data_source(packet_info *pinfo, tvbuff_t *tvb, const char *name) { data_source *src; @@ -616,7 +616,7 @@ struct dtbl_entry { struct dissector_table { GHashTable *hash_table; GSList *dissector_handles; - char *ui_name; + const char *ui_name; ftenum_t type; int base; }; @@ -906,7 +906,7 @@ find_string_dtbl_entry(dissector_table_t sub_dissectors, const gchar *pattern) /* Add an entry to a string dissector table. */ void -dissector_add_string(const char *name, gchar *pattern, +dissector_add_string(const char *name, const gchar *pattern, dissector_handle_t handle) { dissector_table_t sub_dissectors = find_dissector_table( name); @@ -1369,7 +1369,7 @@ dissector_all_tables_foreach_table (DATFunc_table func, } dissector_table_t -register_dissector_table(const char *name, char *ui_name, ftenum_t type, +register_dissector_table(const char *name, const char *ui_name, ftenum_t type, int base) { dissector_table_t sub_dissectors; diff --git a/epan/packet.h b/epan/packet.h index b1f2bc1ea8..05f6195eb7 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -163,7 +163,7 @@ extern void dissector_all_tables_foreach_table (DATFunc_table func, /* a protocol uses the function to register a sub-dissector table */ extern dissector_table_t register_dissector_table(const char *name, - char *ui_name, ftenum_t type, int base); + const char *ui_name, ftenum_t type, int base); /* Find a dissector table by table name. */ extern dissector_table_t find_dissector_table(const char *name); @@ -208,7 +208,7 @@ extern dissector_handle_t dissector_get_port_handle( dissector_table_t sub_dissectors, guint32 port); /* Add an entry to a string dissector table. */ -extern void dissector_add_string(const char *name, gchar *pattern, +extern void dissector_add_string(const char *name, const gchar *pattern, dissector_handle_t handle); /* Delete the entry for a dissector in a string dissector table @@ -379,7 +379,7 @@ final_registration_all_protocols(void); * the tvbuff for the data source and its name. */ extern void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb, - char *name); + const char *name); /* * Free up a frame's list of data sources. diff --git a/epan/packet_info.h b/epan/packet_info.h index bca15bd917..185ffcdb11 100644 --- a/epan/packet_info.h +++ b/epan/packet_info.h @@ -60,7 +60,7 @@ typedef struct _packet_info { guint32 ipxptype; /* IPX packet type, if this is an IPX packet */ circuit_type ctype; /* type of circuit, for protocols with a VC identifier */ guint32 circuit_id; /* circuit ID, for protocols with a VC identifier */ - char *noreassembly_reason; /* reason why reassembly wasn't done, if any */ + const char *noreassembly_reason; /* reason why reassembly wasn't done, if any */ gboolean fragmented; /* TRUE if the protocol is only a fragment */ gboolean in_error_pkt; /* TRUE if we're inside an {ICMP,CLNP,...} error packet */ port_type ptype; /* type of the following two port numbers */ diff --git a/epan/prefs.c b/epan/prefs.c index a30acf261e..58750e152c 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -556,7 +556,7 @@ prefs_register_enum_preference(module_t *module, const char *name, */ void prefs_register_string_preference(module_t *module, const char *name, - const char *title, const char *description, char **var) + const char *title, const char *description, const char **var) { pref_t *preference; diff --git a/epan/prefs.h b/epan/prefs.h index 7aa215ebd8..76c69ce89e 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -275,7 +275,7 @@ extern void prefs_register_enum_preference(module_t *module, const char *name, * Register a preference with a character-string value. */ extern void prefs_register_string_preference(module_t *module, const char *name, - const char *title, const char *description, char **var); + const char *title, const char *description, const char **var); /* * Register a preference with a ranged value. diff --git a/epan/proto.c b/epan/proto.c index 93418d2d54..f080b69ad8 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -580,7 +580,7 @@ header_field_info* proto_registrar_get_byname(const char *field_name) { DISSECTOR_ASSERT(field_name != NULL); - return g_tree_lookup(gpa_name_tree, (gpointer)field_name); + return g_tree_lookup(gpa_name_tree, field_name); } /* Add a text-only node, leaving it to our caller to fill the text in */ @@ -2800,7 +2800,7 @@ proto_get_id(protocol_t *protocol) return protocol->proto_id; } -int proto_get_id_by_filter_name(gchar* filter_name) +int proto_get_id_by_filter_name(const gchar* filter_name) { GList *list_entry; protocol_t *protocol; diff --git a/epan/proto.h b/epan/proto.h index 8a7cf9ed7f..c8675054a4 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -1044,7 +1044,7 @@ extern header_field_info *proto_get_next_protocol_field(void **cookle); /** Given a protocol's filter_name. @param filter_name the filter name to search for @return proto_id */ -extern int proto_get_id_by_filter_name(gchar* filter_name); +extern int proto_get_id_by_filter_name(const gchar* filter_name); /** Can item # n decoding be disabled? @param proto_id protocol id (0-indexed) diff --git a/epan/stats_tree.c b/epan/stats_tree.c index e1fd21d49c..150460afe9 100644 --- a/epan/stats_tree.c +++ b/epan/stats_tree.c @@ -237,9 +237,9 @@ extern void stats_tree_reinit(void* p) { } /* register a new stats_tree */ -extern void stats_tree_register(guint8* tapname, - guint8* abbr, - guint8* name, +extern void stats_tree_register(const guint8* tapname, + const guint8* abbr, + const guint8* name, stat_tree_packet_cb packet, stat_tree_init_cb init, stat_tree_cleanup_cb cleanup) { diff --git a/epan/stats_tree.h b/epan/stats_tree.h index 872450cb70..d3d81e0179 100644 --- a/epan/stats_tree.h +++ b/epan/stats_tree.h @@ -55,9 +55,9 @@ typedef void (*stat_tree_cleanup_cb)(stats_tree*); * packet: per packet callback * init: tree initialization callback */ -extern void stats_tree_register(guint8* tapname, - guint8* abbr, - guint8* name, +extern void stats_tree_register(const guint8* tapname, + const guint8* abbr, + const guint8* name, stat_tree_packet_cb packet, stat_tree_init_cb init, stat_tree_cleanup_cb cleanup); diff --git a/epan/tap.c b/epan/tap.c index 79721ebc78..2480086809 100644 --- a/epan/tap.c +++ b/epan/tap.c @@ -84,7 +84,7 @@ static volatile tap_listener_t *tap_listener_queue=NULL; */ typedef struct _tap_cmd_arg { struct _tap_cmd_arg *next; - char *cmd; + const char *cmd; void (*func)(char *arg); } tap_cmd_arg; static tap_cmd_arg *tap_cmd_arg_list=NULL; @@ -117,7 +117,7 @@ tap_init(void) * and initialization routine * ********************************************************************** */ void -register_tap_listener_cmd_arg(char *cmd, void (*func)(char *arg)) +register_tap_listener_cmd_arg(const char *cmd, void (*func)(char *arg)) { tap_cmd_arg *newtca; @@ -384,7 +384,7 @@ draw_tap_listeners(gboolean draw_all) or 0 if no such tap was found. */ int -find_tap_id(char *name) +find_tap_id(const char *name) { tap_dissector_t *td; int i; @@ -404,7 +404,7 @@ find_tap_id(char *name) * message. */ GString * -register_tap_listener(char *tapname, void *tapdata, char *fstring, tap_reset_cb reset, tap_packet_cb packet, tap_draw_cb draw) +register_tap_listener(const char *tapname, void *tapdata, char *fstring, tap_reset_cb reset, tap_packet_cb packet, tap_draw_cb draw) { tap_listener_t *tl; int tap_id; diff --git a/epan/tap.h b/epan/tap.h index 2d92a8c179..0834ce90e4 100644 --- a/epan/tap.h +++ b/epan/tap.h @@ -38,18 +38,18 @@ typedef void (*tap_draw_cb)(void *tapdata); extern void tap_init(void); -extern void register_tap_listener_cmd_arg(char *cmd, void (*func)(char *arg)); +extern void register_tap_listener_cmd_arg(const char *cmd, void (*func)(char *arg)); extern gboolean process_tap_cmd_arg(char *optarg); extern void list_tap_cmd_args(void); extern void start_requested_taps(void); extern int register_tap(const char *name); -extern int find_tap_id(char *name); +extern int find_tap_id(const char *name); extern void tap_queue_packet(int tap_id, packet_info *pinfo, const void *tap_specific_data); extern void tap_queue_init(epan_dissect_t *edt); extern void tap_push_tapped_queue(epan_dissect_t *edt); extern void reset_tap_listeners(void); extern void draw_tap_listeners(gboolean draw_all); -extern GString *register_tap_listener(char *tapname, void *tapdata, +extern GString *register_tap_listener(const char *tapname, void *tapdata, char *fstring, tap_reset_cb tap_reset, tap_packet_cb tap_packet, tap_draw_cb tap_draw); extern void remove_tap_listener(void *tapdata); diff --git a/epan/to_str.c b/epan/to_str.c index f24cde7d9f..6ccdd4bcbc 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -341,7 +341,7 @@ time_secs_to_str_buf(gint32 time, guint32 frac, gboolean is_nsecs, { static gchar *p; int hours, mins, secs; - gchar *msign = ""; + const gchar *msign = ""; gboolean do_comma = FALSE; if(time<0){ @@ -497,7 +497,7 @@ void display_signed_time(gchar *buf, int buflen, gint32 sec, gint32 frac, time_res_t units) { - char *sign; + const char *sign; /* If the fractional part of the time stamp is negative, print its absolute value and, if the seconds part isn't @@ -533,7 +533,7 @@ rel_time_to_str(nstime_t *rel_time) { gchar *buf; char *p; - char *sign; + const char *sign; gint32 time; gint32 nsec; diff --git a/epan/xdlc.c b/epan/xdlc.c index f631475303..d6fb3148ab 100644 --- a/epan/xdlc.c +++ b/epan/xdlc.c @@ -180,11 +180,11 @@ dissect_xdlc_control(tvbuff_t *tvb, int offset, packet_info *pinfo, guint16 control; int control_len; const xdlc_cf_items *cf_items; - char *control_format; + const char *control_format; guint16 poll_final; char info[80]; proto_tree *tc, *control_tree; - gchar *frame_type = NULL; + const gchar *frame_type = NULL; const gchar *modifier; switch (tvb_get_guint8(tvb, offset) & 0x03) { |