aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2010-06-09 18:12:17 +0000
committerBill Meier <wmeier@newsguy.com>2010-06-09 18:12:17 +0000
commit7b85f43d0e3f3815131a7b03ef5c115a21bb19e1 (patch)
treef7430a2ebe788d37ae3518e97815dff4d048bd27 /epan/dissectors
parent407b8297c0136655cd6fa3c64a454e6e497b837d (diff)
Do some constifying [or other] based upon gcc -Wwrite-strings warnings.
svn path=/trunk/; revision=33198
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-dcm.c8
-rw-r--r--epan/dissectors/packet-diameter.c2
-rw-r--r--epan/dissectors/packet-dtn.c16
-rw-r--r--epan/dissectors/packet-frame.c2
-rw-r--r--epan/dissectors/packet-gsm_a_gm.c4
-rw-r--r--epan/dissectors/packet-mikey.c2
-rw-r--r--epan/dissectors/packet-nasdaq-itch.c2
-rw-r--r--epan/dissectors/packet-ncp-sss.c6
-rw-r--r--epan/dissectors/packet-ntlmssp.c6
-rw-r--r--epan/dissectors/packet-ntp.c15
-rw-r--r--epan/dissectors/packet-ntp.h2
-rw-r--r--epan/dissectors/packet-ppp.c8
-rw-r--r--epan/dissectors/packet-ptp.c2
-rw-r--r--epan/dissectors/packet-pvfs2.c13
-rw-r--r--epan/dissectors/packet-rmi.c2
15 files changed, 45 insertions, 45 deletions
diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c
index 0805e1191f..8acaf37cdb 100644
--- a/epan/dissectors/packet-dcm.c
+++ b/epan/dissectors/packet-dcm.c
@@ -344,13 +344,13 @@ typedef struct dcm_open_tag {
gboolean is_header_fragmented;
gboolean is_value_fragmented;
- guint32 len_decoded; /* Should only by < 16 bytes */
+ guint32 len_decoded; /* Should only by < 16 bytes */
guint16 grp; /* Already decoded group */
guint16 elm; /* Already decoded element */
gchar *vr; /* Already decoded VR */
- gboolean is_vl_long; /* If TRUE, Value Length is 4 Bytes, otherwise 2 */
+ gboolean is_vl_long; /* If TRUE, Value Length is 4 Bytes, otherwise 2 */
guint16 vl_1; /* Partially decoded 1st two bytes of length */
guint16 vl_2; /* Partially decoded 2nd two bytes of length */
@@ -5437,7 +5437,7 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
dcm_tag_t *tag_def = NULL;
const gchar *vr = NULL;
- gchar *tag_value = NULL; /* Tag Value converted to a string */
+ gchar *tag_value = NULL; /* Tag Value converted to a string */
gchar *tag_summary;
guint32 vl = 0;
@@ -5762,7 +5762,7 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
else if (vl == 0) {
/* No value */
- tag_value = "<Empty>";
+ g_strlcpy(tag_value, "<Empty>", MAX_BUF_LEN);
}
else if (vl > vl_max) {
/* Tag is longer than the PDV/PDU. Don't perform any decoding */
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 78392d83b7..1fe6cd2451 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -562,7 +562,7 @@ time_avp(diam_ctx_t* c, diam_avp_t* a, tvbuff_t* tvb)
{
int len = tvb_length(tvb);
guint8 ntptime[8] = {0,0,0,0,0,0,0,0};
- char* label;
+ const char* label;
proto_item* pi;
if ( len != 4 ) {
diff --git a/epan/dissectors/packet-dtn.c b/epan/dissectors/packet-dtn.c
index 35da151088..0073da9214 100644
--- a/epan/dissectors/packet-dtn.c
+++ b/epan/dissectors/packet-dtn.c
@@ -56,9 +56,9 @@ static int dissect_contact_header(tvbuff_t *tvb, packet_info *pinfo,
static int dissect_tcp_convergence_data_header(tvbuff_t *tvb, proto_tree *tree);
static int dissect_version_5_primary_header(packet_info *pinfo,
proto_tree *primary_tree, tvbuff_t *tvb);
-static int add_sdnv_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_id);
-static int add_dtn_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_id);
-static int add_sdnv_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_id);
+static int add_sdnv_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, const char *field_id);
+static int add_dtn_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, const char *field_id);
+static int add_sdnv_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, const char *field_id);
/* For Reassembling TCP Convergence Layer segments */
static GHashTable *msg_fragment_table = NULL;
@@ -1066,8 +1066,8 @@ dissect_version_5_primary_header(packet_info *pinfo,
int timestamp_sequence;
int lifetime;
char *time_string;
- gchar *src_node;
- gchar *dst_node;
+ const gchar *src_node;
+ const gchar *dst_node;
guint8 srrflags;
proto_item *srr_flag_item = NULL;
proto_tree *srr_flag_tree = NULL;
@@ -2060,7 +2060,7 @@ evaluate_sdnv_64(tvbuff_t *tvb, int offset, int *bytecount)
}
static int
-add_sdnv_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_id)
+add_sdnv_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, const char *field_id)
{
int sdnv_length;
int sdnv_value;
@@ -2078,7 +2078,7 @@ add_sdnv_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_id)
* Returns bytes in both SDNVs or 0 if something goes wrong.
*/
static int
-add_dtn_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_id)
+add_dtn_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, const char *field_id)
{
int sdnv_length, sdnv2_length;
int sdnv_value;
@@ -2109,7 +2109,7 @@ add_dtn_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_id
* Returns bytes in SDNV or 0 if something goes wrong.
*/
static int
-add_sdnv_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_id)
+add_sdnv_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, const char *field_id)
{
int sdnv_length;
int sdnv_value;
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index 6770813d3c..d6c520ca03 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -123,7 +123,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
proto_tree *volatile tree;
proto_item *item;
guint32 frame_number;
- gchar *cap_plurality, *frame_plurality;
+ const gchar *cap_plurality, *frame_plurality;
frame_number=pinfo->fd->num; /* dummy so that the buildbot crashdumps
will show the packetnumber where the
diff --git a/epan/dissectors/packet-gsm_a_gm.c b/epan/dissectors/packet-gsm_a_gm.c
index f6e3b3e320..7bd031cf4d 100644
--- a/epan/dissectors/packet-gsm_a_gm.c
+++ b/epan/dissectors/packet-gsm_a_gm.c
@@ -4306,7 +4306,7 @@ de_sm_mbms_bearer_cap(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len
{
guint32 curr_offset, temp32;
guint8 oct;
- gchar *str;
+ const gchar *str;
curr_offset = offset;
@@ -4371,7 +4371,7 @@ static guint16
de_sm_enh_nsapi(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{
guint8 oct;
- gchar *str;
+ const gchar *str;
oct = tvb_get_guint8(tvb, offset);
diff --git a/epan/dissectors/packet-mikey.c b/epan/dissectors/packet-mikey.c
index ec3880038d..83e32ab8c1 100644
--- a/epan/dissectors/packet-mikey.c
+++ b/epan/dissectors/packet-mikey.c
@@ -863,7 +863,7 @@ dissect_payload_t(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pro
switch (ts_type) {
case T_NTP:
case T_NTP_UTC: {
- gchar *buff;
+ const gchar *buff;
tvb_ensure_bytes_exist(tvb, offset+2, 8);
buff = ntp_fmt_ts(tvb_get_ptr(tvb, offset+2, 8));
diff --git a/epan/dissectors/packet-nasdaq-itch.c b/epan/dissectors/packet-nasdaq-itch.c
index ce050e94f2..a9eb17f39a 100644
--- a/epan/dissectors/packet-nasdaq-itch.c
+++ b/epan/dissectors/packet-nasdaq-itch.c
@@ -210,7 +210,7 @@ time_stamp(tvbuff_t *tvb, proto_tree *nasdaq_itch_tree, int id, int offset, int
if (nasdaq_itch_tree) {
guint32 ms, val;
- char *display = "";
+ const char *display = "";
ms = val = nasdaq_itch_atou(str_value, size);
switch (size) {
diff --git a/epan/dissectors/packet-ncp-sss.c b/epan/dissectors/packet-ncp-sss.c
index 9dc5f8a58e..4840107954 100644
--- a/epan/dissectors/packet-ncp-sss.c
+++ b/epan/dissectors/packet-ncp-sss.c
@@ -170,9 +170,9 @@ static void
process_flags(proto_tree *sss_tree, tvbuff_t *tvb, guint32 foffset)
{
gchar flags_str[1024];
- gchar *sep;
- proto_item *tinew;
- proto_tree *flags_tree;
+ const gchar *sep;
+ proto_item *tinew;
+ proto_tree *flags_tree;
guint32 i;
guint32 bvalue = 0;
guint32 flags = 0;
diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c
index 7f846df44f..436f2c9cee 100644
--- a/epan/dissectors/packet-ntlmssp.c
+++ b/epan/dissectors/packet-ntlmssp.c
@@ -282,7 +282,7 @@ typedef struct _ntlmssp_packet_info {
} ntlmssp_packet_info;
#ifdef DEBUG_NTLMSSP
-static void printnbyte(const guint8* tab,int nb,char* txt,char* txt2)
+static void printnbyte(const guint8* tab,int nb,const char* txt,const char* txt2)
{
int i=0;
fprintf(stderr,"%s ",txt);
@@ -305,7 +305,7 @@ static void printnbyte(const guint8* tab,int nb,char* txt,char* txt2)
}
*/
#else
-static void printnbyte(const guint8* tab _U_,int nb _U_, char* txt _U_,char* txt2 _U_)
+static void printnbyte(const guint8* tab _U_,int nb _U_, const char* txt _U_,const char* txt2 _U_)
{
}
#endif
@@ -1149,7 +1149,7 @@ dissect_ntlmv2_response(tvbuff_t *tvb, proto_tree *tree, int offset, int len)
guint16 name_len = tvb_get_letohs(tvb, offset + 2);
proto_tree *name_tree = NULL;
proto_item *name_item = NULL;
- char *name = NULL;
+ const char *name = NULL;
if (ntlmv2_tree) {
name_item = proto_tree_add_item(
diff --git a/epan/dissectors/packet-ntp.c b/epan/dissectors/packet-ntp.c
index 3d3cfce649..a471348b42 100644
--- a/epan/dissectors/packet-ntp.c
+++ b/epan/dissectors/packet-ntp.c
@@ -572,7 +572,7 @@ static tvbparse_wanted_t* want_ignore;
* returns pointer to filled buffer. This buffer will be freed automatically once
* dissection of the next packet occurs.
*/
-char *
+const char *
ntp_fmt_ts(const guint8 *reftime)
{
guint32 tempstmp, tempfrac;
@@ -664,7 +664,8 @@ dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
const guint8 *org;
const guint8 *rec;
const guint8 *xmt;
- gchar *buff;
+ const gchar *buffc;
+ gchar *buff;
int i;
int macofs;
gint maclen;
@@ -681,16 +682,16 @@ dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
*/
stratum = tvb_get_guint8(tvb, 1);
if (stratum == 0) {
- buff="Peer Clock Stratum: unspecified or unavailable (%u)";
+ buffc="Peer Clock Stratum: unspecified or unavailable (%u)";
} else if (stratum == 1) {
- buff="Peer Clock Stratum: primary reference (%u)";
+ buffc="Peer Clock Stratum: primary reference (%u)";
} else if ((stratum >= 2) && (stratum <= 15)) {
- buff="Peer Clock Stratum: secondary reference (%u)";
+ buffc="Peer Clock Stratum: secondary reference (%u)";
} else {
- buff="Peer Clock Stratum: reserved: %u";
+ buffc="Peer Clock Stratum: reserved: %u";
}
proto_tree_add_uint_format(ntp_tree, hf_ntp_stratum, tvb, 1, 1,
- stratum, buff, stratum);
+ stratum, buffc, stratum);
/* Poll interval, 1byte field indicating the maximum interval
* between successive messages, in seconds to the nearest
* power of two.
diff --git a/epan/dissectors/packet-ntp.h b/epan/dissectors/packet-ntp.h
index f52bba51c9..fe41606a1b 100644
--- a/epan/dissectors/packet-ntp.h
+++ b/epan/dissectors/packet-ntp.h
@@ -32,6 +32,6 @@
#define NTP_BASETIME 2208988800ul
#define NTP_TS_SIZE 100
-extern char * ntp_fmt_ts(const guint8 *reftime);
+extern const char * ntp_fmt_ts(const guint8 *reftime);
#endif
diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c
index 4b5da8db27..ea06006263 100644
--- a/epan/dissectors/packet-ppp.c
+++ b/epan/dissectors/packet-ppp.c
@@ -1832,7 +1832,7 @@ dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
proto_tree *tree)
{
guint32 map;
- char *mapstr;
+ const char *mapstr;
static const char *ctrlchars[32] = {
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "HT", "NL", "VT", "NP (FF)", "CR", "SO", "SI",
@@ -1849,9 +1849,9 @@ dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
*/
map = tvb_get_ntohl(tvb, offset + 2);
if (map == 0x00000000)
- mapstr = "None"; /* don't map any control characters */
+ mapstr = "None"; /* don't map any control characters */
else if (map == 0xffffffff)
- mapstr = "All"; /* map all control characters */
+ mapstr = "All"; /* map all control characters */
else {
#define MAX_MAPSTR_LEN (32*(10+2)+1)
mapstr=ep_alloc(MAX_MAPSTR_LEN);
@@ -1861,7 +1861,7 @@ dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
str_index = 0;
for (i = 0; i < 32; i++) {
if (map & (1 << i)) {
- returned_length = g_snprintf(&mapstr[str_index], MAX_MAPSTR_LEN-str_index,
+ returned_length = g_snprintf((char *)(&mapstr[str_index]), MAX_MAPSTR_LEN-str_index,
"%s%s", str_index?"":", ", ctrlchars[i]);
str_index += MIN(returned_length, MAX_MAPSTR_LEN-str_index);
}
diff --git a/epan/dissectors/packet-ptp.c b/epan/dissectors/packet-ptp.c
index 6ac07d96aa..c34a63e2b4 100644
--- a/epan/dissectors/packet-ptp.c
+++ b/epan/dissectors/packet-ptp.c
@@ -2232,7 +2232,7 @@ dissect_ptp_v2_text(tvbuff_t *tvb, guint16 *cur_offset, proto_tree *tree, int hf
}
static void
-dissect_ptp_v2_timeInterval(tvbuff_t *tvb, guint16 *cur_offset, proto_tree *tree, char* name, int hf_ptp_v2_timeInterval_ns, int hf_ptp_v2_timeInterval_subns)
+dissect_ptp_v2_timeInterval(tvbuff_t *tvb, guint16 *cur_offset, proto_tree *tree, const char* name, int hf_ptp_v2_timeInterval_ns, int hf_ptp_v2_timeInterval_subns)
{
double time_double;
diff --git a/epan/dissectors/packet-pvfs2.c b/epan/dissectors/packet-pvfs2.c
index 0824fcd5fc..9f6c39d02e 100644
--- a/epan/dissectors/packet-pvfs2.c
+++ b/epan/dissectors/packet-pvfs2.c
@@ -750,7 +750,7 @@ dissect_pvfs_opaque_data(tvbuff_t *tvb, int offset,
packet_info *pinfo _U_,
int hfindex,
gboolean fixed_length, guint32 length,
- gboolean string_data, char **string_buffer_ret)
+ gboolean string_data, char const **string_buffer_ret)
{
int data_offset;
proto_item *string_item = NULL;
@@ -771,7 +771,7 @@ dissect_pvfs_opaque_data(tvbuff_t *tvb, int offset,
int exception = 0;
char *string_buffer = NULL;
- char *string_buffer_print = NULL;
+ const char *string_buffer_print = NULL;
if (fixed_length) {
string_length = length;
@@ -873,7 +873,7 @@ dissect_pvfs_opaque_data(tvbuff_t *tvb, int offset,
/* alloc maximum data area */
string_buffer_print = (char*) ep_alloc(string_buffer_size);
/* copy over the data */
- g_snprintf(string_buffer_print, string_buffer_size,
+ g_snprintf((char *)string_buffer_print, string_buffer_size,
"%s<TRUNCATED>", formatted);
/* append <TRUNCATED> */
/* This way, we get the TRUNCATED even
@@ -888,7 +888,7 @@ dissect_pvfs_opaque_data(tvbuff_t *tvb, int offset,
}
} else {
if (string_data) {
- string_buffer_print = (char *)
+ string_buffer_print =
ep_strdup(format_text((guint8 *) string_buffer,
(int)strlen(string_buffer)));
} else {
@@ -965,7 +965,7 @@ dissect_pvfs_opaque_data(tvbuff_t *tvb, int offset,
static int
dissect_pvfs_string(tvbuff_t *tvb, proto_tree *tree, int hfindex,
- int offset, char **string_buffer_ret)
+ int offset, const char **string_buffer_ret)
{
return dissect_pvfs_opaque_data(tvb, offset, tree, NULL, hfindex,
FALSE, 0, TRUE, string_buffer_ret);
@@ -1174,7 +1174,6 @@ dissect_pvfs_distribution(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *dist_item = NULL;
proto_tree *dist_tree = NULL;
- char *distname = NULL;
guint32 distlen = 0;
char *tmpstr = NULL;
guint8 issimplestripe = 0;
@@ -1211,7 +1210,7 @@ dissect_pvfs_distribution(tvbuff_t *tvb, proto_tree *tree, int offset)
/* io_dist */
offset = dissect_pvfs_string(tvb, dist_tree, hf_pvfs_io_dist, offset,
- &distname);
+ NULL);
/* TODO: only one distribution type is currently supported */
if (issimplestripe)
diff --git a/epan/dissectors/packet-rmi.c b/epan/dissectors/packet-rmi.c
index 65ebcbe68e..522d87f435 100644
--- a/epan/dissectors/packet-rmi.c
+++ b/epan/dissectors/packet-rmi.c
@@ -124,7 +124,7 @@ dissect_rmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
rmi_type rmitype;
- char *epid_hostname;
+ const char *epid_hostname;
guint epid_len;
offset = 0;