aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-06-16 18:34:17 +0000
committerGuy Harris <guy@alum.mit.edu>2011-06-16 18:34:17 +0000
commit4447b23f6b1199e8bcf67905638b1dbee7c4771f (patch)
tree18a833451be1d0d74ba92dc86674248fe8779515 /epan
parent0b2cb8a57550f0bc13d220860c61525ef27b8ac8 (diff)
Squelch some compiler warnings.
svn path=/trunk/; revision=37685
Diffstat (limited to 'epan')
-rw-r--r--epan/proto.c9
-rw-r--r--epan/strutil.c10
-rw-r--r--epan/tvbuff.c2
-rw-r--r--epan/tvbuff.h2
4 files changed, 14 insertions, 9 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 5301665853..1d3a922dd9 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1226,7 +1226,7 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree,
guint32 value, n;
float floatval;
double doubleval;
- char *string;
+ const char *string;
nstime_t time_stamp;
GPtrArray *ptrs;
@@ -1458,12 +1458,15 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree,
* we're putting this item.
*/
if (length == -1) {
+ gchar *string_writable;
+
/* This can throw an exception */
length = tvb_strsize(tvb, start);
- string = ep_alloc(length);
+ string_writable = ep_alloc(length);
- tvb_memcpy(tvb, string, start, length);
+ tvb_memcpy(tvb, string_writable, start, length);
+ string = string_writable;
} else if (length == 0) {
string = "[Empty]";
} else {
diff --git a/epan/strutil.c b/epan/strutil.c
index 62c2b163b1..790eb5c4bd 100644
--- a/epan/strutil.c
+++ b/epan/strutil.c
@@ -1021,12 +1021,13 @@ IA5_7BIT_decode(unsigned char * dest, const unsigned char* src, int len)
gchar*
ws_strdup_escape_char (const gchar *str, const gchar chr)
{
- gchar *p, *q, *new_str;
+ const gchar *p;
+ gchar *q, *new_str;
if(!str)
return NULL;
- p = (gchar *)str;
+ p = str;
/* Worst case: A string that is full of 'chr' */
q = new_str = g_malloc (strlen(str) * 2 + 1);
@@ -1049,12 +1050,13 @@ ws_strdup_escape_char (const gchar *str, const gchar chr)
gchar*
ws_strdup_unescape_char (const gchar *str, const char chr)
{
- gchar *p, *q, *new_str;
+ const gchar *p;
+ gchar *q, *new_str;
if(!str)
return NULL;
- p = (gchar *)str;
+ p = str;
/* Worst case: A string that contains no 'chr' */
q = new_str = g_malloc (strlen(str) + 1);
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index 24196cfb1b..cec87ce17e 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -3183,7 +3183,7 @@ static dgt_set_t Dgt1_9_bcd = {
'0','1','2','3','4','5','6','7','8','9','?','?','?','?','?'
}
};
-gchar *
+const gchar *
tvb_bcd_dig_to_ep_str(tvbuff_t *tvb, const gint offset, const gint len, dgt_set_t *dgt, gboolean skip_first)
{
int length;
diff --git a/epan/tvbuff.h b/epan/tvbuff.h
index 74bdeed12f..4a187332cb 100644
--- a/epan/tvbuff.h
+++ b/epan/tvbuff.h
@@ -627,7 +627,7 @@ typedef struct dgt_set_t
}
dgt_set_t;
-extern gchar *tvb_bcd_dig_to_ep_str(tvbuff_t *tvb, const gint offset, const gint len, dgt_set_t *dgt, gboolean skip_first);
+extern const gchar *tvb_bcd_dig_to_ep_str(tvbuff_t *tvb, const gint offset, const gint len, dgt_set_t *dgt, gboolean skip_first);
struct tvbuff *tvb_get_ds_tvb(tvbuff_t *tvb);