diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-07-06 16:48:06 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-07-06 23:49:04 +0000 |
commit | 79fcc6a1a36e0637ce21f65a7e27bc6d90213509 (patch) | |
tree | eb18fc856f5228dc614a619085e236af282feb53 /epan/dissectors/packet-cip.c | |
parent | f2b4daf4005d60eef7e34e2e6ebf4fe487d3c255 (diff) | |
download | wireshark-79fcc6a1a36e0637ce21f65a7e27bc6d90213509.tar.gz |
Squelch some compiler warnings.
Change-Id: Ie39c7b0c1fef8f862cec016a3a1a5bd1451a3df2
Reviewed-on: https://code.wireshark.org/review/2905
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-cip.c')
-rw-r--r-- | epan/dissectors/packet-cip.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c index 79dfef3a47..9e8a089b5b 100644 --- a/epan/dissectors/packet-cip.c +++ b/epan/dissectors/packet-cip.c @@ -3129,6 +3129,23 @@ attribute_info_t* cip_get_attribute(guint class_id, guint instance, guint attrib return NULL; } +static const char * +segment_name_format(const char *segment_name, const char *fmt) +#if __GNUC__ >= 2 + __attribute__ ((format_arg (2))) +#endif +; + +static const char * +segment_name_format(const char *segment_name, const char *fmt) +{ + wmem_strbuf_t *strbuf; + + strbuf = wmem_strbuf_new(wmem_packet_scope(), segment_name); + wmem_strbuf_append(strbuf, fmt); + return wmem_strbuf_get_str(strbuf); +} + static gboolean dissect_cia(tvbuff_t *tvb, int offset, int* pathpos, unsigned char segment_type, gboolean generate, gboolean packed, packet_info *pinfo, proto_item *epath_item, @@ -3160,10 +3177,7 @@ dissect_cia(tvbuff_t *tvb, int offset, int* pathpos, unsigned char segment_type, } else { - strbuf = wmem_strbuf_new(wmem_packet_scope(), segment_name); - wmem_strbuf_append(strbuf, ": 0x%02X"); - - proto_item_append_text( epath_item, "%s", val_to_str( temp_data, vals , wmem_strbuf_get_str(strbuf)) ); + proto_item_append_text( epath_item, "%s", val_to_str( temp_data, vals, segment_name_format( segment_name, ": 0x%02X" ) ) ); } if (value != NULL) @@ -3209,7 +3223,7 @@ dissect_cia(tvbuff_t *tvb, int offset, int* pathpos, unsigned char segment_type, strbuf = wmem_strbuf_new(wmem_packet_scope(), segment_name); wmem_strbuf_append(strbuf, ": 0x%04X"); - proto_item_append_text( epath_item, "%s", val_to_str( temp_data, vals , wmem_strbuf_get_str(strbuf)) ); + proto_item_append_text( epath_item, "%s", val_to_str( temp_data, vals, segment_name_format( segment_name, ": 0x%04X" ) ) ); } if (value != NULL) @@ -3264,7 +3278,7 @@ dissect_cia(tvbuff_t *tvb, int offset, int* pathpos, unsigned char segment_type, strbuf = wmem_strbuf_new(wmem_packet_scope(), segment_name); wmem_strbuf_append(strbuf, ": 0x%08X"); - proto_item_append_text( epath_item, "%s", val_to_str( temp_data, vals , wmem_strbuf_get_str(strbuf)) ); + proto_item_append_text( epath_item, "%s", val_to_str( temp_data, vals, segment_name_format( segment_name, ": 0x%08X" ) ) ); } if (value != NULL) |