Squelch some compiler warnings.
authorGuy Harris <guy@alum.mit.edu>
Sun, 6 Jul 2014 23:48:06 +0000 (16:48 -0700)
committerGuy Harris <guy@alum.mit.edu>
Sun, 6 Jul 2014 23:49:04 +0000 (23:49 +0000)
Change-Id: Ie39c7b0c1fef8f862cec016a3a1a5bd1451a3df2
Reviewed-on: https://code.wireshark.org/review/2905
Reviewed-by: Guy Harris <guy@alum.mit.edu>
epan/dissectors/packet-bacapp.c
epan/dissectors/packet-cip.c

index c629120bf03cb7d309f41079b70733b69e8ccafa..e7c15cc8ccedc1bf8834c50db7541a021089f767 100644 (file)
@@ -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*
index 79dfef3a47451761837c321b1b7acb48ddc77348..9e8a089b5b320e91b7ba0600fb1385018e797203 100644 (file)
@@ -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)