diff options
author | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-08-08 18:50:39 +0000 |
---|---|---|
committer | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-08-08 18:50:39 +0000 |
commit | d615067ecfe859cadfb09c0896864a4bff299d4f (patch) | |
tree | ae44175ca8fd23548fcec5833098b535af5e372c /epan/dissectors | |
parent | b5ff280c656047376ee397671794e3b15e7ac3ae (diff) |
various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15264 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors')
75 files changed, 73 insertions, 323 deletions
diff --git a/epan/dissectors/packet-afp.c b/epan/dissectors/packet-afp.c index 96300383a1..8f95ea68a5 100644 --- a/epan/dissectors/packet-afp.c +++ b/epan/dissectors/packet-afp.c @@ -33,10 +33,6 @@ #include <stdio.h> #include <string.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <string.h> #include <glib.h> #include <epan/packet.h> diff --git a/epan/dissectors/packet-amr.c b/epan/dissectors/packet-amr.c index a6bc974511..31fd1e8ac6 100644 --- a/epan/dissectors/packet-amr.c +++ b/epan/dissectors/packet-amr.c @@ -37,10 +37,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "prefs.h" diff --git a/epan/dissectors/packet-aoe.c b/epan/dissectors/packet-aoe.c index 4605b7b1c3..e0cfd48d50 100644 --- a/epan/dissectors/packet-aoe.c +++ b/epan/dissectors/packet-aoe.c @@ -27,10 +27,6 @@ #include <string.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/conversation.h> #include <etypes.h> diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index 7a5bffb5a6..824129804d 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -1706,10 +1706,9 @@ dissect_ber_GeneralizedTime(gboolean implicit_tag, packet_info *pinfo, proto_tre tmpstr=tvb_get_ptr(tvb, offset, len); - snprintf(str, 31, "%.4s-%.2s-%.2s %.2s:%.2s:%.2s (%.1s)", + g_snprintf(str, 32, "%.4s-%.2s-%.2s %.2s:%.2s:%.2s (%.1s)", tmpstr, tmpstr+4, tmpstr+6, tmpstr+8, tmpstr+10, tmpstr+12, tmpstr+14); - str[31]=0; /* just in case ... */ if(hf_id!=-1){ proto_tree_add_string(tree, hf_id, tvb, offset, len, str); diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index 6ca5173532..f1886c3f06 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -51,10 +51,6 @@ #include <string.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/addr_and_mask.h> #include "packet-bgp.h" @@ -481,11 +477,11 @@ decode_MPLS_stack(tvbuff_t *tvb, gint offset, char *buf, size_t buflen) /* withdrawn routes may contain 0 or 0x800000 in the first label */ if((index-offset)==0&&(label_entry==0||label_entry==0x800000)) { - snprintf(buf, buflen, "0 (withdrawn)"); + g_snprintf(buf, buflen, "0 (withdrawn)"); return (1); } - snprintf(junk_buf, sizeof(junk_buf),"%u%s", (label_entry >> 4), ((label_entry & 0x000001) == 0) ? "," : " (bottom)"); + g_snprintf(junk_buf, sizeof(junk_buf),"%u%s", (label_entry >> 4), ((label_entry & 0x000001) == 0) ? "," : " (bottom)"); if (strlen(buf) + strlen(junk_buf) + 1 <= buflen) strcat(buf, junk_buf); index += 3 ; diff --git a/epan/dissectors/packet-brdwlk.c b/epan/dissectors/packet-brdwlk.c index 1fce4130d8..10545e8e53 100644 --- a/epan/dissectors/packet-brdwlk.c +++ b/epan/dissectors/packet-brdwlk.c @@ -41,10 +41,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "etypes.h" diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 38a11acac9..7505215ccc 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -4124,16 +4124,7 @@ decode_ie(bssgp_ie_t *ie, build_info_t *bi) { } if (use_default_ie_name) { - ie->name = g_malloc(strlen(iename) + 1); - if (ie->name == NULL) { -#ifdef BSSGP_DEBUG - proto_tree_add_text(bi->bssgp_tree, bi->tvb, bi->offset, 1, - "Out of memory"); -#endif - /* Out of memory */ - exit(EXIT_FAILURE); - } - strcpy(ie->name, iename); + ie->name = g_strdup(iename); } switch (ie->iei) { @@ -4345,7 +4336,7 @@ decode_ie(bssgp_ie_t *ie, build_info_t *bi) { } if (use_default_ie_name) { /* Memory has been allocated; free it */ - g_free(ie->name); + g_free( (gpointer) ie->name); ie->name = NULL; } } diff --git a/epan/dissectors/packet-camel.c b/epan/dissectors/packet-camel.c index e2d1ebebc9..bfa51ca1ee 100644 --- a/epan/dissectors/packet-camel.c +++ b/epan/dissectors/packet-camel.c @@ -3161,7 +3161,7 @@ dissect_camel_DateAndTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, guint8 digit_pair; guint8 i = 0, curr_offset; - char *time = (char *)(calloc (2*7 + 5 + 1, sizeof(char))); + char *time = (char *)(g_malloc0 ( (2*7 + 5 + 1) * sizeof(char))); char c[ 2*7 + 5] = ""; /*temporary container*/ time[ 2*7 + 5 +1 ] = '\0'; @@ -3234,7 +3234,7 @@ dissect_camel_DateAndTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, 0, 7, time); - free (time); + g_free (time); return 7; /* 7 octetes eaten*/ diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c index ac1f6ca281..cc9fc8a245 100644 --- a/epan/dissectors/packet-ccsds.c +++ b/epan/dissectors/packet-ccsds.c @@ -33,10 +33,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> /* diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c index 76278f4db4..21b9451027 100644 --- a/epan/dissectors/packet-cip.c +++ b/epan/dissectors/packet-cip.c @@ -37,10 +37,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <prefs.h> #include "packet-tcp.h" diff --git a/epan/dissectors/packet-cpfi.c b/epan/dissectors/packet-cpfi.c index e1b22ca7d2..7f28e1abcb 100644 --- a/epan/dissectors/packet-cpfi.c +++ b/epan/dissectors/packet-cpfi.c @@ -194,7 +194,7 @@ dissect_cpfi_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) src_board = tda >> 4; src_port = tda & 0x0f; src = (1 << 24) + (src_instance << 16) + (src_board << 8) + src_port; - snprintf(src_str, sizeof(src_str), "%u.%u.%u", src_instance, src_board, src_port); + g_snprintf(src_str, sizeof(src_str), "%u.%u.%u", src_instance, src_board, src_port); } /* Figure out where the frame is going. srcTDA is destination of frame! */ @@ -210,7 +210,7 @@ dissect_cpfi_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dst_board = tda >> 4; dst_port = tda & 0x0f; dst = (1 << 24) + (dst_instance << 16) + (dst_board << 8) + dst_port; - snprintf(dst_str, sizeof(dst_str), "%u.%u.%u", dst_instance, dst_board, dst_port); + g_snprintf(dst_str, sizeof(dst_str), "%u.%u.%u", dst_instance, dst_board, dst_port); } /* Set up the source and destination and arrow per user configuration. */ diff --git a/epan/dissectors/packet-cpha.c b/epan/dissectors/packet-cpha.c index 6ce650c535..bcba0774d3 100644 --- a/epan/dissectors/packet-cpha.c +++ b/epan/dissectors/packet-cpha.c @@ -32,10 +32,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/ipproto.h> diff --git a/epan/dissectors/packet-csm-encaps.c b/epan/dissectors/packet-csm-encaps.c index 73c2bb03fc..a459d95c20 100644 --- a/epan/dissectors/packet-csm-encaps.c +++ b/epan/dissectors/packet-csm-encaps.c @@ -41,10 +41,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/prefs.h> #include <epan/reassemble.h> diff --git a/epan/dissectors/packet-dcerpc-samr.c b/epan/dissectors/packet-dcerpc-samr.c index 4fe262b113..4527455675 100644 --- a/epan/dissectors/packet-dcerpc-samr.c +++ b/epan/dissectors/packet-dcerpc-samr.c @@ -40,10 +40,6 @@ #include "packet-windows-common.h" #include "packet-smb-common.h" -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - static int proto_dcerpc_samr = -1; static int hf_samr_opnum = -1; @@ -2793,7 +2789,7 @@ samr_dissect_INDEX_ARRAY(tvbuff_t *tvb, int offset, di=pinfo->private_data; field_name = proto_registrar_get_name(di->hf_index); - snprintf(str, 255, "INDEX_ARRAY: %s%s:", field_name, + g_snprintf(str, 255, "INDEX_ARRAY: %s%s:", field_name, plural_ending(field_name)); if(parent_tree){ item = proto_tree_add_text(parent_tree, tvb, offset, -1, @@ -2854,7 +2850,7 @@ samr_dissect_IDX_AND_NAME(tvbuff_t *tvb, int offset, di=pinfo->private_data; - snprintf(str, 255, "IDX_AND_NAME: %s:",proto_registrar_get_name(di->hf_index)); + g_snprintf(str, 255, "IDX_AND_NAME: %s:",proto_registrar_get_name(di->hf_index)); if(parent_tree){ item = proto_tree_add_text(parent_tree, tvb, offset, -1, "%s",str); @@ -2909,7 +2905,7 @@ samr_dissect_IDX_AND_NAME_ARRAY(tvbuff_t *tvb, int offset, offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_samr_count, &count); - snprintf(str, 255, "IDX_AND_NAME pointer: %s%s:", field_name, + g_snprintf(str, 255, "IDX_AND_NAME pointer: %s%s:", field_name, plural_ending(field_name)); offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep, samr_dissect_IDX_AND_NAME_entry, NDR_POINTER_UNIQUE, @@ -2931,7 +2927,7 @@ samr_dissect_IDX_AND_NAME_ARRAY_ptr(tvbuff_t *tvb, int offset, di=pinfo->private_data; field_name = proto_registrar_get_name(di->hf_index); - snprintf(str, 255, "IDX_AND_NAME_ARRAY pointer: %s%s:", field_name, + g_snprintf(str, 255, "IDX_AND_NAME_ARRAY pointer: %s%s:", field_name, plural_ending(field_name)); offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep, samr_dissect_IDX_AND_NAME_ARRAY, NDR_POINTER_UNIQUE, diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index e5d1b62649..f47caaa73f 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -456,7 +456,7 @@ int ResolveWin32UUID(e_uuid_t if_id, char *UUID_NAME, int UUID_NAME_MAX_LEN) if(UUID_NAME_MAX_LEN < 2) return 0; REG_UUID_NAME[0] = '\0'; - snprintf(REG_UUID_STR, MAX_PATH, "SOFTWARE\\Classes\\Interface\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + g_snprintf(REG_UUID_STR, MAX_PATH, "SOFTWARE\\Classes\\Interface\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", if_id.Data1, if_id.Data2, if_id.Data3, if_id.Data4[0], if_id.Data4[1], if_id.Data4[2], if_id.Data4[3], @@ -466,7 +466,7 @@ int ResolveWin32UUID(e_uuid_t if_id, char *UUID_NAME, int UUID_NAME_MAX_LEN) { if (RegQueryValueEx(hKey, NULL, NULL, NULL, (LPBYTE)REG_UUID_NAME, &UUID_MAX_SIZE) == ERROR_SUCCESS && UUID_MAX_SIZE <= MAX_PATH) { - snprintf(UUID_NAME, UUID_NAME_MAX_LEN, "%s", REG_UUID_NAME); + g_snprintf(UUID_NAME, UUID_NAME_MAX_LEN, "%s", REG_UUID_NAME); RegCloseKey(hKey); return strlen(REG_UUID_NAME); } diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index a846332068..95ed785941 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -101,10 +101,6 @@ #include "isprint.h" -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/strutil.h> #include <epan/conversation.h> @@ -530,7 +526,7 @@ dcm_tag2str(guint16 grp, guint16 elm, guint8 syntax, tvbuff_t *tvb, int offset, if (DCM_ILE & syntax) val32 = tvb_get_letohl(tvb, offset); else val32 = tvb_get_ntohl(tvb, offset); - snprintf(buf, sizeof(buf), "Group Length 0x%x (%d)", val32, val32); + g_snprintf(buf, sizeof(buf), "Group Length 0x%x (%d)", val32, val32); return buf; } tag = (grp << 16) | elm; @@ -1042,14 +1038,14 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_memcpy(tvb, dcm_data->targ, 26, 16); dcm_data->orig[AEEND] = dcm_data->targ[AEEND] = 0; buf = g_malloc(128); - snprintf(buf, 128, "DCM ASSOC Request %s <-- %s", + g_snprintf(buf, 128, "DCM ASSOC Request %s <-- %s", dcm_data->orig, dcm_data->targ); offset = 74; break; case 2: /* ASSOC Accept */ tvb_memcpy(tvb, dcm_data->resp, 26, 16); buf = g_malloc(128); - snprintf(buf, 128, "DCM ASSOC Accept %s <-- %s (%s)", + g_snprintf(buf, 128, "DCM ASSOC Accept %s <-- %s (%s)", dcm_data->orig, dcm_data->targ, dcm_data->resp); offset = 74; break; @@ -1058,7 +1054,7 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dcm_data->source = tvb_get_guint8(tvb, 8); dcm_data->reason = tvb_get_guint8(tvb, 9); buf = g_malloc(128); - snprintf(buf, 128, "DCM ASSOC Reject %s <-- %s %s %s %s", + g_snprintf(buf, 128, "DCM ASSOC Reject %s <-- %s %s %s %s", dcm_data->orig, dcm_data->targ, dcm_result2str(dcm_data->result), dcm_source2str(dcm_data->source), @@ -1084,7 +1080,7 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dcm_data->source = tvb_get_guint8(tvb, 8); dcm_data->reason = tvb_get_guint8(tvb, 9); buf = g_malloc(128); - snprintf(buf, 128, "DCM ABORT %s <-- %s %s %s", + g_snprintf(buf, 128, "DCM ABORT %s <-- %s %s %s", dcm_data->orig, dcm_data->targ, (dcm_data->source == 1) ? "USER" : (dcm_data->source == 2) ? "PROVIDER" : "", diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c index 33623ed8c7..b64d1150c4 100644 --- a/epan/dissectors/packet-dcom.c +++ b/epan/dissectors/packet-dcom.c @@ -675,7 +675,7 @@ const gchar* dcom_uuid_to_str(e_uuid_t *uuid) { } else { cur = &str[0][0]; } - snprintf(cur, 64, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + g_snprintf(cur, 64, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1], uuid->Data4[2], uuid->Data4[3], diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index 20f6eeb3ae..0853412b8e 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -57,10 +57,6 @@ #include "packet-tcp.h" #include "packet-sip.h" -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - /* This must be defined before we include packet-diameter-defs.h */ /* Valid data types */ @@ -923,7 +919,7 @@ diameter_vendor_to_str(guint32 vendorId, gboolean longName) { } } - snprintf(buffer, sizeof(buffer), + g_snprintf(buffer, sizeof(buffer), "Vendor 0x%08x", vendorId); return buffer; } /*diameter_vendor_to_str */ @@ -965,7 +961,7 @@ diameter_command_to_str(guint32 commandCode, guint32 vendorId) if ( suppress_console_output == FALSE ) g_warning("Diameter: Unable to find name for command code 0x%08x, Vendor \"%u\"!", commandCode, vendorId); - snprintf(buffer, sizeof(buffer), + g_snprintf(buffer, sizeof(buffer), "Cmd-0x%08x", commandCode); break; case DIAMETER_RFC: @@ -980,7 +976,7 @@ diameter_command_to_str(guint32 commandCode, guint32 vendorId) if ( suppress_console_output == FALSE ) g_warning("Diameter: Unable to find name for command code 0x%08x!", commandCode); - snprintf(buffer, sizeof(buffer), + g_snprintf(buffer, sizeof(buffer), "Cmd-0x%08x", commandCode); break; } @@ -999,7 +995,7 @@ diameter_app_to_str(guint32 appId) { } } - snprintf(buffer, sizeof(buffer), "Unknown"); + g_snprintf(buffer, sizeof(buffer), "Unknown"); return buffer; } /*diameter_app_to_str */ diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index f0c433b65d..f962129dc3 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -37,10 +37,6 @@ #include <glib.h> #include <time.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/prefs.h> #include <epan/reassemble.h> @@ -1124,10 +1120,10 @@ dnp3_al_decode_timestamp(tvbuff_t *tvb, int temp_pos, char* buff) alts_noms = (const long) al_timestamp; ptm = gmtime(&alts_noms); - /*snprintf(buff, 25,"%02d/%02d/%4d %02d:%02d:%02d.%03d",(ptm->tm_mon + 1), ptm->tm_mday, + /*g_snprintf(buff, 25,"%02d/%02d/%4d %02d:%02d:%02d.%03d",(ptm->tm_mon + 1), ptm->tm_mday, (ptm->tm_year+1900), ptm->tm_hour, ptm->tm_min, ptm->tm_sec, time_ms); */ /* Time-stamp in ISO format - perhaps an option should be added for different locales? */ - snprintf(buff, 25,"%04d/%02d/%02d %02d:%02d:%02d.%03"PRIu64,(ptm->tm_year+1900),ptm->tm_mday, + g_snprintf(buff, 25,"%04d/%02d/%02d %02d:%02d:%02d.%03"PRIu64,(ptm->tm_year+1900),ptm->tm_mday, (ptm->tm_mon + 1), ptm->tm_hour, ptm->tm_min, ptm->tm_sec, time_ms); diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 12333373e3..f0788d3d68 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -443,7 +443,7 @@ dns_type_description (guint type) short_name = dns_type_name(type); if (short_name == NULL) { - snprintf(strbuf, sizeof strbuf, "Unknown (%u)", type); + g_snprintf(strbuf, sizeof strbuf, "Unknown (%u)", type); return strbuf; } if (type < sizeof(type_names)/sizeof(type_names[0])) @@ -482,9 +482,9 @@ dns_type_description (guint type) } if (long_name != NULL) - snprintf(strbuf, sizeof strbuf, "%s (%s)", short_name, long_name); + g_snprintf(strbuf, sizeof strbuf, "%s (%s)", short_name, long_name); else - snprintf(strbuf, sizeof strbuf, "%s", short_name); + g_snprintf(strbuf, sizeof strbuf, "%s", short_name); return strbuf; } diff --git a/epan/dissectors/packet-enip.c b/epan/dissectors/packet-enip.c index 3a0ede14a2..9c7a89c0ac 100644 --- a/epan/dissectors/packet-enip.c +++ b/epan/dissectors/packet-enip.c @@ -37,10 +37,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <prefs.h> #include "packet-tcp.h" diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c index efab45c62c..7ab8cf9d3f 100644 --- a/epan/dissectors/packet-fc.c +++ b/epan/dissectors/packet-fc.c @@ -44,10 +44,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/prefs.h> #include <epan/reassemble.h> diff --git a/epan/dissectors/packet-fcct.c b/epan/dissectors/packet-fcct.c index 269edacd97..d938c8fe16 100644 --- a/epan/dissectors/packet-fcct.c +++ b/epan/dissectors/packet-fcct.c @@ -41,10 +41,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "etypes.h" #include "packet-fc.h" diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c index f3765350d1..ce9cbf0dce 100644 --- a/epan/dissectors/packet-fcdns.c +++ b/epan/dissectors/packet-fcdns.c @@ -47,10 +47,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/conversation.h> #include "etypes.h" diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c index b576ee0a4a..54964ab1f0 100644 --- a/epan/dissectors/packet-fcels.c +++ b/epan/dissectors/packet-fcels.c @@ -46,10 +46,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/conversation.h> #include "etypes.h" diff --git a/epan/dissectors/packet-fcfcs.c b/epan/dissectors/packet-fcfcs.c index 30f30e018a..a974bf12e8 100644 --- a/epan/dissectors/packet-fcfcs.c +++ b/epan/dissectors/packet-fcfcs.c @@ -41,10 +41,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/conversation.h> #include "etypes.h" diff --git a/epan/dissectors/packet-fcfzs.c b/epan/dissectors/packet-fcfzs.c index 90afbfc6ac..b1284726f2 100644 --- a/epan/dissectors/packet-fcfzs.c +++ b/epan/dissectors/packet-fcfzs.c @@ -47,10 +47,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/conversation.h> #include "etypes.h" diff --git a/epan/dissectors/packet-fclctl.c b/epan/dissectors/packet-fclctl.c index 446585c424..f635c17f4d 100644 --- a/epan/dissectors/packet-fclctl.c +++ b/epan/dissectors/packet-fclctl.c @@ -41,10 +41,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "etypes.h" #include "packet-fc.h" diff --git a/epan/dissectors/packet-fcp.c b/epan/dissectors/packet-fcp.c index 247c55923c..47b463347b 100644 --- a/epan/dissectors/packet-fcp.c +++ b/epan/dissectors/packet-fcp.c @@ -41,10 +41,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/prefs.h> #include <epan/packet.h> #include <epan/conversation.h> diff --git a/epan/dissectors/packet-fcsb3.c b/epan/dissectors/packet-fcsb3.c index 2c538a64a7..d3850119d5 100644 --- a/epan/dissectors/packet-fcsb3.c +++ b/epan/dissectors/packet-fcsb3.c @@ -48,10 +48,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/prefs.h> #include <epan/packet.h> #include <epan/conversation.h> diff --git a/epan/dissectors/packet-fcsp.c b/epan/dissectors/packet-fcsp.c index 374d3c7d15..954e2518ff 100644 --- a/epan/dissectors/packet-fcsp.c +++ b/epan/dissectors/packet-fcsp.c @@ -48,10 +48,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/prefs.h> #include <epan/packet.h> #include <epan/conversation.h> diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index 85dacacad5..046a01f1d1 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -41,10 +41,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/conversation.h> #include "etypes.h" diff --git a/epan/dissectors/packet-g723.c b/epan/dissectors/packet-g723.c index 673417ac99..d5598324c6 100644 --- a/epan/dissectors/packet-g723.c +++ b/epan/dissectors/packet-g723.c @@ -35,10 +35,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "rtp_pt.h" diff --git a/epan/dissectors/packet-gprs-llc.c b/epan/dissectors/packet-gprs-llc.c index ed21f1a0cf..a8330a2d52 100644 --- a/epan/dissectors/packet-gprs-llc.c +++ b/epan/dissectors/packet-gprs-llc.c @@ -33,10 +33,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "prefs.h" diff --git a/epan/dissectors/packet-hyperscsi.c b/epan/dissectors/packet-hyperscsi.c index fb7856c984..23f057d894 100644 --- a/epan/dissectors/packet-hyperscsi.c +++ b/epan/dissectors/packet-hyperscsi.c @@ -31,10 +31,6 @@ #include <string.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> static int proto_hyperscsi; diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index da53e41d90..9dce2337cb 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -769,7 +769,7 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) case FIELD_TIMESTAMP: dataptr = tvb_get_ptr (tvb, offset, 8); memset (out_buff, 0, SHORT_STR); - snprintf (out_buff, SHORT_STR, "0x%02X%02X%02X%02X%02X%02X%02X%02X", + g_snprintf (out_buff, SHORT_STR, "0x%02X%02X%02X%02X%02X%02X%02X%02X", dataptr[7], dataptr[6], dataptr[5], diff --git a/epan/dissectors/packet-igmp.c b/epan/dissectors/packet-igmp.c index 8613976b71..0a06e89a3f 100644 --- a/epan/dissectors/packet-igmp.c +++ b/epan/dissectors/packet-igmp.c @@ -103,10 +103,6 @@ #include <string.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/ipproto.h> #include <epan/in_cksum.h> @@ -663,7 +659,7 @@ dissect_igmp_mtrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int typ */ if (type == IGMP_TRACEROUTE_RESPONSE) { int i = (tvb_reported_length_remaining(tvb, offset) - IGMP_TRACEROUTE_HDR_LEN) / IGMP_TRACEROUTE_RSP_LEN; - snprintf(buf, sizeof buf, ", %d block%s", i, plurality(i, "", "s")); + g_snprintf(buf, sizeof buf, ", %d block%s", i, plurality(i, "", "s")); typestr = "Traceroute Response"; blocks = buf; } else if (tvb_reported_length_remaining(tvb, offset) == IGMP_TRACEROUTE_HDR_LEN) diff --git a/epan/dissectors/packet-image-gif.c b/epan/dissectors/packet-image-gif.c index 4eefe72635..16819c1202 100644 --- a/epan/dissectors/packet-image-gif.c +++ b/epan/dissectors/packet-image-gif.c @@ -45,10 +45,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> /* General-purpose debug logger. diff --git a/epan/dissectors/packet-image-jfif.c b/epan/dissectors/packet-image-jfif.c index a05e5de3d8..2040e79401 100644 --- a/epan/dissectors/packet-image-jfif.c +++ b/epan/dissectors/packet-image-jfif.c @@ -48,10 +48,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> /* General-purpose debug logger. diff --git a/epan/dissectors/packet-ipdc.c b/epan/dissectors/packet-ipdc.c index adaefbc041..36f0681c2c 100644 --- a/epan/dissectors/packet-ipdc.c +++ b/epan/dissectors/packet-ipdc.c @@ -37,10 +37,6 @@ #include <glib.h> #include <math.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "packet-ipdc.h" #include "packet-tcp.h" diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 5e0a0135e6..5371b9e0c8 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -383,7 +383,7 @@ dissect_ipv6_options(tvbuff_t *tvb, int offset, guint length, optp = NULL; /* indicate that we don't know this option */ len_type = VARIABLE_LENGTH; optlen = 0; - snprintf(name_str, sizeof name_str, "Unknown (0x%02x)", opt); + g_snprintf(name_str, sizeof name_str, "Unknown (0x%02x)", opt); name = name_str; dissect = NULL; } else { diff --git a/epan/dissectors/packet-ipvs-syncd.c b/epan/dissectors/packet-ipvs-syncd.c index 3b974beb23..01ad34a81c 100644 --- a/epan/dissectors/packet-ipvs-syncd.c +++ b/epan/dissectors/packet-ipvs-syncd.c @@ -30,10 +30,6 @@ #include <string.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/ipproto.h> #include <epan/in_cksum.h> diff --git a/epan/dissectors/packet-ismp.c b/epan/dissectors/packet-ismp.c index 1076ce44f5..e5242ea794 100644 --- a/epan/dissectors/packet-ismp.c +++ b/epan/dissectors/packet-ismp.c @@ -34,10 +34,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/strutil.h> #include "etypes.h" diff --git a/epan/dissectors/packet-isns.c b/epan/dissectors/packet-isns.c index f68da333b9..163426b7a1 100644 --- a/epan/dissectors/packet-isns.c +++ b/epan/dissectors/packet-isns.c @@ -47,10 +47,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/conversation.h> #include "packet-tcp.h" diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c index e618be2552..a83f58b88b 100644 --- a/epan/dissectors/packet-isup.c +++ b/epan/dissectors/packet-isup.c @@ -5656,8 +5656,8 @@ static int msg_stats_tree_packet(stats_tree *st , packet_info *pinfo, epan_diss int msg_node; int dir_node; - address_to_str_buf(&(pinfo->net_src), src); - address_to_str_buf(&(pinfo->net_dst), dst); + address_to_str_buf(&(pinfo->net_src), src, sizeof src); + address_to_str_buf(&(pinfo->net_dst), dst, sizeof dst); g_snprintf(dir,sizeof(dir),"%s->%s",src,dst); msg_node = tick_stat_node(st, msg, st_node_msg, TRUE); diff --git a/epan/dissectors/packet-isup_thin.c b/epan/dissectors/packet-isup_thin.c index a60fa59811..192615ca5c 100644 --- a/epan/dissectors/packet-isup_thin.c +++ b/epan/dissectors/packet-isup_thin.c @@ -35,10 +35,6 @@ #include <glib.h> #include <epan/conversation.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "prefs.h" diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index e4c2cf61cb..fcabe44d69 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -1056,8 +1056,8 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree gchar src_addr[256]; gchar dst_addr[256]; - address_to_str_buf( &pinfo->src, src_addr ); - address_to_str_buf( &pinfo->dst, dst_addr ); + address_to_str_buf( &pinfo->src, src_addr, sizeof src_addr ); + address_to_str_buf( &pinfo->dst, dst_addr, sizeof dst_addr ); if( PT_NONE != pinfo->ptype ) { size_t len = strlen( src_addr ); @@ -1088,8 +1088,8 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree gchar dst_addr[256]; proto_item * tree_item; - address_to_str_buf( &pinfo->src, src_addr ); - address_to_str_buf( &pinfo->dst, dst_addr ); + address_to_str_buf( &pinfo->src, src_addr, sizeof src_addr ); + address_to_str_buf( &pinfo->dst, dst_addr, sizeof dst_addr ); if( PT_NONE != pinfo->ptype ) { size_t len = strlen( src_addr ); diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c index 53a9293a3d..740b2bd35b 100644 --- a/epan/dissectors/packet-kerberos.c +++ b/epan/dissectors/packet-kerberos.c @@ -1629,7 +1629,7 @@ static int dissect_krb5_address(packet_info *pinfo, proto_tree *tree, tvbuff_t * int netbios_name_type; netbios_name_type = process_netbios_name(tvb_get_ptr(tvb, offset, 16), netbios_name); - snprintf(address_str, 255, "%s<%02x>", netbios_name, netbios_name_type); + g_snprintf(address_str, 255, "%s<%02x>", netbios_name, netbios_name_type); it=proto_tree_add_string_format(tree, hf_krb_address_netbios, tvb, offset, 16, netbios_name, "NetBIOS Name: %s (%s)", address_str, netbios_name_type_descr(netbios_name_type)); } break; diff --git a/epan/dissectors/packet-laplink.c b/epan/dissectors/packet-laplink.c index 2f737ba28d..9f02295074 100644 --- a/epan/dissectors/packet-laplink.c +++ b/epan/dissectors/packet-laplink.c @@ -33,10 +33,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/strutil.h> #include <epan/conversation.h> diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index 1800225700..b54550225d 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -73,10 +73,6 @@ #include <string.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/asn1.h> @@ -1808,7 +1804,7 @@ static void dissect_ldap_request_compare(ASN1_SCK *a, proto_tree *tree) s2 = (string2 == NULL) ? "(null)" : string2; length = 2 + strlen(s1) + strlen(s2); compare = g_malloc0(length); - snprintf(compare, length, "%s=%s", s1, s2); + g_snprintf(compare, length, "%s=%s", s1, s2); proto_tree_add_string(tree, hf_ldap_message_compare, a->tvb, start, a->offset-start, compare); diff --git a/epan/dissectors/packet-lwapp.c b/epan/dissectors/packet-lwapp.c index 8d5e55ed40..b0eb8360c8 100644 --- a/epan/dissectors/packet-lwapp.c +++ b/epan/dissectors/packet-lwapp.c @@ -43,10 +43,6 @@ #include <epan/prefs.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #define LWAPP_FLAGS_T 0x04 #define LWAPP_FLAGS_F 0x02 #define LWAPP_FLAGS_FT 0x01 diff --git a/epan/dissectors/packet-mdshdr.c b/epan/dissectors/packet-mdshdr.c index 794ee6f372..e12de8e205 100644 --- a/epan/dissectors/packet-mdshdr.c +++ b/epan/dissectors/packet-mdshdr.c @@ -47,10 +47,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/value_string.h> #include <etypes.h> #include <epan/packet.h> diff --git a/epan/dissectors/packet-msrp.c b/epan/dissectors/packet-msrp.c index 31b26fcae2..b9ba83fa0d 100644 --- a/epan/dissectors/packet-msrp.c +++ b/epan/dissectors/packet-msrp.c @@ -38,10 +38,6 @@ #include <glib.h> #include <epan/conversation.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "prefs.h" diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index 7c196c3a92..6a5d55f26d 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -39,10 +39,6 @@ #include <string.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -#include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/tap.h> #include <epan/prefs.h> diff --git a/epan/dissectors/packet-mtp3mg.c b/epan/dissectors/packet-mtp3mg.c index 5eab60dd42..692ac73182 100644 --- a/epan/dissectors/packet-mtp3mg.c +++ b/epan/dissectors/packet-mtp3mg.c @@ -39,10 +39,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -#include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/prefs.h> @@ -506,7 +502,7 @@ dissect_mtp3mg_3byte_pc(tvbuff_t *tvb, proto_tree *tree, gint *ett_pc, apc = tvb_get_ntoh24(tvb, 0); - snprintf(pc, sizeof(pc), "%d-%d-%d", + g_snprintf(pc, sizeof(pc), "%d-%d-%d", (apc & ANSI_NETWORK_MASK), ((apc & ANSI_CLUSTER_MASK) >> 8), ((apc & ANSI_MEMBER_MASK) >> 16)); diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c index f7f113411c..5fda13e7ec 100644 --- a/epan/dissectors/packet-multipart.c +++ b/epan/dissectors/packet-multipart.c @@ -67,10 +67,6 @@ #include <glib.h> #include <ctype.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> /* Dissector table for media requiring special attention in multipart diff --git a/epan/dissectors/packet-ntp.c b/epan/dissectors/packet-ntp.c index 3629f1adcd..aa13cfc9de 100644 --- a/epan/dissectors/packet-ntp.c +++ b/epan/dissectors/packet-ntp.c @@ -36,10 +36,6 @@ #include <math.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/addr_resolv.h> #include "packet-ntp.h" @@ -392,7 +388,7 @@ ntp_fmt_ts(const guint8 *reftime, char* buff) bd = gmtime(&temptime); if (bd != NULL) { fractime = bd->tm_sec + tempfrac / 4294967296.0; - snprintf(buff, NTP_TS_SIZE, + g_snprintf(buff, NTP_TS_SIZE, "%s %2d, %d %02d:%02d:%07.4f UTC", mon_names[bd->tm_mon], bd->tm_mday, @@ -550,7 +546,7 @@ dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags) */ refid = tvb_get_ptr(tvb, 12, 4); if (stratum <= 1) { - snprintf (buff, sizeof buff, + g_snprintf (buff, sizeof buff, "Unindentified reference source '%.4s'", refid); for (i = 0; primary_sources[i].id; i++) { diff --git a/epan/dissectors/packet-pflog.c b/epan/dissectors/packet-pflog.c index 2412068a8d..197b166a6c 100644 --- a/epan/dissectors/packet-pflog.c +++ b/epan/dissectors/packet-pflog.c @@ -180,10 +180,10 @@ dissect_pflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hdrlen = BPF_WORDALIGN(pflogh.length); if (pflogh.subrulenr == (guint32) -1) - snprintf(rulestr, sizeof(rulestr), "%u", + g_snprintf(rulestr, sizeof(rulestr), "%u", pflogh.rulenr); else - snprintf(rulestr, sizeof(rulestr), "%u.%s.%u", + g_snprintf(rulestr, sizeof(rulestr), "%u.%s.%u", pflogh.rulenr, pflogh.ruleset, pflogh.subrulenr); if (hdrlen < MIN_PFLOG_HDRLEN) { diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c index ac0408c16e..768c37d51d 100644 --- a/epan/dissectors/packet-pim.c +++ b/epan/dissectors/packet-pim.c @@ -74,14 +74,14 @@ dissect_pimv1_addr(tvbuff_t *tvb, int offset) { flags_masklen = tvb_get_ntohs(tvb, offset); if (flags_masklen & 0x0180) { - (void)snprintf(buf, sizeof(buf), + g_snprintf(buf, sizeof(buf), "(%s%s%s) ", flags_masklen & 0x0100 ? "S" : "", flags_masklen & 0x0080 ? "W" : "", flags_masklen & 0x0040 ? "R" : ""); } else buf[0] = '\0'; - (void)snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s/%u", + g_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s/%u", ip_to_str(tvb_get_ptr(tvb, offset + 2, 4)), flags_masklen & 0x3f); return buf; @@ -520,13 +520,13 @@ dissect_pim_addr(tvbuff_t *tvb, int offset, enum pimv2_addrtype at, switch (af) { case AFNUM_INET: len = 4; - (void)snprintf(buf, sizeof(buf), "%s", + g_snprintf(buf, sizeof(buf), "%s", ip_to_str(tvb_get_ptr(tvb, offset + 2, len))); break; case AFNUM_INET6: len = 16; - (void)snprintf(buf, sizeof(buf), "%s", + g_snprintf(buf, sizeof(buf), "%s", ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 2, len))); break; } @@ -539,13 +539,13 @@ dissect_pim_addr(tvbuff_t *tvb, int offset, enum pimv2_addrtype at, switch (af) { case AFNUM_INET: len = 4; - (void)snprintf(buf, sizeof(buf), "%s/%u", + g_snprintf(buf, sizeof(buf), "%s/%u", ip_to_str(tvb_get_ptr(tvb, offset + 4, len)), mask_len); break; case AFNUM_INET6: len = 16; - (void)snprintf(buf, sizeof(buf), "%s/%u", + g_snprintf(buf, sizeof(buf), "%s/%u", ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, len)), mask_len); break; } @@ -559,18 +559,18 @@ dissect_pim_addr(tvbuff_t *tvb, int offset, enum pimv2_addrtype at, switch (af) { case AFNUM_INET: len = 4; - (void)snprintf(buf, sizeof(buf), "%s/%u", + g_snprintf(buf, sizeof(buf), "%s/%u", ip_to_str(tvb_get_ptr(tvb, offset + 4, len)), mask_len); break; case AFNUM_INET6: len = 16; - (void)snprintf(buf, sizeof(buf), "%s/%u", + g_snprintf(buf, sizeof(buf), "%s/%u", ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, len)), mask_len); break; } if (flags) { - (void)snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + g_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " (%s%s%s)", flags & 0x04 ? "S" : "", flags & 0x02 ? "W" : "", diff --git a/epan/dissectors/packet-pn-rt.c b/epan/dissectors/packet-pn-rt.c index 0832e88a82..646d785428 100644 --- a/epan/dissectors/packet-pn-rt.c +++ b/epan/dissectors/packet-pn-rt.c @@ -261,7 +261,7 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) u8DataStatus = tvb_get_guint8(tvb, tvb_len - 2); u8TransferStatus = tvb_get_guint8(tvb, tvb_len - 1); - snprintf (szFieldSummary, sizeof(szFieldSummary), + g_snprintf (szFieldSummary, sizeof(szFieldSummary), "%sFrameID: 0x%04x, DataLen: %4u, Cycle: %5u (%s,%s,%s,%s)", pszProtAddInfo, u16FrameID, tvb_len - 2 - 4, u16CycleCounter, (u8DataStatus & 0x04) ? "Valid" : "Invalid", @@ -278,7 +278,7 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) u8TransferStatus = 0; /* acyclic transfer has no fields at the end */ - snprintf (szFieldSummary, sizeof(szFieldSummary), + g_snprintf (szFieldSummary, sizeof(szFieldSummary), "%sFrameID: 0x%04x, DataLen: %4u", pszProtAddInfo, u16FrameID, tvb_len - 2); diff --git a/epan/dissectors/packet-ptp.c b/epan/dissectors/packet-ptp.c index 89763b1496..da37752cd5 100644 --- a/epan/dissectors/packet-ptp.c +++ b/epan/dissectors/packet-ptp.c @@ -37,10 +37,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c index 6811a5aa54..0341871ae6 100644 --- a/epan/dissectors/packet-rsvp.c +++ b/epan/dissectors/packet-rsvp.c @@ -70,10 +70,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/tvbuff.h> #include <epan/packet.h> #include <prefs.h> @@ -1257,31 +1253,31 @@ static char *summary_session (tvbuff_t *tvb, int offset) switch(tvb_get_guint8(tvb, offset+3)) { case RSVP_SESSION_TYPE_IPV4: - snprintf(buf, 100, "SESSION: IPv4, Destination %s, Protocol %d, Port %d. ", + g_snprintf(buf, 100, "SESSION: IPv4, Destination %s, Protocol %d, Port %d. ", ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_guint8(tvb, offset+8), tvb_get_ntohs(tvb, offset+10)); break; case RSVP_SESSION_TYPE_IPV4_LSP: - snprintf(buf, 100, "SESSION: IPv4-LSP, Destination %s, Tunnel ID %d, Ext ID %0x. ", + g_snprintf(buf, 100, "SESSION: IPv4-LSP, Destination %s, Tunnel ID %d, Ext ID %0x. ", ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10), tvb_get_ntohl(tvb, offset+12)); break; case RSVP_SESSION_TYPE_IPV4_UNI: - snprintf(buf, 100, "SESSION: IPv4-UNI, Destination %s, Tunnel ID %d, Ext Address %s. ", + g_snprintf(buf, 100, "SESSION: IPv4-UNI, Destination %s, Tunnel ID %d, Ext Address %s. ", ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10), ip_to_str(tvb_get_ptr(tvb, offset+12, 4))); break; case RSVP_SESSION_TYPE_IPV4_E_NNI: - snprintf(buf, 100, "SESSION: IPv4-E-NNI, Destination %s, Tunnel ID %d, Ext Address %s. ", + g_snprintf(buf, 100, "SESSION: IPv4-E-NNI, Destination %s, Tunnel ID %d, Ext Address %s. ", ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10), ip_to_str(tvb_get_ptr(tvb, offset+12, 4))); break; default: - snprintf(buf, 100, "SESSION: Type %d. ", tvb_get_guint8(tvb, offset+3)); + g_snprintf(buf, 100, "SESSION: Type %d. ", tvb_get_guint8(tvb, offset+3)); } return buf; @@ -1299,17 +1295,17 @@ static char *summary_template (tvbuff_t *tvb, int offset) switch(tvb_get_guint8(tvb, offset+3)) { case 1: - snprintf(buf, 80, "%s: IPv4, Sender %s, Port %d. ", objtype, + g_snprintf(buf, 80, "%s: IPv4, Sender %s, Port %d. ", objtype, ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10)); break; case 7: - snprintf(buf, 80, "%s: IPv4-LSP, Tunnel Source: %s, LSP ID: %d. ", objtype, + g_snprintf(buf, 80, "%s: IPv4-LSP, Tunnel Source: %s, LSP ID: %d. ", objtype, ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10)); break; default: - snprintf(buf, 80, "%s: Type %d. ", objtype, tvb_get_guint8(tvb, offset+3)); + g_snprintf(buf, 80, "%s: Type %d. ", objtype, tvb_get_guint8(tvb, offset+3)); } return buf; diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index ac56796c1f..538e930a7c 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -40,10 +40,6 @@ # include "config.h" #endif -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c index aae0dbb116..9a3a06efca 100644 --- a/epan/dissectors/packet-sccp.c +++ b/epan/dissectors/packet-sccp.c @@ -41,10 +41,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -#include "snprintf.h" -#endif - #include <epan/packet.h> #include "packet-mtp3.h" #include <epan/prefs.h> @@ -863,7 +859,7 @@ dissect_sccp_3byte_pc(tvbuff_t *tvb, proto_tree *call_tree, guint offset, /* create the DPC tree; modified from that in packet-mtp3.c */ dpc = tvb_get_ntoh24(tvb, offset); - snprintf(pc, sizeof(pc), "%d-%d-%d", (dpc & ANSI_NETWORK_MASK), + g_snprintf(pc, sizeof(pc), "%d-%d-%d", (dpc & ANSI_NETWORK_MASK), ((dpc & ANSI_CLUSTER_MASK) >> 8), ((dpc & ANSI_MEMBER_MASK) >> 16)); diff --git a/epan/dissectors/packet-sccpmg.c b/epan/dissectors/packet-sccpmg.c index a0f90fcdba..26d836e212 100644 --- a/epan/dissectors/packet-sccpmg.c +++ b/epan/dissectors/packet-sccpmg.c @@ -39,10 +39,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -#include "snprintf.h" -#endif - #include <epan/packet.h> #include "packet-mtp3.h" @@ -170,7 +166,7 @@ dissect_sccpmg_affected_pc(tvbuff_t *tvb, proto_tree *sccpmg_tree) /* create the DPC tree; modified from that in packet-sccp.c */ dpc = tvb_get_ntoh24(tvb, offset); - snprintf(pc, sizeof(pc), "%d-%d-%d", + g_snprintf(pc, sizeof(pc), "%d-%d-%d", (dpc & ANSI_NETWORK_MASK), ((dpc & ANSI_CLUSTER_MASK) >> 8), ((dpc & ANSI_MEMBER_MASK) >> 16)); diff --git a/epan/dissectors/packet-sebek.c b/epan/dissectors/packet-sebek.c index 959e03c7fd..5646847d8c 100644 --- a/epan/dissectors/packet-sebek.c +++ b/epan/dissectors/packet-sebek.c @@ -36,10 +36,6 @@ #include <math.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/addr_resolv.h> diff --git a/epan/dissectors/packet-sflow.c b/epan/dissectors/packet-sflow.c index aedb28796c..57ffcd8d4a 100644 --- a/epan/dissectors/packet-sflow.c +++ b/epan/dissectors/packet-sflow.c @@ -54,10 +54,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> /*#include "packet-sflow.h"*/ diff --git a/epan/dissectors/packet-sigcomp.c b/epan/dissectors/packet-sigcomp.c index b4055fbb14..69eb33be6c 100644 --- a/epan/dissectors/packet-sigcomp.c +++ b/epan/dissectors/packet-sigcomp.c @@ -39,10 +39,6 @@ #include <math.h> #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "prefs.h" #include "strutil.h" diff --git a/epan/dissectors/packet-sndcp.c b/epan/dissectors/packet-sndcp.c index 91ae6cc2ca..9736d35a61 100644 --- a/epan/dissectors/packet-sndcp.c +++ b/epan/dissectors/packet-sndcp.c @@ -33,10 +33,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include <epan/reassemble.h> diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c index 8b9f5317d5..5bdf225198 100644 --- a/epan/dissectors/packet-stun.c +++ b/epan/dissectors/packet-stun.c @@ -35,10 +35,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> /* Initialize the protocol and registered fields */ diff --git a/epan/dissectors/packet-uma.c b/epan/dissectors/packet-uma.c index 12a4bbb888..b4a3f5aebf 100644 --- a/epan/dissectors/packet-uma.c +++ b/epan/dissectors/packet-uma.c @@ -62,10 +62,6 @@ #include <glib.h> #include <epan/conversation.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/packet.h> #include "prefs.h" #include "packet-bssap.h" diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c index ef5d89fb62..bcd8d6a79f 100644 --- a/epan/dissectors/packet-wccp.c +++ b/epan/dissectors/packet-wccp.c @@ -33,10 +33,6 @@ #include <epan/strutil.h> #include "packet-wccp.h" -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - static int proto_wccp = -1; static int hf_wccp_message_type = -1; /* the message type */ static int hf_wccp_version = -1; /* protocol version */ @@ -1228,10 +1224,10 @@ dissect_32_bit_capability_flags(tvbuff_t *tvb, int curr_offset, for (i = 0; flags[i].short_name != NULL; i++) { if (capability_val & flags[i].value) { if (p != &flags_string[0]) { - snprintf(p, space_left, ","); + g_snprintf(p, space_left, ","); p = &flags_string[strlen(flags_string)]; } - snprintf(p, space_left, "%s", flags[i].short_name); + g_snprintf(p, space_left, "%s", flags[i].short_name); p = &flags_string[strlen(flags_string)]; } } diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index b146439b11..cdb518647d 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -51,10 +51,6 @@ #include <stdio.h> #include <stdlib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <string.h> #include <glib.h> #include <epan/packet.h> diff --git a/epan/dissectors/packet-wtls.c b/epan/dissectors/packet-wtls.c index 8ce0374af6..9995cb6aa6 100644 --- a/epan/dissectors/packet-wtls.c +++ b/epan/dissectors/packet-wtls.c @@ -34,10 +34,6 @@ #include <stdio.h> #include <stdlib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <string.h> #include <glib.h> #include <epan/packet.h> @@ -804,22 +800,22 @@ dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint coun { if (valMac != NULL) { - snprintf(valStr,1024,"%s, %s",valBulk,valMac); + g_snprintf(valStr,1024,"%s, %s",valBulk,valMac); } else { - snprintf(valStr,1024,"%s, Unknown MAC (0x%02x)",valBulk,tvb_get_guint8 (tvb, offset)); + g_snprintf(valStr,1024,"%s, Unknown MAC (0x%02x)",valBulk,tvb_get_guint8 (tvb, offset)); } } else { if (valMac != NULL) { - snprintf(valStr,1024,"Unknown Bulk (0x%02x), %s",value,valMac); + g_snprintf(valStr,1024,"Unknown Bulk (0x%02x), %s",value,valMac); } else { - snprintf(valStr,1024,"Unknown Bulk (0x%02x), Unknown MAC (0x%02x)",value, + g_snprintf(valStr,1024,"Unknown Bulk (0x%02x), Unknown MAC (0x%02x)",value, tvb_get_guint8 (tvb, offset)); } } diff --git a/epan/dissectors/packet-wtp.c b/epan/dissectors/packet-wtp.c index 36649ead4c..1a71192465 100644 --- a/epan/dissectors/packet-wtp.c +++ b/epan/dissectors/packet-wtp.c @@ -34,10 +34,6 @@ #include <stdio.h> #include <stdlib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <string.h> #include <glib.h> #include <epan/packet.h> |