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 | |
parent | cb4ac62893d38d74efc89f5d5c90c7451dc421a4 (diff) |
More 'char*' -> 'const char*' changes to fix warnings.
svn path=/trunk/; revision=15015
46 files changed, 186 insertions, 176 deletions
diff --git a/clopts_common.c b/clopts_common.c index d30f8751b6..1528d726e8 100644 --- a/clopts_common.c +++ b/clopts_common.c @@ -40,7 +40,7 @@ * to be printed. */ void -handle_dashG_option(int argc, char **argv, char *progname) +handle_dashG_option(int argc, char **argv, const char *progname) { char *gpf_path, *pf_path; int gpf_open_errno, gpf_read_errno; diff --git a/clopts_common.h b/clopts_common.h index 376ddcc9c3..d4862f8575 100644 --- a/clopts_common.h +++ b/clopts_common.h @@ -33,7 +33,7 @@ extern "C" { * Handle the "-G" option, to cause protocol field, etc. information * to be printed. */ -void handle_dashG_option(int argc, char **argv, char *progname); +void handle_dashG_option(int argc, char **argv, const char *progname); int get_natural_int(const char *appname, const char *string, const char *name); diff --git a/disabled_protos.c b/disabled_protos.c index cc11ad0de9..19045431db 100644 --- a/disabled_protos.c +++ b/disabled_protos.c @@ -317,11 +317,12 @@ skip: void save_disabled_protos_list(char **pref_path_return, int *errno_return) { - gchar *ff_path, *ff_path_new, *ff_name; - FILE *ff; - gint i; - protocol_t *protocol; - void *cookie; + gchar *ff_path, *ff_path_new; + const gchar *ff_name; + FILE *ff; + gint i; + protocol_t *protocol; + void *cookie; *pref_path_return = NULL; /* assume no error */ 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) { diff --git a/plugins/gryphon/packet-gryphon.c b/plugins/gryphon/packet-gryphon.c index eb84399a05..4d6b67f35b 100644 --- a/plugins/gryphon/packet-gryphon.c +++ b/plugins/gryphon/packet-gryphon.c @@ -137,7 +137,7 @@ static int cmd_bits_in(tvbuff_t*, int, proto_tree*); static int cmd_bits_out(tvbuff_t*, int, proto_tree*); static int cmd_init_strat(tvbuff_t*, int, proto_tree*); -static char *frame_type[] = { +static const char *frame_type[] = { "", "Command request", "Command response", @@ -869,7 +869,7 @@ decode_misc (tvbuff_t *tvb, int offset, proto_tree *pt) static int cmd_init(tvbuff_t *tvb, int offset, proto_tree *pt) { - char *ptr; + const char *ptr; if (tvb_get_guint8(tvb, offset) == 0) ptr = "Always initialize"; @@ -1164,7 +1164,7 @@ resp_getspeeds(tvbuff_t *tvb, int offset, proto_tree *pt) static int cmd_sort(tvbuff_t *tvb, int offset, proto_tree *pt) { - char *which; + const char *which; which = tvb_get_guint8(tvb, offset) ? "Sort into blocks of up to 16 messages" : @@ -1177,7 +1177,7 @@ cmd_sort(tvbuff_t *tvb, int offset, proto_tree *pt) static int cmd_optimize(tvbuff_t *tvb, int offset, proto_tree *pt) { - char *which; + const char *which; which = tvb_get_guint8(tvb, offset) ? "Optimize for latency (Nagle algorithm disabled)" : @@ -1390,7 +1390,7 @@ cmd_sched_rep(tvbuff_t *tvb, int offset, proto_tree *pt) proto_item *item; int save_offset; unsigned int x; - char *type; + const char *type; msglen = tvb_reported_length_remaining(tvb, offset); x = tvb_get_ntohl(tvb, offset); @@ -1415,10 +1415,10 @@ cmd_sched_rep(tvbuff_t *tvb, int offset, proto_tree *pt) static int resp_blm_data(tvbuff_t *tvb, int offset, proto_tree *pt) { - unsigned int i; - int hours, minutes, seconds, fraction, x, fract; - unsigned long timestamp; - static char *fields[] = { + unsigned int i; + int hours, minutes, seconds, fraction, x, fract; + unsigned long timestamp; + static const char *fields[] = { "Bus load average: %d.%02d%%", "Current bus load: %d.%02d%%", "Peak bus load: %d.%02d%%", @@ -1446,7 +1446,7 @@ static int resp_blm_stat(tvbuff_t *tvb, int offset, proto_tree *pt) { unsigned int x, i; - char *fields[] = { + const char *fields[] = { "Receive frame count: %u", "Transmit frame count: %u", "Receive dropped frame count: %u", @@ -1815,7 +1815,7 @@ cmd_options(tvbuff_t *tvb, int offset, proto_tree *pt) proto_item *item; proto_tree *tree; unsigned int i, size, padding, option, option_length, option_value; - char *string, *string1; + const char *string, *string1; msglen = tvb_reported_length_remaining(tvb, offset); item = proto_tree_add_text(pt, tvb, offset, 1, "Handle: %u", @@ -1882,8 +1882,8 @@ cmd_options(tvbuff_t *tvb, int offset, proto_tree *pt) static int cmd_files(tvbuff_t *tvb, int offset, proto_tree *pt) { - int msglen; - gchar *which; + int msglen; + const gchar *which; msglen = tvb_reported_length_remaining(tvb, offset); if (tvb_get_guint8(tvb, offset) == 0) @@ -1901,8 +1901,8 @@ cmd_files(tvbuff_t *tvb, int offset, proto_tree *pt) static int resp_files(tvbuff_t *tvb, int offset, proto_tree *pt) { - int msglen; - gchar *flag; + int msglen; + const gchar *flag; msglen = tvb_reported_length_remaining(tvb, offset); flag = tvb_get_guint8(tvb, offset) ? "Yes": "No"; @@ -1915,24 +1915,30 @@ resp_files(tvbuff_t *tvb, int offset, proto_tree *pt) static int cmd_usdt(tvbuff_t *tvb, int offset, proto_tree *pt) { - int ids, id, remain, size, i, j, bytes; - gchar *desc; - guint8 flags; - proto_tree *localTree; - proto_item *localItem; - gchar *actions[] = {"Use 11 bit headers only", - "Use 29 bit headers only", - "Use both 11 & 29 bit headers", - "undefined"}; - gchar *xmit_opts[] = {"Pad messages with less than 8 data bytes with 0x00's", - "Pad messages with less than 8 data bytes with 0xFF's", - "Do not pad messages with less than 8 data bytes", - "undefined"}; - gchar *recv_opts[] = {"Do not verify the integrity of long received messages and do not send them to the client", - "Verify the integrity of long received messages and send them to the client", - "Verify the integrity of long received messages but do not send them to the client", - "undefined"}; - gchar *block_desc[] = {"USDT request", "USDT response", "UUDT response"}; + int ids, id, remain, size, i, j, bytes; + const gchar *desc; + guint8 flags; + proto_tree *localTree; + proto_item *localItem; + const gchar *actions[] = { + "Use 11 bit headers only", + "Use 29 bit headers only", + "Use both 11 & 29 bit headers", + "undefined" + }; + const gchar *xmit_opts[] = { + "Pad messages with less than 8 data bytes with 0x00's", + "Pad messages with less than 8 data bytes with 0xFF's", + "Do not pad messages with less than 8 data bytes", + "undefined" + }; + const gchar *recv_opts[] = { + "Do not verify the integrity of long received messages and do not send them to the client", + "Verify the integrity of long received messages and send them to the client", + "Verify the integrity of long received messages but do not send them to the client", + "undefined" + }; + const gchar *block_desc[] = {"USDT request", "USDT response", "UUDT response"}; flags = tvb_get_guint8(tvb, offset); if (flags & 1) @@ -2046,8 +2052,8 @@ cmd_bits_in (tvbuff_t *tvb, int offset, proto_tree *pt) proto_item *item; proto_tree *tree; unsigned int i; - int msglen, mask, value; - char *decode[] = {"Input 1", "Input 2", "Input 3", "Pushbutton"}; + int msglen, mask, value; + const char *decode[] = {"Input 1", "Input 2", "Input 3", "Pushbutton"}; msglen = tvb_reported_length_remaining(tvb, offset); value = tvb_get_guint8(tvb, offset); @@ -2075,8 +2081,8 @@ cmd_bits_out (tvbuff_t *tvb, int offset, proto_tree *pt) proto_item *item; proto_tree *tree; unsigned int i; - int msglen, mask, value; - char *decode[] = {"Output 1", "Output 2"}; + int msglen, mask, value; + const char *decode[] = {"Output 1", "Output 2"}; msglen = tvb_reported_length_remaining(tvb, offset); value = tvb_get_guint8(tvb, offset); @@ -2187,7 +2193,8 @@ filter_block(tvbuff_t *tvb, int offset, proto_tree *pt) static int blm_mode(tvbuff_t *tvb, int offset, proto_tree *pt) { - char *mode, line[50]; + const char *mode; + char line[50]; int x, y, seconds; x = tvb_get_ntohl(tvb, offset); diff --git a/plugins/gryphon/packet-gryphon.h b/plugins/gryphon/packet-gryphon.h index abac7c3957..01f3f25fab 100644 --- a/plugins/gryphon/packet-gryphon.h +++ b/plugins/gryphon/packet-gryphon.h @@ -457,8 +457,8 @@ typedef struct val_str_dsp { - int value; - char *strptr; - int (*cmd_fnct)(tvbuff_t *, int, proto_tree*); - int (*rsp_fnct)(tvbuff_t *, int, proto_tree*); + int value; + const char *strptr; + int (*cmd_fnct)(tvbuff_t *, int, proto_tree*); + int (*rsp_fnct)(tvbuff_t *, int, proto_tree*); } val_str_dsp; diff --git a/plugins/irda/irda-appl.h b/plugins/irda/irda-appl.h index 571d8bfc5e..683e03503e 100644 --- a/plugins/irda/irda-appl.h +++ b/plugins/irda/irda-appl.h @@ -54,12 +54,12 @@ typedef gboolean (*ias_value_dissector_t)(tvbuff_t* tvb, unsigned offset, packet unsigned list_index, guint8 attr_type); typedef const struct ias_attr_dissector { - char* attr_name; + const char* attr_name; ias_value_dissector_t value_dissector; } ias_attr_dissector_t; typedef const struct ias_class_dissector { - char* class_name; + const char* class_name; ias_attr_dissector_t* pattr_dissector; } ias_class_dissector_t; diff --git a/plugins/mate/mate.h b/plugins/mate/mate.h index 61060dbdcb..7b12625aa0 100644 --- a/plugins/mate/mate.h +++ b/plugins/mate/mate.h @@ -372,7 +372,7 @@ extern mate_pdu* mate_get_pdus(guint32 framenum); extern void mate_analyze_frame(packet_info *pinfo, proto_tree* tree); /* from mate_setup.c */ -extern mate_config* mate_make_config(gchar* filename, int mate_hfid); +extern mate_config* mate_make_config(const gchar* filename, int mate_hfid); extern mate_config* mate_cfg(void); extern mate_cfg_pdu* new_pducfg(gchar* name); @@ -384,6 +384,6 @@ extern gchar* add_ranges(gchar* range, GPtrArray* range_ptr_arr); /* from mate_parser.l */ -extern gboolean mate_load_config(gchar* filename, mate_config* mc); +extern gboolean mate_load_config(const gchar* filename, mate_config* mc); #endif diff --git a/plugins/mate/mate_grammar.lemon b/plugins/mate/mate_grammar.lemon index 837a66e3e9..54dc221d7d 100644 --- a/plugins/mate/mate_grammar.lemon +++ b/plugins/mate/mate_grammar.lemon @@ -94,9 +94,9 @@ typedef struct _gog_statements { LoAL* current_gogkeys; } gog_statement_t; -static void configuration_error(mate_config* mc, gchar* fmt, ...) { +static void configuration_error(mate_config* mc, const gchar* fmt, ...) { static gchar error_buffer[256]; - gchar* incl; + const gchar* incl; gint i; mate_config_frame* current_frame; va_list list; diff --git a/plugins/mate/mate_parser.l b/plugins/mate/mate_parser.l index f8d3076403..1cd0730528 100644 --- a/plugins/mate/mate_parser.l +++ b/plugins/mate/mate_parser.l @@ -245,7 +245,7 @@ blk_cmnt_stop "*/" %% -extern gboolean mate_load_config(gchar* filename, mate_config* matecfg) { +extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) { gboolean state; mc = matecfg; diff --git a/plugins/mate/mate_setup.c b/plugins/mate/mate_setup.c index c54f18d7e5..07b7af8597 100644 --- a/plugins/mate/mate_setup.c +++ b/plugins/mate/mate_setup.c @@ -30,7 +30,7 @@ static mate_config* matecfg = NULL; /* appends the formatted string to the current error log */ -static void report_error(gchar* fmt, ...) { +static void report_error(const gchar* fmt, ...) { static gchar error_buffer[DEBUG_BUFFER_SIZE]; va_list list; @@ -679,8 +679,8 @@ static void print_hfid_hash(gpointer k, gpointer v, gpointer p _U_) { static void print_pdu_config(mate_cfg_pdu* cfg, GString* s) { guint i; int hfid; - gchar* discard; - gchar* stop; + const gchar* discard; + const gchar* stop; discard = cfg->discard ? "TRUE": "FALSE"; stop = cfg->last_extracted ? "TRUE" : "FALSE"; @@ -858,7 +858,7 @@ static void print_config(void) { g_string_free(config_text,TRUE); } -extern mate_config* mate_make_config(gchar* filename, int mate_hfid) { +extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) { gint* ett; avp_init(); diff --git a/plugins/mate/mate_util.c b/plugins/mate/mate_util.c index 1020046ad4..8137f0cd56 100644 --- a/plugins/mate/mate_util.c +++ b/plugins/mate/mate_util.c @@ -130,7 +130,7 @@ extern SCS_collection* scs_init(void) { * * Return value: a pointer to the subscribed string. **/ -gchar* scs_subscribe(SCS_collection* c, gchar* s) { +gchar* scs_subscribe(SCS_collection* c, const gchar* s) { gchar* orig = NULL; guint* ip = NULL; size_t len = 0; @@ -346,7 +346,7 @@ extern void avp_init(void) { * Return value: a pointer to the newly created avp. * **/ -extern AVP* new_avp_from_finfo(gchar* name, field_info* finfo) { +extern AVP* new_avp_from_finfo(const gchar* name, field_info* finfo) { AVP* new = g_mem_chunk_alloc(avp_chunk); gchar* value; @@ -397,7 +397,7 @@ extern AVP* new_avp_from_finfo(gchar* name, field_info* finfo) { * Return value: a pointer to the newly created avp. * **/ -extern AVP* new_avp(gchar* name, gchar* value, gchar o) { +extern AVP* new_avp(const gchar* name, const gchar* value, gchar o) { AVP* new = g_mem_chunk_alloc(avp_chunk); new->n = scs_subscribe(avp_strings, name); @@ -468,7 +468,7 @@ extern void rename_avp(AVP* avp, gchar* name) { * Return value: a pointer to the newly created avpl. * **/ -extern AVPL* new_avpl(gchar* name) { +extern AVPL* new_avpl(const gchar* name) { AVPL* new_avpl = g_mem_chunk_alloc(avp_chunk); #ifdef _AVP_DEBUGGING @@ -913,7 +913,7 @@ extern void merge_avpl(AVPL* dst, AVPL* src, gboolean copy_avps) { * Return value: a pointer to the newly allocated string. * **/ -extern AVPL* new_avpl_from_avpl(gchar* name, AVPL* avpl, gboolean copy_avps) { +extern AVPL* new_avpl_from_avpl(const gchar* name, AVPL* avpl, gboolean copy_avps) { AVPL* newavpl = new_avpl(name); void* cookie = NULL; AVP* avp; @@ -1043,7 +1043,7 @@ extern AVP* match_avp(AVP* src, AVP* op) { * Return value: a pointer to the newly created avpl containing the * matching avps. **/ -extern AVPL* new_avpl_loose_match(gchar* name, +extern AVPL* new_avpl_loose_match(const gchar* name, AVPL* src, AVPL* op, gboolean copy_avps) { @@ -1121,7 +1121,7 @@ extern AVPL* new_avpl_loose_match(gchar* name, * Return value: a pointer to the newly created avpl containing the * matching avps. **/ -extern AVPL* new_avpl_every_match(gchar* name, AVPL* src, AVPL* op, gboolean copy_avps) { +extern AVPL* new_avpl_every_match(const gchar* name, AVPL* src, AVPL* op, gboolean copy_avps) { AVPL* newavpl; AVPN* co = NULL; AVPN* cs = NULL; @@ -1212,7 +1212,7 @@ extern AVPL* new_avpl_every_match(gchar* name, AVPL* src, AVPL* op, gboolean cop * Return value: a pointer to the newly created avpl containing the * matching avps. **/ -extern AVPL* new_avpl_exact_match(gchar* name,AVPL* src, AVPL* op, gboolean copy_avps) { +extern AVPL* new_avpl_exact_match(const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps) { AVPL* newavpl = new_avpl(name); AVPN* co = NULL; AVPN* cs = NULL; @@ -1283,7 +1283,7 @@ extern AVPL* new_avpl_exact_match(gchar* name,AVPL* src, AVPL* op, gboolean copy return NULL; } -extern AVPL* new_avpl_from_match(avpl_match_mode mode, gchar* name,AVPL* src, AVPL* op, gboolean copy_avps) { +extern AVPL* new_avpl_from_match(avpl_match_mode mode, const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps) { AVPL* avpl = NULL; switch (mode) { @@ -1435,7 +1435,7 @@ extern void avpl_transform(AVPL* src, AVPL_Transf* op) { * * Return value: a pointer to the newly created loal. **/ -extern LoAL* new_loal(gchar* name) { +extern LoAL* new_loal(const gchar* name) { LoAL* new_loal = g_mem_chunk_alloc(avp_chunk); if (! name) { @@ -1614,7 +1614,7 @@ extern void delete_loal(LoAL* loal, gboolean avpls_too, gboolean avps_too) { * load_loal_error: * Used by loal_from_file to handle errors while loading. **/ -LoAL* load_loal_error(FILE* fp, LoAL* loal, AVPL* curr, int linenum, gchar* fmt, ...) { +LoAL* load_loal_error(FILE* fp, LoAL* loal, AVPL* curr, int linenum, const gchar* fmt, ...) { va_list list; gchar* desc; LoAL* ret = NULL; diff --git a/plugins/mate/mate_util.h b/plugins/mate/mate_util.h index 27af4fdccb..01eb9fa9bb 100644 --- a/plugins/mate/mate_util.h +++ b/plugins/mate/mate_util.h @@ -56,7 +56,7 @@ typedef struct _scs_collection SCS_collection; extern void destroy_scs_collection(SCS_collection* c); extern SCS_collection* scs_init(void); -extern gchar* scs_subscribe(SCS_collection* collection, gchar* s); +extern gchar* scs_subscribe(SCS_collection* collection, const gchar* s); extern void scs_unsubscribe(SCS_collection* collection, gchar* s); extern gchar* scs_subscribe_printf(SCS_collection* collection, gchar* fmt, ...); @@ -157,13 +157,13 @@ extern void setup_avp_debug(FILE* fp, int* general, int* avp, int* avp_op, int* */ /* creates a new avp */ -extern AVP* new_avp(gchar* name, gchar* value, gchar op); +extern AVP* new_avp(const gchar* name, const gchar* value, gchar op); /* creates a copy od an avp */ extern AVP* avp_copy(AVP* from); /* creates an avp from a field_info record */ -extern AVP* new_avp_from_finfo(gchar* name, field_info* finfo); +extern AVP* new_avp_from_finfo(const gchar* name, field_info* finfo); /* * avp destructor @@ -185,26 +185,26 @@ extern AVP* match_avp(AVP* src, AVP* op); */ /* creates an empty avp list */ -extern AVPL* new_avpl(gchar* name); +extern AVPL* new_avpl(const gchar* name); /* creates a copy of an avp list */ -extern AVPL* new_avpl_from_avpl(gchar* name, AVPL* avpl, gboolean copy_avps); +extern AVPL* new_avpl_from_avpl(const gchar* name, AVPL* avpl, gboolean copy_avps); /* creates an avp list containing any avps in src matching any avps in op it will eventually create an empty list in none match */ -extern AVPL* new_avpl_loose_match(gchar* name,AVPL* src, AVPL* op, gboolean copy_avps); +extern AVPL* new_avpl_loose_match(const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps); /* creates an avp list containing any avps in src matching every avp in op it will not create a list if there is not a match for every attribute in op */ -extern AVPL* new_avpl_every_match(gchar* name,AVPL* src, AVPL* op, gboolean copy_avps); +extern AVPL* new_avpl_every_match(const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps); /* creates an avp list containing every avp in src matching every avp in op it will not create a list unless every avp in op is matched only once to avery avp in op */ -extern AVPL* new_avpl_exact_match(gchar* name,AVPL* src, AVPL* op, gboolean copy_avps); +extern AVPL* new_avpl_exact_match(const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps); /* uses mode to call one of the former matches. NO_MATCH = merge(merge(copy(src),op)) */ -extern AVPL* new_avpl_from_match(avpl_match_mode mode, gchar* name,AVPL* src, AVPL* op, gboolean copy_avps); +extern AVPL* new_avpl_from_match(avpl_match_mode mode, const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps); @@ -262,7 +262,7 @@ extern void avpl_transform(AVPL* src, AVPL_Transf* op); */ /* creates an empty list of avp lists */ -extern LoAL* new_loal(gchar* name); +extern LoAL* new_loal(const gchar* name); /* given a file loads all the avpls contained in it every line is formatted as it is the output of avplist_to_string */ diff --git a/plugins/mate/packet-mate.c b/plugins/mate/packet-mate.c index dbf749c0f2..abd941f8ab 100644 --- a/plugins/mate/packet-mate.c +++ b/plugins/mate/packet-mate.c @@ -37,8 +37,8 @@ static mate_config* mc = NULL; static int proto_mate = -1; -static gchar* pref_mate_config_filename = ""; -static gchar* current_mate_config_filename = NULL; +static const gchar* pref_mate_config_filename = ""; +static const gchar* current_mate_config_filename = NULL; static proto_item *mate_i = NULL; @@ -196,8 +196,8 @@ void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) { float rel_time; float gop_time; float pdu_rel_time; - gchar* pdu_str; - gchar* type_str; + const gchar* pdu_str; + const gchar* type_str; guint32 pdu_item; gop_item = proto_tree_add_uint(tree,gop->cfg->hfid,tvb,0,0,gop->id); diff --git a/plugins/mgcp/packet-mgcp.c b/plugins/mgcp/packet-mgcp.c index cf2a7d0087..e53b4b126e 100644 --- a/plugins/mgcp/packet-mgcp.c +++ b/plugins/mgcp/packet-mgcp.c @@ -268,7 +268,7 @@ static int callagent_tcp_port = 0; static int callagent_udp_port = 0; /* Some basic utility functions that are specific to this dissector */ -static gboolean is_mgcp_verb(tvbuff_t *tvb, gint offset, gint maxlength, gchar **verb_name); +static gboolean is_mgcp_verb(tvbuff_t *tvb, gint offset, gint maxlength, const gchar **verb_name); static gboolean is_mgcp_rspcode(tvbuff_t *tvb, gint offset, gint maxlength); static gint tvb_parse_param(tvbuff_t *tvb, gint offset, gint maxlength, int** hf); @@ -345,7 +345,7 @@ static void dissect_mgcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 num_messages; gint tvb_sectionend,tvb_sectionbegin, tvb_len, tvb_current_len; proto_tree *mgcp_tree, *ti; - gchar *verb_name = ""; + const gchar *verb_name = ""; /* Initialize variables */ tvb_sectionend = 0; @@ -451,7 +451,7 @@ static void dissect_mgcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree * gint sectionlen; gint tvb_sectionend,tvb_sectionbegin, tvb_len, tvb_current_len; tvbuff_t *next_tvb; - gchar *verb_name = ""; + const gchar *verb_name = ""; /* Initialise stat info for passing to tap */ pi_current++; @@ -950,7 +950,7 @@ void proto_reg_handoff_mgcp(void) * * Return: TRUE if there is an MGCP verb at offset in tvb, otherwise FALSE */ -static gboolean is_mgcp_verb(tvbuff_t *tvb, gint offset, gint maxlength, gchar **verb_name) +static gboolean is_mgcp_verb(tvbuff_t *tvb, gint offset, gint maxlength, const gchar **verb_name) { int returnvalue = FALSE; guint8 word[5]; @@ -1321,7 +1321,7 @@ static void dissect_mgcp_firstline(tvbuff_t *tvb, packet_info *pinfo, proto_tree mgcp_call_t *mgcp_call = NULL; nstime_t delta; gint rspcode = 0; - gchar *verb_description = ""; + const gchar *verb_description = ""; char code_with_verb[64] = ""; /* To fit "<4-letter-code> (<longest-verb>)" */ static address null_address = { AT_NONE, 0, NULL }; diff --git a/plugins/opsi/packet-opsi.h b/plugins/opsi/packet-opsi.h index 830dc5c34a..c83da77b35 100644 --- a/plugins/opsi/packet-opsi.h +++ b/plugins/opsi/packet-opsi.h @@ -51,11 +51,11 @@ /* Internal structure to dissect attributes */ typedef struct { - guint16 attribute_type; /* attribute code */ - char *tree_text; /* text for fold out */ - gint *tree_id; /* id for add_item */ - int* hf_type_attribute; /* id for seach option */ - void (*dissect)(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int offset, int length); + guint16 attribute_type; /* attribute code */ + const char *tree_text; /* text for fold out */ + gint *tree_id; /* id for add_item */ + int* hf_type_attribute; /* id for seach option */ + void (*dissect)(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int offset, int length); } opsi_attribute_handle_t; diff --git a/plugins/profinet/packet-pn-dcp.c b/plugins/profinet/packet-pn-dcp.c index 4dcdafd797..9c94be0f33 100644 --- a/plugins/profinet/packet-pn-dcp.c +++ b/plugins/profinet/packet-pn-dcp.c @@ -329,7 +329,7 @@ dissect_pn_padding(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, /* append the given info text */ static void -pn_append_info(packet_info *pinfo, proto_item *dcp_item, char *text) +pn_append_info(packet_info *pinfo, proto_item *dcp_item, const char *text) { if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, text); diff --git a/plugins/rlm/packet-rlm.c b/plugins/rlm/packet-rlm.c index 79d2e98caa..8c9d9c6a5c 100644 --- a/plugins/rlm/packet-rlm.c +++ b/plugins/rlm/packet-rlm.c @@ -120,7 +120,7 @@ dissect_rlm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *ti; proto_tree *rlm_tree; guint8 rlm_type, version; - char *type_str = NULL; + const char *type_str = NULL; if (pinfo->srcport < 3000 || pinfo->srcport > 3015 || pinfo->destport < 3000 || pinfo->destport > 3015 @@ -228,7 +228,7 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data) { field_info *fi = PITEM_FINFO(node); write_pdml_data *pdata = (write_pdml_data*) data; - gchar *label_ptr; + const gchar *label_ptr; gchar label_str[ITEM_LABEL_LENGTH]; char *dfilter_string; int chop_len; @@ -74,12 +74,12 @@ enum { }; typedef struct { - char *abbrev; - char *longname; - int produceable_type; - guint8 *sample_buffer; - int sample_wtap_encap; - int sample_length; + const char *abbrev; + const char *longname; + int produceable_type; + guint8 *sample_buffer; + int sample_wtap_encap; + int sample_length; } pkt_example; /* Ethernet, indicating ARP */ diff --git a/tap-iousers.c b/tap-iousers.c index f20137e816..1b1499ae12 100644 --- a/tap-iousers.c +++ b/tap-iousers.c @@ -50,7 +50,7 @@ #include <string.h> typedef struct _io_users_t { - char *type; + const char *type; char *filter; struct _io_users_item_t *items; } io_users_t; @@ -582,7 +582,7 @@ void iousers_init(char *optarg) { char *filter=NULL; - char *tap_type, *tap_type_name; + const char *tap_type, *tap_type_name; tap_packet_cb packet_func; io_users_t *iu=NULL; GString *error_string; diff --git a/tethereal.c b/tethereal.c index 5e499deb3a..d69f3f4942 100644 --- a/tethereal.c +++ b/tethereal.c @@ -197,7 +197,7 @@ static void show_print_file_io_error(int err); static gboolean write_preamble(capture_file *cf); static gboolean print_packet(capture_file *cf, epan_dissect_t *edt); static gboolean write_finale(void); -static char *cf_open_error_message(int err, gchar *err_info, +static const char *cf_open_error_message(int err, gchar *err_info, gboolean for_writing, int file_type); #ifdef HAVE_LIBPCAP #ifndef _WIN32 @@ -1470,7 +1470,7 @@ capture(char *save_file, int out_file_type) #ifndef _WIN32 void (*oldhandler)(int); static const char ppamsg[] = "can't find PPA for "; - char *libpcap_warn; + const char *libpcap_warn; volatile int pipe_fd = -1; struct pcap_hdr hdr; struct pcaprec_modified_hdr rechdr; @@ -2853,11 +2853,11 @@ show_print_file_io_error(int err) } } -static char * +static const char * cf_open_error_message(int err, gchar *err_info, gboolean for_writing, int file_type) { - char *errmsg; + const char *errmsg; static char errmsg_errno[1024+1]; if (err < 0) { diff --git a/text2pcap.c b/text2pcap.c index a1374af38f..9c5bedbb57 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -176,10 +176,10 @@ static guint32 ts_usec = 0; static char *ts_fmt = NULL; /* Input file */ -static char *input_filename; +static const char *input_filename; static FILE *input_file = NULL; /* Output file */ -static char *output_filename; +static const char *output_filename; static FILE *output_file = NULL; /* Offset base to parse */ @@ -330,7 +330,7 @@ static unsigned long pcap_link_type = 1; /* Default is DLT-EN10MB */ * Pass in TRUE if this is an offset, FALSE if not */ static unsigned long -parse_num (char *str, int offset) +parse_num (const char *str, int offset) { unsigned long num; char *c; @@ -347,7 +347,7 @@ parse_num (char *str, int offset) * Write this byte into current packet */ static void -write_byte (char *str) +write_byte (const char *str) { unsigned long num; diff --git a/tools/lemon/lempar.c b/tools/lemon/lempar.c index 507805be6d..b14b4f3271 100644 --- a/tools/lemon/lempar.c +++ b/tools/lemon/lempar.c @@ -182,7 +182,7 @@ void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ -static char *yyTokenName[] = { +static const char *yyTokenName[] = { %% }; #define YYTRACE(X) if( yyTraceFILE ) fprintf(yyTraceFILE,"%sReduce [%s].\n",yyTracePrompt,X); |