aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-btatt.c14
-rw-r--r--epan/dissectors/packet-diameter.c21
-rw-r--r--epan/dissectors/packet-xml.c6
-rw-r--r--epan/oids.c17
4 files changed, 35 insertions, 23 deletions
diff --git a/epan/dissectors/packet-btatt.c b/epan/dissectors/packet-btatt.c
index a6c2a86db9..2123b66496 100644
--- a/epan/dissectors/packet-btatt.c
+++ b/epan/dissectors/packet-btatt.c
@@ -14046,6 +14046,7 @@ void
proto_reg_handoff_btatt(void)
{
gint i_array;
+ GString *uuid_str = g_string_new("");
http_handle = find_dissector_add_dependency("http", proto_btatt);
usb_hid_boot_keyboard_input_report_handle = find_dissector_add_dependency("usbhid.boot_report.keyboard.input", proto_btatt);
@@ -14072,18 +14073,19 @@ proto_reg_handoff_btatt(void)
continue;
}
- name = wmem_strdup_printf(wmem_epan_scope(), "Bluetooth GATT Attribute %s (UUID 0x%04x)",
- bluetooth_uuid_vals[i_array].strptr, bluetooth_uuid_vals[i_array].value);
- short_name = wmem_strdup_printf(wmem_epan_scope(), "BT GATT %s (UUID 0x%04x)",
- bluetooth_uuid_vals[i_array].strptr, bluetooth_uuid_vals[i_array].value);
- abbrev = wmem_strdup_printf(wmem_epan_scope(), "btgatt.uuid0x%04x",
- bluetooth_uuid_vals[i_array].value);
+ g_string_printf(uuid_str, "0x%04x", bluetooth_uuid_vals[i_array].value);
+ name = wmem_strconcat(wmem_epan_scope(), "Bluetooth GATT Attribute ",
+ bluetooth_uuid_vals[i_array].strptr, " (UUID ", uuid_str->str, ")", NULL);
+ short_name = wmem_strconcat(wmem_epan_scope(), "BT GATT ",
+ bluetooth_uuid_vals[i_array].strptr, " (UUID ", uuid_str->str, ")", NULL);
+ abbrev = wmem_strconcat(wmem_epan_scope(), "btgatt.uuid", uuid_str->str, NULL);
proto_tmp = proto_register_protocol(name, short_name, abbrev);
handle_tmp = register_dissector(abbrev, dissect_btgatt, proto_tmp);
dissector_add_for_decode_as("btatt.handle", handle_tmp);
}
+ g_string_free(uuid_str, TRUE);
}
void
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 46c0037bb6..1d2100f1fa 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -1654,20 +1654,20 @@ build_address_avp(const avp_type_t *type _U_, guint32 code,
basic_avp_reginfo(a, name, FT_BYTES, BASE_NONE, NULL);
- reginfo(&(t->hf_address_type), wmem_strdup_printf(wmem_epan_scope(), "%s Address Family",name),
- alnumerize(wmem_strdup_printf(wmem_epan_scope(), "diameter.%s.addr_family",name)),
+ reginfo(&(t->hf_address_type), wmem_strconcat(wmem_epan_scope(), name, " Address Family", NULL),
+ alnumerize(wmem_strconcat(wmem_epan_scope(), "diameter.", name, ".addr_family", NULL)),
NULL, FT_UINT16, (field_display_e)(BASE_DEC|BASE_EXT_STRING), &diameter_avp_data_addrfamily_vals_ext, 0);
- reginfo(&(t->hf_ipv4), wmem_strdup_printf(wmem_epan_scope(), "%s Address",name),
- alnumerize(wmem_strdup_printf(wmem_epan_scope(), "diameter.%s.IPv4",name)),
+ reginfo(&(t->hf_ipv4), wmem_strconcat(wmem_epan_scope(), name, " Address", NULL),
+ alnumerize(wmem_strconcat(wmem_epan_scope(), "diameter.", name, ".IPv4", NULL)),
NULL, FT_IPv4, BASE_NONE, NULL, 0);
- reginfo(&(t->hf_ipv6), wmem_strdup_printf(wmem_epan_scope(), "%s Address",name),
- alnumerize(wmem_strdup_printf(wmem_epan_scope(), "diameter.%s.IPv6",name)),
+ reginfo(&(t->hf_ipv6), wmem_strconcat(wmem_epan_scope(), name, " Address", NULL),
+ alnumerize(wmem_strconcat(wmem_epan_scope(), "diameter.", name, ".IPv6", NULL)),
NULL, FT_IPv6, BASE_NONE, NULL, 0);
- reginfo(&(t->hf_other), wmem_strdup_printf(wmem_epan_scope(), "%s Address",name),
- alnumerize(wmem_strdup_printf(wmem_epan_scope(), "diameter.%s.Bytes",name)),
+ reginfo(&(t->hf_other), wmem_strconcat(wmem_epan_scope(), name, " Address", NULL),
+ alnumerize(wmem_strconcat(wmem_epan_scope(), "diameter.", name, ".Bytes", NULL)),
NULL, FT_BYTES, BASE_NONE, NULL, 0);
g_ptr_array_add(build_dict.ett,ettp);
@@ -1733,7 +1733,7 @@ build_simple_avp(const avp_type_t *type, guint32 code, diam_vnd_t *vendor,
while (vs[i].strptr) {
i++;
}
- vs_ext = value_string_ext_new(vs, i+1, wmem_strdup_printf(wmem_epan_scope(), "%s_vals_ext",name));
+ vs_ext = value_string_ext_new(vs, i+1, wmem_strconcat(wmem_epan_scope(), name, "_vals_ext", NULL));
base = (field_display_e)(base|BASE_EXT_STRING);
}
@@ -1899,6 +1899,7 @@ dictionary_load(void)
/* load the dictionary */
dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "diameter" G_DIR_SEPARATOR_S, get_datafile_dir());
+ /* XXX We don't call ddict_free anywhere. */
d = ddict_scan(dir,"dictionary.xml",do_debug_parser);
g_free(dir);
if (d == NULL) {
@@ -1962,7 +1963,7 @@ dictionary_load(void)
dictionary.applications = value_string_ext_new((value_string *)wmem_array_get_raw(arr),
wmem_array_get_count(arr),
- wmem_strdup_printf(wmem_epan_scope(), "applications_vals_ext"));
+ wmem_strdup(wmem_epan_scope(), "applications_vals_ext"));
}
if ((v = d->vendors)) {
diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c
index 841be638dc..3bc13099e2 100644
--- a/epan/dissectors/packet-xml.c
+++ b/epan/dissectors/packet-xml.c
@@ -210,7 +210,7 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
colinfo_str = "/XML";
} else {
char *colinfo_str_buf;
- colinfo_str_buf = wmem_strdup_printf(wmem_packet_scope(), "/%s", root_ns->name);
+ colinfo_str_buf = wmem_strconcat(wmem_packet_scope(), "/", root_ns->name, NULL);
ascii_strup_inplace(colinfo_str_buf);
colinfo_str = colinfo_str_buf;
}
@@ -832,7 +832,7 @@ static void add_xml_field(wmem_array_t *hfs, int *p_id, const gchar *name, const
static void add_xml_attribute_names(gpointer k, gpointer v, gpointer p)
{
struct _attr_reg_data *d = (struct _attr_reg_data *)p;
- const gchar *basename = wmem_strdup_printf(wmem_epan_scope(), "%s.%s", d->basename, (gchar *)k);
+ const gchar *basename = wmem_strconcat(wmem_epan_scope(), d->basename, ".", (gchar *)k, NULL);
add_xml_field(d->hf, (int*) v, (gchar *)k, basename);
}
@@ -841,7 +841,7 @@ static void add_xml_attribute_names(gpointer k, gpointer v, gpointer p)
static void add_xmlpi_namespace(gpointer k _U_, gpointer v, gpointer p)
{
xml_ns_t *ns = (xml_ns_t *)v;
- const gchar *basename = wmem_strdup_printf(wmem_epan_scope(), "%s.%s", (gchar *)p, ns->name);
+ const gchar *basename = wmem_strconcat(wmem_epan_scope(), (gchar *)p, ".", ns->name, NULL);
gint *ett_p = &(ns->ett);
struct _attr_reg_data d;
diff --git a/epan/oids.c b/epan/oids.c
index 9d14838fc8..5230c37c8b 100644
--- a/epan/oids.c
+++ b/epan/oids.c
@@ -437,7 +437,7 @@ static inline oid_kind_t smikind(SmiNode* sN, oid_key_t** key_p) {
oid1 = smiRenderOID(sN->oidlen, sN->oid, SMI_RENDER_QUALIFIED);
oid2 = smiRenderOID(elNode->oidlen, elNode->oid, SMI_RENDER_NAME);
- k->name = g_strdup_printf("%s.%s", oid1, oid2);
+ k->name = g_strconcat(oid1, ".", oid2, NULL);
smi_free (oid1);
smi_free (oid2);
@@ -696,8 +696,8 @@ static void register_mibs(void) {
bits->data[n].hfid = -1;
bits->data[n].offset = smiEnum->value.value.integer32 / 8;
- hf2.hfinfo.name = g_strdup_printf("%s:%s",oid_data->name,smiEnum->name);
- hf2.hfinfo.abbrev = g_strdup_printf("%s.%s",base,ext);
+ hf2.hfinfo.name = g_strconcat("%s:%s",oid_data->name, ":", smiEnum->name, NULL);
+ hf2.hfinfo.abbrev = g_strconcat(base, ".", ext, NULL);
g_free(base);
g_free(ext);
@@ -872,7 +872,16 @@ char* rel_oid_subid2string(wmem_allocator_t *scope, guint32* subids, guint len,
*w++ = '.';
do {
+#ifdef _WIN32
+ /*
+ * GLib appears to use gnulib's snprintf on Windows, which is
+ * slow. MSDN says that _snprintf can return -1, but that
+ * shouldn't be possible here.
+ */
+ w += _snprintf(w,12,"%u.",*subids++);
+#else
w += g_snprintf(w,12,"%u.",*subids++);
+#endif
} while(--len);
if (w!=s) *(w-1) = '\0'; else *(s) = '\0';
@@ -1212,7 +1221,7 @@ gchar *oid_resolved(wmem_allocator_t *scope, guint32 num_subids, guint32* subids
*str1 = oid_subid2string(NULL, subids,matched),
*str2 = oid_subid2string(NULL, &(subids[matched]),left);
- ret = wmem_strdup_printf(scope, "%s.%s", oid->name ? oid->name : str1, str2);
+ ret = wmem_strconcat(scope, oid->name ? oid->name : str1, ".", str2, NULL);
wmem_free(NULL, str1);
wmem_free(NULL, str2);
return ret;