From e5cfd9e13a0b6372b87727167843fa61d4926f95 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 9 May 2014 00:50:51 -0700 Subject: [PATCH] Squelch compiler warnings. Some are legitimate warnings - get_node_field_value() now returns a value that the callers are expected to g_free(), so we'd better not return a string constant. Change-Id: I937254316119044691c1d9a3da8c9615763e2e5a Reviewed-on: https://code.wireshark.org/review/1571 Reviewed-by: Guy Harris --- epan/print.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/epan/print.c b/epan/print.c index aee5f59cef..36a8bc7d25 100644 --- a/epan/print.c +++ b/epan/print.c @@ -1740,7 +1740,7 @@ void write_fields_finale(output_fields_t* fields _U_ , FILE *fh _U_) /* Nothing to do */ } -/* Returns an ep_alloced string or a static constant*/ +/* Returns an g_malloced string */ gchar* get_node_field_value(field_info* fi, epan_dissect_t* edt) { if (fi->hfinfo->id == hf_text_only) { @@ -1776,7 +1776,7 @@ gchar* get_node_field_value(field_info* fi, epan_dissect_t* edt) case FT_NONE: /* Return "1" so that the presence of a field of type * FT_NONE can be checked when using -T fields */ - return "1"; + return g_strdup("1"); default: dfilter_string = fvalue_to_string_repr(&fi->value, FTREPR_DISPLAY, NULL); if (dfilter_string != NULL) { @@ -1809,7 +1809,7 @@ get_field_hex_value(GSList *src_list, field_info *fi) return NULL; if (fi->length > tvb_length_remaining(fi->ds_tvb, fi->start)) { - return "field length invalid!"; + return g_strdup("field length invalid!"); } /* Find the data for this field. */ @@ -1823,7 +1823,7 @@ get_field_hex_value(GSList *src_list, field_info *fi) const int chars_per_byte = 2; len = chars_per_byte * fi->length; - buffer = g_malloc(sizeof(gchar)*(len + 1)); + buffer = (gchar *)g_malloc(sizeof(gchar)*(len + 1)); buffer[len] = '\0'; /* Ensure NULL termination in bad cases */ p = buffer; /* Print a simple hex dump */