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 | |
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')
-rw-r--r-- | epan/dissectors/packet-bacapp.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-cip.c | 26 |
2 files changed, 27 insertions, 8 deletions
diff --git a/epan/dissectors/packet-bacapp.c b/epan/dissectors/packet-bacapp.c index c629120bf0..e7c15cc8cc 100644 --- a/epan/dissectors/packet-bacapp.c +++ b/epan/dissectors/packet-bacapp.c @@ -2319,8 +2319,8 @@ fApplicationTypesEnumerated(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gchar *label, const value_string *vs); static const char *bacapp_unknown_service_str = "unknown service"; /* Usage: no format specifiers */ -static const char *ASHRAE_Reserved_Fmt = "(%d) Reserved for Use by ASHRAE"; -static const char *Vendor_Proprietary_Fmt = "(%d) Vendor Proprietary Value"; +static const char ASHRAE_Reserved_Fmt[] = "(%d) Reserved for Use by ASHRAE"; +static const char Vendor_Proprietary_Fmt[] = "(%d) Vendor Proprietary Value"; static const value_string BACnetTypeName[] = { @@ -5080,6 +5080,11 @@ fGetMaxAPDUSize(guint8 idx) } #endif +static const char* +val_to_split_str(guint32 val, guint32 split_val, const value_string *vs, + const char *fmt, const char *split_fmt) + G_GNUC_PRINTF(4, 0) + G_GNUC_PRINTF(5, 0); /* Used when there are ranges of reserved and proprietary enumerations */ static const char* 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) |