diff --git a/capture/airpcap_loader.c b/capture/airpcap_loader.c index 4e83953fdb..285014493e 100644 --- a/capture/airpcap_loader.c +++ b/capture/airpcap_loader.c @@ -115,7 +115,7 @@ static guint num_legacy_channels = 14; static gchar * cant_get_airpcap_if_list_error_message(const char *err_str) { - return g_strdup_printf("Can't get list of Wireless interfaces: %s", err_str); + return ws_strdup_printf("Can't get list of Wireless interfaces: %s", err_str); } /* @@ -931,7 +931,7 @@ airpcap_get_if_string_number(airpcap_if_info_t* if_info) } else { - number = g_strdup_printf("%.2u",n); + number = ws_strdup_printf("%.2u",n); } return number; diff --git a/capture/capture-pcap-util-unix.c b/capture/capture-pcap-util-unix.c index 2753a54ec4..34207be74b 100644 --- a/capture/capture-pcap-util-unix.c +++ b/capture/capture-pcap-util-unix.c @@ -51,7 +51,7 @@ get_interface_list(int *err, char **err_str) gchar * cant_get_if_list_error_message(const char *err_str) { - return g_strdup_printf("Can't get list of interfaces: %s", err_str); + return ws_strdup_printf("Can't get list of interfaces: %s", err_str); } if_capabilities_t * diff --git a/capture/capture-pcap-util.c b/capture/capture-pcap-util.c index 146915f4eb..217329b69e 100644 --- a/capture/capture-pcap-util.c +++ b/capture/capture-pcap-util.c @@ -231,7 +231,7 @@ add_unix_interface_ifinfo(if_info_t *if_info, const char *name, * Look for /sys/class/net/{device}/wireless. If it exists, * it's a wireless interface. */ - wireless_path = g_strdup_printf("/sys/class/net/%s/wireless", name); + wireless_path = ws_strdup_printf("/sys/class/net/%s/wireless", name); if (wireless_path != NULL) { if (ws_stat64(wireless_path, &statb) == 0) if_info->type = IF_WIRELESS; @@ -915,7 +915,7 @@ create_data_link_info(int dlt) if (text != NULL) data_link_info->name = g_strdup(text); else - data_link_info->name = g_strdup_printf("DLT %d", dlt); + data_link_info->name = ws_strdup_printf("DLT %d", dlt); text = pcap_datalink_val_to_description(dlt); data_link_info->description = g_strdup(text); return data_link_info; @@ -947,7 +947,7 @@ get_data_link_types(pcap_t *pch, interface_options *interface_opts, */ if (nlt == PCAP_ERROR) { *status = CAP_DEVICE_OPEN_ERR_GENERIC; - *status_str = g_strdup_printf("pcap_list_datalinks() failed: %s", + *status_str = ws_strdup_printf("pcap_list_datalinks() failed: %s", pcap_geterr(pch)); } else { if (nlt == PCAP_ERROR_PERM_DENIED) @@ -958,7 +958,7 @@ get_data_link_types(pcap_t *pch, interface_options *interface_opts, } #else /* HAVE_PCAP_CREATE */ *status = CAP_DEVICE_OPEN_ERR_GENERIC; - *status_str = g_strdup_printf("pcap_list_datalinks() failed: %s", + *status_str = ws_strdup_printf("pcap_list_datalinks() failed: %s", pcap_geterr(pch)); #endif /* HAVE_PCAP_CREATE */ return NULL; @@ -1197,7 +1197,7 @@ get_if_capabilities_pcap_create(interface_options *interface_opts, /* Error. */ if (status == PCAP_ERROR) { *open_status = CAP_DEVICE_OPEN_ERR_GENERIC; - *open_status_str = g_strdup_printf("pcap_can_set_rfmon() failed: %s", + *open_status_str = ws_strdup_printf("pcap_can_set_rfmon() failed: %s", pcap_geterr(pch)); } else { if (status == PCAP_ERROR_PERM_DENIED) @@ -1218,7 +1218,7 @@ get_if_capabilities_pcap_create(interface_options *interface_opts, pcap_set_rfmon(pch, 1); } else { *open_status = CAP_DEVICE_OPEN_ERR_NOT_PERMISSIONS; - *open_status_str = g_strdup_printf("pcap_can_set_rfmon() returned %d", + *open_status_str = ws_strdup_printf("pcap_can_set_rfmon() returned %d", status); pcap_close(pch); g_free(caps); @@ -1230,7 +1230,7 @@ get_if_capabilities_pcap_create(interface_options *interface_opts, /* Error. */ if (status == PCAP_ERROR) { *open_status = CAP_DEVICE_OPEN_ERR_GENERIC; - *open_status_str = g_strdup_printf("pcap_activate() failed: %s", + *open_status_str = ws_strdup_printf("pcap_activate() failed: %s", pcap_geterr(pch)); } else { if (status == PCAP_ERROR_PERM_DENIED) diff --git a/capture/capture-wpcap.c b/capture/capture-wpcap.c index a6a9797f28..d92a670f95 100644 --- a/capture/capture-wpcap.c +++ b/capture/capture-wpcap.c @@ -270,7 +270,7 @@ convert_errbuf_to_utf8(char *errbuf) static char * cant_load_winpcap_err(const char *app_name) { - return g_strdup_printf( + return ws_strdup_printf( "Unable to load Npcap or WinPcap (wpcap.dll); %s will not be able to\n" "capture packets.\n" "\n" @@ -771,12 +771,12 @@ cant_get_if_list_error_message(const char *err_str) */ if (strstr(err_str, "Not enough storage is available to process this command") != NULL || strstr(err_str, "The operation completed successfully") != NULL) { - return g_strdup_printf("Can't get list of interfaces: %s\n" + return ws_strdup_printf("Can't get list of interfaces: %s\n" "This might be a problem with WinPcap 3.0. You should try updating to\n" "Npcap. See https://nmap.org/npcap/ for more information.", err_str); } - return g_strdup_printf("Can't get list of interfaces: %s", err_str); + return ws_strdup_printf("Can't get list of interfaces: %s", err_str); } if_capabilities_t * diff --git a/capture/capture_ifinfo.c b/capture/capture_ifinfo.c index 21ef1ece77..0029df3fab 100644 --- a/capture/capture_ifinfo.c +++ b/capture/capture_ifinfo.c @@ -266,7 +266,7 @@ capture_get_if_capabilities(const gchar *ifname, gboolean monitor_mode, default: ws_info("Capture Interface Capabilities returned bad information."); if (err_primary_msg) { - *err_primary_msg = g_strdup_printf("Dumpcap returned \"%s\" for monitor-mode capability", + *err_primary_msg = ws_strdup_printf("Dumpcap returned \"%s\" for monitor-mode capability", raw_list[0]); } g_free(caps); diff --git a/capture/capture_sync.c b/capture/capture_sync.c index 8db0f42280..8f17bbbc91 100644 --- a/capture/capture_sync.c +++ b/capture/capture_sync.c @@ -187,9 +187,9 @@ init_pipe_args(int *argc) { /* take Wireshark's absolute program path and replace "Wireshark" with "dumpcap" */ #ifdef _WIN32 - exename = g_strdup_printf("%s\\dumpcap.exe", progfile_dir); + exename = ws_strdup_printf("%s\\dumpcap.exe", progfile_dir); #else - exename = g_strdup_printf("%s/dumpcap", progfile_dir); + exename = ws_strdup_printf("%s/dumpcap", progfile_dir); #endif /* Make that the first argument in the argument list (argv[0]). */ @@ -349,7 +349,7 @@ sync_pipe_start(capture_options *capture_opts, GPtrArray *capture_comments, if (interface_opts->extcap_fifo != NULL) { #ifdef _WIN32 - char *pipe = g_strdup_printf("%s%" PRIuPTR, EXTCAP_PIPE_PREFIX, interface_opts->extcap_pipe_h); + char *pipe = ws_strdup_printf("%s%" PRIuPTR, EXTCAP_PIPE_PREFIX, interface_opts->extcap_pipe_h); argv = sync_pipe_add_arg(argv, &argc, pipe); g_free(pipe); #else @@ -501,7 +501,7 @@ sync_pipe_start(capture_options *capture_opts, GPtrArray *capture_comments, } /* Create the signal pipe */ - signal_pipe_name = g_strdup_printf(SIGNAL_PIPE_FORMAT, control_id); + signal_pipe_name = ws_strdup_printf(SIGNAL_PIPE_FORMAT, control_id); signal_pipe = CreateNamedPipe(utf_8to16(signal_pipe_name), PIPE_ACCESS_OUTBOUND, PIPE_TYPE_BYTE, 1, 65535, 65535, 0, NULL); g_free(signal_pipe_name); @@ -715,7 +715,7 @@ sync_pipe_open_command(char* const argv[], int *data_read_fd, /* (increase this value if you have trouble while fast capture file switches) */ if (! CreatePipe(&sync_pipe[PIPE_READ], &sync_pipe[PIPE_WRITE], &sa, 5120)) { /* Couldn't create the message pipe between parent and child. */ - *msg = g_strdup_printf("Couldn't create sync pipe: %s", + *msg = ws_strdup_printf("Couldn't create sync pipe: %s", win32strerror(GetLastError())); return -1; } @@ -729,7 +729,7 @@ sync_pipe_open_command(char* const argv[], int *data_read_fd, */ *message_read_fd = _open_osfhandle( (intptr_t) sync_pipe[PIPE_READ], _O_BINARY); if (*message_read_fd == -1) { - *msg = g_strdup_printf("Couldn't get C file handle for message read pipe: %s", g_strerror(errno)); + *msg = ws_strdup_printf("Couldn't get C file handle for message read pipe: %s", g_strerror(errno)); CloseHandle(sync_pipe[PIPE_READ]); CloseHandle(sync_pipe[PIPE_WRITE]); return -1; @@ -739,7 +739,7 @@ sync_pipe_open_command(char* const argv[], int *data_read_fd, /* (increase this value if you have trouble while fast capture file switches) */ if (! CreatePipe(&data_pipe[PIPE_READ], &data_pipe[PIPE_WRITE], &sa, 5120)) { /* Couldn't create the message pipe between parent and child. */ - *msg = g_strdup_printf("Couldn't create data pipe: %s", + *msg = ws_strdup_printf("Couldn't create data pipe: %s", win32strerror(GetLastError())); ws_close(*message_read_fd); /* Should close sync_pipe[PIPE_READ] */ CloseHandle(sync_pipe[PIPE_WRITE]); @@ -755,7 +755,7 @@ sync_pipe_open_command(char* const argv[], int *data_read_fd, */ *data_read_fd = _open_osfhandle( (intptr_t) data_pipe[PIPE_READ], _O_BINARY); if (*data_read_fd == -1) { - *msg = g_strdup_printf("Couldn't get C file handle for data read pipe: %s", g_strerror(errno)); + *msg = ws_strdup_printf("Couldn't get C file handle for data read pipe: %s", g_strerror(errno)); CloseHandle(data_pipe[PIPE_READ]); CloseHandle(data_pipe[PIPE_WRITE]); ws_close(*message_read_fd); /* Should close sync_pipe[PIPE_READ] */ @@ -792,7 +792,7 @@ sync_pipe_open_command(char* const argv[], int *data_read_fd, /* call dumpcap */ if(!win32_create_process(argv[0], args->str, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) { - *msg = g_strdup_printf("Couldn't run %s in child process: %s", + *msg = ws_strdup_printf("Couldn't run %s in child process: %s", args->str, win32strerror(GetLastError())); ws_close(*data_read_fd); /* Should close data_pipe[PIPE_READ] */ CloseHandle(data_pipe[PIPE_WRITE]); @@ -809,14 +809,14 @@ sync_pipe_open_command(char* const argv[], int *data_read_fd, /* Create a pipe for the child process to send us messages */ if (pipe(sync_pipe) < 0) { /* Couldn't create the message pipe between parent and child. */ - *msg = g_strdup_printf("Couldn't create sync pipe: %s", g_strerror(errno)); + *msg = ws_strdup_printf("Couldn't create sync pipe: %s", g_strerror(errno)); return -1; } /* Create a pipe for the child process to send us data */ if (pipe(data_pipe) < 0) { /* Couldn't create the data pipe between parent and child. */ - *msg = g_strdup_printf("Couldn't create data pipe: %s", g_strerror(errno)); + *msg = ws_strdup_printf("Couldn't create data pipe: %s", g_strerror(errno)); ws_close(sync_pipe[PIPE_READ]); ws_close(sync_pipe[PIPE_WRITE]); return -1; @@ -872,7 +872,7 @@ sync_pipe_open_command(char* const argv[], int *data_read_fd, if (*fork_child == WS_INVALID_PID) { /* We couldn't even create the child process. */ - *msg = g_strdup_printf("Couldn't create child process: %s", g_strerror(errno)); + *msg = ws_strdup_printf("Couldn't create child process: %s", g_strerror(errno)); ws_close(*data_read_fd); ws_close(*message_read_fd); return -1; @@ -982,7 +982,7 @@ sync_pipe_run_command_actual(char* const argv[], gchar **data, gchar **primary_m /* We got an error from the sync pipe. If ret is -1, report both the sync pipe I/O error and the wait error. */ if (ret == -1) { - combined_msg = g_strdup_printf("%s\n\n%s", *primary_msg, wait_msg); + combined_msg = ws_strdup_printf("%s\n\n%s", *primary_msg, wait_msg); g_free(*primary_msg); g_free(wait_msg); *primary_msg = combined_msg; @@ -1085,7 +1085,7 @@ sync_pipe_run_command_actual(char* const argv[], gchar **data, gchar **primary_m /* * Child process returned an unknown status. */ - *primary_msg = g_strdup_printf("dumpcap process gave an unexpected message type: 0x%02x", + *primary_msg = ws_strdup_printf("dumpcap process gave an unexpected message type: 0x%02x", indicator); *secondary_msg = NULL; ret = -1; @@ -1153,11 +1153,11 @@ sync_interface_set_80211_chan(const gchar *iface, const char *freq, const gchar argv = sync_pipe_add_arg(argv, &argc, iface); if (center_freq2) - opt = g_strdup_printf("%s,%s,%s,%s", freq, type, center_freq1, center_freq2); + opt = ws_strdup_printf("%s,%s,%s,%s", freq, type, center_freq1, center_freq2); else if (center_freq1) - opt = g_strdup_printf("%s,%s,%s", freq, type, center_freq1); + opt = ws_strdup_printf("%s,%s,%s", freq, type, center_freq1); else if (type) - opt = g_strdup_printf("%s,%s", freq, type); + opt = ws_strdup_printf("%s,%s", freq, type); else opt = g_strdup(freq); @@ -1366,7 +1366,7 @@ sync_interface_stats_open(int *data_read_fd, ws_process_id *fork_child, gchar ** /* We got an error from the sync pipe. If ret is -1, report both the sync pipe I/O error and the wait error. */ if (ret == -1) { - combined_msg = g_strdup_printf("%s\n\n%s", *msg, wait_msg); + combined_msg = ws_strdup_printf("%s\n\n%s", *msg, wait_msg); g_free(*msg); g_free(wait_msg); *msg = combined_msg; @@ -1433,7 +1433,7 @@ sync_interface_stats_open(int *data_read_fd, ws_process_id *fork_child, gchar ** /* * Child process returned an unknown status. */ - *msg = g_strdup_printf("dumpcap process gave an unexpected message type: 0x%02x", + *msg = ws_strdup_printf("dumpcap process gave an unexpected message type: 0x%02x", indicator); ret = -1; } @@ -1477,7 +1477,7 @@ pipe_read_bytes(int pipe_fd, char *bytes, int required, char **msg) /* error */ error = errno; ws_debug("read from pipe %d: error(%u): %s", pipe_fd, error, g_strerror(error)); - *msg = g_strdup_printf("Error reading from sync pipe: %s", + *msg = ws_strdup_printf("Error reading from sync pipe: %s", g_strerror(error)); return newly; } @@ -1564,7 +1564,7 @@ pipe_read_block(int pipe_fd, char *indicator, int len, char *msg, /* * Short read, but not an immediate EOF. */ - *err_msg = g_strdup_printf("Premature EOF reading from sync pipe: got only %ld bytes", + *err_msg = ws_strdup_printf("Premature EOF reading from sync pipe: got only %ld bytes", (long)newly); } return -1; @@ -1591,7 +1591,7 @@ pipe_read_block(int pipe_fd, char *indicator, int len, char *msg, if (newly < 0) { /* error */ ws_debug("read from pipe %d: error(%u): %s", pipe_fd, errno, g_strerror(errno)); } - *err_msg = g_strdup_printf("Unknown message from dumpcap reading header, try to show it as a string: %s", + *err_msg = ws_strdup_printf("Unknown message from dumpcap reading header, try to show it as a string: %s", msg); return -1; } @@ -1601,7 +1601,7 @@ pipe_read_block(int pipe_fd, char *indicator, int len, char *msg, newly = pipe_read_bytes(pipe_fd, msg, required, err_msg); if(newly != required) { if (newly != -1) { - *err_msg = g_strdup_printf("Unknown message from dumpcap reading data, try to show it as a string: %s", + *err_msg = ws_strdup_printf("Unknown message from dumpcap reading data, try to show it as a string: %s", msg); } return -1; @@ -1660,7 +1660,7 @@ sync_pipe_input_cb(gint source, gpointer user_data) /* We got an error from the sync pipe. If ret is -1, report both the sync pipe I/O error and the wait error. */ if (ret == -1) { - combined_msg = g_strdup_printf("%s\n\n%s", primary_msg, wait_msg); + combined_msg = ws_strdup_printf("%s\n\n%s", primary_msg, wait_msg); g_free(primary_msg); g_free(wait_msg); primary_msg = combined_msg; @@ -1789,7 +1789,7 @@ sync_pipe_wait_for_child(ws_process_id fork_child, gchar **msgp) *msgp = NULL; /* assume no error */ #ifdef _WIN32 if (_cwait(&fork_child_status, (intptr_t) fork_child, _WAIT_CHILD) == -1) { - *msgp = g_strdup_printf("Error from cwait(): %s", g_strerror(errno)); + *msgp = ws_strdup_printf("Error from cwait(): %s", g_strerror(errno)); ret = -1; } else { /* @@ -1799,7 +1799,7 @@ sync_pipe_wait_for_child(ws_process_id fork_child, gchar **msgp) ret = fork_child_status; if ((fork_child_status & 0xC0000000) == ERROR_SEVERITY_ERROR) { /* Probably an exception code */ - *msgp = g_strdup_printf("Child dumpcap process died: %s", + *msgp = ws_strdup_printf("Child dumpcap process died: %s", win32strexception(fork_child_status)); ret = -1; } @@ -1816,19 +1816,19 @@ sync_pipe_wait_for_child(ws_process_id fork_child, gchar **msgp) ret = WEXITSTATUS(fork_child_status); } else if (WIFSTOPPED(fork_child_status)) { /* It stopped, rather than exiting. "Should not happen." */ - *msgp = g_strdup_printf("Child dumpcap process stopped: %s", + *msgp = ws_strdup_printf("Child dumpcap process stopped: %s", sync_pipe_signame(WSTOPSIG(fork_child_status))); ret = -1; } else if (WIFSIGNALED(fork_child_status)) { /* It died with a signal. */ - *msgp = g_strdup_printf("Child dumpcap process died: %s%s", + *msgp = ws_strdup_printf("Child dumpcap process died: %s%s", sync_pipe_signame(WTERMSIG(fork_child_status)), WCOREDUMP(fork_child_status) ? " - core dumped" : ""); ret = -1; } else { /* What? It had to either have exited, or stopped, or died with a signal; what happened here? */ - *msgp = g_strdup_printf("Bad status from waitpid(): %#o", + *msgp = ws_strdup_printf("Bad status from waitpid(): %#o", fork_child_status); ret = -1; } @@ -1863,7 +1863,7 @@ sync_pipe_wait_for_child(ws_process_id fork_child, gchar **msgp) ret = fetch_dumpcap_pid ? 0 : -1; } else { /* Unknown error. */ - *msgp = g_strdup_printf("Error from waitpid(): %s", g_strerror(errno)); + *msgp = ws_strdup_printf("Error from waitpid(): %s", g_strerror(errno)); ret = -1; } } @@ -1982,11 +1982,11 @@ static void create_dummy_signal_pipe() { if (dummy_signal_pipe != NULL) return; if (!dummy_control_id) { - dummy_control_id = g_strdup_printf("%d.dummy", GetCurrentProcessId()); + dummy_control_id = ws_strdup_printf("%d.dummy", GetCurrentProcessId()); } /* Create the signal pipe */ - dummy_signal_pipe_name = g_strdup_printf(SIGNAL_PIPE_FORMAT, dummy_control_id); + dummy_signal_pipe_name = ws_strdup_printf(SIGNAL_PIPE_FORMAT, dummy_control_id); dummy_signal_pipe = CreateNamedPipe(utf_8to16(dummy_signal_pipe_name), PIPE_ACCESS_OUTBOUND, PIPE_TYPE_BYTE, 1, 65535, 65535, 0, NULL); g_free(dummy_signal_pipe_name); diff --git a/capture/ws80211_utils.c b/capture/ws80211_utils.c index fab1c3ec74..d7e334426a 100644 --- a/capture/ws80211_utils.c +++ b/capture/ws80211_utils.c @@ -383,7 +383,7 @@ static int get_phys_handler(struct nl_msg *msg, void *arg) if (!tb_msg[NL80211_ATTR_WIPHY_NAME]) return NL_SKIP; - ifname = g_strdup_printf("%s.mon", nla_get_string(tb_msg[NL80211_ATTR_WIPHY_NAME])); + ifname = ws_strdup_printf("%s.mon", nla_get_string(tb_msg[NL80211_ATTR_WIPHY_NAME])); iface = get_interface_by_name(cookie->interfaces, ifname); if (!iface) { @@ -674,7 +674,7 @@ static int ws80211_populate_devices(GArray *interfaces) if (iface_info.type == NL80211_IFTYPE_MONITOR) { for (j = 0; j < interfaces->len; j++) { iface = g_array_index(interfaces, struct ws80211_interface *, j); - t2 = g_strdup_printf("phy%d.mon", iface_info.phyidx); + t2 = ws_strdup_printf("phy%d.mon", iface_info.phyidx); if (t2) { if (!strcmp(t2, iface->ifname)) { g_free(iface->ifname); @@ -1182,7 +1182,7 @@ const char *ws80211_get_helper_path(void) if (reg_ret == ERROR_SUCCESS) { airpcap_dir_utf16[ad_size-1] = L'\0'; g_free(airpcap_conf_path); - airpcap_conf_path = g_strdup_printf("%s\\AirpcapConf.exe", utf_16to8(airpcap_dir_utf16)); + airpcap_conf_path = ws_strdup_printf("%s\\AirpcapConf.exe", utf_16to8(airpcap_dir_utf16)); if (!g_file_test(airpcap_conf_path, G_FILE_TEST_IS_EXECUTABLE)) { g_free(airpcap_conf_path); diff --git a/capture_opts.c b/capture_opts.c index b04f3aa2b4..2c77a29ef8 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -544,7 +544,7 @@ capture_opts_generate_display_name(const char *friendly_name, * On UN*X, however, users are more used to interface names, * and may find it helpful to see them. */ - return g_strdup_printf("%s: %s", friendly_name, name); + return ws_strdup_printf("%s: %s", friendly_name, name); } #endif diff --git a/dumpcap.c b/dumpcap.c index d4baf7a30b..e832a10887 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -471,7 +471,7 @@ dumpcap_cmdarg_err(const char *fmt, va_list ap) if (capture_child) { gchar *msg; /* Generate a 'special format' message back to parent */ - msg = g_strdup_vprintf(fmt, ap); + msg = ws_strdup_vprintf(fmt, ap); sync_pipe_errmsg_to_parent(2, msg, ""); g_free(msg); } else { @@ -491,7 +491,7 @@ dumpcap_cmdarg_err_cont(const char *fmt, va_list ap) { if (capture_child) { gchar *msg; - msg = g_strdup_vprintf(fmt, ap); + msg = ws_strdup_vprintf(fmt, ap); sync_pipe_errmsg_to_parent(2, msg, ""); g_free(msg); } else { @@ -2847,7 +2847,7 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld, break; default: - sync_msg_str = g_strdup_printf( + sync_msg_str = ws_strdup_printf( "Unknown sampling method %d specified,\n" "continue without packet sampling", interface_opts->sampling_method); @@ -2935,7 +2935,7 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld, If so, "open_capture_device()" returned a warning; print it, but keep capturing. */ if (open_status != CAP_DEVICE_OPEN_NO_ERR) { - sync_msg_str = g_strdup_printf("%s.", open_status_str); + sync_msg_str = ws_strdup_printf("%s.", open_status_str); report_capture_error(sync_msg_str, ""); g_free(sync_msg_str); } @@ -3601,7 +3601,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd, * More than one interface; just use the number of interfaces * to generate the temporary file name prefix. */ - prefix = g_strdup_printf("wireshark_%d_interfaces", global_capture_opts.ifaces->len); + prefix = ws_strdup_printf("wireshark_%d_interfaces", global_capture_opts.ifaces->len); } else { /* * One interface; use its description, if it has one, to generate @@ -3863,7 +3863,7 @@ handle_npcap_bug(char *adapter_name _U_, char *cap_err_str _U_) } windows_info_str = g_string_new(""); get_os_version_info(windows_info_str); - msg = g_strdup_printf("If you have not removed that adapter, this " + msg = ws_strdup_printf("If you have not removed that adapter, this " "is probably a known issue in Npcap resulting from " "the behavior of the Windows networking stack. " "Work is being done in Npcap to improve the " @@ -4206,7 +4206,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct cap_err_str = pcap_geterr(pcap_src->pcap_h); if (strcmp(cap_err_str, "The interface went down") == 0 || strcmp(cap_err_str, "recvfrom: Network is down") == 0) { - primary_msg = g_strdup_printf("The network adapter \"%s\" " + primary_msg = ws_strdup_printf("The network adapter \"%s\" " "is no longer running; the " "capture has stopped.", interface_opts->display_name); @@ -4215,7 +4215,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct strcmp(cap_err_str, "read: Device not configured") == 0 || strcmp(cap_err_str, "read: I/O error") == 0 || strcmp(cap_err_str, "read error: PacketReceivePacket failed") == 0) { - primary_msg = g_strdup_printf("The network adapter \"%s\" " + primary_msg = ws_strdup_printf("The network adapter \"%s\" " "is no longer attached; the " "capture has stopped.", interface_opts->display_name); @@ -4229,7 +4229,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct * * Those should be reported as Npcap issues. */ - primary_msg = g_strdup_printf("The network adapter \"%s\" " + primary_msg = ws_strdup_printf("The network adapter \"%s\" " "is no longer attached; the " "capture has stopped.", interface_opts->display_name); @@ -4254,7 +4254,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct * sort of problems popping up, but I can't find that * discussion. */ - primary_msg = g_strdup_printf("The network adapter \"%s\" " + primary_msg = ws_strdup_printf("The network adapter \"%s\" " "is no longer attached; the " "capture has stopped.", interface_opts->display_name); @@ -4266,7 +4266,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct "remote host on which you are " "capturing packets."); } else { - primary_msg = g_strdup_printf("Error while capturing packets: %s", + primary_msg = ws_strdup_printf("Error while capturing packets: %s", cap_err_str); secondary_msg = g_strdup(please_report_bug()); } @@ -5194,7 +5194,7 @@ main(int argc, char *argv[]) * signal pipe name. */ if (strcmp(ws_optarg, SIGNAL_PIPE_CTRL_ID_NONE) != 0) { - sig_pipe_name = g_strdup_printf(SIGNAL_PIPE_FORMAT, ws_optarg); + sig_pipe_name = ws_strdup_printf(SIGNAL_PIPE_FORMAT, ws_optarg); sig_pipe_handle = CreateFile(utf_8to16(sig_pipe_name), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); @@ -5440,7 +5440,7 @@ main(int argc, char *argv[]) caps = get_if_capabilities(interface_opts, &open_status, &open_status_str); if (caps == NULL) { if (capture_child) { - char *error_msg = g_strdup_printf("The capabilities of the capture device " + char *error_msg = ws_strdup_printf("The capabilities of the capture device " "\"%s\" could not be obtained (%s)", interface_opts->name, open_status_str); sync_pipe_errmsg_to_parent(2, error_msg, @@ -5527,14 +5527,14 @@ main(int argc, char *argv[]) g_free(interface_opts->display_name); if (interface_opts->descr != NULL) { #ifdef _WIN32 - interface_opts->display_name = g_strdup_printf("%s", + interface_opts->display_name = ws_strdup_printf("%s", interface_opts->descr); #else - interface_opts->display_name = g_strdup_printf("%s: %s", + interface_opts->display_name = ws_strdup_printf("%s: %s", interface_opts->descr, interface_opts->ifname); #endif } else { - interface_opts->display_name = g_strdup_printf("%s", + interface_opts->display_name = ws_strdup_printf("%s", interface_opts->ifname); } } @@ -5602,7 +5602,7 @@ dumpcap_log_writer(const char *domain, enum ws_log_level level, /* ERROR, CRITICAL, WARNING, MESSAGE messages goto stderr or */ /* to parent especially formatted if dumpcap running as child. */ if (capture_child) { - gchar *msg = g_strdup_vprintf(user_format, user_ap); + gchar *msg = ws_strdup_vprintf(user_format, user_ap); sync_pipe_errmsg_to_parent(2, msg, ""); g_free(msg); } else if(ws_log_msg_is_active(domain, level)) { @@ -5722,7 +5722,7 @@ report_packet_drops(guint32 received, guint32 pcap_drops, guint32 drops, guint32 guint32 total_drops = pcap_drops + drops + flushed; if (capture_child) { - char* tmp = g_strdup_printf("%u:%s", total_drops, name); + char* tmp = ws_strdup_printf("%u:%s", total_drops, name); ws_debug("Packets received/dropped on interface '%s': %u/%u (pcap:%u/dumpcap:%u/flushed:%u/ps_ifdrop:%u)", name, received, total_drops, pcap_drops, drops, flushed, ps_ifdrop); diff --git a/epan/dissectors/asn1/camel/packet-camel-template.c b/epan/dissectors/asn1/camel/packet-camel-template.c index 7c312db9b1..6f34c361d5 100644 --- a/epan/dissectors/asn1/camel/packet-camel-template.c +++ b/epan/dissectors/asn1/camel/packet-camel-template.c @@ -1183,9 +1183,9 @@ static void camel_stat_init(stat_tap_table_ui* new_stat) const char *ocs = try_val_to_str(i, camel_opr_code_strings); char *col_str; if (ocs) { - col_str = g_strdup_printf("Request %s", ocs); + col_str = ws_strdup_printf("Request %s", ocs); } else { - col_str = g_strdup_printf("Unknown op code %d", i); + col_str = ws_strdup_printf("Unknown op code %d", i); } items[MESSAGE_TYPE_COLUMN].value.string_value = col_str; diff --git a/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c b/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c index 8d8ad4e171..cec724fa62 100644 --- a/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c +++ b/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c @@ -2764,7 +2764,7 @@ static void gsm_map_stat_init(stat_tap_table_ui* new_stat) if (ocs) { col_str = g_strdup(ocs); } else { - col_str = g_strdup_printf("Unknown op code %d", i); + col_str = ws_strdup_printf("Unknown op code %d", i); } items[ID_COLUMN].value.uint_value = i; diff --git a/epan/dissectors/asn1/ldap/packet-ldap-template.c b/epan/dissectors/asn1/ldap/packet-ldap-template.c index b1e63b95c3..636eaedd39 100644 --- a/epan/dissectors/asn1/ldap/packet-ldap-template.c +++ b/epan/dissectors/asn1/ldap/packet-ldap-template.c @@ -483,7 +483,7 @@ attribute_types_update_cb(void *r, char **err) */ c = proto_check_field_name(rec->attribute_type); if (c) { - *err = g_strdup_printf("Attribute type can't contain '%c'", c); + *err = ws_strdup_printf("Attribute type can't contain '%c'", c); return FALSE; } @@ -576,7 +576,7 @@ attribute_types_post_update_cb(void) dynamic_hf[i].p_id = hf_id; dynamic_hf[i].hfinfo.name = attribute_type; - dynamic_hf[i].hfinfo.abbrev = g_strdup_printf("ldap.AttributeValue.%s", attribute_type); + dynamic_hf[i].hfinfo.abbrev = ws_strdup_printf("ldap.AttributeValue.%s", attribute_type); dynamic_hf[i].hfinfo.type = FT_STRING; dynamic_hf[i].hfinfo.display = BASE_NONE; dynamic_hf[i].hfinfo.strings = NULL; diff --git a/epan/dissectors/file-file.c b/epan/dissectors/file-file.c index 774661b0a1..d8e75fe75d 100644 --- a/epan/dissectors/file-file.c +++ b/epan/dissectors/file-file.c @@ -196,7 +196,7 @@ dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, /* XXX - add other hardware exception codes as required */ default: show_exception(tvb, pinfo, parent_tree, DissectorError, - g_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode())); + ws_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode())); } } #endif @@ -261,7 +261,7 @@ dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, /* XXX - add other hardware exception codes as required */ default: show_exception(tvb, pinfo, parent_tree, DissectorError, - g_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode())); + ws_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode())); } } #endif diff --git a/epan/dissectors/packet-autosar-ipdu-multiplexer.c b/epan/dissectors/packet-autosar-ipdu-multiplexer.c index 850e5802a0..65f185dc13 100644 --- a/epan/dissectors/packet-autosar-ipdu-multiplexer.c +++ b/epan/dissectors/packet-autosar-ipdu-multiplexer.c @@ -194,22 +194,22 @@ update_ipdum_message_list(void *r, char **err) { ipdum_message_list_uat_t *rec = (ipdum_message_list_uat_t *)r; if (rec->pos >= 0xffff) { - *err = g_strdup_printf("Position too big"); + *err = ws_strdup_printf("Position too big"); return FALSE; } if (rec->num_of_params >= 0xffff) { - *err = g_strdup_printf("Number of PDUs too big"); + *err = ws_strdup_printf("Number of PDUs too big"); return FALSE; } if (rec->pos >= rec->num_of_params) { - *err = g_strdup_printf("Position >= Number of PDUs"); + *err = ws_strdup_printf("Position >= Number of PDUs"); return FALSE; } if (rec->name == NULL || rec->name[0] == 0) { - *err = g_strdup_printf("Name cannot be empty"); + *err = ws_strdup_printf("Name cannot be empty"); return FALSE; } @@ -414,12 +414,12 @@ update_ipdum_flexray_mapping(void *r, char **err) { ipdum_flexray_mapping_uat_t *rec = (ipdum_flexray_mapping_uat_t *)r; if (rec->cycle > 0xff) { - *err = g_strdup_printf("We currently only support 8 bit Cycles (Cycle: %i Frame ID: %i)", rec->cycle, rec->frame_id); + *err = ws_strdup_printf("We currently only support 8 bit Cycles (Cycle: %i Frame ID: %i)", rec->cycle, rec->frame_id); return FALSE; } if (rec->frame_id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit Frame IDs (Cycle: %i Frame ID: %i)", rec->cycle, rec->frame_id); + *err = ws_strdup_printf("We currently only support 16 bit Frame IDs (Cycle: %i Frame ID: %i)", rec->cycle, rec->frame_id); return FALSE; } @@ -492,12 +492,12 @@ update_ipdum_lin_mapping(void *r, char **err) { ipdum_lin_mapping_uat_t *rec = (ipdum_lin_mapping_uat_t *)r; if (rec->frame_id > LIN_ID_MASK) { - *err = g_strdup_printf("LIN Frame IDs are only uint with 6 bits (ID: %i)", rec->frame_id); + *err = ws_strdup_printf("LIN Frame IDs are only uint with 6 bits (ID: %i)", rec->frame_id); return FALSE; } if (rec->bus_id > 0xffff) { - *err = g_strdup_printf("LIN Bus IDs are only uint with 16 bits (ID: 0x%x, Bus ID: 0x%x)", rec->frame_id, rec->bus_id); + *err = ws_strdup_printf("LIN Bus IDs are only uint with 16 bits (ID: 0x%x, Bus ID: 0x%x)", rec->frame_id, rec->bus_id); return FALSE; } @@ -597,7 +597,7 @@ update_ipdum_pdu_transport_mapping(void *r, char **err) { ipdum_pdu_transport_mapping_uat_t *rec = (ipdum_pdu_transport_mapping_uat_t *)r; if (rec->pdu_id > 0xffffffff) { - *err = g_strdup_printf("PDU-Transport IDs are only uint32 (ID: %i)", rec->pdu_id); + *err = ws_strdup_printf("PDU-Transport IDs are only uint32 (ID: %i)", rec->pdu_id); return FALSE; } diff --git a/epan/dissectors/packet-autosar-nm.c b/epan/dissectors/packet-autosar-nm.c index 5992396412..f7107dc4eb 100644 --- a/epan/dissectors/packet-autosar-nm.c +++ b/epan/dissectors/packet-autosar-nm.c @@ -153,35 +153,35 @@ user_data_fields_update_cb(void *r, char **err) *err = NULL; if (rec->udf_length == 0) { - *err = g_strdup_printf("length of user data field can't be 0 Bytes (name: %s offset: %i length: %i)", rec->udf_name, rec->udf_offset, rec->udf_length); + *err = ws_strdup_printf("length of user data field can't be 0 Bytes (name: %s offset: %i length: %i)", rec->udf_name, rec->udf_offset, rec->udf_length); return (*err == NULL); } if (rec->udf_length > 8) { - *err = g_strdup_printf("length of user data field can't be greater 8 Bytes (name: %s offset: %i length: %i)", rec->udf_name, rec->udf_offset, rec->udf_length); + *err = ws_strdup_printf("length of user data field can't be greater 8 Bytes (name: %s offset: %i length: %i)", rec->udf_name, rec->udf_offset, rec->udf_length); return (*err == NULL); } if (rec->udf_mask >= G_MAXUINT64) { - *err = g_strdup_printf("mask can only be up to 64bits (name: %s)", rec->udf_name); + *err = ws_strdup_printf("mask can only be up to 64bits (name: %s)", rec->udf_name); return (*err == NULL); } if (rec->udf_name == NULL) { - *err = g_strdup_printf("Name of user data field can't be empty"); + *err = ws_strdup_printf("Name of user data field can't be empty"); return (*err == NULL); } g_strstrip(rec->udf_name); if (rec->udf_name[0] == 0) { - *err = g_strdup_printf("Name of user data field can't be empty"); + *err = ws_strdup_printf("Name of user data field can't be empty"); return (*err == NULL); } /* Check for invalid characters (to avoid asserting out when registering the field). */ c = proto_check_field_name(rec->udf_name); if (c) { - *err = g_strdup_printf("Name of user data field can't contain '%c'", c); + *err = ws_strdup_printf("Name of user data field can't contain '%c'", c); return (*err == NULL); } @@ -236,7 +236,7 @@ static gchar* calc_hf_key(user_data_field_t udf) { gchar* ret = NULL; - ret = g_strdup_printf("%i-%i-%" PRIu64 "-%s", udf.udf_offset, udf.udf_length, udf.udf_mask, udf.udf_name); + ret = ws_strdup_printf("%i-%i-%" PRIu64 "-%s", udf.udf_offset, udf.udf_length, udf.udf_mask, udf.udf_name); return ret; } @@ -339,14 +339,14 @@ user_data_post_update_cb(void) if (user_data_fields[i].udf_mask == 0 || user_data_fields[i].udf_length <= 0 || user_data_fields[i].udf_length>8) { dynamic_hf[i].hfinfo.name = g_strdup(user_data_fields[i].udf_name); - dynamic_hf[i].hfinfo.abbrev = g_strdup_printf("autosar-nm.user_data.%s", user_data_fields[i].udf_name); + dynamic_hf[i].hfinfo.abbrev = ws_strdup_printf("autosar-nm.user_data.%s", user_data_fields[i].udf_name); dynamic_hf[i].hfinfo.type = FT_BYTES; dynamic_hf[i].hfinfo.display = BASE_NONE; dynamic_hf[i].hfinfo.bitmask = 0; dynamic_hf[i].hfinfo.blurb = g_strdup(user_data_fields[i].udf_desc); } else { dynamic_hf[i].hfinfo.name = g_strdup(user_data_fields[i].udf_value_desc); - dynamic_hf[i].hfinfo.abbrev = g_strdup_printf("autosar-nm.user_data.%s.%s", user_data_fields[i].udf_name, user_data_fields[i].udf_value_desc); + dynamic_hf[i].hfinfo.abbrev = ws_strdup_printf("autosar-nm.user_data.%s.%s", user_data_fields[i].udf_name, user_data_fields[i].udf_value_desc); dynamic_hf[i].hfinfo.type = FT_BOOLEAN; dynamic_hf[i].hfinfo.display = 8 * (user_data_fields[i].udf_length); /* dynamic_hf[i].hfinfo.bitmask = 0; */ diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 1b27841c26..1370dc928a 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -856,7 +856,7 @@ de_bssgp_cell_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 of proto_tree_add_item(tree, hf_bssgp_ci, tvb, curr_offset, 2, ENC_BIG_ENDIAN); curr_offset+=2; if (add_string) { - char *str = g_strdup_printf("%s, CI %u", add_string, ci); + char *str = ws_strdup_printf("%s, CI %u", add_string, ci); g_strlcpy(add_string, str, string_len); g_free(str); } @@ -2312,7 +2312,7 @@ de_bssgp_rim_routing_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gu proto_tree_add_item(tree, hf_bssgp_rnc_id, tvb, curr_offset, 2, ENC_BIG_ENDIAN); if (add_string) { - char *str = g_strdup_printf(" %s, RNC-ID %u", add_string, rnc_id); + char *str = ws_strdup_printf(" %s, RNC-ID %u", add_string, rnc_id); g_strlcpy(add_string, str, string_len); g_free(str); } @@ -2769,7 +2769,7 @@ de_bssgp_rnc_identifier(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gui curr_offset+=2; if (add_string) { - char *str = g_strdup_printf(" %s, RNC-ID %u", add_string, rnc_id); + char *str = ws_strdup_printf(" %s, RNC-ID %u", add_string, rnc_id); g_strlcpy(add_string, str, string_len); g_free(str); } diff --git a/epan/dissectors/packet-btmesh.c b/epan/dissectors/packet-btmesh.c index 4eac4d0206..f614e290b6 100644 --- a/epan/dissectors/packet-btmesh.c +++ b/epan/dissectors/packet-btmesh.c @@ -8207,7 +8207,7 @@ compute_ascii_key(guchar **ascii_key, const gchar *key, const gchar *key_name, g { g_free(*ascii_key); *ascii_key = NULL; - *err = g_strdup_printf("Key %s begins with an invalid hex char (%c)", key, key[i]); + *err = ws_strdup_printf("Key %s begins with an invalid hex char (%c)", key, key[i]); return -1; /* not a valid hex digit */ } (*ascii_key)[j] = (guchar)hex_digit; @@ -8230,7 +8230,7 @@ compute_ascii_key(guchar **ascii_key, const gchar *key, const gchar *key_name, g { g_free(*ascii_key); *ascii_key = NULL; - *err = g_strdup_printf("%s %s has an invalid hex char (%c)", key_name, key, key[i-1]); + *err = ws_strdup_printf("%s %s has an invalid hex char (%c)", key_name, key, key[i-1]); return -1; /* not a valid hex digit */ } key_byte = ((guchar)hex_digit) << 4; @@ -8240,7 +8240,7 @@ compute_ascii_key(guchar **ascii_key, const gchar *key, const gchar *key_name, g { g_free(*ascii_key); *ascii_key = NULL; - *err = g_strdup_printf("%s %s has an invalid hex char (%c)", key_name, key, key[i-1]); + *err = ws_strdup_printf("%s %s has an invalid hex char (%c)", key_name, key, key[i-1]); return -1; /* not a valid hex digit */ } key_byte |= (guchar)hex_digit; @@ -8250,7 +8250,7 @@ compute_ascii_key(guchar **ascii_key, const gchar *key, const gchar *key_name, g (*ascii_key)[j] = '\0'; } else { *ascii_key = NULL; - *err = g_strdup_printf("%s %s has to start with '0x' or '0X', and represent exactly %d octets", key_name, key, expected_octets); + *err = ws_strdup_printf("%s %s has to start with '0x' or '0X', and represent exactly %d octets", key_name, key, expected_octets); return -1; } } diff --git a/epan/dissectors/packet-camel.c b/epan/dissectors/packet-camel.c index caeb0dd2c0..d6f23daa99 100644 --- a/epan/dissectors/packet-camel.c +++ b/epan/dissectors/packet-camel.c @@ -8213,9 +8213,9 @@ static void camel_stat_init(stat_tap_table_ui* new_stat) const char *ocs = try_val_to_str(i, camel_opr_code_strings); char *col_str; if (ocs) { - col_str = g_strdup_printf("Request %s", ocs); + col_str = ws_strdup_printf("Request %s", ocs); } else { - col_str = g_strdup_printf("Unknown op code %d", i); + col_str = ws_strdup_printf("Unknown op code %d", i); } items[MESSAGE_TYPE_COLUMN].value.string_value = col_str; diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c index 444fff565b..2686f6d551 100644 --- a/epan/dissectors/packet-dccp.c +++ b/epan/dissectors/packet-dccp.c @@ -525,7 +525,7 @@ dccp_build_filter(packet_info *pinfo) { if( pinfo->net_src.type == AT_IPv4 && pinfo->net_dst.type == AT_IPv4 ) { /* DCCP over IPv4 */ - return g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (dccp.port eq %d and dccp.port eq %d)", + return ws_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (dccp.port eq %d and dccp.port eq %d)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), pinfo->srcport, pinfo->destport ); @@ -533,7 +533,7 @@ dccp_build_filter(packet_info *pinfo) if( pinfo->net_src.type == AT_IPv6 && pinfo->net_dst.type == AT_IPv6 ) { /* DCCP over IPv6 */ - return g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (dccp.port eq %d and dccp.port eq %d)", + return ws_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (dccp.port eq %d and dccp.port eq %d)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), pinfo->srcport, pinfo->destport ); @@ -554,7 +554,7 @@ static gchar *dccp_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinf /* DCCP over IPv4/6 */ dccpd = get_dccp_conversation_data(conv, pinfo); *stream = dccpd->stream; - return g_strdup_printf("dccp.stream eq %u", dccpd->stream); + return ws_strdup_printf("dccp.stream eq %u", dccpd->stream); } return NULL; @@ -562,7 +562,7 @@ static gchar *dccp_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinf static gchar *dccp_follow_index_filter(guint stream, guint sub_stream _U_) { - return g_strdup_printf("dccp.stream eq %u", stream); + return ws_strdup_printf("dccp.stream eq %u", stream); } static gchar *dccp_follow_address_filter(address *src_addr, address *dst_addr, int src_port, int dst_port) @@ -574,7 +574,7 @@ static gchar *dccp_follow_address_filter(address *src_addr, address *dst_addr, i address_to_str_buf(src_addr, src_addr_str, sizeof(src_addr_str)); address_to_str_buf(dst_addr, dst_addr_str, sizeof(dst_addr_str)); - return g_strdup_printf("((ip%s.src eq %s and dccp.srcport eq %d) and " + return ws_strdup_printf("((ip%s.src eq %s and dccp.srcport eq %d) and " "(ip%s.dst eq %s and dccp.dstport eq %d))" " or " "((ip%s.src eq %s and dccp.srcport eq %d) and " diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 2e45251813..8a2bec6635 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -2039,11 +2039,11 @@ dcerpcstat_param(register_srt_t* srt, const char* opt_arg, char** err) &d1,&d2,&d3,&d40,&d41,&d42,&d43,&d44,&d45,&d46,&d47,&major,&minor,&pos) == 13) { if ((major < 0) || (major > 65535)) { - *err = g_strdup_printf("dcerpcstat_init() Major version number %d is invalid - must be positive and <= 65535", major); + *err = ws_strdup_printf("dcerpcstat_init() Major version number %d is invalid - must be positive and <= 65535", major); return pos; } if ((minor < 0) || (minor > 65535)) { - *err = g_strdup_printf("dcerpcstat_init() Minor version number %d is invalid - must be positive and <= 65535", minor); + *err = ws_strdup_printf("dcerpcstat_init() Minor version number %d is invalid - must be positive and <= 65535", minor); return pos; } ver = major; @@ -2079,7 +2079,7 @@ dcerpcstat_param(register_srt_t* srt, const char* opt_arg, char** err) } else { - *err = g_strdup_printf(",.[,]"); + *err = ws_strdup_printf(",.[,]"); } return pos; diff --git a/epan/dissectors/packet-dhcp.c b/epan/dissectors/packet-dhcp.c index b5c26c31e6..c2a1754ff9 100644 --- a/epan/dissectors/packet-dhcp.c +++ b/epan/dissectors/packet-dhcp.c @@ -1667,7 +1667,7 @@ static gboolean uat_dhcp_record_update_cb(void* r, char** err) { uat_dhcp_record_t* rec = (uat_dhcp_record_t *)r; if ((rec->opt == 0) || (rec->opt >=DHCP_OPT_NUM-1)) { - *err = g_strdup_printf("Option must be between 1 and %d", DHCP_OPT_NUM-2); + *err = ws_strdup_printf("Option must be between 1 and %d", DHCP_OPT_NUM-2); return FALSE; } return TRUE; diff --git a/epan/dissectors/packet-doip.c b/epan/dissectors/packet-doip.c index ac5b137453..fe3004418d 100644 --- a/epan/dissectors/packet-doip.c +++ b/epan/dissectors/packet-doip.c @@ -472,7 +472,7 @@ update_generic_one_identifier_16bit(void *r, char **err) { generic_one_id_string_t *rec = (generic_one_id_string_t *)r; if (rec->id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 16 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); return FALSE; } diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c index be3fe72449..6a07774def 100644 --- a/epan/dissectors/packet-dtls.c +++ b/epan/dissectors/packet-dtls.c @@ -1799,12 +1799,12 @@ dtlsdecrypt_uat_fld_protocol_chk_cb(void* r _U_, const char* p, guint len _U_, c if (!find_dissector(p)) { if (proto_get_id_by_filter_name(p) != -1) { - *err = g_strdup_printf("While '%s' is a valid dissector filter name, that dissector is not configured" + *err = ws_strdup_printf("While '%s' is a valid dissector filter name, that dissector is not configured" " to support DTLS decryption.\n\n" "If you need to decrypt '%s' over DTLS, please contact the Wireshark development team.", p, p); } else { char* ssl_str = ssl_association_info("dtls.port", "UDP"); - *err = g_strdup_printf("Could not find dissector for: '%s'\nCommonly used DTLS dissectors include:\n%s", p, ssl_str); + *err = ws_strdup_printf("Could not find dissector for: '%s'\nCommonly used DTLS dissectors include:\n%s", p, ssl_str); g_free(ssl_str); } return FALSE; diff --git a/epan/dissectors/packet-enip.c b/epan/dissectors/packet-enip.c index 9136105642..76ad7dd448 100644 --- a/epan/dissectors/packet-enip.c +++ b/epan/dissectors/packet-enip.c @@ -990,7 +990,7 @@ enip_io_conv_filter(packet_info *pinfo) if (conn->close_frame > 0) { - buf = g_strdup_printf( + buf = ws_strdup_printf( "((frame.number == %u) || ((frame.number >= %u) && (frame.number <= %u))) && " /* Frames between ForwardOpen and ForwardClose reply */ "((enip.cpf.sai.connid == 0x%08x || enip.cpf.sai.connid == 0x%08x) || " /* O->T and T->O Connection IDs */ "((cip.cm.conn_serial_num == 0x%04x) && (cip.cm.vendor == 0x%04x) && (cip.cm.orig_serial_num == 0x%08x)))", /* Connection Triad */ @@ -1001,7 +1001,7 @@ enip_io_conv_filter(packet_info *pinfo) else { /* If Forward Close isn't found, don't limit the (end) frame range */ - buf = g_strdup_printf( + buf = ws_strdup_printf( "((frame.number == %u) || (frame.number >= %u)) && " /* Frames starting with ForwardOpen */ "((enip.cpf.sai.connid == 0x%08x || enip.cpf.sai.connid == 0x%08x) || " /* O->T and T->O Connection IDs */ "((cip.cm.conn_serial_num == 0x%04x) && (cip.cm.vendor == 0x%04x) && (cip.cm.orig_serial_num == 0x%08x)))", /* Connection Triad */ @@ -1036,7 +1036,7 @@ enip_exp_conv_filter(packet_info *pinfo) if (conn->close_frame > 0) { - buf = g_strdup_printf( + buf = ws_strdup_printf( "((frame.number == %u) || ((frame.number >= %u) && (frame.number <= %u))) && " /* Frames between ForwardOpen and ForwardClose reply */ "((enip.cpf.cai.connid == 0x%08x || enip.cpf.cai.connid == 0x%08x) || " /* O->T and T->O Connection IDs */ "((cip.cm.conn_serial_num == 0x%04x) && (cip.cm.vendor == 0x%04x) && (cip.cm.orig_serial_num == 0x%08x)))", /* Connection Triad */ @@ -1047,7 +1047,7 @@ enip_exp_conv_filter(packet_info *pinfo) else { /* If Forward Close isn't found, don't limit the (end) frame range */ - buf = g_strdup_printf( + buf = ws_strdup_printf( "((frame.number == %u) || (frame.number >= %u)) && " /* Frames between ForwardOpen and ForwardClose */ "((enip.cpf.cai.connid == 0x%08x || enip.cpf.cai.connid == 0x%08x) || " /* O->T and T->O Connection IDs */ "((cip.cm.conn_serial_num == 0x%04x) && (cip.cm.vendor == 0x%04x) && (cip.cm.orig_serial_num == 0x%08x)))", /* Connection Triad */ diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c index 076ada62a6..debd174010 100644 --- a/epan/dissectors/packet-epl.c +++ b/epan/dissectors/packet-epl.c @@ -6503,7 +6503,7 @@ epl_profile_uat_fld_fileopen_check_cb(void *record _U_, const char *path, guint if (ws_stat64(path, &st) != 0) { - *err = g_strdup_printf("File '%s' does not exist or access was denied.", path); + *err = ws_strdup_printf("File '%s' does not exist or access was denied.", path); return FALSE; } @@ -6520,7 +6520,7 @@ epl_profile_uat_fld_fileopen_check_cb(void *record _U_, const char *path, guint *err = NULL; return TRUE; #else - *err = g_strdup_printf("*.xdd and *.xdc support not compiled in. %s", supported); + *err = ws_strdup_printf("*.xdd and *.xdc support not compiled in. %s", supported); return FALSE; #endif } diff --git a/epan/dissectors/packet-etch.c b/epan/dissectors/packet-etch.c index 93f635c9e4..f3c1f10298 100644 --- a/epan/dissectors/packet-etch.c +++ b/epan/dissectors/packet-etch.c @@ -298,7 +298,7 @@ add_symbols_of_file(const char *filename) pos = strcspn(line, ","); if ((line[pos] != '\0') && (line[pos+1] !='\0')) /* require at least 1 char in symbol */ gbl_symbols_array_append(hash, - g_strdup_printf("%." ETCH_MAX_SYMBOL_LENGTH "s", &line[pos+1])); + ws_strdup_printf("%." ETCH_MAX_SYMBOL_LENGTH "s", &line[pos+1])); } fclose(pFile); } @@ -335,7 +335,7 @@ read_hashed_symbols_from_dir(const char *dirname) if (g_str_has_suffix(file, ".ewh")) { filename = - g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dirname, + ws_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dirname, name); add_symbols_of_file(filename); g_free(filename); diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index 361591c7b2..64349a4281 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -197,7 +197,7 @@ eth_filter_valid(packet_info *pinfo) static gchar* eth_build_filter(packet_info *pinfo) { - return g_strdup_printf("eth.addr eq %s and eth.addr eq %s", + return ws_strdup_printf("eth.addr eq %s and eth.addr eq %s", address_to_str(pinfo->pool, &pinfo->dl_src), address_to_str(pinfo->pool, &pinfo->dl_dst)); } diff --git a/epan/dissectors/packet-f5ethtrailer.c b/epan/dissectors/packet-f5ethtrailer.c index 7924d8075c..708d055c3d 100644 --- a/epan/dissectors/packet-f5ethtrailer.c +++ b/epan/dissectors/packet-f5ethtrailer.c @@ -480,7 +480,7 @@ f5_udp_conv_valid(packet_info *pinfo) * @return A filter string for the F5 IP conversation or NULL if no filter can be * computed. The caller should free this string with g_free(). * - * @attention This function uses g_strdup_printf() rather than the wmem equivalent because the + * @attention This function uses ws_strdup_printf() rather than the wmem equivalent because the * caller (menu_dissector_filter_cb()) uses g_free to free the filter string. * (as of WS 1.12). */ @@ -496,7 +496,7 @@ f5_ip_conv_filter(packet_info *pinfo) address_to_str_buf(&pinfo->src, src_addr, WS_INET6_ADDRSTRLEN); address_to_str_buf(&pinfo->dst, dst_addr, WS_INET6_ADDRSTRLEN); if (*src_addr != '\0' && *dst_addr != '\0') { - buf = g_strdup_printf( + buf = ws_strdup_printf( "(ip.addr eq %s and ip.addr eq %s) or" " (f5ethtrailer.peeraddr eq %s and f5ethtrailer.peeraddr eq %s)", src_addr, dst_addr, src_addr, dst_addr); @@ -505,7 +505,7 @@ f5_ip_conv_filter(packet_info *pinfo) address_to_str_buf(&pinfo->src, src_addr, WS_INET6_ADDRSTRLEN); address_to_str_buf(&pinfo->dst, dst_addr, WS_INET6_ADDRSTRLEN); if (*src_addr != '\0' && *dst_addr != '\0') { - buf = g_strdup_printf( + buf = ws_strdup_printf( "(ipv6.addr eq %s and ipv6.addr eq %s) or" " (f5ethtrailer.peeraddr6 eq %s and f5ethtrailer.peeraddr6 eq %s)", src_addr, dst_addr, src_addr, dst_addr); @@ -535,7 +535,7 @@ f5_ip_conv_filter(packet_info *pinfo) * be filtered properly. In the >=11.0.0 case, if you have TCP on one side and UDP on the other * and it should "do the right thing". * - * @attention This function uses g_strdup_printf() rather than the wmem equivalent because the + * @attention This function uses ws_strdup_printf() rather than the wmem equivalent because the * caller (menu_dissector_filter_cb()) uses g_free to free the filter string. * (as of WS 1.12). */ @@ -551,7 +551,7 @@ f5_tcp_conv_filter(packet_info *pinfo) address_to_str_buf(&pinfo->src, src_addr, WS_INET6_ADDRSTRLEN); address_to_str_buf(&pinfo->dst, dst_addr, WS_INET6_ADDRSTRLEN); if (*src_addr != '\0' && *dst_addr != '\0') { - buf = g_strdup_printf( + buf = ws_strdup_printf( "(ip.addr eq %s and ip.addr eq %s and tcp.port eq %d and tcp.port eq %d) or" " (f5ethtrailer.peeraddr eq %s and f5ethtrailer.peeraddr eq %s and" " f5ethtrailer.peerport eq %d and f5ethtrailer.peerport eq %d and" @@ -563,7 +563,7 @@ f5_tcp_conv_filter(packet_info *pinfo) address_to_str_buf(&pinfo->src, src_addr, WS_INET6_ADDRSTRLEN); address_to_str_buf(&pinfo->dst, dst_addr, WS_INET6_ADDRSTRLEN); if (*src_addr != '\0' && *dst_addr != '\0') { - buf = g_strdup_printf( + buf = ws_strdup_printf( "(ipv6.addr eq %s and ipv6.addr eq %s and tcp.port eq %d and tcp.port eq %d) or" " (f5ethtrailer.peeraddr6 eq %s and f5ethtrailer.peeraddr6 eq %s and" " f5ethtrailer.peerport eq %d and f5ethtrailer.peerport eq %d and" @@ -595,7 +595,7 @@ f5_tcp_conv_filter(packet_info *pinfo) * be filtered properly. In the >=11.0.0 case, if you have TCP on one side and UDP on the other * and it should "do the right thing". * - * @attention This function uses g_strdup_printf() rather than the wmem equivalent because the + * @attention This function uses ws_strdup_printf() rather than the wmem equivalent because the * caller (menu_dissector_filter_cb()) uses g_free to free the filter string. * (as of WS 1.12). */ @@ -611,7 +611,7 @@ f5_udp_conv_filter(packet_info *pinfo) address_to_str_buf(&pinfo->src, src_addr, WS_INET6_ADDRSTRLEN); address_to_str_buf(&pinfo->dst, dst_addr, WS_INET6_ADDRSTRLEN); if (*src_addr != '\0' && *dst_addr != '\0') { - buf = g_strdup_printf( + buf = ws_strdup_printf( "(ip.addr eq %s and ip.addr eq %s and udp.port eq %d and udp.port eq %d) or" " (f5ethtrailer.peeraddr eq %s and f5ethtrailer.peeraddr eq %s and" " f5ethtrailer.peerport eq %d and f5ethtrailer.peerport eq %d and" @@ -623,7 +623,7 @@ f5_udp_conv_filter(packet_info *pinfo) address_to_str_buf(&pinfo->src, src_addr, WS_INET6_ADDRSTRLEN); address_to_str_buf(&pinfo->dst, dst_addr, WS_INET6_ADDRSTRLEN); if (*src_addr != '\0' && *dst_addr != '\0') { - buf = g_strdup_printf( + buf = ws_strdup_printf( "(ipv6.addr eq %s and ipv6.addr eq %s and udp.port eq %d and udp.port eq %d) or" " (f5ethtrailer.peeraddr6 eq %s and f5ethtrailer.peeraddr6 eq %s and" " f5ethtrailer.peerport eq %d and f5ethtrailer.peerport eq %d and" diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 99303be481..619504002f 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -1003,7 +1003,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* /* XXX - add other hardware exception codes as required */ default: show_exception(tvb, pinfo, parent_tree, DissectorError, - g_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode())); + ws_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode())); } } #endif @@ -1071,7 +1071,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* /* XXX - add other hardware exception codes as required */ default: show_exception(tvb, pinfo, parent_tree, DissectorError, - g_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode())); + ws_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode())); } } #endif diff --git a/epan/dissectors/packet-ftdi-mpsse.c b/epan/dissectors/packet-ftdi-mpsse.c index e3f2b51404..838ef2f1b6 100644 --- a/epan/dissectors/packet-ftdi-mpsse.c +++ b/epan/dissectors/packet-ftdi-mpsse.c @@ -485,15 +485,15 @@ static gchar* freq_to_str(gfloat freq) { if (freq < 1e3) { - return g_strdup_printf("%.12g Hz", freq); + return ws_strdup_printf("%.12g Hz", freq); } else if (freq < 1e6) { - return g_strdup_printf("%.12g kHz", freq / 1e3); + return ws_strdup_printf("%.12g kHz", freq / 1e3); } else { - return g_strdup_printf("%.12g MHz", freq / 1e6); + return ws_strdup_printf("%.12g MHz", freq / 1e6); } } diff --git a/epan/dissectors/packet-gsm_a_bssmap.c b/epan/dissectors/packet-gsm_a_bssmap.c index 382c8aee13..120bd3cf35 100644 --- a/epan/dissectors/packet-gsm_a_bssmap.c +++ b/epan/dissectors/packet-gsm_a_bssmap.c @@ -1839,7 +1839,7 @@ be_cell_id_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 off } else { - char *str = g_strdup_printf("%s/RNC-ID (%u)", add_string, value); + char *str = ws_strdup_printf("%s/RNC-ID (%u)", add_string, value); g_strlcpy(add_string, str, string_len); g_free(str); } @@ -1868,7 +1868,7 @@ be_cell_id_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 off } else { - char *str = g_strdup_printf("%s/CI (%u)", add_string, value); + char *str = ws_strdup_printf("%s/CI (%u)", add_string, value); g_strlcpy(add_string, str, string_len); g_free(str); } diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index a4d9bf0ae5..bf4384ebf4 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -3712,7 +3712,7 @@ static void gsm_a_stat_init(stat_tap_table_ui* new_stat, const char *table_title if (msg_str) { col_str = g_strdup(msg_str); } else { - col_str = g_strdup_printf("Unknown message %d", i); + col_str = ws_strdup_printf("Unknown message %d", i); } items[IEI_COLUMN].value.uint_value = i; diff --git a/epan/dissectors/packet-gsm_map.c b/epan/dissectors/packet-gsm_map.c index e1d5908ab4..91bf2de2fc 100644 --- a/epan/dissectors/packet-gsm_map.c +++ b/epan/dissectors/packet-gsm_map.c @@ -24156,7 +24156,7 @@ static void gsm_map_stat_init(stat_tap_table_ui* new_stat) if (ocs) { col_str = g_strdup(ocs); } else { - col_str = g_strdup_printf("Unknown op code %d", i); + col_str = ws_strdup_printf("Unknown op code %d", i); } items[ID_COLUMN].value.uint_value = i; diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index 69ae2bae95..faca4a4f83 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -540,7 +540,7 @@ pdcp_uat_fld_ip_chk_cb(void* r _U_, const char* ipaddr, guint len _U_, const voi return TRUE; } - *err = g_strdup_printf("No valid IP address given"); + *err = ws_strdup_printf("No valid IP address given"); return FALSE; } @@ -564,7 +564,7 @@ pdcp_uat_fld_teid_chk_cb(void* r _U_, const char* teid, guint len _U_, const voi } } - *err = g_strdup_printf("No valid TEID given"); + *err = ws_strdup_printf("No valid TEID given"); return FALSE; } @@ -598,7 +598,7 @@ static gboolean pdcp_lte_update_cb(void *r, char **err) rec->teid_wildcard = FALSE; } else { if (err) - *err = g_strdup_printf("No valid TEID given"); + *err = ws_strdup_printf("No valid TEID given"); return FALSE; } @@ -609,7 +609,7 @@ static gboolean pdcp_lte_update_cb(void *r, char **err) alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv4, sizeof(ws_in4_addr), &ip4_addr); } else { if (err) - *err = g_strdup_printf("No valid IP address given"); + *err = ws_strdup_printf("No valid IP address given"); return FALSE; } @@ -689,7 +689,7 @@ static gboolean pdcp_nr_update_cb(void *r, char **err) { rec->teid_wildcard = FALSE; } else { if (err) - *err = g_strdup_printf("No valid TEID given"); + *err = ws_strdup_printf("No valid TEID given"); return FALSE; } @@ -700,7 +700,7 @@ static gboolean pdcp_nr_update_cb(void *r, char **err) { alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv4, sizeof(ws_in4_addr), &ip4_addr); } else { if (err) - *err = g_strdup_printf("No valid IP address given"); + *err = ws_strdup_printf("No valid IP address given"); return FALSE; } diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index a1fd8c6ee6..e927bf9f44 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -198,7 +198,7 @@ header_fields_update_cb(void *r, char **err) */ c = proto_check_field_name(rec->header_name); if (c) { - *err = g_strdup_printf("Header name can't contain '%c'", c); + *err = ws_strdup_printf("Header name can't contain '%c'", c); return FALSE; } @@ -2891,7 +2891,7 @@ header_fields_post_update_cb(void) dynamic_hf[i].p_id = hf_id; dynamic_hf[i].hfinfo.name = header_name; - dynamic_hf[i].hfinfo.abbrev = g_strdup_printf("http.header.%s", header_name); + dynamic_hf[i].hfinfo.abbrev = ws_strdup_printf("http.header.%s", header_name); dynamic_hf[i].hfinfo.type = FT_STRING; dynamic_hf[i].hfinfo.display = BASE_NONE; dynamic_hf[i].hfinfo.strings = NULL; diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c index a57cec0791..98bda390fa 100644 --- a/epan/dissectors/packet-http2.c +++ b/epan/dissectors/packet-http2.c @@ -576,7 +576,7 @@ header_fields_update_cb(void *r, char **err) */ c = proto_check_field_name(rec->header_name); if (c) { - *err = g_strdup_printf("Header name can't contain '%c'", c); + *err = ws_strdup_printf("Header name can't contain '%c'", c); return FALSE; } @@ -584,7 +584,7 @@ header_fields_update_cb(void *r, char **err) if (header_fields_hash != NULL) { const gint *entry = (const gint *) g_hash_table_lookup(header_fields_hash, rec->header_name); if (entry != NULL) { - *err = g_strdup_printf("This header field is already defined in UAT or it is a static header field"); + *err = ws_strdup_printf("This header field is already defined in UAT or it is a static header field"); return FALSE; } } @@ -1101,7 +1101,7 @@ http2_init_protocol(void) hf_uat[i].p_id = hf_id; hf_uat[i].hfinfo.name = header_name; - hf_uat[i].hfinfo.abbrev = g_strdup_printf("http2.headers.%s", header_name); + hf_uat[i].hfinfo.abbrev = ws_strdup_printf("http2.headers.%s", header_name); switch(header_fields[i].header_type) { case val_uint64: hf_uat[i].hfinfo.type = FT_UINT64; @@ -2314,7 +2314,7 @@ http2_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinfo, guint *str *stream = tcpd->stream; *sub_stream = h2session->current_stream_id; - return g_strdup_printf("tcp.stream eq %u and http2.streamid eq %u", tcpd->stream, h2session->current_stream_id); + return ws_strdup_printf("tcp.stream eq %u and http2.streamid eq %u", tcpd->stream, h2session->current_stream_id); } return NULL; @@ -2395,7 +2395,7 @@ http2_get_stream_id_ge(guint streamid, guint sub_stream_id, guint *sub_stream_id static gchar* http2_follow_index_filter(guint stream, guint sub_stream) { - return g_strdup_printf("tcp.stream eq %u and http2.streamid eq %u", stream, sub_stream); + return ws_strdup_printf("tcp.stream eq %u and http2.streamid eq %u", stream, sub_stream); } static tap_packet_status diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index 91df22bc95..442a1e9049 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -322,7 +322,7 @@ static gboolean ieee802154_key_update_cb(void *r, char **err) if (bytes->len < IEEE802154_CIPHER_SIZE) { - *err = g_strdup_printf("Key must be at least %d bytes", IEEE802154_CIPHER_SIZE); + *err = ws_strdup_printf("Key must be at least %d bytes", IEEE802154_CIPHER_SIZE); g_byte_array_free(bytes, TRUE); return FALSE; } @@ -5609,7 +5609,7 @@ static gboolean ieee802154_filter_valid(packet_info *pinfo) static gchar* ieee802154_build_filter(packet_info *pinfo) { - return g_strdup_printf("wpan.%s eq %s and wpan.%s eq %s", + return ws_strdup_printf("wpan.%s eq %s and wpan.%s eq %s", (pinfo->dl_src.type == ieee802_15_4_short_address_type) ? "addr16" : "addr64", address_to_str(pinfo->pool, &pinfo->dl_src), (pinfo->dl_dst.type == ieee802_15_4_short_address_type) ? "addr16" : "addr64", diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c index 9a2de8ef4b..4ab9ec9377 100644 --- a/epan/dissectors/packet-imf.c +++ b/epan/dissectors/packet-imf.c @@ -169,14 +169,14 @@ imf_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const /* Only include the string inside of the "<>" brackets. If there is nothing between the two brackets use the sender_data string */ if(start && stop && stop > start && (stop - start) > 2){ - entry->hostname = g_strdup_printf("%.*s", (int) (stop - start - 1), start + 1); + entry->hostname = ws_strdup_printf("%.*s", (int) (stop - start - 1), start + 1); } else { entry->hostname = g_strdup(eo_info->sender_data); } entry->pkt_num = pinfo->num; entry->content_type = g_strdup("EML file"); - entry->filename = g_strdup_printf("%s.eml", eo_info->subject_data); + entry->filename = ws_strdup_printf("%s.eml", eo_info->subject_data); entry->payload_len = eo_info->payload_len; entry->payload_data = (guint8 *)g_memdup2(eo_info->payload_data, eo_info->payload_len); @@ -339,7 +339,7 @@ header_fields_update_cb(void *r, char **err) */ c = proto_check_field_name(rec->header_name); if (c) { - *err = g_strdup_printf("Header name can't contain '%c'", c); + *err = ws_strdup_printf("Header name can't contain '%c'", c); return FALSE; } @@ -983,7 +983,7 @@ header_fields_post_update_cb (void) dynamic_hf[i].p_id = hf_id; dynamic_hf[i].hfinfo.name = header_name; - dynamic_hf[i].hfinfo.abbrev = g_strdup_printf ("imf.header.%s", header_name); + dynamic_hf[i].hfinfo.abbrev = ws_strdup_printf ("imf.header.%s", header_name); dynamic_hf[i].hfinfo.type = FT_STRING; dynamic_hf[i].hfinfo.display = BASE_NONE; dynamic_hf[i].hfinfo.strings = NULL; diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index afb9c748f0..09f4af6975 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -545,7 +545,7 @@ ip_filter_valid(packet_info *pinfo) static gchar* ip_build_filter(packet_info *pinfo) { - return g_strdup_printf("ip.addr eq %s and ip.addr eq %s", + return ws_strdup_printf("ip.addr eq %s and ip.addr eq %s", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst)); } diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c index e4bb40480e..f229f8b1c3 100644 --- a/epan/dissectors/packet-ipsec.c +++ b/epan/dissectors/packet-ipsec.c @@ -320,7 +320,7 @@ compute_ascii_key(gchar **ascii_key, const gchar *key, char **err) { g_free(*ascii_key); *ascii_key = NULL; - *err = g_strdup_printf("Key %s begins with an invalid hex char (%c)", key, key[i]); + *err = ws_strdup_printf("Key %s begins with an invalid hex char (%c)", key, key[i]); return -1; /* not a valid hex digit */ } (*ascii_key)[j] = (guchar)hex_digit; @@ -345,7 +345,7 @@ compute_ascii_key(gchar **ascii_key, const gchar *key, char **err) { g_free(*ascii_key); *ascii_key = NULL; - *err = g_strdup_printf("Key %s has an invalid hex char (%c)", + *err = ws_strdup_printf("Key %s has an invalid hex char (%c)", key, key[i-1]); return -1; /* not a valid hex digit */ } @@ -356,7 +356,7 @@ compute_ascii_key(gchar **ascii_key, const gchar *key, char **err) { g_free(*ascii_key); *ascii_key = NULL; - *err = g_strdup_printf("Key %s has an invalid hex char (%c)", key, key[i-1]); + *err = ws_strdup_printf("Key %s has an invalid hex char (%c)", key, key[i-1]); return -1; /* not a valid hex digit */ } key_byte |= (guchar)hex_digit; diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 6411ab504e..77dfd6b42b 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -564,7 +564,7 @@ ipv6_filter_valid(packet_info *pinfo) static gchar* ipv6_build_filter(packet_info *pinfo) { - return g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s", + return ws_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst)); } diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c index a66224a1a7..2aae7c0e14 100644 --- a/epan/dissectors/packet-isakmp.c +++ b/epan/dissectors/packet-isakmp.c @@ -6292,7 +6292,7 @@ static gboolean ikev1_uat_data_update_cb(void* p, char** err) { ikev1_uat_data_key_t *ud = (ikev1_uat_data_key_t *)p; if (ud->icookie_len != COOKIE_SIZE) { - *err = g_strdup_printf("Length of Initiator's COOKIE must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2); + *err = ws_strdup_printf("Length of Initiator's COOKIE must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2); return FALSE; } @@ -6302,7 +6302,7 @@ static gboolean ikev1_uat_data_update_cb(void* p, char** err) { } if (ud->key_len > MAX_KEY_SIZE) { - *err = g_strdup_printf("Length of Encryption key limited to %d octets (%d hex characters).", MAX_KEY_SIZE, MAX_KEY_SIZE * 2); + *err = ws_strdup_printf("Length of Encryption key limited to %d octets (%d hex characters).", MAX_KEY_SIZE, MAX_KEY_SIZE * 2); return FALSE; } @@ -6377,12 +6377,12 @@ static gboolean ikev2_uat_data_update_cb(void* p, char** err) { ikev2_uat_data_t *ud = (ikev2_uat_data_t *)p; if (ud->key.spii_len != COOKIE_SIZE) { - *err = g_strdup_printf("Length of Initiator's SPI must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2); + *err = ws_strdup_printf("Length of Initiator's SPI must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2); return FALSE; } if (ud->key.spir_len != COOKIE_SIZE) { - *err = g_strdup_printf("Length of Responder's SPI must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2); + *err = ws_strdup_printf("Length of Responder's SPI must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2); return FALSE; } @@ -6395,31 +6395,31 @@ static gboolean ikev2_uat_data_update_cb(void* p, char** err) { } if (ud->encr_spec->icv_len && ud->auth_spec->number != IKEV2_AUTH_NONE) { - *err = g_strdup_printf("Selected encryption_algorithm %s requires selecting NONE integrity algorithm.", + *err = ws_strdup_printf("Selected encryption_algorithm %s requires selecting NONE integrity algorithm.", val_to_str(ud->encr_spec->number, vs_ikev2_encr_algs, "other-%d")); return FALSE; } if (ud->sk_ei_len != ud->encr_spec->key_len) { - *err = g_strdup_printf("Length of SK_ei (%u octets) does not match the key length (%u octets) of the selected encryption algorithm.", + *err = ws_strdup_printf("Length of SK_ei (%u octets) does not match the key length (%u octets) of the selected encryption algorithm.", ud->sk_ei_len, ud->encr_spec->key_len); return FALSE; } if (ud->sk_er_len != ud->encr_spec->key_len) { - *err = g_strdup_printf("Length of SK_er (%u octets) does not match the key length (%u octets) of the selected encryption algorithm.", + *err = ws_strdup_printf("Length of SK_er (%u octets) does not match the key length (%u octets) of the selected encryption algorithm.", ud->sk_er_len, ud->encr_spec->key_len); return FALSE; } if (ud->sk_ai_len != ud->auth_spec->key_len) { - *err = g_strdup_printf("Length of SK_ai (%u octets) does not match the key length (%u octets) of the selected integrity algorithm.", + *err = ws_strdup_printf("Length of SK_ai (%u octets) does not match the key length (%u octets) of the selected integrity algorithm.", ud->sk_ai_len, ud->auth_spec->key_len); return FALSE; } if (ud->sk_ar_len != ud->auth_spec->key_len) { - *err = g_strdup_printf("Length of SK_ar (%u octets) does not match the key length (%u octets) of the selected integrity algorithm.", + *err = ws_strdup_printf("Length of SK_ar (%u octets) does not match the key length (%u octets) of the selected integrity algorithm.", ud->sk_ar_len, ud->auth_spec->key_len); return FALSE; } diff --git a/epan/dissectors/packet-iso15765.c b/epan/dissectors/packet-iso15765.c index fbbf5ffbe0..db1cde6e0a 100644 --- a/epan/dissectors/packet-iso15765.c +++ b/epan/dissectors/packet-iso15765.c @@ -249,44 +249,44 @@ update_config_can_addr_mappings(void *r, char **err) { config_can_addr_mapping_t *rec = (config_can_addr_mapping_t *)r; if (rec->source_addr_mask == 0 && rec->target_addr_mask == 0 && rec->ecu_addr_mask == 0) { - *err = g_strdup_printf("You need to define the ECU Mask OR Source Mask/Target Mask!"); + *err = ws_strdup_printf("You need to define the ECU Mask OR Source Mask/Target Mask!"); return FALSE; } if ((rec->source_addr_mask != 0 || rec->target_addr_mask != 0) && rec->ecu_addr_mask != 0) { - *err = g_strdup_printf("You can only use Source Address Mask/Target Address Mask OR ECU Address Mask! Not both at the same time!"); + *err = ws_strdup_printf("You can only use Source Address Mask/Target Address Mask OR ECU Address Mask! Not both at the same time!"); return FALSE; } if ((rec->source_addr_mask == 0 || rec->target_addr_mask == 0) && rec->ecu_addr_mask == 0) { - *err = g_strdup_printf("You can only use Source Address Mask and Target Address Mask in combination!"); + *err = ws_strdup_printf("You can only use Source Address Mask and Target Address Mask in combination!"); return FALSE; } if (rec->extended_address) { if ((rec->source_addr_mask & ~CAN_EFF_MASK) != 0) { - *err = g_strdup_printf("Source Address Mask covering bits not allowed for extended IDs (29bit)!"); + *err = ws_strdup_printf("Source Address Mask covering bits not allowed for extended IDs (29bit)!"); return FALSE; } if ((rec->target_addr_mask & ~CAN_EFF_MASK) != 0) { - *err = g_strdup_printf("Target Address Mask covering bits not allowed for extended IDs (29bit)!"); + *err = ws_strdup_printf("Target Address Mask covering bits not allowed for extended IDs (29bit)!"); return FALSE; } if ((rec->ecu_addr_mask & ~CAN_EFF_MASK) != 0) { - *err = g_strdup_printf("ECU Address Mask covering bits not allowed for extended IDs (29bit)!"); + *err = ws_strdup_printf("ECU Address Mask covering bits not allowed for extended IDs (29bit)!"); return FALSE; } } else { if ((rec->source_addr_mask & ~CAN_SFF_MASK) != 0) { - *err = g_strdup_printf("Source Address Mask covering bits not allowed for standard IDs (11bit)!"); + *err = ws_strdup_printf("Source Address Mask covering bits not allowed for standard IDs (11bit)!"); return FALSE; } if ((rec->target_addr_mask & ~CAN_SFF_MASK) != 0) { - *err = g_strdup_printf("Target Address Mask covering bits not allowed for standard IDs (11bit)!"); + *err = ws_strdup_printf("Target Address Mask covering bits not allowed for standard IDs (11bit)!"); return FALSE; } if ((rec->ecu_addr_mask & ~CAN_SFF_MASK) != 0) { - *err = g_strdup_printf("ECU Address Mask covering bits not allowed for standard IDs (11bit)!"); + *err = ws_strdup_printf("ECU Address Mask covering bits not allowed for standard IDs (11bit)!"); return FALSE; } } diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index 938cbf28f4..4f35b609fc 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -307,7 +307,7 @@ k12_update_cb(void* r, char** err) if ( ! (h->handles[i] = find_dissector(protos[i])) ) { h->handles[i] = data_handle; h->handles[i+1] = NULL; - *err = g_strdup_printf("Could not find dissector for: '%s'",protos[i]); + *err = ws_strdup_printf("Could not find dissector for: '%s'",protos[i]); g_strfreev(protos); return FALSE; } @@ -374,7 +374,7 @@ protos_chk_cb(void* r _U_, const char* p, guint len, const void* u1 _U_, const v for (i = 0; i < num_protos; i++) { if (!find_dissector(protos[i])) { - *err = g_strdup_printf("Could not find dissector for: '%s'",protos[i]); + *err = ws_strdup_printf("Could not find dissector for: '%s'",protos[i]); wmem_free(NULL, line); g_strfreev(protos); return FALSE; diff --git a/epan/dissectors/packet-lbmc.c b/epan/dissectors/packet-lbmc.c index 50c062437b..f987aa35af 100644 --- a/epan/dissectors/packet-lbmc.c +++ b/epan/dissectors/packet-lbmc.c @@ -6150,24 +6150,24 @@ lbm_uim_seq_analysis_packet(void *ptr, packet_info *pinfo, epan_dissect_t *edt _ if (stream_info->description == NULL) { - sai->frame_label = g_strdup_printf("(%" PRIu32 ")", stream_info->sqn); + sai->frame_label = ws_strdup_printf("(%" PRIu32 ")", stream_info->sqn); } else { - sai->frame_label = g_strdup_printf("%s (%" PRIu32 ")", stream_info->description, stream_info->sqn); + sai->frame_label = ws_strdup_printf("%s (%" PRIu32 ")", stream_info->description, stream_info->sqn); } if (epa.type == lbm_uim_instance_stream) { ctxinst1 = bytes_to_str(pinfo->pool, epa.stream_info.ctxinst.ctxinst, sizeof(epa.stream_info.ctxinst.ctxinst)); ctxinst2 = bytes_to_str(pinfo->pool, epb.stream_info.ctxinst.ctxinst, sizeof(epb.stream_info.ctxinst.ctxinst)); - sai->comment = g_strdup_printf("%s <-> %s [%" PRIu64 "]", + sai->comment = ws_strdup_printf("%s <-> %s [%" PRIu64 "]", ctxinst1, ctxinst2, stream_info->channel); } else { - sai->comment = g_strdup_printf("%" PRIu32 ":%s:%" PRIu16 " <-> %" PRIu32 ":%s:%" PRIu16 " [%" PRIu64 "]", + sai->comment = ws_strdup_printf("%" PRIu32 ":%s:%" PRIu16 " <-> %" PRIu32 ":%s:%" PRIu16 " [%" PRIu64 "]", epa.stream_info.dest.domain, address_to_str(pinfo->pool, &(epa.stream_info.dest.addr)), epa.stream_info.dest.port, diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index 8ec97cb899..0b189d30ff 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -697,7 +697,7 @@ attribute_types_update_cb(void *r, char **err) */ c = proto_check_field_name(rec->attribute_type); if (c) { - *err = g_strdup_printf("Attribute type can't contain '%c'", c); + *err = ws_strdup_printf("Attribute type can't contain '%c'", c); return FALSE; } @@ -790,7 +790,7 @@ attribute_types_post_update_cb(void) dynamic_hf[i].p_id = hf_id; dynamic_hf[i].hfinfo.name = attribute_type; - dynamic_hf[i].hfinfo.abbrev = g_strdup_printf("ldap.AttributeValue.%s", attribute_type); + dynamic_hf[i].hfinfo.abbrev = ws_strdup_printf("ldap.AttributeValue.%s", attribute_type); dynamic_hf[i].hfinfo.type = FT_STRING; dynamic_hf[i].hfinfo.display = BASE_NONE; dynamic_hf[i].hfinfo.strings = NULL; diff --git a/epan/dissectors/packet-lin.c b/epan/dissectors/packet-lin.c index cfc23b5573..2ddc2b02d4 100644 --- a/epan/dissectors/packet-lin.c +++ b/epan/dissectors/packet-lin.c @@ -144,13 +144,13 @@ update_interface_config(void *r, char **err) { interface_config_t *rec = (interface_config_t *)r; if (rec->interface_id > 0xffffffff) { - *err = g_strdup_printf("We currently only support 32 bit identifiers (ID: %i Name: %s)", + *err = ws_strdup_printf("We currently only support 32 bit identifiers (ID: %i Name: %s)", rec->interface_id, rec->interface_name); return FALSE; } if (rec->bus_id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit bus identifiers (ID: %i Name: %s Bus-ID: %i)", + *err = ws_strdup_printf("We currently only support 16 bit bus identifiers (ID: %i Name: %s Bus-ID: %i)", rec->interface_id, rec->interface_name, rec->bus_id); return FALSE; } diff --git a/epan/dissectors/packet-lwm2mtlv.c b/epan/dissectors/packet-lwm2mtlv.c index 133a809ac8..a378601f33 100644 --- a/epan/dissectors/packet-lwm2mtlv.c +++ b/epan/dissectors/packet-lwm2mtlv.c @@ -383,7 +383,7 @@ static gboolean lwm2m_resource_update_cb(void *record, char **error) /* Check for invalid characters (to avoid asserting out when registering the field). */ c = proto_check_field_name(rec->field_name); if (c) { - *error = g_strdup_printf("Resource Name can't contain '%c'", c); + *error = ws_strdup_printf("Resource Name can't contain '%c'", c); return FALSE; } @@ -437,7 +437,7 @@ static void lwm2m_add_resource(lwm2m_resource_t *resource, hf_register_info *hf, hf->p_id = hf_id; hf->hfinfo.name = g_strdup(resource->name); - hf->hfinfo.abbrev = g_strdup_printf("lwm2mtlv.resource.%s", resource_abbrev); + hf->hfinfo.abbrev = ws_strdup_printf("lwm2mtlv.resource.%s", resource_abbrev); g_free (resource_abbrev); switch (resource->data_type) { diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index a8142ba760..24d25a62bc 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -327,7 +327,7 @@ megacostat_filtercheck(const char *opt_arg _U_, const char **filter _U_, char** } if (!prefs_get_bool_value(megaco_ctx_track, pref_current) || !prefs_get_bool_value(h248_ctx_track, pref_current)) { - *err = g_strdup_printf("Track Context option at Protocols -> MEGACO and Protocols -> H248 preferences\n" + *err = ws_strdup_printf("Track Context option at Protocols -> MEGACO and Protocols -> H248 preferences\n" "has to be set to true to enable measurement of service response times.\n"); } } diff --git a/epan/dissectors/packet-mqtt.c b/epan/dissectors/packet-mqtt.c index c8503e3780..6b9479fdf2 100644 --- a/epan/dissectors/packet-mqtt.c +++ b/epan/dissectors/packet-mqtt.c @@ -660,7 +660,7 @@ static gboolean mqtt_message_decode_update_cb(void *record, char **error) u->topic_regex = g_regex_new(u->topic_pattern, (GRegexCompileFlags) G_REGEX_OPTIMIZE, (GRegexMatchFlags) 0, NULL); if (!u->topic_regex) { - *error = g_strdup_printf("Invalid regex: %s", u->topic_pattern); + *error = ws_strdup_printf("Invalid regex: %s", u->topic_pattern); return FALSE; } } diff --git a/epan/dissectors/packet-mswsp.c b/epan/dissectors/packet-mswsp.c index 168ff49168..33c4920184 100644 --- a/epan/dissectors/packet-mswsp.c +++ b/epan/dissectors/packet-mswsp.c @@ -2972,7 +2972,7 @@ static void get_name_from_fullpropspec(struct CFullPropSpec *v, char *out, int b } else if (v->kind == PRSPEC_PROPID) { snprintf(dest, bufsize, "%s 0x%08x", guid_str, v->u.propid); } else { - char *str = g_strdup_printf("%s ", dest); + char *str = ws_strdup_printf("%s ", dest); g_strlcpy(dest, str, bufsize); g_free(str); } diff --git a/epan/dissectors/packet-mtp2.c b/epan/dissectors/packet-mtp2.c index f17a84d04c..db0053b54e 100644 --- a/epan/dissectors/packet-mtp2.c +++ b/epan/dissectors/packet-mtp2.c @@ -1142,7 +1142,7 @@ dissect_mtp2_bitstream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void recognized_packet = wmem_list_frame_next(recognized_packet); } /* insert how many packets were found */ - col_info_str = g_strdup_printf("%s: %u Packet%s%s%s", + col_info_str = ws_strdup_printf("%s: %u Packet%s%s%s", "MTP2", wmem_list_count(result->found_packets), (wmem_list_count(result->found_packets) > 1 @@ -1150,7 +1150,7 @@ dissect_mtp2_bitstream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void :"" ), (was_unaligned_packet - ?g_strdup_printf(" [Unaligned Packet%s]", (wmem_list_count(result->found_packets)>1 + ?ws_strdup_printf(" [Unaligned Packet%s]", (wmem_list_count(result->found_packets)>1 ?"s" :"")) :"" @@ -1169,7 +1169,7 @@ dissect_mtp2_bitstream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void && frag_msg_before_fh) { col_add_str(pinfo->cinfo, COL_PROTOCOL, "MTP2"); - col_info_str = g_strdup_printf("[MTP2 Reassembled in: %u]", frag_msg_before_fh->reassembled_in); + col_info_str = ws_strdup_printf("[MTP2 Reassembled in: %u]", frag_msg_before_fh->reassembled_in); col_add_str(pinfo->cinfo, COL_INFO, col_info_str); g_free(col_info_str); } else { diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index 8588aa9537..e1cc53948a 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -924,7 +924,7 @@ mtp3_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, if (sis) { col_str = g_strdup(sis); } else { - col_str = g_strdup_printf("Unknown service indicator %d", m3tr->mtp3_si_code); + col_str = ws_strdup_printf("Unknown service indicator %d", m3tr->mtp3_si_code); } item_data = stat_tap_get_field_data(table, element, SI_COLUMN); diff --git a/epan/dissectors/packet-oscore.c b/epan/dissectors/packet-oscore.c index ccfcf78470..a0b060c653 100644 --- a/epan/dissectors/packet-oscore.c +++ b/epan/dissectors/packet-oscore.c @@ -202,7 +202,7 @@ static gboolean oscore_context_update_cb(void *r, char **err) { } if (bytes->len > OSCORE_KID_MAX_LEN) { - *err = g_strdup_printf("Should be %u bytes or less.", OSCORE_KID_MAX_LEN); + *err = ws_strdup_printf("Should be %u bytes or less.", OSCORE_KID_MAX_LEN); g_byte_array_free(bytes, TRUE); return FALSE; } @@ -214,7 +214,7 @@ static gboolean oscore_context_update_cb(void *r, char **err) { } if (bytes->len > OSCORE_KID_MAX_LEN) { - *err = g_strdup_printf("Should be %u bytes or less.", OSCORE_KID_MAX_LEN); + *err = ws_strdup_printf("Should be %u bytes or less.", OSCORE_KID_MAX_LEN); g_byte_array_free(bytes, TRUE); return FALSE; } @@ -226,7 +226,7 @@ static gboolean oscore_context_update_cb(void *r, char **err) { } if (bytes->len > OSCORE_KID_CONTEXT_MAX_LEN) { - *err = g_strdup_printf("Should be %u bytes or less.", OSCORE_KID_CONTEXT_MAX_LEN); + *err = ws_strdup_printf("Should be %u bytes or less.", OSCORE_KID_CONTEXT_MAX_LEN); g_byte_array_free(bytes, TRUE); return FALSE; } diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c index b32930dbf1..ab0acb2cba 100644 --- a/epan/dissectors/packet-pdcp-lte.c +++ b/epan/dissectors/packet-pdcp-lte.c @@ -218,7 +218,7 @@ static gboolean check_valid_key_string(const char* raw_string, char* checked_str /* Can't be valid if not long enough. */ if (length < 32) { if (length > 0) { - *error = g_strdup_printf("PDCP LTE: Invalid key string (%s) - should include 32 ASCII hex characters (16 bytes) but only %u chars given", + *error = ws_strdup_printf("PDCP LTE: Invalid key string (%s) - should include 32 ASCII hex characters (16 bytes) but only %u chars given", raw_string, length); } @@ -240,18 +240,18 @@ static gboolean check_valid_key_string(const char* raw_string, char* checked_str checked_string[written++] = c; } else { - *error = g_strdup_printf("PDCP-LTE: Invalid char '%c' given in key", c); + *error = ws_strdup_printf("PDCP-LTE: Invalid char '%c' given in key", c); return FALSE; } } /* Must have found exactly 32 hex ascii chars for 16-byte key */ if (n 0) { - *error = g_strdup_printf("PDCP NR: Invalid key string (%s) - should include 32 ASCII hex characters (16 bytes) but only %u chars given", + *error = ws_strdup_printf("PDCP NR: Invalid key string (%s) - should include 32 ASCII hex characters (16 bytes) but only %u chars given", raw_string, length); } return FALSE; @@ -218,18 +218,18 @@ static gboolean check_valid_key_string(const char* raw_string, char* checked_str checked_string[written++] = c; } else { - *error = g_strdup_printf("PDCP-NR: Invalid char '%c' given in key", c); + *error = ws_strdup_printf("PDCP-NR: Invalid char '%c' given in key", c); return FALSE; } } /* Must have found exactly 32 hex ascii chars for 16-byte key */ if (np_id = g_new(gint, 1); *(hf->p_id) = -1; hf->hfinfo.name = g_strdup(pbw_Descriptor_name(message)); - hf->hfinfo.abbrev = g_strdup_printf("pbm.%s", pbw_Descriptor_full_name(message)); + hf->hfinfo.abbrev = ws_strdup_printf("pbm.%s", pbw_Descriptor_full_name(message)); hf->hfinfo.type = FT_BYTES; hf->hfinfo.display = BASE_NONE; wmem_list_append(hf_list, hf); @@ -1590,7 +1590,7 @@ collect_fields(const PbwDescriptor* message, void* userdata) *(hf->p_id) = -1; hf->hfinfo.name = g_strdup(pbw_FieldDescriptor_name(field_desc)); - hf->hfinfo.abbrev = g_strdup_printf("pbf.%s", pbw_FieldDescriptor_full_name(field_desc)); + hf->hfinfo.abbrev = ws_strdup_printf("pbf.%s", pbw_FieldDescriptor_full_name(field_desc)); switch (field_type) { case PROTOBUF_TYPE_DOUBLE: hf->hfinfo.type = FT_DOUBLE; diff --git a/epan/dissectors/packet-quic.c b/epan/dissectors/packet-quic.c index 014f327c15..ad4aa70fbf 100644 --- a/epan/dissectors/packet-quic.c +++ b/epan/dissectors/packet-quic.c @@ -3970,7 +3970,7 @@ quic_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinfo, guint *stre if (s) { *stream = conn->number; *sub_stream = (guint)s->stream_id; - return g_strdup_printf("quic.connection.number eq %u and quic.stream.stream_id eq %u", conn->number, *sub_stream); + return ws_strdup_printf("quic.connection.number eq %u and quic.stream.stream_id eq %u", conn->number, *sub_stream); } } } @@ -3981,7 +3981,7 @@ quic_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinfo, guint *stre static gchar * quic_follow_index_filter(guint stream, guint sub_stream) { - return g_strdup_printf("quic.connection.number eq %u and quic.stream.stream_id eq %u", stream, sub_stream); + return ws_strdup_printf("quic.connection.number eq %u and quic.stream.stream_id eq %u", stream, sub_stream); } static gchar * diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index efa16d2586..d437bec9e1 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -2508,7 +2508,7 @@ radius_register_avp_dissector(guint32 vendor_id, guint32 _attribute_id, radius_a if (!vendor) { vendor = g_new(radius_vendor_info_t, 1); - vendor->name = g_strdup_printf("%s-%u", + vendor->name = ws_strdup_printf("%s-%u", enterprises_lookup(vendor_id, "Unknown"), vendor_id); vendor->code = vendor_id; @@ -2534,7 +2534,7 @@ radius_register_avp_dissector(guint32 vendor_id, guint32 _attribute_id, radius_a if (!dictionary_entry) { dictionary_entry = g_new(radius_attr_info_t, 1); - dictionary_entry->name = g_strdup_printf("Unknown-Attribute-%u", attribute_id.value); + dictionary_entry->name = ws_strdup_printf("Unknown-Attribute-%u", attribute_id.value); dictionary_entry->code = attribute_id; dictionary_entry->encrypt = 0; dictionary_entry->type = NULL; diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c index 175670ea60..a6ebca274d 100644 --- a/epan/dissectors/packet-rpc.c +++ b/epan/dissectors/packet-rpc.c @@ -422,7 +422,7 @@ rpcstat_param(register_srt_t* srt, const char* opt_arg, char** err) tap_data->num_procedures = rpc_max_proc+1; if (rpc_min_proc == -1) { - *err = g_strdup_printf("Program:%u version:%u isn't supported", rpc_program, rpc_version); + *err = ws_strdup_printf("Program:%u version:%u isn't supported", rpc_program, rpc_version); } } else diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c index 16fcf78304..bea387cef3 100644 --- a/epan/dissectors/packet-sctp.c +++ b/epan/dissectors/packet-sctp.c @@ -471,7 +471,7 @@ sctp_chunk_type_update_cb(void *r, char **err) */ c = proto_check_field_name(rec->type_name); if (c) { - *err = g_strdup_printf("Header name can't contain '%c'", c); + *err = ws_strdup_printf("Header name can't contain '%c'", c); return FALSE; } diff --git a/epan/dissectors/packet-signal-pdu.c b/epan/dissectors/packet-signal-pdu.c index 027187da43..85e098a788 100644 --- a/epan/dissectors/packet-signal-pdu.c +++ b/epan/dissectors/packet-signal-pdu.c @@ -433,7 +433,7 @@ update_generic_one_identifier_32bit(void *r, char **err) { generic_one_id_string_t *rec = (generic_one_id_string_t *)r; if (rec->id > 0xffffffff) { - *err = g_strdup_printf("We currently only support 32 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 32 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); return FALSE; } @@ -445,11 +445,11 @@ update_generic_one_identifier_32bit(void *r, char **err) { guchar c = proto_check_field_name(rec->name); if (c) { if (c == '.') { - *err = g_strdup_printf("Name contains illegal chars '.' (ID: 0x%08x)", rec->id); + *err = ws_strdup_printf("Name contains illegal chars '.' (ID: 0x%08x)", rec->id); } else if (g_ascii_isprint(c)) { - *err = g_strdup_printf("Name contains illegal chars '%c' (ID: 0x%08x)", c, rec->id); + *err = ws_strdup_printf("Name contains illegal chars '%c' (ID: 0x%08x)", c, rec->id); } else { - *err = g_strdup_printf("Name contains invalid byte \\%03o (ID: 0x%08x)", c, rec->id); + *err = ws_strdup_printf("Name contains invalid byte \\%03o (ID: 0x%08x)", c, rec->id); } return FALSE; } @@ -579,66 +579,66 @@ update_spdu_signal_list(void *r, char **err) { spdu_signal_list_uat_t *rec = (spdu_signal_list_uat_t *)r; if (rec->pos >= 0xffff) { - *err = g_strdup_printf("Position too big"); + *err = ws_strdup_printf("Position too big"); return FALSE; } if (rec->num_of_params >= 0xffff) { - *err = g_strdup_printf("Number of Parameters too big"); + *err = ws_strdup_printf("Number of Parameters too big"); return FALSE; } if (rec->pos >= rec->num_of_params) { - *err = g_strdup_printf("Position >= Number of Parameters"); + *err = ws_strdup_printf("Position >= Number of Parameters"); return FALSE; } if (rec->name == NULL || rec->name[0] == 0) { - *err = g_strdup_printf("Name cannot be empty"); + *err = ws_strdup_printf("Name cannot be empty"); return FALSE; } if (rec->filter_string == NULL || rec->filter_string[0] == 0) { - *err = g_strdup_printf("Filter String cannot be empty"); + *err = ws_strdup_printf("Filter String cannot be empty"); return FALSE; } c = proto_check_field_name(rec->filter_string); if (c) { if (c == '.') { - *err = g_strdup_printf("Filter String contains illegal chars '.' (ID: 0x%08x)", rec->id); + *err = ws_strdup_printf("Filter String contains illegal chars '.' (ID: 0x%08x)", rec->id); } else if (g_ascii_isprint(c)) { - *err = g_strdup_printf("Filter String contains illegal chars '%c' (ID: 0x%08x)", c, rec->id); + *err = ws_strdup_printf("Filter String contains illegal chars '%c' (ID: 0x%08x)", c, rec->id); } else { - *err = g_strdup_printf("Filter String contains invalid byte \\%03o (ID: 0x%08x)", c, rec->id); + *err = ws_strdup_printf("Filter String contains invalid byte \\%03o (ID: 0x%08x)", c, rec->id); } return FALSE; } if (g_strcmp0(rec->data_type, "uint") != 0 && g_strcmp0(rec->data_type, "int") != 0) { - *err = g_strdup_printf("Currently only uint and int supported!"); + *err = ws_strdup_printf("Currently only uint and int supported!"); return FALSE; } if (g_strcmp0(rec->data_type, "int") == 0 && (rec->bitlength_base_type != rec->bitlength_encoded_type)) { - *err = g_strdup_printf("signed ints (int) only support in non-shortened length"); + *err = ws_strdup_printf("signed ints (int) only support in non-shortened length"); return FALSE; } if (g_strcmp0(rec->data_type, "int") == 0 && (rec->bitlength_encoded_type != 8) && (rec->bitlength_encoded_type != 16) && (rec->bitlength_encoded_type != 32) && (rec->bitlength_encoded_type != 64)) { - *err = g_strdup_printf("signed ints (int) are only supported in 8, 16, 32, or 64 bit."); + *err = ws_strdup_printf("signed ints (int) are only supported in 8, 16, 32, or 64 bit."); return FALSE; } d = g_ascii_strtod(rec->offset, &tmp); if (!(d == d)) { - *err = g_strdup_printf("Offset not a double!"); + *err = ws_strdup_printf("Offset not a double!"); return FALSE; } d = g_ascii_strtod(rec->scaler, &tmp); if (!(d == d)) { - *err = g_strdup_printf("Scaler not a double!"); + *err = ws_strdup_printf("Scaler not a double!"); return FALSE; } @@ -700,11 +700,11 @@ create_hf_entry(guint i, guint32 id, guint32 pos, gchar *name, gchar *filter_str dynamic_hf[i].hfinfo.bitmask = 0x0; if (raw) { - dynamic_hf[i].hfinfo.name = g_strdup_printf("%s_raw", name); - dynamic_hf[i].hfinfo.abbrev = g_strdup_printf("%s.%s_raw", SPDU_NAME_FILTER, filter_string); + dynamic_hf[i].hfinfo.name = ws_strdup_printf("%s_raw", name); + dynamic_hf[i].hfinfo.abbrev = ws_strdup_printf("%s.%s_raw", SPDU_NAME_FILTER, filter_string); } else { dynamic_hf[i].hfinfo.name = g_strdup(name); - dynamic_hf[i].hfinfo.abbrev = g_strdup_printf("%s.%s", SPDU_NAME_FILTER, filter_string); + dynamic_hf[i].hfinfo.abbrev = ws_strdup_printf("%s.%s", SPDU_NAME_FILTER, filter_string); } dynamic_hf[i].hfinfo.bitmask = 0; dynamic_hf[i].hfinfo.blurb = NULL; @@ -875,17 +875,17 @@ update_spdu_signal_value_name(void *r, char **err) { spdu_signal_value_name_uat_t *rec = (spdu_signal_value_name_uat_t *)r; if (rec->value_name == NULL || rec->value_name[0] == 0) { - *err = g_strdup_printf("Value Name cannot be empty"); + *err = ws_strdup_printf("Value Name cannot be empty"); return FALSE; } if (rec->value_end < rec->value_start) { - *err = g_strdup_printf("Value Range is defined backwards (end < start)!"); + *err = ws_strdup_printf("Value Range is defined backwards (end < start)!"); return FALSE; } if (rec->pos >= 0xffff) { - *err = g_strdup_printf("Position too big"); + *err = ws_strdup_printf("Position too big"); return FALSE; } @@ -1015,24 +1015,24 @@ update_spdu_someip_mapping(void *r, char **err) { spdu_someip_mapping_uat_t *rec = (spdu_someip_mapping_uat_t *)r; if (rec->service_id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit SOME/IP Service IDs (Service-ID: %x Method-ID: %x MsgType: %x Version: %i)", + *err = ws_strdup_printf("We currently only support 16 bit SOME/IP Service IDs (Service-ID: %x Method-ID: %x MsgType: %x Version: %i)", rec->service_id, rec->method_id, rec->message_type, rec->major_version); return FALSE; } if (rec->method_id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit SOME/IP Method IDs (Service-ID: %x Method-ID: %x MsgType: %x Version: %i)", + *err = ws_strdup_printf("We currently only support 16 bit SOME/IP Method IDs (Service-ID: %x Method-ID: %x MsgType: %x Version: %i)", rec->service_id, rec->method_id, rec->message_type, rec->major_version); return FALSE; } if (rec->major_version > 0xff) { - *err = g_strdup_printf("We currently only support 8 bit SOME/IP major versions (Service-ID: %x Method-ID: %x MsgType: %x Version: %i)", + *err = ws_strdup_printf("We currently only support 8 bit SOME/IP major versions (Service-ID: %x Method-ID: %x MsgType: %x Version: %i)", rec->service_id, rec->method_id, rec->message_type, rec->major_version); } if (rec->message_type > 0xff) { - *err = g_strdup_printf("We currently only support 8 bit SOME/IP message types (Service-ID: %x Method-ID: %x MsgType: %x Version: %i)", + *err = ws_strdup_printf("We currently only support 8 bit SOME/IP message types (Service-ID: %x Method-ID: %x MsgType: %x Version: %i)", rec->service_id, rec->method_id, rec->message_type, rec->major_version); } @@ -1170,12 +1170,12 @@ update_spdu_flexray_mapping(void *r, char **err) { spdu_flexray_mapping_uat_t *rec = (spdu_flexray_mapping_uat_t *)r; if (rec->cycle > 0xff) { - *err = g_strdup_printf("We currently only support 8 bit Cycles (Cycle: %i Frame ID: %i)", rec->cycle, rec->flexray_id); + *err = ws_strdup_printf("We currently only support 8 bit Cycles (Cycle: %i Frame ID: %i)", rec->cycle, rec->flexray_id); return FALSE; } if (rec->flexray_id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit Frame IDs (Cycle: %i Frame ID: %i)", rec->cycle, rec->flexray_id); + *err = ws_strdup_printf("We currently only support 16 bit Frame IDs (Cycle: %i Frame ID: %i)", rec->cycle, rec->flexray_id); return FALSE; } @@ -1243,12 +1243,12 @@ update_spdu_lin_mapping(void *r, char **err) { spdu_lin_mapping_uat_t *rec = (spdu_lin_mapping_uat_t *)r; if (rec->frame_id > LIN_ID_MASK) { - *err = g_strdup_printf("LIN Frame IDs are only uint with 6 bits (ID: %i)", rec->frame_id); + *err = ws_strdup_printf("LIN Frame IDs are only uint with 6 bits (ID: %i)", rec->frame_id); return FALSE; } if (rec->bus_id > 0xffff) { - *err = g_strdup_printf("LIN Bus IDs are only uint with 16 bits (ID: 0x%x, Bus ID: 0x%x)", rec->frame_id, rec->bus_id); + *err = ws_strdup_printf("LIN Bus IDs are only uint with 16 bits (ID: 0x%x, Bus ID: 0x%x)", rec->frame_id, rec->bus_id); return FALSE; } @@ -1324,7 +1324,7 @@ update_spdu_pdu_transport_mapping(void *r, char **err) { spdu_pdu_transport_mapping_uat_t *rec = (spdu_pdu_transport_mapping_uat_t *)r; if (rec->pdu_id > 0xffffffff) { - *err = g_strdup_printf("PDU-Transport IDs are only uint32 (ID: %i)", rec->pdu_id); + *err = ws_strdup_printf("PDU-Transport IDs are only uint32 (ID: %i)", rec->pdu_id); return FALSE; } @@ -1390,7 +1390,7 @@ update_spdu_ipdum_mapping(void *r, char **err) { spdu_ipdum_mapping_uat_t *rec = (spdu_ipdum_mapping_uat_t *)r; if (rec->pdu_id > 0xffffffff) { - *err = g_strdup_printf("IPduM IDs are only uint32 (ID: %i)", rec->pdu_id); + *err = ws_strdup_printf("IPduM IDs are only uint32 (ID: %i)", rec->pdu_id); return FALSE; } diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index d40e1789ad..ca2c5929e9 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -975,7 +975,7 @@ header_fields_update_cb(void *r, char **err) */ c = proto_check_field_name(rec->header_name); if (c) { - *err = g_strdup_printf("Header name can't contain '%c'", c); + *err = ws_strdup_printf("Header name can't contain '%c'", c); return FALSE; } @@ -1047,7 +1047,7 @@ header_fields_post_update_cb(void) dynamic_hf[i].p_id = hf_id; dynamic_hf[i].hfinfo.name = header_name; - dynamic_hf[i].hfinfo.abbrev = g_strdup_printf("sip.%s", header_name); + dynamic_hf[i].hfinfo.abbrev = ws_strdup_printf("sip.%s", header_name); dynamic_hf[i].hfinfo.type = FT_STRING; dynamic_hf[i].hfinfo.display = BASE_NONE; dynamic_hf[i].hfinfo.strings = NULL; @@ -1105,7 +1105,7 @@ authorization_users_update_cb(void *r, char **err) */ c = proto_check_field_name(rec->username); if (c) { - *err = g_strdup_printf("Username can't contain '%c'", c); + *err = ws_strdup_printf("Username can't contain '%c'", c); return FALSE; } @@ -5875,7 +5875,7 @@ static void sip_stat_init(stat_tap_table_ui* new_stat) for (i = 1; sip_response_code_vals[i].strptr; i++) { unsigned response_code = sip_response_code_vals[i].value; items[REQ_RESP_METHOD_COLUMN].value.string_value = - g_strdup_printf("%u %s", response_code, sip_response_code_vals[i].strptr); + ws_strdup_printf("%u %s", response_code, sip_response_code_vals[i].strptr); items[REQ_RESP_METHOD_COLUMN].user_data.uint_value = response_code; stat_tap_init_table_row(resp_table, i-1, num_fields, items); } @@ -6031,11 +6031,11 @@ static gchar *sip_follow_conv_filter(epan_dissect_t *edt, packet_info *pinfo _U_ int hfid = proto_registrar_get_id_byname("sip.Call-ID"); GPtrArray *gp = proto_find_first_finfo(edt->tree, hfid); if (gp != NULL && gp->len != 0) { - filter = g_strdup_printf("sip.Call-ID == \"%s\"", (gchar *)fvalue_get(&((field_info *)gp->pdata[0])->value)); + filter = ws_strdup_printf("sip.Call-ID == \"%s\"", (gchar *)fvalue_get(&((field_info *)gp->pdata[0])->value)); } g_ptr_array_free(gp, TRUE); } else { - filter = g_strdup_printf("sip.Call-ID"); + filter = ws_strdup_printf("sip.Call-ID"); } return filter; diff --git a/epan/dissectors/packet-skinny.c b/epan/dissectors/packet-skinny.c index 6e8f0043d9..1a7ada9c58 100644 --- a/epan/dissectors/packet-skinny.c +++ b/epan/dissectors/packet-skinny.c @@ -2362,7 +2362,7 @@ dissect_skinny_displayLabel(ptvcursor_t *cursor, packet_info *pinfo, int hfindex } } if (show_replaced_str) { - si->additionalInfo = g_strdup_printf("\"%s\"", wmem_strbuf_get_str(wmem_new)); + si->additionalInfo = ws_strdup_printf("\"%s\"", wmem_strbuf_get_str(wmem_new)); proto_item_append_text(item, " => \"%s\"" , wmem_strbuf_get_str(wmem_new)); } ptvcursor_advance(cursor, length); @@ -2522,7 +2522,7 @@ handle_KeypadButtonMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_ { guint32 hdr_data_length = tvb_get_letohl(ptvcursor_tvbuff(cursor), 0); - si->additionalInfo = g_strdup_printf("\"%s\"", + si->additionalInfo = ws_strdup_printf("\"%s\"", try_val_to_str_ext( tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)), &KeyPadButton_short_ext @@ -2838,7 +2838,7 @@ handle_OpenReceiveChannelAckMessage(ptvcursor_t *cursor, packet_info * pinfo _U_ ptvcursor_add(cursor, hf_skinny_portNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &ipAddr, portNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); ipAddr_str = address_to_display(NULL, &ipAddr); - si->additionalInfo = g_strdup_printf("%s:%d", ipAddr_str, portNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", ipAddr_str, portNumber); wmem_free(NULL, ipAddr_str); passThroughPartyId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); si->passThroughPartyId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); @@ -3000,7 +3000,7 @@ handle_MediaTransmissionFailureMessage(ptvcursor_t *cursor, packet_info * pinfo ptvcursor_add(cursor, hf_skinny_remotePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &remoteIpAddr, remotePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); remoteIpAddr_str = address_to_display(NULL, &remoteIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); wmem_free(NULL, remoteIpAddr_str); si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN); @@ -3423,7 +3423,7 @@ handle_OpenMultiMediaReceiveChannelAckMessage(ptvcursor_t *cursor, packet_info * ptvcursor_add(cursor, hf_skinny_portNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &ipAddr, portNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); ipAddr_str = address_to_display(NULL, &ipAddr); - si->additionalInfo = g_strdup_printf("%s:%d", ipAddr_str, portNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", ipAddr_str, portNumber); wmem_free(NULL, ipAddr_str); passThroughPartyId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); si->passThroughPartyId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); @@ -4340,7 +4340,7 @@ handle_PortResMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_conv_ ptvcursor_add(cursor, hf_skinny_portNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &ipAddr, portNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); ipAddr_str = address_to_display(NULL, &ipAddr); - si->additionalInfo = g_strdup_printf("%s:%d", ipAddr_str, portNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", ipAddr_str, portNumber); wmem_free(NULL, ipAddr_str); ptvcursor_add(cursor, hf_skinny_RTCPPortNumber, 4, ENC_LITTLE_ENDIAN); if (hdr_version >= V19_MSG_TYPE) { @@ -4374,7 +4374,7 @@ handle_QoSResvNotifyMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny ptvcursor_add(cursor, hf_skinny_remotePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &remoteIpAddr, remotePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); remoteIpAddr_str = address_to_display(NULL, &remoteIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); wmem_free(NULL, remoteIpAddr_str); ptvcursor_add(cursor, hf_skinny_direction, 4, ENC_LITTLE_ENDIAN); } @@ -4404,7 +4404,7 @@ handle_QoSErrorNotifyMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinn ptvcursor_add(cursor, hf_skinny_remotePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &remoteIpAddr, remotePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); remoteIpAddr_str = address_to_display(NULL, &remoteIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); wmem_free(NULL, remoteIpAddr_str); ptvcursor_add(cursor, hf_skinny_direction, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_errorCode, 4, ENC_LITTLE_ENDIAN); @@ -4555,7 +4555,7 @@ handle_RegisterAckMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_c static void handle_StartToneMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_conv_info_t * skinny_conv _U_) { - si->additionalInfo = g_strdup_printf("\"%s\"", + si->additionalInfo = ws_strdup_printf("\"%s\"", try_val_to_str_ext( tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)), &DeviceTone_ext @@ -4684,7 +4684,7 @@ handle_StartMediaTransmissionMessage(ptvcursor_t *cursor, packet_info * pinfo _U ptvcursor_add(cursor, hf_skinny_remotePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &remoteIpAddr, remotePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); remoteIpAddr_str = address_to_display(NULL, &remoteIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); wmem_free(NULL, remoteIpAddr_str); ptvcursor_add(cursor, hf_skinny_milliSecondPacketSize, 4, ENC_LITTLE_ENDIAN); compressionType = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); @@ -4879,7 +4879,7 @@ handle_CallInfoMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_conv ptvcursor_advance(cursor, 4); ptvcursor_pop_subtree(cursor); /* end bitfield: partyPIRestrictionBits */ if (si->callingParty && si->calledParty) { - si->additionalInfo = g_strdup_printf("\"%s -> %s\"", si->callingParty, si->calledParty); + si->additionalInfo = ws_strdup_printf("\"%s -> %s\"", si->callingParty, si->calledParty); } } @@ -5215,7 +5215,7 @@ handle_StartMulticastMediaReceptionMessage(ptvcursor_t *cursor, packet_info * pi ptvcursor_add(cursor, hf_skinny_multicastPortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &multicastIpAddr, multicastPortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); multicastIpAddr_str = address_to_display(NULL, &multicastIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", multicastIpAddr_str, multicastPortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", multicastIpAddr_str, multicastPortNumber); wmem_free(NULL, multicastIpAddr_str); ptvcursor_add(cursor, hf_skinny_milliSecondPacketSize, 4, ENC_LITTLE_ENDIAN); compressionType = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); @@ -5278,7 +5278,7 @@ handle_StartMulticastMediaTransmissionMessage(ptvcursor_t *cursor, packet_info * ptvcursor_add(cursor, hf_skinny_multicastPortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &multicastIpAddr, multicastPortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); multicastIpAddr_str = address_to_display(NULL, &multicastIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", multicastIpAddr_str, multicastPortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", multicastIpAddr_str, multicastPortNumber); wmem_free(NULL, multicastIpAddr_str); ptvcursor_add(cursor, hf_skinny_milliSecondPacketSize, 4, ENC_LITTLE_ENDIAN); compressionType = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); @@ -5461,7 +5461,7 @@ handle_OpenReceiveChannelMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, s ptvcursor_add(cursor, hf_skinny_sourcePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &sourceIpAddr, sourcePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); sourceIpAddr_str = address_to_display(NULL, &sourceIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", sourceIpAddr_str, sourcePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", sourceIpAddr_str, sourcePortNumber); wmem_free(NULL, sourceIpAddr_str); } if (hdr_version >= V16_MSG_TYPE) { @@ -5708,7 +5708,7 @@ handle_SelectSoftKeysMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinn static void handle_CallStateMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_conv_info_t * skinny_conv _U_) { - si->additionalInfo = g_strdup_printf("\"%s\"", + si->additionalInfo = ws_strdup_printf("\"%s\"", try_val_to_str_ext( tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)), &DCallState_ext @@ -5909,7 +5909,7 @@ handle_DialedNumberMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_ guint32 dialedNumber_len; dialedNumber_len = tvb_strnlen(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), 24)+1; if (dialedNumber_len > 1) { - si->additionalInfo = g_strdup_printf("\"%s\"", tvb_format_stringzpad(pinfo->pool, ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), dialedNumber_len)); + si->additionalInfo = ws_strdup_printf("\"%s\"", tvb_format_stringzpad(pinfo->pool, ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), dialedNumber_len)); } ptvcursor_add(cursor, hf_skinny_dialedNumber, 24, ENC_ASCII|ENC_NA); si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); @@ -5921,7 +5921,7 @@ handle_DialedNumberMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_ guint32 dialedNumber_len; dialedNumber_len = tvb_strnlen(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), VariableDirnumSize)+1; if (dialedNumber_len > 1) { - si->additionalInfo = g_strdup_printf("\"%s\"", tvb_format_stringzpad(pinfo->pool, ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), dialedNumber_len)); + si->additionalInfo = ws_strdup_printf("\"%s\"", tvb_format_stringzpad(pinfo->pool, ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), dialedNumber_len)); } ptvcursor_add(cursor, hf_skinny_dialedNumber, VariableDirnumSize, ENC_ASCII|ENC_NA); si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); @@ -6499,7 +6499,7 @@ handle_OpenMultiMediaReceiveChannelMessage(ptvcursor_t *cursor, packet_info * pi ptvcursor_add(cursor, hf_skinny_sourcePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &sourceIpAddr, sourcePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); sourceIpAddr_str = address_to_display(NULL, &sourceIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", sourceIpAddr_str, sourcePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", sourceIpAddr_str, sourcePortNumber); wmem_free(NULL, sourceIpAddr_str); } if (hdr_version >= V16_MSG_TYPE) { @@ -7519,7 +7519,7 @@ handle_CallInfoV2Message(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_co } } if (si->callingParty && si->calledParty) { - si->additionalInfo = g_strdup_printf("\"%s -> %s\"", si->callingParty, si->calledParty); + si->additionalInfo = ws_strdup_printf("\"%s -> %s\"", si->callingParty, si->calledParty); } } @@ -7589,7 +7589,7 @@ handle_QoSListenMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_con ptvcursor_add(cursor, hf_skinny_remotePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &remoteIpAddr, remotePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); remoteIpAddr_str = address_to_display(NULL, &remoteIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); wmem_free(NULL, remoteIpAddr_str); ptvcursor_add(cursor, hf_skinny_resvStyle, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_maxRetryNumber, 4, ENC_LITTLE_ENDIAN); @@ -7636,7 +7636,7 @@ handle_QoSPathMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_conv_ ptvcursor_add(cursor, hf_skinny_remotePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &remoteIpAddr, remotePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); remoteIpAddr_str = address_to_display(NULL, &remoteIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); wmem_free(NULL, remoteIpAddr_str); ptvcursor_add(cursor, hf_skinny_resvStyle, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_maxRetryNumber, 4, ENC_LITTLE_ENDIAN); @@ -7682,7 +7682,7 @@ handle_QoSTeardownMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_c ptvcursor_add(cursor, hf_skinny_remotePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &remoteIpAddr, remotePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); remoteIpAddr_str = address_to_display(NULL, &remoteIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); wmem_free(NULL, remoteIpAddr_str); ptvcursor_add(cursor, hf_skinny_direction, 4, ENC_LITTLE_ENDIAN); } @@ -7712,7 +7712,7 @@ handle_UpdateDSCPMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_co ptvcursor_add(cursor, hf_skinny_remotePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &remoteIpAddr, remotePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); remoteIpAddr_str = address_to_display(NULL, &remoteIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); wmem_free(NULL, remoteIpAddr_str); ptvcursor_add(cursor, hf_skinny_DSCPValue, 4, ENC_LITTLE_ENDIAN); } @@ -7742,7 +7742,7 @@ handle_QoSModifyMessage(ptvcursor_t *cursor, packet_info * pinfo _U_, skinny_con ptvcursor_add(cursor, hf_skinny_remotePortNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &remoteIpAddr, remotePortNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); remoteIpAddr_str = address_to_display(NULL, &remoteIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", remoteIpAddr_str, remotePortNumber); wmem_free(NULL, remoteIpAddr_str); ptvcursor_add(cursor, hf_skinny_direction, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_compressionType, 4, ENC_LITTLE_ENDIAN); @@ -7823,7 +7823,7 @@ handle_StartMediaTransmissionAckMessage(ptvcursor_t *cursor, packet_info * pinfo ptvcursor_add(cursor, hf_skinny_portNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &transmitIpAddr, portNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); transmitIpAddr_str = address_to_display(NULL, &transmitIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", transmitIpAddr_str, portNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", transmitIpAddr_str, portNumber); wmem_free(NULL, transmitIpAddr_str); si->mediaTransmissionStatus = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_mediaTransmissionStatus, 4, ENC_LITTLE_ENDIAN); @@ -7857,7 +7857,7 @@ handle_StartMultiMediaTransmissionAckMessage(ptvcursor_t *cursor, packet_info * ptvcursor_add(cursor, hf_skinny_portNumber, 4, ENC_LITTLE_ENDIAN); srtp_add_address(pinfo, PT_UDP, &transmitIpAddr, portNumber, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL); transmitIpAddr_str = address_to_display(NULL, &transmitIpAddr); - si->additionalInfo = g_strdup_printf("%s:%d", transmitIpAddr_str, portNumber); + si->additionalInfo = ws_strdup_printf("%s:%d", transmitIpAddr_str, portNumber); wmem_free(NULL, transmitIpAddr_str); si->multimediaTransmissionStatus = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_multimediaTransmissionStatus, 4, ENC_LITTLE_ENDIAN); diff --git a/epan/dissectors/packet-skinny.c.in b/epan/dissectors/packet-skinny.c.in index 2f280329f6..cad14b5223 100644 --- a/epan/dissectors/packet-skinny.c.in +++ b/epan/dissectors/packet-skinny.c.in @@ -321,7 +321,7 @@ dissect_skinny_displayLabel(ptvcursor_t *cursor, packet_info *pinfo, int hfindex } } if (show_replaced_str) { - si->additionalInfo = g_strdup_printf("\"%s\"", wmem_strbuf_get_str(wmem_new)); + si->additionalInfo = ws_strdup_printf("\"%s\"", wmem_strbuf_get_str(wmem_new)); proto_item_append_text(item, " => \"%s\"" , wmem_strbuf_get_str(wmem_new)); } ptvcursor_advance(cursor, length); diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index ec0d89cb84..2954a1e81d 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -1306,7 +1306,7 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const if (new_file->is_out_of_memory) { entry->content_type = - g_strdup_printf("%s (%"PRIu64"?/%"PRIu64") %s [mem!!]", + ws_strdup_printf("%s (%"PRIu64"?/%"PRIu64") %s [mem!!]", aux_smb_fid_type_string, new_file->data_gathered, new_file->file_length, @@ -1319,7 +1319,7 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const } entry->content_type = - g_strdup_printf("%s (%"PRIu64"/%"PRIu64") %s [%5.2f%%]", + ws_strdup_printf("%s (%"PRIu64"/%"PRIu64") %s [%5.2f%%]", aux_smb_fid_type_string, new_file->data_gathered, new_file->file_length, @@ -1341,7 +1341,7 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const /* Modify the current_entry object_type string */ if (current_file->is_out_of_memory) { current_entry->content_type = - g_strdup_printf("%s (%"PRIu64"?/%"PRIu64") %s [mem!!]", + ws_strdup_printf("%s (%"PRIu64"?/%"PRIu64") %s [mem!!]", aux_smb_fid_type_string, current_file->data_gathered, current_file->file_length, @@ -1349,7 +1349,7 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const } else { percent = (gfloat) (100*current_file->data_gathered/current_file->file_length); current_entry->content_type = - g_strdup_printf("%s (%"PRIu64"/%"PRIu64") %s [%5.2f%%]", + ws_strdup_printf("%s (%"PRIu64"/%"PRIu64") %s [%5.2f%%]", aux_smb_fid_type_string, current_file->data_gathered, current_file->file_length, diff --git a/epan/dissectors/packet-socketcan.c b/epan/dissectors/packet-socketcan.c index 83e528c3e8..fe8910b8db 100644 --- a/epan/dissectors/packet-socketcan.c +++ b/epan/dissectors/packet-socketcan.c @@ -191,13 +191,13 @@ update_interface_config(void *r, char **err) { interface_config_t *rec = (interface_config_t *)r; if (rec->interface_id > 0xffffffff) { - *err = g_strdup_printf("We currently only support 32 bit identifiers (ID: %i Name: %s)", + *err = ws_strdup_printf("We currently only support 32 bit identifiers (ID: %i Name: %s)", rec->interface_id, rec->interface_name); return FALSE; } if (rec->bus_id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit bus identifiers (ID: %i Name: %s Bus-ID: %i)", + *err = ws_strdup_printf("We currently only support 16 bit bus identifiers (ID: %i Name: %s Bus-ID: %i)", rec->interface_id, rec->interface_name, rec->bus_id); return FALSE; } diff --git a/epan/dissectors/packet-someip.c b/epan/dissectors/packet-someip.c index d16264fa42..8b23c01061 100644 --- a/epan/dissectors/packet-someip.c +++ b/epan/dissectors/packet-someip.c @@ -622,11 +622,11 @@ check_filter_string(gchar *filter_string, guint32 id) { c = proto_check_field_name(filter_string); if (c) { if (c == '.') { - err = g_strdup_printf("Filter String contains illegal chars '.' (ID: %i )", id); + err = ws_strdup_printf("Filter String contains illegal chars '.' (ID: %i )", id); } else if (g_ascii_isprint(c)) { - err = g_strdup_printf("Filter String contains illegal chars '%c' (ID: %i)", c, id); + err = ws_strdup_printf("Filter String contains illegal chars '%c' (ID: %i)", c, id); } else { - err = g_strdup_printf("Filter String contains invalid byte \\%03o (ID: %i)", c, id); + err = ws_strdup_printf("Filter String contains invalid byte \\%03o (ID: %i)", c, id); } } @@ -660,7 +660,7 @@ update_generic_one_identifier_16bit(void *r, char **err) { generic_one_id_string_t *rec = (generic_one_id_string_t *)r; if (rec->id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 16 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); return FALSE; } @@ -712,12 +712,12 @@ update_generic_two_identifier_16bit(void *r, char **err) { generic_two_id_string_t *rec = (generic_two_id_string_t *)r; if ( rec->id > 0xffff ) { - *err = g_strdup_printf("We currently only support 16 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 16 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); return FALSE; } if ( rec->id2 > 0xffff ) { - *err = g_strdup_printf("We currently only support 16 bit identifiers (ID: %i ID2: %i Name: %s)", rec->id, rec->id2, rec->name); + *err = ws_strdup_printf("We currently only support 16 bit identifiers (ID: %i ID2: %i Name: %s)", rec->id, rec->id2, rec->name); return FALSE; } @@ -1012,48 +1012,48 @@ update_someip_parameter_list(void *r, char **err) { guchar c; if (rec->service_id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit Service IDs (Service-ID: %i Name: %s)", rec->service_id, rec->name); + *err = ws_strdup_printf("We currently only support 16 bit Service IDs (Service-ID: %i Name: %s)", rec->service_id, rec->name); return FALSE; } if (rec->method_id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit Method IDs (Service-ID: %i Method-ID: %i Name: %s)", rec->service_id, rec->method_id, rec->name); + *err = ws_strdup_printf("We currently only support 16 bit Method IDs (Service-ID: %i Method-ID: %i Name: %s)", rec->service_id, rec->method_id, rec->name); return FALSE; } if (rec->version > 0xff) { - *err = g_strdup_printf("We currently only support 8 bit Version (Service-ID: %i Method-ID: %i Version: %d Name: %s)", rec->service_id, rec->method_id, rec->version, rec->name); + *err = ws_strdup_printf("We currently only support 8 bit Version (Service-ID: %i Method-ID: %i Version: %d Name: %s)", rec->service_id, rec->method_id, rec->version, rec->name); return FALSE; } if (rec->message_type > 0xff) { - *err = g_strdup_printf("We currently only support 8 bit Message Type (Service-ID: %i Method-ID: %i Version: %d Message Type: %x Name: %s)", rec->service_id, rec->method_id, rec->version, rec->message_type, rec->name); + *err = ws_strdup_printf("We currently only support 8 bit Message Type (Service-ID: %i Method-ID: %i Version: %d Message Type: %x Name: %s)", rec->service_id, rec->method_id, rec->version, rec->message_type, rec->name); return FALSE; } if (rec->name == NULL || rec->name[0] == 0) { - *err = g_strdup_printf("Name cannot be empty"); + *err = ws_strdup_printf("Name cannot be empty"); return FALSE; } if (rec->pos >= rec->num_of_params) { - *err = g_strdup_printf("Position >= Number of Parameters"); + *err = ws_strdup_printf("Position >= Number of Parameters"); return FALSE; } if (rec->filter_string == NULL || rec->filter_string[0] == 0) { - *err = g_strdup_printf("Name cannot be empty"); + *err = ws_strdup_printf("Name cannot be empty"); return FALSE; } c = proto_check_field_name(rec->filter_string); if (c) { if (c == '.') { - *err = g_strdup_printf("Filter String contains illegal chars '.' (Service-ID: %i Method-ID: %i)", rec->service_id, rec->method_id); + *err = ws_strdup_printf("Filter String contains illegal chars '.' (Service-ID: %i Method-ID: %i)", rec->service_id, rec->method_id); } else if (g_ascii_isprint(c)) { - *err = g_strdup_printf("Filter String contains illegal chars '%c' (Service-ID: %i Method-ID: %i)", c, rec->service_id, rec->method_id); + *err = ws_strdup_printf("Filter String contains illegal chars '%c' (Service-ID: %i Method-ID: %i)", c, rec->service_id, rec->method_id); } else { - *err = g_strdup_printf("Filter String contains invalid byte \\%03o (Service-ID: %i Method-ID: %i)", c, rec->service_id, rec->method_id); + *err = ws_strdup_printf("Filter String contains invalid byte \\%03o (Service-ID: %i Method-ID: %i)", c, rec->service_id, rec->method_id); } return FALSE; } @@ -1177,17 +1177,17 @@ update_someip_parameter_enum(void *r, char **err) { /* enum name is not used in a filter yet. */ if (rec->name == NULL || rec->name[0] == 0) { - *err = g_strdup_printf("Name cannot be empty"); + *err = ws_strdup_printf("Name cannot be empty"); return FALSE; } if (rec->value_name == NULL || rec->value_name[0] == 0) { - *err = g_strdup_printf("Value Name cannot be empty"); + *err = ws_strdup_printf("Value Name cannot be empty"); return FALSE; } if (rec->num_of_items == 0) { - *err = g_strdup_printf("Number_of_Items = 0"); + *err = ws_strdup_printf("Number_of_Items = 0"); return FALSE; } @@ -1317,17 +1317,17 @@ update_someip_parameter_array(void *r, char **err) { char *tmp; if (rec->name == NULL || rec->name[0] == 0) { - *err = g_strdup_printf("Name cannot be empty"); + *err = ws_strdup_printf("Name cannot be empty"); return FALSE; } if (rec->num >= rec->num_of_dims) { - *err = g_strdup_printf("Dimension >= Number of Dimensions"); + *err = ws_strdup_printf("Dimension >= Number of Dimensions"); return FALSE; } if (rec->filter_string == NULL || rec->filter_string[0] == 0) { - *err = g_strdup_printf("Filter String cannot be empty"); + *err = ws_strdup_printf("Filter String cannot be empty"); return FALSE; } @@ -1468,12 +1468,12 @@ update_someip_parameter_struct(void *r, char **err) { char *tmp = NULL; if (rec->struct_name == NULL || rec->struct_name[0] == 0) { - *err = g_strdup_printf("Struct name cannot be empty"); + *err = ws_strdup_printf("Struct name cannot be empty"); return FALSE; } if (rec->filter_string == NULL || rec->filter_string[0] == 0) { - *err = g_strdup_printf("Struct name cannot be empty"); + *err = ws_strdup_printf("Struct name cannot be empty"); return FALSE; } @@ -1484,12 +1484,12 @@ update_someip_parameter_struct(void *r, char **err) { } if (rec->name == NULL || rec->name[0] == 0) { - *err = g_strdup_printf("Name cannot be empty"); + *err = ws_strdup_printf("Name cannot be empty"); return FALSE; } if (rec->pos >= rec->num_of_items) { - *err = g_strdup_printf("Position >= Number of Parameters"); + *err = ws_strdup_printf("Position >= Number of Parameters"); return FALSE; } @@ -1627,7 +1627,7 @@ update_someip_parameter_union(void *r, char **err) { gchar *tmp; if (rec->name == NULL || rec->name[0] == 0) { - *err = g_strdup_printf("Union name cannot be empty"); + *err = ws_strdup_printf("Union name cannot be empty"); return FALSE; } @@ -1638,7 +1638,7 @@ update_someip_parameter_union(void *r, char **err) { } if (rec->type_name == NULL || rec->type_name[0] == 0) { - *err = g_strdup_printf("Type Name cannot be empty"); + *err = ws_strdup_printf("Type Name cannot be empty"); return FALSE; } @@ -1761,12 +1761,12 @@ update_someip_parameter_base_type_list(void *r, char **err) { someip_parameter_base_type_list_uat_t *rec = (someip_parameter_base_type_list_uat_t *)r; if (rec->name == NULL || rec->name[0] == 0) { - *err = g_strdup_printf("Name cannot be empty"); + *err = ws_strdup_printf("Name cannot be empty"); return FALSE; } if (rec->id > 0xffffffff) { - *err = g_strdup_printf("We currently only support 32 bit IDs (%i) Name: %s", rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 32 bit IDs (%i) Name: %s", rec->id, rec->name); return FALSE; } @@ -1850,22 +1850,22 @@ update_someip_parameter_string_list(void *r, char **err) { someip_parameter_string_uat_t *rec = (someip_parameter_string_uat_t *)r; if (rec->name == NULL || rec->name[0] == 0) { - *err = g_strdup_printf("Name cannot be empty"); + *err = ws_strdup_printf("Name cannot be empty"); return FALSE; } if (rec->id > 0xffffffff) { - *err = g_strdup_printf("We currently only support 32 bit IDs (%i) Name: %s", rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 32 bit IDs (%i) Name: %s", rec->id, rec->name); return FALSE; } if (rec->max_length > 0xffffffff) { - *err = g_strdup_printf("We currently only support 32 bit max_length (%i) Name: %s", rec->max_length, rec->name); + *err = ws_strdup_printf("We currently only support 32 bit max_length (%i) Name: %s", rec->max_length, rec->name); return FALSE; } if (rec->length_of_length != 0 && rec->length_of_length != 8 && rec->length_of_length != 16 && rec->length_of_length != 32) { - *err = g_strdup_printf("length_of_length can be only 0, 8, 16, or 32 but not %d (IDs: %i Name: %s)", rec->length_of_length, rec->id, rec->name); + *err = ws_strdup_printf("length_of_length can be only 0, 8, 16, or 32 but not %d (IDs: %i Name: %s)", rec->length_of_length, rec->id, rec->name); return FALSE; } @@ -1936,7 +1936,7 @@ update_someip_parameter_typedef_list(void *r, char **err) { someip_parameter_typedef_uat_t *rec = (someip_parameter_typedef_uat_t *)r; if (rec->id > 0xffffffff) { - *err = g_strdup_printf("We currently only support 32 bit IDs (%i) Name: %s", rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 32 bit IDs (%i) Name: %s", rec->id, rec->name); return FALSE; } @@ -2124,7 +2124,7 @@ update_dynamic_hf_entry(hf_register_info *hf_array, int pos, guint32 data_type, if (attribs.base_type_name == NULL) { hf_array[pos].hfinfo.name = g_strdup(param_name); } else { - hf_array[pos].hfinfo.name = g_strdup_printf("%s [%s]", param_name, attribs.base_type_name); + hf_array[pos].hfinfo.name = ws_strdup_printf("%s [%s]", param_name, attribs.base_type_name); } hf_array[pos].hfinfo.abbrev = abbrev; @@ -2165,7 +2165,7 @@ update_dynamic_param_hf_entry(gpointer key _U_, gpointer value, gpointer data) { if (service_name == NULL) { service_name_needs_free = TRUE; - service_name = g_strdup_printf("0x%04x", list->service_id); + service_name = ws_strdup_printf("0x%04x", list->service_id); } if (method_name != NULL) { @@ -2177,10 +2177,10 @@ update_dynamic_param_hf_entry(gpointer key _U_, gpointer value, gpointer data) { if (method_name == NULL) { method_name_needs_free = TRUE; - method_name = g_strdup_printf("0x%04x", list->method_id); + method_name = ws_strdup_printf("0x%04x", list->method_id); } - char *abbrev = g_strdup_printf("someip.payload.%s", item->filter_string); + char *abbrev = ws_strdup_printf("someip.payload.%s", item->filter_string); item->hf_id = update_dynamic_hf_entry(dynamic_hf_param, *pos, item->data_type, item->id_ref, item->name, abbrev); if (service_name_needs_free) { @@ -2207,7 +2207,7 @@ update_dynamic_array_hf_entry(gpointer key _U_, gpointer value, gpointer data) { return; } - abbrev = g_strdup_printf("someip.payload.%s", item->filter_string); + abbrev = ws_strdup_printf("someip.payload.%s", item->filter_string); item->hf_id = update_dynamic_hf_entry(dynamic_hf_array, *pos, item->data_type, item->id_ref, item->name, abbrev); if (item->hf_id != NULL) { @@ -2228,7 +2228,7 @@ update_dynamic_struct_hf_entry(gpointer key _U_, gpointer value, gpointer data) for (i = 0; i < list->num_of_items; i++) { someip_payload_parameter_item_t *item = &(list->items[i]); - char *abbrev = g_strdup_printf("someip.payload.%s", item->filter_string); + char *abbrev = ws_strdup_printf("someip.payload.%s", item->filter_string); item->hf_id = update_dynamic_hf_entry(dynamic_hf_struct, *pos, item->data_type, item->id_ref, item->name, abbrev); if (item->hf_id != NULL) { @@ -2250,7 +2250,7 @@ update_dynamic_union_hf_entry(gpointer key _U_, gpointer value, gpointer data) { for (i = 0; i < list->num_of_items; i++) { someip_parameter_union_item_t *item = &(list->items[i]); - char *abbrev = g_strdup_printf("someip.payload.%s", item->filter_string); + char *abbrev = ws_strdup_printf("someip.payload.%s", item->filter_string); item->hf_id = update_dynamic_hf_entry(dynamic_hf_union, *pos, item->data_type, item->id_ref, item->name, abbrev); if (item->hf_id != NULL) { diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 8456b7bbf0..9705449f08 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -919,7 +919,7 @@ tcp_build_filter(packet_info *pinfo) { if( pinfo->net_src.type == AT_IPv4 && pinfo->net_dst.type == AT_IPv4 ) { /* TCP over IPv4 */ - return g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", + return ws_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), pinfo->srcport, pinfo->destport ); @@ -927,7 +927,7 @@ tcp_build_filter(packet_info *pinfo) if( pinfo->net_src.type == AT_IPv6 && pinfo->net_dst.type == AT_IPv6 ) { /* TCP over IPv6 */ - return g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", + return ws_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), pinfo->srcport, pinfo->destport ); @@ -958,7 +958,7 @@ tcp_seq_analysis_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U_, flags = tcp_flags_to_str(NULL, tcph); if ((tcph->th_have_seglen)&&(tcph->th_seglen!=0)){ - sai->frame_label = g_strdup_printf("%s - Len: %u",flags, tcph->th_seglen); + sai->frame_label = ws_strdup_printf("%s - Len: %u",flags, tcph->th_seglen); } else{ sai->frame_label = g_strdup(flags); @@ -967,9 +967,9 @@ tcp_seq_analysis_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U_, wmem_free(NULL, flags); if (tcph->th_flags & TH_ACK) - sai->comment = g_strdup_printf("Seq = %u Ack = %u",tcph->th_seq, tcph->th_ack); + sai->comment = ws_strdup_printf("Seq = %u Ack = %u",tcph->th_seq, tcph->th_ack); else - sai->comment = g_strdup_printf("Seq = %u",tcph->th_seq); + sai->comment = ws_strdup_printf("Seq = %u",tcph->th_seq); sai->line_style = 1; sai->conv_num = (guint16) tcph->th_stream; @@ -996,7 +996,7 @@ gchar *tcp_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinfo, guint return NULL; *stream = tcpd->stream; - return g_strdup_printf("tcp.stream eq %u", tcpd->stream); + return ws_strdup_printf("tcp.stream eq %u", tcpd->stream); } return NULL; @@ -1004,7 +1004,7 @@ gchar *tcp_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinfo, guint gchar *tcp_follow_index_filter(guint stream, guint sub_stream _U_) { - return g_strdup_printf("tcp.stream eq %u", stream); + return ws_strdup_printf("tcp.stream eq %u", stream); } gchar *tcp_follow_address_filter(address *src_addr, address *dst_addr, int src_port, int dst_port) @@ -1016,7 +1016,7 @@ gchar *tcp_follow_address_filter(address *src_addr, address *dst_addr, int src_p address_to_str_buf(src_addr, src_addr_str, sizeof(src_addr_str)); address_to_str_buf(dst_addr, dst_addr_str, sizeof(dst_addr_str)); - return g_strdup_printf("((ip%s.src eq %s and tcp.srcport eq %d) and " + return ws_strdup_printf("((ip%s.src eq %s and tcp.srcport eq %d) and " "(ip%s.dst eq %s and tcp.dstport eq %d))" " or " "((ip%s.src eq %s and tcp.srcport eq %d) and " @@ -1131,7 +1131,7 @@ check_follow_fragments(follow_info_t *follow_info, gboolean is_server, guint32 a * by the receiving host. Add dummy stream chunk with the data * "[xxx bytes missing in capture file]". */ - dummy_str = g_strdup_printf("[%d bytes missing in capture file]", + dummy_str = ws_strdup_printf("[%d bytes missing in capture file]", (int)(lowest_seq - follow_info->seq[is_server]) ); // XXX the dummy replacement could be larger than the actual missing bytes. diff --git a/epan/dissectors/packet-tecmp.c b/epan/dissectors/packet-tecmp.c index 42ac11c28d..7f2a1442bf 100644 --- a/epan/dissectors/packet-tecmp.c +++ b/epan/dissectors/packet-tecmp.c @@ -488,7 +488,7 @@ update_generic_one_identifier_16bit(void *r, char **err) { generic_one_id_string_t *rec = (generic_one_id_string_t *)r; if (rec->id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 16 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); return FALSE; } @@ -555,7 +555,7 @@ update_channel_config(void *r, char **err) { channel_config_t *rec = (channel_config_t *)r; if (rec->id > 0xffffffff) { - *err = g_strdup_printf("We currently only support 32 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 32 bit identifiers (ID: %i Name: %s)", rec->id, rec->name); return FALSE; } @@ -565,7 +565,7 @@ update_channel_config(void *r, char **err) { } if (rec->bus_id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit bus identifiers (ID: %i Name: %s Bus-ID: %i)", rec->id, rec->name, rec->bus_id); + *err = ws_strdup_printf("We currently only support 16 bit bus identifiers (ID: %i Name: %s Bus-ID: %i)", rec->id, rec->name, rec->bus_id); return FALSE; } diff --git a/epan/dissectors/packet-tibia.c b/epan/dissectors/packet-tibia.c index 7e6daebbbd..e44813740a 100644 --- a/epan/dissectors/packet-tibia.c +++ b/epan/dissectors/packet-tibia.c @@ -1740,7 +1740,7 @@ rsakeys_uat_fld_ip_chk_cb(void* r _U_, const char* ipaddr, guint len _U_, const return TRUE; } - *err = g_strdup_printf("No IPv4 address given."); + *err = ws_strdup_printf("No IPv4 address given."); return FALSE; } @@ -1762,7 +1762,7 @@ rsakeys_uat_fld_fileopen_chk_cb(void* r _U_, const char* p, guint len _U_, const if (p && *p) { ws_statb64 st; if (ws_stat64(p, &st) != 0) { - *err = g_strdup_printf("File '%s' does not exist or access is denied.", p); + *err = ws_strdup_printf("File '%s' does not exist or access is denied.", p); return FALSE; } } else { @@ -1785,7 +1785,7 @@ rsakeys_uat_fld_password_chk_cb(void *r, const char *p, guint len _U_, const voi gnutls_x509_privkey_t priv_key = rsa_load_pkcs12(fp, p, &msg); if (!priv_key) { fclose(fp); - *err = g_strdup_printf("Could not load PKCS#12 key file: %s", msg); + *err = ws_strdup_printf("Could not load PKCS#12 key file: %s", msg); g_free(msg); return FALSE; } @@ -1793,7 +1793,7 @@ rsakeys_uat_fld_password_chk_cb(void *r, const char *p, guint len _U_, const voi gnutls_x509_privkey_deinit(priv_key); fclose(fp); } else { - *err = g_strdup_printf("Leave this field blank if the keyfile is not PKCS#12."); + *err = ws_strdup_printf("Leave this field blank if the keyfile is not PKCS#12."); return FALSE; } } @@ -1865,7 +1865,7 @@ xteakeys_uat_fld_key_chk_cb(void *r _U_, const char *key, guint len, const void } } - *err = g_strdup_printf("XTEA keys are 32 character long hex strings."); + *err = ws_strdup_printf("XTEA keys are 32 character long hex strings."); return FALSE; } diff --git a/epan/dissectors/packet-tls-utils.c b/epan/dissectors/packet-tls-utils.c index ef2b203fb4..a271be9261 100644 --- a/epan/dissectors/packet-tls-utils.c +++ b/epan/dissectors/packet-tls-utils.c @@ -6322,7 +6322,7 @@ ssldecrypt_uat_fld_fileopen_chk_cb(void* r _U_, const char* p, guint len _U_, co return FALSE; } else { if (ws_stat64(p, &st) != 0) { - *err = g_strdup_printf("File '%s' does not exist or access is denied.", p); + *err = ws_strdup_printf("File '%s' does not exist or access is denied.", p); return FALSE; } } @@ -6345,7 +6345,7 @@ ssldecrypt_uat_fld_password_chk_cb(void *r _U_, const char *p _U_, guint len _U_ gnutls_x509_privkey_t priv_key = rsa_load_pkcs12(fp, p, &msg); if (!priv_key) { fclose(fp); - *err = g_strdup_printf("Could not load PKCS#12 key file: %s", msg); + *err = ws_strdup_printf("Could not load PKCS#12 key file: %s", msg); g_free(msg); return FALSE; } @@ -6353,7 +6353,7 @@ ssldecrypt_uat_fld_password_chk_cb(void *r _U_, const char *p _U_, guint len _U_ gnutls_x509_privkey_deinit(priv_key); fclose(fp); } else { - *err = g_strdup_printf("Leave this field blank if the keyfile is not PKCS#12."); + *err = ws_strdup_printf("Leave this field blank if the keyfile is not PKCS#12."); return FALSE; } } diff --git a/epan/dissectors/packet-tls.c b/epan/dissectors/packet-tls.c index 6b8c0db0eb..0d170d866e 100644 --- a/epan/dissectors/packet-tls.c +++ b/epan/dissectors/packet-tls.c @@ -4052,12 +4052,12 @@ ssldecrypt_uat_fld_protocol_chk_cb(void* r _U_, const char* p, guint len _U_, co if (!ssl_find_appdata_dissector(p)) { if (proto_get_id_by_filter_name(p) != -1) { - *err = g_strdup_printf("While '%s' is a valid dissector filter name, that dissector is not configured" + *err = ws_strdup_printf("While '%s' is a valid dissector filter name, that dissector is not configured" " to support TLS decryption.\n\n" "If you need to decrypt '%s' over TLS, please contact the Wireshark development team.", p, p); } else { char* ssl_str = ssl_association_info("tls.port", "TCP"); - *err = g_strdup_printf("Could not find dissector for: '%s'\nCommonly used TLS dissectors include:\n%s", p, ssl_str); + *err = ws_strdup_printf("Could not find dissector for: '%s'\nCommonly used TLS dissectors include:\n%s", p, ssl_str); g_free(ssl_str); } return FALSE; diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index 37f3acd327..c4c92915fb 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -353,7 +353,7 @@ udp_build_filter(packet_info *pinfo) { if( pinfo->net_src.type == AT_IPv4 && pinfo->net_dst.type == AT_IPv4 ) { /* UDP over IPv4 */ - return g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)", + return ws_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), pinfo->srcport, pinfo->destport ); @@ -361,7 +361,7 @@ udp_build_filter(packet_info *pinfo) if( pinfo->net_src.type == AT_IPv6 && pinfo->net_dst.type == AT_IPv6 ) { /* UDP over IPv6 */ - return g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)", + return ws_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), pinfo->srcport, pinfo->destport ); @@ -384,7 +384,7 @@ static gchar *udp_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinfo return NULL; *stream = udpd->stream; - return g_strdup_printf("udp.stream eq %u", udpd->stream); + return ws_strdup_printf("udp.stream eq %u", udpd->stream); } return NULL; @@ -392,7 +392,7 @@ static gchar *udp_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinfo static gchar *udp_follow_index_filter(guint stream, guint sub_stream _U_) { - return g_strdup_printf("udp.stream eq %u", stream); + return ws_strdup_printf("udp.stream eq %u", stream); } static gchar *udp_follow_address_filter(address *src_addr, address *dst_addr, int src_port, int dst_port) @@ -404,7 +404,7 @@ static gchar *udp_follow_address_filter(address *src_addr, address *dst_addr, in address_to_str_buf(src_addr, src_addr_str, sizeof(src_addr_str)); address_to_str_buf(dst_addr, dst_addr_str, sizeof(dst_addr_str)); - return g_strdup_printf("((ip%s.src eq %s and udp.srcport eq %d) and " + return ws_strdup_printf("((ip%s.src eq %s and udp.srcport eq %d) and " "(ip%s.dst eq %s and udp.dstport eq %d))" " or " "((ip%s.src eq %s and udp.srcport eq %d) and " diff --git a/epan/dissectors/packet-uds.c b/epan/dissectors/packet-uds.c index f7656e393d..ac9e96ad5a 100644 --- a/epan/dissectors/packet-uds.c +++ b/epan/dissectors/packet-uds.c @@ -410,12 +410,12 @@ update_generic_addr_id_16bit(void *r, char **err) { generic_addr_id_string_t *rec = (generic_addr_id_string_t *)r; if (rec->id > 0xffff) { - *err = g_strdup_printf("We currently only support 16 bit identifiers (Addr: %x ID: %i Name: %s)", rec->address, rec->id, rec->name); + *err = ws_strdup_printf("We currently only support 16 bit identifiers (Addr: %x ID: %i Name: %s)", rec->address, rec->id, rec->name); return FALSE; } if (rec->address > 0xffff && rec->address != G_MAXUINT32) { - *err = g_strdup_printf("We currently only support 16 bit addresses with 0xffffffff = \"don't care\" (Addr: %x ID: %i Name: %s)", + *err = ws_strdup_printf("We currently only support 16 bit addresses with 0xffffffff = \"don't care\" (Addr: %x ID: %i Name: %s)", rec->address, rec->id, rec->name); return FALSE; } diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index a3e187c631..f4d3b9eb0e 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -3041,7 +3041,7 @@ wkh_profile_warning(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i if (ok) { /* Valid warn-target string */ /* TODO: Why did we just call get_uri_value() and not use * the str, since the pointer to it is immediately - * forgotten with the call to g_strdup_printf()? */ + * forgotten with the call to ws_strdup_printf()? */ off += len; proto_item_append_text(ti, "; target=%s", val_str); /* Add zero or more dates */ diff --git a/epan/dissectors/packet-zbee-nwk-gp.c b/epan/dissectors/packet-zbee-nwk-gp.c index 2ccbb945c7..0e7fa0e72b 100644 --- a/epan/dissectors/packet-zbee-nwk-gp.c +++ b/epan/dissectors/packet-zbee-nwk-gp.c @@ -642,7 +642,7 @@ uat_key_record_update_cb(void *r, char **err) if (rec->string[0] != 0) { *err = NULL; if (!zbee_gp_security_parse_key(rec->string, rec->key, rec->byte_order)) { - *err = g_strdup_printf("Expecting %d hexadecimal bytes or a %d character double-quoted string", + *err = ws_strdup_printf("Expecting %d hexadecimal bytes or a %d character double-quoted string", ZBEE_SEC_CONST_KEYSIZE, ZBEE_SEC_CONST_KEYSIZE); return FALSE; } diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c index 2212bb388c..0215d3ecf0 100644 --- a/epan/dissectors/packet-zbee-nwk.c +++ b/epan/dissectors/packet-zbee-nwk.c @@ -1856,7 +1856,7 @@ static gboolean zbee_nwk_filter_valid(packet_info *pinfo) static gchar* zbee_nwk_build_filter(packet_info *pinfo) { - return g_strdup_printf("zbee_nwk.addr eq %s and zbee_nwk.addr eq %s", + return ws_strdup_printf("zbee_nwk.addr eq %s and zbee_nwk.addr eq %s", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst)); } diff --git a/epan/dissectors/packet-zbee-security.c b/epan/dissectors/packet-zbee-security.c index c9af0ff709..3c09f98f34 100644 --- a/epan/dissectors/packet-zbee-security.c +++ b/epan/dissectors/packet-zbee-security.c @@ -148,7 +148,7 @@ static gboolean uat_key_record_update_cb(void* r, char** err) { if (rec->string[0] != 0) { *err = NULL; if ( !zbee_security_parse_key(rec->string, key, rec->byte_order) ) { - *err = g_strdup_printf("Expecting %d hexadecimal bytes or\n" + *err = ws_strdup_printf("Expecting %d hexadecimal bytes or\n" "a %d character double-quoted string", ZBEE_SEC_CONST_KEYSIZE, ZBEE_SEC_CONST_KEYSIZE); return FALSE; } diff --git a/extcap.c b/extcap.c index 45f6405fce..1c796bfc9d 100644 --- a/extcap.c +++ b/extcap.c @@ -238,7 +238,7 @@ extcap_get_extcap_paths_from_dir(GSList * list, const char * dirname) if ((dir = g_dir_open(dirname, 0, NULL)) != NULL) { while ((file = g_dir_read_name(dir)) != NULL) { /* full path to extcap binary */ - gchar *extcap_path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dirname, file); + gchar *extcap_path = ws_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dirname, file); /* treat anything executable as an extcap binary */ if (g_file_test(extcap_path, G_FILE_TEST_IS_REGULAR) && g_file_test(extcap_path, G_FILE_TEST_IS_EXECUTABLE)) { @@ -1267,7 +1267,7 @@ void extcap_if_cleanup(capture_options *capture_opts, gchar **errormsg) { if (*errormsg == NULL) { - *errormsg = g_strdup_printf("Error by extcap pipe: %s", pipedata->stderr_msg); + *errormsg = ws_strdup_printf("Error by extcap pipe: %s", pipedata->stderr_msg); } else { @@ -2038,7 +2038,7 @@ extcap_load_interface_list(void) } get_ws_version_number(&major, &minor, NULL); - char *arg_version = g_strdup_printf("%s=%d.%d", EXTCAP_ARGUMENT_VERSION, major, minor); + char *arg_version = ws_strdup_printf("%s=%d.%d", EXTCAP_ARGUMENT_VERSION, major, minor); const char *argv[] = { EXTCAP_ARGUMENT_LIST_INTERFACES, arg_version, diff --git a/extcap/androiddump.c b/extcap/androiddump.c index 9c6175dd2b..bc1c4e784f 100644 --- a/extcap/androiddump.c +++ b/extcap/androiddump.c @@ -890,8 +890,8 @@ adb_connect_transport(const char *server_ip, unsigned short *server_tcp_port, static void new_interface(extcap_parameters * extcap_conf, const gchar *interface_id, const gchar *model_name, const gchar *serial_number, const gchar *display_name) { - char *interface = g_strdup_printf("%s-%s", interface_id, serial_number); - char *ifdisplay = g_strdup_printf("%s %s %s", display_name, model_name, serial_number); + char *interface = ws_strdup_printf("%s-%s", interface_id, serial_number); + char *ifdisplay = ws_strdup_printf("%s %s %s", display_name, model_name, serial_number); if (is_specified_interface(interface, INTERFACE_ANDROID_BLUETOOTH_HCIDUMP) || is_specified_interface(interface, INTERFACE_ANDROID_BLUETOOTH_EXTERNAL_PARSER) || @@ -2555,7 +2555,7 @@ int main(int argc, char *argv[]) { ANDROIDDUMP_VERSION_RELEASE, help_url); g_free(help_url); - help_header = g_strdup_printf( + help_header = ws_strdup_printf( " %s --extcap-interfaces [--adb-server-ip=] [--adb-server-tcp-port=]\n" " %s --extcap-interface=INTERFACE --extcap-dlts\n" " %s --extcap-interface=INTERFACE --extcap-config\n" diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c index 182ff0b369..c8b5c0dd9c 100644 --- a/extcap/ciscodump.c +++ b/extcap/ciscodump.c @@ -393,7 +393,7 @@ static ssh_channel run_capture(ssh_session sshs, const char* iface, const char* if (read_output_bytes(channel, -1, NULL) == EXIT_FAILURE) goto error; - cmdline = g_strdup_printf("show monitor capture buffer %s dump\n", WIRESHARK_CAPTURE_BUFFER); + cmdline = ws_strdup_printf("show monitor capture buffer %s dump\n", WIRESHARK_CAPTURE_BUFFER); if (ssh_channel_printf(channel, cmdline) == EXIT_FAILURE) goto error; @@ -560,7 +560,7 @@ int main(int argc, char *argv[]) g_free(help_url); extcap_base_register_interface(extcap_conf, CISCODUMP_EXTCAP_INTERFACE, "Cisco remote capture", 147, "Remote capture dependent DLT"); - help_header = g_strdup_printf( + help_header = ws_strdup_printf( " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n" " %s --extcap-interface=%s --extcap-config\n" diff --git a/extcap/dpauxmon.c b/extcap/dpauxmon.c index 27941295b6..9696b33771 100644 --- a/extcap/dpauxmon.c +++ b/extcap/dpauxmon.c @@ -517,7 +517,7 @@ int main(int argc, char *argv[]) NULL); extcap_base_register_interface(extcap_conf, DPAUXMON_EXTCAP_INTERFACE, "DisplayPort AUX channel monitor capture", 275, "DisplayPort AUX channel monitor"); - help_header = g_strdup_printf( + help_header = ws_strdup_printf( " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n" " %s --extcap-interface=%s --extcap-config\n" diff --git a/extcap/etl.c b/extcap/etl.c index b2f3c866f6..0186a13535 100644 --- a/extcap/etl.c +++ b/extcap/etl.c @@ -211,7 +211,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen } else { - *err_info = g_strdup_printf("Cannot convert provider %s to a GUID, err is 0x%x", ws_optarg, *err); + *err_info = ws_strdup_printf("Cannot convert provider %s to a GUID, err is 0x%x", ws_optarg, *err); return WTAP_OPEN_ERROR; } @@ -221,7 +221,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen if (IsEqualGUID(&g_provider_filters[0].ProviderId, &ZeroGuid)) { *err = ERROR_INVALID_PARAMETER; - *err_info = g_strdup_printf("Provider %s is zero, err is 0x%x", ws_optarg, *err); + *err_info = ws_strdup_printf("Provider %s is zero, err is 0x%x", ws_optarg, *err); return WTAP_OPEN_ERROR; } provider_idx++; @@ -230,7 +230,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen if (provider_idx == 0) { *err = ERROR_INVALID_PARAMETER; - *err_info = g_strdup_printf("-k parameter must follow -p, err is 0x%x", *err); + *err_info = ws_strdup_printf("-k parameter must follow -p, err is 0x%x", *err); return WTAP_OPEN_ERROR; } @@ -238,7 +238,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen if (!g_provider_filters[provider_idx - 1].Keyword) { *err = ERROR_INVALID_PARAMETER; - *err_info = g_strdup_printf("Keyword %s cannot be converted, err is 0x%x", ws_optarg, *err); + *err_info = ws_strdup_printf("Keyword %s cannot be converted, err is 0x%x", ws_optarg, *err); return WTAP_OPEN_ERROR; } break; @@ -246,7 +246,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen if (provider_idx == 0) { *err = ERROR_INVALID_PARAMETER; - *err_info = g_strdup_printf("-l parameter must follow -p, err is 0x%x", *err); + *err_info = ws_strdup_printf("-l parameter must follow -p, err is 0x%x", *err); return WTAP_OPEN_ERROR; } @@ -254,13 +254,13 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen if (convert_level > UCHAR_MAX) { *err = ERROR_INVALID_PARAMETER; - *err_info = g_strdup_printf("Level %s is bigger than 0xff, err is 0x%x", ws_optarg, *err); + *err_info = ws_strdup_printf("Level %s is bigger than 0xff, err is 0x%x", ws_optarg, *err); return WTAP_OPEN_ERROR; } if (!convert_level) { *err = ERROR_INVALID_PARAMETER; - *err_info = g_strdup_printf("Level %s cannot be converted, err is 0x%x", ws_optarg, *err); + *err_info = ws_strdup_printf("Level %s cannot be converted, err is 0x%x", ws_optarg, *err); return WTAP_OPEN_ERROR; } @@ -307,7 +307,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen &super_trace_properties.prop); if (*err != ERROR_SUCCESS) { - *err_info = g_strdup_printf("StartTrace failed with %u", *err); + *err_info = ws_strdup_printf("StartTrace failed with %u", *err); returnVal = WTAP_OPEN_ERROR; break; } @@ -330,7 +330,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen NULL); if (*err != ERROR_SUCCESS) { - *err_info = g_strdup_printf("EnableTraceEx failed with %u", *err); + *err_info = ws_strdup_printf("EnableTraceEx failed with %u", *err); returnVal = WTAP_OPEN_ERROR; break; } @@ -340,7 +340,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen trace_handle = OpenTrace(&log_file); if (trace_handle == INVALID_PROCESSTRACE_HANDLE) { *err = GetLastError(); - *err_info = g_strdup_printf("OpenTrace failed with %u", err); + *err_info = ws_strdup_printf("OpenTrace failed with %u", err); returnVal = WTAP_OPEN_NOT_MINE; break; } @@ -355,7 +355,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen *err = ProcessTrace(&trace_handle, 1, 0, 0); if (*err != ERROR_SUCCESS) { returnVal = WTAP_OPEN_ERROR; - *err_info = g_strdup_printf("ProcessTrace failed with %u", err); + *err_info = ws_strdup_printf("ProcessTrace failed with %u", err); break; } @@ -369,7 +369,7 @@ wtap_open_return_val etw_dump(const char* etl_filename, const char* pcapng_filen if (!g_num_events) { *err = ERROR_NO_DATA; - *err_info = g_strdup_printf("Didn't find any etw event"); + *err_info = ws_strdup_printf("Didn't find any etw event"); returnVal = WTAP_OPEN_NOT_MINE; break; } diff --git a/extcap/etwdump.c b/extcap/etwdump.c index 9e7b845fb7..0e3f216907 100644 --- a/extcap/etwdump.c +++ b/extcap/etwdump.c @@ -148,7 +148,7 @@ int main(int argc, char* argv[]) g_free(help_url); extcap_base_register_interface(extcap_conf, ETW_EXTCAP_INTERFACE, "ETW reader", 290, "DLT_ETW"); - help_header = g_strdup_printf( + help_header = ws_strdup_printf( " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n" " %s --extcap-interface=%s --extcap-config\n" @@ -186,7 +186,7 @@ int main(int argc, char* argv[]) case OPT_PARAMS: /* Add params as the prefix since getopt_long will ignore the first argument always */ - params = g_strdup_printf("params %s", ws_optarg); + params = ws_strdup_printf("params %s", ws_optarg); break; case OPT_INCLUDE_UNDECIDABLE_EVENT: diff --git a/extcap/extcap-base.c b/extcap/extcap-base.c index c44981eed2..9b6029f2fc 100644 --- a/extcap/extcap-base.c +++ b/extcap/extcap-base.c @@ -82,7 +82,7 @@ void extcap_base_set_util_info(extcap_parameters * extcap, const char * exename, if (!minor) ws_assert(!release); - extcap->version = g_strdup_printf("%s%s%s%s%s", + extcap->version = ws_strdup_printf("%s%s%s%s%s", major, minor ? "." : "", minor ? minor : "", @@ -96,7 +96,7 @@ void extcap_base_set_compiled_with(extcap_parameters * extcap, const char *fmt, va_list ap; va_start(ap, fmt); - extcap->compiled_with = g_strdup_vprintf(fmt, ap); + extcap->compiled_with = ws_strdup_vprintf(fmt, ap); va_end(ap); } @@ -105,7 +105,7 @@ void extcap_base_set_running_with(extcap_parameters * extcap, const char *fmt, . va_list ap; va_start(ap, fmt); - extcap->running_with = g_strdup_vprintf(fmt, ap); + extcap->running_with = ws_strdup_vprintf(fmt, ap); va_end(ap); } diff --git a/extcap/randpktdump.c b/extcap/randpktdump.c index e084a27867..4350eae22f 100644 --- a/extcap/randpktdump.c +++ b/extcap/randpktdump.c @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) g_free(help_url); extcap_base_register_interface(extcap_conf, RANDPKT_EXTCAP_INTERFACE, "Random packet generator", 147, "Generator dependent DLT"); - help_header = g_strdup_printf( + help_header = ws_strdup_printf( " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n" " %s --extcap-interface=%s --extcap-config\n" diff --git a/extcap/sdjournal.c b/extcap/sdjournal.c index f5ad03d723..c1c937c705 100644 --- a/extcap/sdjournal.c +++ b/extcap/sdjournal.c @@ -210,7 +210,7 @@ static int sdj_start_export(const int start_from_entries, const gboolean start_f } - appname = g_strdup_printf(SDJOURNAL_EXTCAP_INTERFACE " (Wireshark) %s.%s.%s", + appname = ws_strdup_printf(SDJOURNAL_EXTCAP_INTERFACE " (Wireshark) %s.%s.%s", SDJOURNAL_VERSION_MAJOR, SDJOURNAL_VERSION_MINOR, SDJOURNAL_VERSION_RELEASE); success = pcapng_write_section_header_block(fp, NULL, /* Comment */ @@ -367,7 +367,7 @@ int main(int argc, char **argv) // We don't have an SDJOURNAL DLT, so use USER0 (147). extcap_base_register_interface(extcap_conf, SDJOURNAL_EXTCAP_INTERFACE, "systemd Journal Export", 147, "USER0"); - help_header = g_strdup_printf( + help_header = ws_strdup_printf( " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n" " %s --extcap-interface=%s --extcap-config\n" diff --git a/extcap/ssh-base.c b/extcap/ssh-base.c index 85d77b8061..2adb1f7aa6 100644 --- a/extcap/ssh-base.c +++ b/extcap/ssh-base.c @@ -51,7 +51,7 @@ ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_inf } if (ssh_options_set(sshs, SSH_OPTIONS_HOST, ssh_params->host)) { - *err_info = g_strdup_printf("Can't set the host: %s", ssh_params->host); + *err_info = ws_strdup_printf("Can't set the host: %s", ssh_params->host); goto failure; } @@ -71,21 +71,21 @@ ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_inf if (ssh_params->port != 0) { port = ssh_params->port; if (ssh_options_set(sshs, SSH_OPTIONS_PORT, &port)) { - *err_info = g_strdup_printf("Can't set the port: %u", port); + *err_info = ws_strdup_printf("Can't set the port: %u", port); goto failure; } } if (ssh_params->proxycommand) { if (ssh_options_set(sshs, SSH_OPTIONS_PROXYCOMMAND, ssh_params->proxycommand)) { - *err_info = g_strdup_printf("Can't set the ProxyCommand: %s", ssh_params->proxycommand); + *err_info = ws_strdup_printf("Can't set the ProxyCommand: %s", ssh_params->proxycommand); goto failure; } } if (ssh_params->username) { if (ssh_options_set(sshs, SSH_OPTIONS_USER, ssh_params->username)) { - *err_info = g_strdup_printf("Can't set the username: %s", ssh_params->username); + *err_info = ws_strdup_printf("Can't set the username: %s", ssh_params->username); goto failure; } } @@ -100,7 +100,7 @@ ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_inf /* Connect to server */ if (ssh_connect(sshs) != SSH_OK) { - *err_info = g_strdup_printf("Connection error: %s", ssh_get_error(sshs)); + *err_info = ws_strdup_printf("Connection error: %s", ssh_get_error(sshs)); goto failure; } @@ -151,7 +151,7 @@ ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_inf ws_info("ssh connection closed before public key authentication"); } - *err_info = g_strdup_printf("Can't find a valid authentication. Disconnecting."); + *err_info = ws_strdup_printf("Can't find a valid authentication. Disconnecting."); /* All authentication failed. Disconnect and return */ ssh_disconnect(sshs); @@ -168,7 +168,7 @@ int ssh_channel_printf(ssh_channel channel, const char* fmt, ...) int ret = EXIT_SUCCESS; va_start(arg, fmt); - buf = g_strdup_vprintf(fmt, arg); + buf = ws_strdup_vprintf(fmt, arg); if (ssh_channel_write(channel, buf, (guint32)strlen(buf)) == SSH_ERROR) ret = EXIT_FAILURE; va_end(arg); diff --git a/extcap/sshdump.c b/extcap/sshdump.c index ed5fad81ca..9d16161246 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -159,9 +159,9 @@ static ssh_channel run_ssh_command(ssh_session sshs, const char* capture_command quoted_iface = iface ? g_shell_quote(iface) : NULL; quoted_filter = g_shell_quote(cfilter ? cfilter : ""); if (count > 0) - count_str = g_strdup_printf("-c %u", count); + count_str = ws_strdup_printf("-c %u", count); - cmdline = g_strdup_printf("%s tcpdump -U %s%s %s -w - %s %s", + cmdline = ws_strdup_printf("%s tcpdump -U %s%s %s -w - %s %s", use_sudo ? "sudo" : "", quoted_iface ? "-i " : "", quoted_iface ? quoted_iface : "", @@ -341,7 +341,7 @@ static char* concat_filters(const char* extcap_filter, const char* remote_filter if (!remote_filter && !extcap_filter) return NULL; - return g_strdup_printf("(%s) and (%s)", extcap_filter, remote_filter); + return ws_strdup_printf("(%s) and (%s)", extcap_filter, remote_filter); } int main(int argc, char *argv[]) @@ -390,13 +390,13 @@ int main(int argc, char *argv[]) add_libssh_info(extcap_conf); if (g_strcmp0(sshdump_extcap_interface, DEFAULT_SSHDUMP_EXTCAP_INTERFACE)) { gchar* temp = interface_description; - interface_description = g_strdup_printf("%s, custom version", interface_description); + interface_description = ws_strdup_printf("%s, custom version", interface_description); g_free(temp); } extcap_base_register_interface(extcap_conf, sshdump_extcap_interface, interface_description, 147, "Remote capture dependent DLT"); g_free(interface_description); - help_header = g_strdup_printf( + help_header = ws_strdup_printf( " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n" " %s --extcap-interface=%s --extcap-config\n" diff --git a/extcap/udpdump.c b/extcap/udpdump.c index 283f8f0930..0113c73156 100644 --- a/extcap/udpdump.c +++ b/extcap/udpdump.c @@ -382,7 +382,7 @@ int main(int argc, char *argv[]) g_free(help_url); extcap_base_register_interface(extcap_conf, UDPDUMP_EXTCAP_INTERFACE, "UDP Listener remote capture", 252, "Exported PDUs"); - help_header = g_strdup_printf( + help_header = ws_strdup_printf( " %s --extcap-interfaces\n" " %s --extcap-interface=%s --extcap-dlts\n" " %s --extcap-interface=%s --extcap-config\n" @@ -392,7 +392,7 @@ int main(int argc, char *argv[]) g_free(help_header); extcap_help_add_option(extcap_conf, "--help", "print this help"); extcap_help_add_option(extcap_conf, "--version", "print the version"); - port_msg = g_strdup_printf("the port to listens on. Default: %u", UDPDUMP_DEFAULT_PORT); + port_msg = ws_strdup_printf("the port to listens on. Default: %u", UDPDUMP_DEFAULT_PORT); extcap_help_add_option(extcap_conf, "--port ", port_msg); g_free(port_msg); diff --git a/file.c b/file.c index cc95946e4c..a1fb7d3301 100644 --- a/file.c +++ b/file.c @@ -4536,7 +4536,7 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format, to a new file and, if the write succeeds, renaming the new file on top of the old file. */ if (file_exists(fname)) { - fname_new = g_strdup_printf("%s~", fname); + fname_new = ws_strdup_printf("%s~", fname); if (!copy_file_binary_mode(cf->filename, fname_new)) goto fail; } else { @@ -4572,7 +4572,7 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format, file. (If the existing file is the current capture file, we *HAVE* to do that, otherwise we're overwriting the file from which we're reading the packets that we're writing!) */ - fname_new = g_strdup_printf("%s~", fname); + fname_new = ws_strdup_printf("%s~", fname); pdh = wtap_dump_open(fname_new, save_format, compression_type, ¶ms, &err, &err_info); } else { @@ -4831,7 +4831,7 @@ cf_export_specified_packets(capture_file *cf, const char *fname, file. (If the existing file is the current capture file, we *HAVE* to do that, otherwise we're overwriting the file from which we're reading the packets that we're writing!) */ - fname_new = g_strdup_printf("%s~", fname); + fname_new = ws_strdup_printf("%s~", fname); pdh = wtap_dump_open(fname_new, save_format, compression_type, ¶ms, &err, &err_info); } else { diff --git a/fileset.c b/fileset.c index f8accb3d31..f137de3b73 100644 --- a/fileset.c +++ b/fileset.c @@ -213,7 +213,7 @@ fileset_add_file(const char *dirname, const char *fname, gboolean current) fileset_entry *entry = NULL; - path = g_strdup_printf("%s%s", dirname, fname); + path = ws_strdup_printf("%s%s", dirname, fname); fh = ws_open( path, O_RDONLY, 0000 /* no creation so don't matter */); if(fh != -1) { diff --git a/plugins/epan/mate/mate_grammar.lemon b/plugins/epan/mate/mate_grammar.lemon index ef8289ea8f..1a95b4db2c 100644 --- a/plugins/epan/mate/mate_grammar.lemon +++ b/plugins/epan/mate/mate_grammar.lemon @@ -710,7 +710,7 @@ avp(A) ::= NAME(B) AVP_OPERATOR(C) value(D). { A = new_avp(B,D,*C); } avp(A) ::= NAME(B). { A = new_avp(B,"",'?'); } avp(A) ::= NAME(B) OPEN_BRACE avp_oneoff(C) CLOSE_BRACE. { A = new_avp(B,C,'|'); } -avp_oneoff(A) ::= avp_oneoff(B) PIPE value(C). { A = g_strdup_printf("%s|%s",B,C); } +avp_oneoff(A) ::= avp_oneoff(B) PIPE value(C). { A = ws_strdup_printf("%s|%s",B,C); } avp_oneoff(A) ::= value(B). { A = g_strdup(B); } value(A) ::= QUOTED(B). { A = g_strdup(B); } diff --git a/plugins/epan/mate/mate_setup.c b/plugins/epan/mate/mate_setup.c index 3f88abbd2d..eef9764389 100644 --- a/plugins/epan/mate/mate_setup.c +++ b/plugins/epan/mate/mate_setup.c @@ -196,7 +196,7 @@ extern gchar* add_ranges(mate_config* mc, gchar* range,GPtrArray* range_ptr_arr) g_ptr_array_add(range_ptr_arr,(gpointer)hfidp); } else { g_strfreev(ranges); - return g_strdup_printf("no such proto: '%s'",ranges[i]); + return ws_strdup_printf("no such proto: '%s'",ranges[i]); } } @@ -215,12 +215,12 @@ static void new_attr_hfri(mate_config* mc, gchar* item_name, GHashTable* hfids, *p_id = -1; hfri.p_id = p_id; hfri.hfinfo.name = g_strdup(name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.%s",item_name,name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.%s",item_name,name); hfri.hfinfo.type = FT_STRING; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.strings = NULL; hfri.hfinfo.bitmask = 0; - hfri.hfinfo.blurb = g_strdup_printf("%s attribute of %s",name,item_name); + hfri.hfinfo.blurb = ws_strdup_printf("%s attribute of %s",name,item_name); *p_id = -1; g_hash_table_insert(hfids,name,p_id); @@ -271,16 +271,16 @@ static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) { hfri.p_id = &(cfg->hfid); hfri.hfinfo.name = g_strdup(cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("%s id",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("%s id",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_pdu_rel_time); - hfri.hfinfo.name = g_strdup_printf("%s time",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.RelativeTime",cfg->name); + hfri.hfinfo.name = ws_strdup_printf("%s time",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.RelativeTime",cfg->name); hfri.hfinfo.type = FT_FLOAT; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = "Seconds passed since the start of capture"; @@ -288,8 +288,8 @@ static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) { g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_pdu_time_in_gop); - hfri.hfinfo.name = g_strdup_printf("%s time since beginning of Gop",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.TimeInGop",cfg->name); + hfri.hfinfo.name = ws_strdup_printf("%s time since beginning of Gop",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.TimeInGop",cfg->name); hfri.hfinfo.type = FT_FLOAT; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = "Seconds passed since the start of the GOP"; @@ -326,49 +326,49 @@ static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p) { hfri.p_id = &(cfg->hfid); hfri.hfinfo.name = g_strdup(cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("%s id",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("%s id",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_start_time); - hfri.hfinfo.name = g_strdup_printf("%s start time",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.StartTime",cfg->name); + hfri.hfinfo.name = ws_strdup_printf("%s start time",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.StartTime",cfg->name); hfri.hfinfo.type = FT_FLOAT; hfri.hfinfo.display = BASE_NONE; - hfri.hfinfo.blurb = g_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_stop_time); - hfri.hfinfo.name = g_strdup_printf("%s hold time",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Time",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("Duration in seconds from start to stop of this %s",cfg->name); + hfri.hfinfo.name = ws_strdup_printf("%s hold time",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Time",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("Duration in seconds from start to stop of this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_last_time); - hfri.hfinfo.name = g_strdup_printf("%s duration",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Duration",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name); + hfri.hfinfo.name = ws_strdup_printf("%s duration",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Duration",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_gop_num_pdus); - hfri.hfinfo.name = g_strdup_printf("%s number of PDUs",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.NumOfPdus",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("Number of PDUs assigned to this %s",cfg->name); + hfri.hfinfo.name = ws_strdup_printf("%s number of PDUs",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.NumOfPdus",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("Number of PDUs assigned to this %s",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_gop_pdu); - hfri.hfinfo.name = g_strdup_printf("A PDU of %s",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Pdu",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("A PDU assigned to this %s",cfg->name); + hfri.hfinfo.name = ws_strdup_printf("A PDU of %s",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Pdu",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("A PDU assigned to this %s",cfg->name); if (cfg->pdu_tree_mode == GOP_FRAME_TREE) { hfri.hfinfo.type = FT_FRAMENUM; @@ -445,8 +445,8 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) { /* create the hf array for this gog */ hfri.p_id = &(cfg->hfid); hfri.hfinfo.name = g_strdup(cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("%s Id",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("%s Id",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; @@ -454,16 +454,16 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) { hfri.p_id = &(cfg->hfid_gog_num_of_gops); hfri.hfinfo.name = "number of GOPs"; - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.NumOfGops",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.NumOfGops",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; - hfri.hfinfo.blurb = g_strdup_printf("Number of GOPs assigned to this %s",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("Number of GOPs assigned to this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_gog_gopstart); hfri.hfinfo.name = "GopStart frame"; - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.GopStart",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.GopStart",cfg->name); hfri.hfinfo.type = FT_FRAMENUM; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = g_strdup("The start frame of a GOP"); @@ -472,7 +472,7 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) { hfri.p_id = &(cfg->hfid_gog_gopstop); hfri.hfinfo.name = "GopStop frame"; - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.GopStop",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.GopStop",cfg->name); hfri.hfinfo.type = FT_FRAMENUM; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = g_strdup("The stop frame of a GOP"); @@ -480,27 +480,27 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) { g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_start_time); - hfri.hfinfo.name = g_strdup_printf("%s start time",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.StartTime",cfg->name); + hfri.hfinfo.name = ws_strdup_printf("%s start time",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.StartTime",cfg->name); hfri.hfinfo.type = FT_FLOAT; - hfri.hfinfo.blurb = g_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_last_time); - hfri.hfinfo.name = g_strdup_printf("%s duration",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Duration",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name); + hfri.hfinfo.name = ws_strdup_printf("%s duration",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Duration",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name); g_array_append_val(mc->hfrs,hfri); /* this might become mate.gogname.gopname */ hfri.p_id = &(cfg->hfid_gog_gop); hfri.hfinfo.name = "a GOP"; - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Gop",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Gop",cfg->name); hfri.hfinfo.type = FT_STRING; hfri.hfinfo.display = BASE_NONE; - hfri.hfinfo.blurb = g_strdup_printf("a GOPs assigned to this %s",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("a GOPs assigned to this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); @@ -586,7 +586,7 @@ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) { mc->dbg_facility = NULL; - mc->mate_lib_path = g_strdup_printf("%s%c%s%c",get_datafile_dir(),DIR_SEP,DEFAULT_MATE_LIB_PATH,DIR_SEP); + mc->mate_lib_path = ws_strdup_printf("%s%c%s%c",get_datafile_dir(),DIR_SEP,DEFAULT_MATE_LIB_PATH,DIR_SEP); mc->pducfgs = g_hash_table_new(g_str_hash,g_str_equal); mc->gopcfgs = g_hash_table_new(g_str_hash,g_str_equal); diff --git a/plugins/epan/mate/mate_util.c b/plugins/epan/mate/mate_util.c index 30a4f098b4..063a7294b7 100644 --- a/plugins/epan/mate/mate_util.c +++ b/plugins/epan/mate/mate_util.c @@ -1435,13 +1435,13 @@ static LoAL* load_loal_error(FILE* fp, LoAL* loal, AVPL* curr, int linenum, cons gchar* err; va_start( list, fmt ); - desc = g_strdup_vprintf(fmt, list); + desc = ws_strdup_vprintf(fmt, list); va_end( list ); if (loal) { - err = g_strdup_printf("Error Loading LoAL from file: in %s at line: %i, %s",loal->name,linenum,desc); + err = ws_strdup_printf("Error Loading LoAL from file: in %s at line: %i, %s",loal->name,linenum,desc); } else { - err = g_strdup_printf("Error Loading LoAL at line: %i, %s",linenum,desc); + err = ws_strdup_printf("Error Loading LoAL at line: %i, %s",linenum,desc); } ret = new_loal(err); diff --git a/plugins/epan/mate/mate_util.h b/plugins/epan/mate/mate_util.h index a233f5fc34..0764ea5ec2 100644 --- a/plugins/epan/mate/mate_util.h +++ b/plugins/epan/mate/mate_util.h @@ -150,7 +150,7 @@ extern void delete_avp(AVP* avp); * avp methods */ /* returns a newly allocated string containing a representation of the avp */ -#define avp_to_str(avp) (g_strdup_printf("%s%c%s",avp->n,avp->o,avp->v)) +#define avp_to_str(avp) (ws_strdup_printf("%s%c%s",avp->n,avp->o,avp->v)) /* returns the src avp if the src avp matches(*) the op avp or NULL if it doesn't */ extern AVP* match_avp(AVP* src, AVP* op); diff --git a/plugins/epan/pluginifdemo/pluginifdemo.c b/plugins/epan/pluginifdemo/pluginifdemo.c index 5cbe4ad4fc..e6c42b474d 100644 --- a/plugins/epan/pluginifdemo/pluginifdemo.c +++ b/plugins/epan/pluginifdemo/pluginifdemo.c @@ -105,31 +105,31 @@ void toolbar_cb(gpointer toolbar_item, gpointer item_data, gpointer user_data _U pluginifdemo_toolbar_log("Button pressed at toolbar"); guint32 fnum = GPOINTER_TO_UINT(plugin_if_get_frame_data(get_frame_data_cb, NULL)); if (fnum) { - message = g_strdup_printf("Current frame is: %u", fnum); + message = ws_strdup_printf("Current frame is: %u", fnum); pluginifdemo_toolbar_log(message); } const gchar* fnm = (const gchar*)plugin_if_get_capture_file(get_capture_file_cb, NULL); if (fnm) { - message = g_strdup_printf("Capture file name is: %s", fnm); + message = ws_strdup_printf("Capture file name is: %s", fnm); pluginifdemo_toolbar_log(message); } } else if ( entry->item_type == EXT_TOOLBAR_BOOLEAN ) { gboolean data = *((gboolean *)item_data); - message = g_strdup_printf( "Checkbox selected value: %d", (int) (data) ); + message = ws_strdup_printf( "Checkbox selected value: %d", (int) (data) ); pluginifdemo_toolbar_log(message); } else if ( entry->item_type == EXT_TOOLBAR_STRING ) { gchar * data = (gchar *)item_data; - message = g_strdup_printf( "String entered in toolbar: %s", data ); + message = ws_strdup_printf( "String entered in toolbar: %s", data ); pluginifdemo_toolbar_log(message); } else if ( entry->item_type == EXT_TOOLBAR_SELECTOR ) { ext_toolbar_value_t * data = (ext_toolbar_value_t *)item_data; - message = g_strdup_printf( "Value from toolbar: %s", data->value ); + message = ws_strdup_printf( "Value from toolbar: %s", data->value ); pluginifdemo_toolbar_log(message); } diff --git a/plugins/epan/profinet/packet-dcerpc-pn-io.c b/plugins/epan/profinet/packet-dcerpc-pn-io.c index a378a2c0a4..cf154059a6 100644 --- a/plugins/epan/profinet/packet-dcerpc-pn-io.c +++ b/plugins/epan/profinet/packet-dcerpc-pn-io.c @@ -11889,7 +11889,7 @@ pn_io_ar_conv_filter(packet_info *pinfo) set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac); set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac); - buf = g_strdup_printf( + buf = ws_strdup_printf( "pn_io.ar_uuid == %s || " /* ARUUID */ "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || " /* Alarm CR (contr -> dev) */ "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)", /* Alarm CR (dev -> contr) */ @@ -11919,7 +11919,7 @@ pn_io_ar_conv_data_filter(packet_info *pinfo) guid_str = guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid); if (ar->arType == 0x0010) /* IOCARSingle using RT_CLASS_3 */ { - buf = g_strdup_printf( + buf = ws_strdup_printf( "pn_io.ar_uuid == %s || " /* ARUUID */ "(pn_rt.frame_id == 0x%x) || (pn_rt.frame_id == 0x%x) || " "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || " /* Alarm CR (contr -> dev) */ @@ -11931,7 +11931,7 @@ pn_io_ar_conv_data_filter(packet_info *pinfo) } else { - buf = g_strdup_printf( + buf = ws_strdup_printf( "pn_io.ar_uuid == %s || " /* ARUUID */ "(pn_rt.frame_id == 0x%x && eth.src == %s && eth.dst == %s) || " /* Input CR && dev MAC -> contr MAC */ "(pn_rt.frame_id == 0x%x && eth.src == %s && eth.dst == %s) || " /* Output CR && contr MAC -> dev MAC */ diff --git a/plugins/epan/profinet/packet-dcom-cba-acco.c b/plugins/epan/profinet/packet-dcom-cba-acco.c index 9026023d62..825284cbca 100644 --- a/plugins/epan/profinet/packet-dcom-cba-acco.c +++ b/plugins/epan/profinet/packet-dcom-cba-acco.c @@ -345,25 +345,25 @@ cba_build_filter(packet_info *pinfo) /* IPv4 */ switch(GPOINTER_TO_UINT(profinet_type)) { case 1: - return g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", + return ws_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst)); case 2: - return g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", + return ws_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_src)); case 3: - return g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", + return ws_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst)); case 4: - return g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", + return ws_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_dst), diff --git a/plugins/epan/stats_tree/pinfo_stats_tree.c b/plugins/epan/stats_tree/pinfo_stats_tree.c index ce715c887b..0bc231ea99 100644 --- a/plugins/epan/stats_tree/pinfo_stats_tree.c +++ b/plugins/epan/stats_tree/pinfo_stats_tree.c @@ -255,7 +255,7 @@ static void plen_stats_tree_init(stats_tree *st) { for (i = 0; i < num_plen_uat - 1; i++) { str_range_array[i] = range_convert_range(NULL, uat_plen_records[i].packet_range); } - str_range_array[num_plen_uat - 1] = g_strdup_printf("%u and greater", + str_range_array[num_plen_uat - 1] = ws_strdup_printf("%u and greater", uat_plen_records[num_plen_uat - 1].packet_range->ranges[0].low); st_node_plen = stats_tree_create_range_node_string(st, st_str_plen, 0, num_plen_uat, str_range_array); diff --git a/plugins/epan/wimaxasncp/packet-wimaxasncp.c b/plugins/epan/wimaxasncp/packet-wimaxasncp.c index e0e1bfc282..ae89c8fdc4 100644 --- a/plugins/epan/wimaxasncp/packet-wimaxasncp.c +++ b/plugins/epan/wimaxasncp/packet-wimaxasncp.c @@ -3231,7 +3231,7 @@ register_wimaxasncp_fields(const char* unused _U_) debug_parser = getenv("WIRESHARK_DEBUG_WIMAXASNCP_DICT_PARSER") != NULL; dump_dict = getenv("WIRESHARK_DUMP_WIMAXASNCP_DICT") != NULL; - dir = g_strdup_printf( + dir = ws_strdup_printf( "%s" G_DIR_SEPARATOR_S "wimaxasncp", get_datafile_dir()); diff --git a/plugins/epan/wimaxasncp/wimaxasncp_dict.l b/plugins/epan/wimaxasncp/wimaxasncp_dict.l index 883afbc020..3b42207e5e 100644 --- a/plugins/epan/wimaxasncp/wimaxasncp_dict.l +++ b/plugins/epan/wimaxasncp/wimaxasncp_dict.l @@ -346,7 +346,7 @@ since_attr since=\042 } if (!e) { - temp_str = g_strdup_printf( + temp_str = ws_strdup_printf( "cannot find entity: '%s'\n", yytext); yyextra->dict_error = g_string_append(yyextra->dict_error, temp_str); g_free(temp_str); @@ -642,7 +642,7 @@ static FILE *wimaxasncp_dict_open( gchar *fname; if (system_directory) { - fname = g_strdup_printf("%s%s%s", + fname = ws_strdup_printf("%s%s%s", system_directory, G_DIR_SEPARATOR_S,filename); } else diff --git a/plugins/wiretap/usbdump/usbdump.c b/plugins/wiretap/usbdump/usbdump.c index dfcdf5252a..5cc01ec1f6 100644 --- a/plugins/wiretap/usbdump/usbdump.c +++ b/plugins/wiretap/usbdump/usbdump.c @@ -113,7 +113,7 @@ usbdump_open(wtap *wth, int *err, char **err_info) if (GUINT16_FROM_BE(version) != 3) { /* We only support version 0.3 */ *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("usbdump: version %u.%u unsupported", + *err_info = ws_strdup_printf("usbdump: version %u.%u unsupported", version >> 8, version & 0xff); return WTAP_OPEN_NOT_MINE; } @@ -176,7 +176,7 @@ usbdump_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, if (usbdump_info->multiframe_overrun) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Multiframe overrun"); + *err_info = ws_strdup_printf("Multiframe overrun"); return FALSE; } diff --git a/rawshark.c b/rawshark.c index 9af3899e42..8ae7addc90 100644 --- a/rawshark.c +++ b/rawshark.c @@ -900,7 +900,7 @@ raw_pipe_read(wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, gint64 *da #endif if (bytes_needed > WTAP_MAX_PACKET_SIZE_STANDARD) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Bad packet length: %lu", + *err_info = ws_strdup_printf("Bad packet length: %lu", (unsigned long) bytes_needed); return FALSE; } diff --git a/ringbuffer.c b/ringbuffer.c index ddd1dea4a8..c22de5eeef 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -141,7 +141,7 @@ static int ringbuf_exec_compress(gchar* name) return -1; } - outgz = g_strdup_printf("%s.gz", name); + outgz = ws_strdup_printf("%s.gz", name); fi = gzopen(outgz, "wb"); g_free(outgz); if (fi == NULL) { diff --git a/sharkd_daemon.c b/sharkd_daemon.c index 7932bb8842..bd80f68069 100644 --- a/sharkd_daemon.c +++ b/sharkd_daemon.c @@ -415,7 +415,7 @@ sharkd_loop(int argc _U_, char* argv[]) si.hStdOutput = (HANDLE) fd; si.hStdError = GetStdHandle(STD_ERROR_HANDLE); - exename = g_strdup_printf("%s\\%s", get_progfile_dir(), "sharkd.exe"); + exename = ws_strdup_printf("%s\\%s", get_progfile_dir(), "sharkd.exe"); // we need to pass in all of the command line parameters except the -a parameter // passing in -a at this point would could a loop, each iteration of which would generate a new session process diff --git a/sharkd_session.c b/sharkd_session.c index 32aaa1e505..9b1b3addf2 100644 --- a/sharkd_session.c +++ b/sharkd_session.c @@ -153,7 +153,7 @@ sharkd_json_value_stringf(const char *key, const char *format, ...) if (format) { va_list ap; va_start(ap, format); - char* sformat = g_strdup_printf("\"%s\"", format); + char* sformat = ws_strdup_printf("\"%s\"", format); json_dumper_value_va_list(&dumper, sformat, ap); g_free(sformat); va_end(ap); @@ -266,7 +266,7 @@ sharkd_json_error(guint32 id, int code, char* data, char* format, ...) va_list args; va_start(args, format); - char *error_msg = g_strdup_vprintf(format, args); + char *error_msg = ws_strdup_vprintf(format, args); va_end(args); sharkd_json_value_string("message", error_msg); diff --git a/text2pcap.c b/text2pcap.c index b96115f494..b62352e12e 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -876,7 +876,7 @@ write_file_header (void) char *comment; GPtrArray *comments; - comment = g_strdup_printf("Generated from input file %s.", input_filename); + comment = ws_strdup_printf("Generated from input file %s.", input_filename); comments = g_ptr_array_new_with_free_func(g_free); g_ptr_array_add(comments, comment); success = pcapng_write_section_header_block(output_file, diff --git a/tools/parse_xml2skinny_dissector.py b/tools/parse_xml2skinny_dissector.py index 07de4b2983..9d7e7044ba 100755 --- a/tools/parse_xml2skinny_dissector.py +++ b/tools/parse_xml2skinny_dissector.py @@ -401,7 +401,7 @@ def xml2obj(src): if self.make_additional_info == "yes": ret += self.indent_out('srtp_add_address(pinfo, PT_UDP, &%s, %s, 0, "SKINNY", pinfo->num, false, NULL, NULL, NULL);\n' %(self.use_param, self.name)) ret += self.indent_out('%s_str = address_to_display(NULL, &%s);\n' % (self.use_param, self.use_param)) - ret += self.indent_out('si->additionalInfo = g_strdup_printf("%%s:%%d", %s_str, %s);\n' % (self.use_param, self.name)) + ret += self.indent_out('si->additionalInfo = ws_strdup_printf("%%s:%%d", %s_str, %s);\n' % (self.use_param, self.name)) ret += self.indent_out('wmem_free(NULL, %s_str);\n' % (self.use_param)) return ret @@ -447,7 +447,7 @@ def xml2obj(src): size = self.size if self.make_additional_info == "yes": - ret += self.indent_out('si->additionalInfo = g_strdup_printf("\\"%s\\"",\n') + ret += self.indent_out('si->additionalInfo = ws_strdup_printf("\\"%s\\"",\n') self.incr_indent() ret += self.indent_out('try_val_to_str_ext(\n') self.incr_indent() @@ -459,7 +459,7 @@ def xml2obj(src): ret += self.indent_out(');\n') if self.make_additional_info_short == "yes": - ret += self.indent_out('si->additionalInfo = g_strdup_printf("\\"%s\\"",\n') + ret += self.indent_out('si->additionalInfo = ws_strdup_printf("\\"%s\\"",\n') self.incr_indent() ret += self.indent_out('try_val_to_str_ext(\n') self.incr_indent() @@ -608,7 +608,7 @@ def xml2obj(src): ret += self.indent_out('%s_len = tvb_strnlen(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), 24)+1;\n' %(self.name)) ret += self.indent_out('if (%s_len > 1) {\n' %(self.name)) self.incr_indent() - ret += self.indent_out('si->additionalInfo = g_strdup_printf("\\"%%s\\"", tvb_format_stringzpad(pinfo->pool, ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), %s_len));\n' %(self.name)) + ret += self.indent_out('si->additionalInfo = ws_strdup_printf("\\"%%s\\"", tvb_format_stringzpad(pinfo->pool, ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), %s_len));\n' %(self.name)) self.decr_indent() ret += self.indent_out('}\n') @@ -803,7 +803,7 @@ def xml2obj(src): params = self.use_param.split(',') ret += self.indent_out('if (si->%s && si->%s) {\n' %(params[0], params[1])) self.incr_indent() - ret += self.indent_out('si->additionalInfo = g_strdup_printf("\\"%%s -> %%s\\"", si->%s, si->%s);\n' %(params[0], params[1])) + ret += self.indent_out('si->additionalInfo = ws_strdup_printf("\\"%%s -> %%s\\"", si->%s, si->%s);\n' %(params[0], params[1])) self.decr_indent() ret += self.indent_out('}\n') return ret diff --git a/tshark.c b/tshark.c index 499632c6f6..92bcd4ecf3 100644 --- a/tshark.c +++ b/tshark.c @@ -2057,7 +2057,7 @@ main(int argc, char *argv[]) /* Activate the export PDU tap */ /* Write to our output file with this comment (if the type supports it, * otherwise exp_pdu_open() will ignore the comment) */ - comment = g_strdup_printf("Dump of PDUs from %s", cf_name); + comment = ws_strdup_printf("Dump of PDUs from %s", cf_name); exp_pdu_status = exp_pdu_open(&exp_pdu_tap_data, exp_pdu_filename, out_file_type, exp_fd, comment, &err, &err_info); @@ -2194,7 +2194,7 @@ main(int argc, char *argv[]) interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, i); #ifdef HAVE_PCAP_REMOTE if (interface_opts->auth_type == CAPTURE_AUTH_PWD) { - auth_str = g_strdup_printf("%s:%s", interface_opts->auth_username, interface_opts->auth_password); + auth_str = ws_strdup_printf("%s:%s", interface_opts->auth_username, interface_opts->auth_password); } #endif caps = capture_get_if_capabilities(interface_opts->name, interface_opts->monitor_mode, diff --git a/ui/alert_box.c b/ui/alert_box.c index 0089e7105a..b96f5a1213 100644 --- a/ui/alert_box.c +++ b/ui/alert_box.c @@ -270,7 +270,7 @@ cfile_read_failure_alert_box(const char *filename, int err, gchar *err_info) gchar *display_basename; display_basename = g_filename_display_basename(filename); - display_name = g_strdup_printf("capture file \"%s\"", display_basename); + display_name = ws_strdup_printf("capture file \"%s\"", display_basename); g_free(display_basename); } @@ -360,7 +360,7 @@ cfile_write_failure_alert_box(const char *in_filename, const char *out_filename, if (in_filename == NULL) in_file_string = g_strdup(""); else - in_file_string = g_strdup_printf(" of file \"%s\"", in_filename); + in_file_string = ws_strdup_printf(" of file \"%s\"", in_filename); switch (err) { diff --git a/ui/capture.c b/ui/capture.c index d627925847..75a93325bd 100644 --- a/ui/capture.c +++ b/ui/capture.c @@ -440,7 +440,7 @@ capture_input_new_file(capture_session *cap_session, gchar *new_file) cap_session->wtap = wtap_open_offline(new_file, WTAP_TYPE_AUTO, &err, &err_info, FALSE); if (!cap_session->wtap) { - err_msg = g_strdup_printf(cf_open_error_message(err, err_info), + err_msg = ws_strdup_printf(cf_open_error_message(err, err_info), new_file); ws_warning("capture_input_new_file: %d (%s)", err, err_msg); g_free(err_msg); diff --git a/ui/capture_ui_utils.c b/ui/capture_ui_utils.c index 00d0e5133b..358fc891f6 100644 --- a/ui/capture_ui_utils.c +++ b/ui/capture_ui_utils.c @@ -336,14 +336,14 @@ build_capture_combo_list(GList *if_list, gboolean do_hide) descr = capture_dev_user_descr_find(if_info->name); if (descr != NULL) { /* Yes, we have a user-supplied description; use it. */ - if_string = g_strdup_printf("%s: %s", descr, if_info->name); + if_string = ws_strdup_printf("%s: %s", descr, if_info->name); g_free(descr); } else { /* No, we don't have a user-supplied description; did we get one from the OS or libpcap? */ if (if_info->vendor_description != NULL) { /* Yes - use it. */ - if_string = g_strdup_printf("%s: %s", + if_string = ws_strdup_printf("%s: %s", if_info->vendor_description, if_info->name); } else { diff --git a/ui/cli/tap-diameter-avp.c b/ui/cli/tap-diameter-avp.c index 73062269ff..74d738b934 100644 --- a/ui/cli/tap-diameter-avp.c +++ b/ui/cli/tap-diameter-avp.c @@ -103,7 +103,7 @@ diam_tree_to_csv(proto_node *node, gpointer data) val_str = g_strdup(val_tmp); wmem_free(NULL, val_tmp); } else - val_str = g_strdup_printf("unsupported type: %s", ftype_name(ftype)); + val_str = ws_strdup_printf("unsupported type: %s", ftype_name(ftype)); /*printf("traverse: name='%s', abbrev='%s',desc='%s', val='%s'\n", hfi->name, hfi->abbrev, ftype_name(hfi->type), val_str);*/ printf("%s='%s' ", hfi->name, val_str); diff --git a/ui/commandline.c b/ui/commandline.c index 7ec8fa40e3..be8f787c13 100644 --- a/ui/commandline.c +++ b/ui/commandline.c @@ -718,7 +718,7 @@ void commandline_options_drop(const char *module_name, const char *pref_name) { if (global_commandline_info.user_opts == NULL) return; - opt_prefix = g_strdup_printf("%s.%s:", module_name, pref_name); + opt_prefix = ws_strdup_printf("%s.%s:", module_name, pref_name); while (NULL != (elem = g_slist_find_custom(global_commandline_info.user_opts, (gconstpointer)opt_prefix, cl_find_custom))) { diff --git a/ui/export_pdu_ui_utils.c b/ui/export_pdu_ui_utils.c index 53e43bbba2..72188f78fe 100644 --- a/ui/export_pdu_ui_utils.c +++ b/ui/export_pdu_ui_utils.c @@ -61,7 +61,7 @@ do_export_pdu(const char *filter, const gchar *tap_name) /* Write a pcapng file... */ file_type_subtype = wtap_pcapng_file_type_subtype(); /* ...with this comment */ - comment = g_strdup_printf("Dump of PDUs from %s", cfile.filename); + comment = ws_strdup_printf("Dump of PDUs from %s", cfile.filename); status = exp_pdu_open(&exp_pdu_tap_data, capfile_name, file_type_subtype, import_file_fd, comment, &err, &err_info); g_free(comment); diff --git a/ui/failure_message.c b/ui/failure_message.c index 760e75124e..5c1d874c5a 100644 --- a/ui/failure_message.c +++ b/ui/failure_message.c @@ -79,7 +79,7 @@ input_file_description(const char *fname) fstring = g_strdup("standard input"); } else { /* We're reading from a file */ - fstring = g_strdup_printf("file \"%s\"", fname); + fstring = ws_strdup_printf("file \"%s\"", fname); } return fstring; } @@ -94,7 +94,7 @@ output_file_description(const char *fname) fstring = g_strdup("standard output"); } else { /* We're writing to a file */ - fstring = g_strdup_printf("file \"%s\"", fname); + fstring = ws_strdup_printf("file \"%s\"", fname); } return fstring; } @@ -371,7 +371,7 @@ cfile_write_failure_message(const char *in_filename, const char *out_filename, in_frame_string = g_strdup(""); } else { in_file_string = input_file_description(in_filename); - in_frame_string = g_strdup_printf(" %u of %s", framenum, + in_frame_string = ws_strdup_printf(" %u of %s", framenum, in_file_string); g_free(in_file_string); } diff --git a/ui/filter_files.c b/ui/filter_files.c index ed771fab61..df139951af 100644 --- a/ui/filter_files.c +++ b/ui/filter_files.c @@ -480,7 +480,7 @@ save_filter_list(filter_list_type_t list_type) /* Write to "XXX.new", and rename if that succeeds. That means we don't trash the file if we fail to write it out completely. */ - ff_path_new = g_strdup_printf("%s.new", ff_path); + ff_path_new = ws_strdup_printf("%s.new", ff_path); if ((ff = ws_fopen(ff_path_new, "w")) == NULL) { /* We had an error saving the filter. */ diff --git a/ui/iface_lists.c b/ui/iface_lists.c index 408a111ccb..78aec9ea81 100644 --- a/ui/iface_lists.c +++ b/ui/iface_lists.c @@ -76,14 +76,14 @@ get_iface_display_name(const gchar *description, const if_info_t *if_info) * of the device GUID, and not at all friendly. */ gchar *if_string = if_info->friendly_name ? if_info->friendly_name : if_info->name; - return g_strdup_printf("%s: %s", description, if_string); + return ws_strdup_printf("%s: %s", description, if_string); #else /* * On UN*X, show the interface name; it's short and somewhat * friendly, and many UN*X users are used to interface names, * so we should show it. */ - return g_strdup_printf("%s: %s", description, if_info->name); + return ws_strdup_printf("%s: %s", description, if_info->name); #endif } @@ -95,7 +95,7 @@ get_iface_display_name(const gchar *description, const if_info_t *if_info) * don't show the name, as that's a string made out of * the device GUID, and not at all friendly. */ - return g_strdup_printf("%s", if_info->friendly_name); + return ws_strdup_printf("%s", if_info->friendly_name); #else /* * On UN*X, if we have a friendly name, show it along @@ -103,13 +103,13 @@ get_iface_display_name(const gchar *description, const if_info_t *if_info) * and somewhat friendly, and many UN*X users are used * to interface names, so we should show it. */ - return g_strdup_printf("%s: %s", if_info->friendly_name, if_info->name); + return ws_strdup_printf("%s: %s", if_info->friendly_name, if_info->name); #endif } if (if_info->vendor_description) { /* We have a device description from libpcap. */ - return g_strdup_printf("%s: %s", if_info->vendor_description, if_info->name); + return ws_strdup_printf("%s: %s", if_info->vendor_description, if_info->name); } /* No additional descriptions found. */ @@ -296,7 +296,7 @@ scan_local_interfaces(void (*update_cb)(void)) link->name = g_strdup(data_link_info->description); } else { link->dlt = -1; - link->name = g_strdup_printf("%s (not supported)", data_link_info->name); + link->name = ws_strdup_printf("%s (not supported)", data_link_info->name); } device.links = g_list_append(device.links, link); linktype_count++; @@ -380,7 +380,7 @@ scan_local_interfaces(void (*update_cb)(void)) device.name = g_strdup(interface_opts->name); device.vendor_description = g_strdup(interface_opts->hardware); device.display_name = interface_opts->descr ? - g_strdup_printf("%s: %s", device.name, interface_opts->descr) : + ws_strdup_printf("%s: %s", device.name, interface_opts->descr) : g_strdup(device.name); device.hidden = FALSE; device.selected = TRUE; diff --git a/ui/profile.c b/ui/profile.c index e75150e24e..853ec45c76 100644 --- a/ui/profile.c +++ b/ui/profile.c @@ -114,7 +114,7 @@ gchar *apply_profile_changes(void) profile1 = (profile_def *) fl1->data; g_strstrip(profile1->name); if ((err_msg = profile_name_is_valid(profile1->name)) != NULL) { - gchar *message = g_strdup_printf("%s\nProfiles unchanged.", err_msg); + gchar *message = ws_strdup_printf("%s\nProfiles unchanged.", err_msg); g_free(err_msg); return message; } @@ -131,7 +131,7 @@ gchar *apply_profile_changes(void) g_strstrip(profile1->name); if (profile1->status == PROF_STAT_COPY) { if (create_persconffile_profile(profile1->name, &pf_dir_path) == -1) { - err_msg = g_strdup_printf("Can't create directory\n\"%s\":\n%s.", + err_msg = ws_strdup_printf("Can't create directory\n\"%s\":\n%s.", pf_dir_path, g_strerror(errno)); g_free(pf_dir_path); @@ -328,7 +328,7 @@ init_profile_list(void) if ((dir = ws_dir_open(profiles_dir, 0, NULL)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) { name = ws_dir_get_name(file); - filename = g_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name); + filename = ws_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name); if (test_for_directory(filename) == EISDIR) { local_profiles = g_list_prepend(local_profiles, g_strdup(name)); @@ -351,7 +351,7 @@ init_profile_list(void) if ((dir = ws_dir_open(profiles_dir, 0, NULL)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) { name = ws_dir_get_name(file); - filename = g_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name); + filename = ws_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name); if (test_for_directory(filename) == EISDIR) { global_profiles = g_list_prepend(global_profiles, g_strdup(name)); @@ -395,18 +395,18 @@ profile_name_is_valid(const gchar *name) invalid = TRUE; } if (invalid) { - reason = g_strdup_printf("start or end with period (.), or contain any of the following characters:\n" + reason = ws_strdup_printf("start or end with period (.), or contain any of the following characters:\n" " \\ / : * ? \" < > |"); } #else if (strchr(name, '/')) { /* Invalid character in directory */ - reason = g_strdup_printf("contain the '/' character."); + reason = ws_strdup_printf("contain the '/' character."); } #endif if (reason) { - message = g_strdup_printf("A profile name cannot %s", reason); + message = ws_strdup_printf("A profile name cannot %s", reason); g_free(reason); return message; } diff --git a/ui/qt/capture_options_dialog.cpp b/ui/qt/capture_options_dialog.cpp index 72b2ab0815..857ae2b16f 100644 --- a/ui/qt/capture_options_dialog.cpp +++ b/ui/qt/capture_options_dialog.cpp @@ -417,7 +417,7 @@ void CaptureOptionsDialog::interfaceItemChanged(QTreeWidgetItem *item, int colum #ifdef HAVE_PCAP_REMOTE if (device->remote_opts.remote_host_opts.auth_type == CAPTURE_AUTH_PWD) { - auth_str = g_strdup_printf("%s:%s", device->remote_opts.remote_host_opts.auth_username, + auth_str = ws_strdup_printf("%s:%s", device->remote_opts.remote_host_opts.auth_username, device->remote_opts.remote_host_opts.auth_password); } #endif @@ -455,7 +455,7 @@ void CaptureOptionsDialog::interfaceItemChanged(QTreeWidgetItem *item, int colum } else { gchar *str; /* XXX - should we just omit them? */ - str = g_strdup_printf("%s (not supported)", data_link_info->name); + str = ws_strdup_printf("%s (not supported)", data_link_info->name); linkr->dlt = -1; linkr->name = g_strdup(str); g_free(str); diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp index e64b37ce6e..d88f8bcc18 100644 --- a/ui/qt/io_graph_dialog.cpp +++ b/ui/qt/io_graph_dialog.cpp @@ -149,7 +149,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g ((rec_t*)rec)->field_name = 0; \ g_free(tmp_str); } \ static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\ - *out_ptr = g_strdup_printf("%s",((rec_t*)rec)->field_name ? "Enabled" : "Disabled"); \ + *out_ptr = ws_strdup_printf("%s",((rec_t*)rec)->field_name ? "Enabled" : "Disabled"); \ *out_len = (unsigned)strlen(*out_ptr); } static gboolean uat_fld_chk_enable(void* u1 _U_, const char* strptr, guint len, const void* u2 _U_, const void* u3 _U_, char** err) @@ -166,7 +166,7 @@ static gboolean uat_fld_chk_enable(void* u1 _U_, const char* strptr, guint len, } //User should never see this unless they are manually modifying UAT - *err = g_strdup_printf("invalid value: %s (must be Enabled or Disabled)", str); + *err = ws_strdup_printf("invalid value: %s (must be Enabled or Disabled)", str); g_free(str); return FALSE; } @@ -189,7 +189,7 @@ static void io_graph_sma_period_set_cb(void* rec, const char* buf, guint len, co g_free(str); str = g_strdup("None"); } else { - char *str2 = g_strdup_printf("%s interval SMA", str); + char *str2 = ws_strdup_printf("%s interval SMA", str); g_free(str); str = str2; } @@ -231,7 +231,7 @@ static gboolean sma_period_chk_enum(void* u1 _U_, const char* strptr, guint len, g_free(str); str = g_strdup("None"); } else { - char *str2 = g_strdup_printf("%s interval SMA", str); + char *str2 = ws_strdup_printf("%s interval SMA", str); g_free(str); str = str2; } @@ -245,7 +245,7 @@ static gboolean sma_period_chk_enum(void* u1 _U_, const char* strptr, guint len, } } - *err = g_strdup_printf("invalid value: %s",str); + *err = ws_strdup_printf("invalid value: %s",str); g_free(str); return FALSE; } diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index a1e5b404f8..2f995cc18e 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -883,7 +883,7 @@ int main(int argc, char *qt_argv[]) interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, i); #ifdef HAVE_PCAP_REMOTE if (interface_opts->auth_type == CAPTURE_AUTH_PWD) { - auth_str = g_strdup_printf("%s:%s", interface_opts->auth_username, interface_opts->auth_password); + auth_str = ws_strdup_printf("%s:%s", interface_opts->auth_username, interface_opts->auth_password); } #endif caps = capture_get_if_capabilities(interface_opts->name, interface_opts->monitor_mode, diff --git a/ui/qt/manage_interfaces_dialog.cpp b/ui/qt/manage_interfaces_dialog.cpp index fb7d1e477d..ea1e762d79 100644 --- a/ui/qt/manage_interfaces_dialog.cpp +++ b/ui/qt/manage_interfaces_dialog.cpp @@ -365,21 +365,21 @@ void ManageInterfacesDialog::updateRemoteInterfaceList(GList* rlist, remote_opti descr = capture_dev_user_descr_find(if_info->name); if (descr != NULL) { /* Yes, we have a user-supplied description; use it. */ - if_string = g_strdup_printf("%s: %s", descr, if_info->name); + if_string = ws_strdup_printf("%s: %s", descr, if_info->name); g_free(descr); } else { /* No, we don't have a user-supplied description; did we get one from the OS or libpcap? */ if (if_info->vendor_description != NULL) { /* Yes - use it. */ - if_string = g_strdup_printf("%s: %s", if_info->vendor_description, if_info->name); + if_string = ws_strdup_printf("%s: %s", if_info->vendor_description, if_info->name); } else { /* No. */ if_string = g_strdup(if_info->name); } } /* else descr != NULL */ if (if_info->loopback) { - device.display_name = g_strdup_printf("%s (loopback)", if_string); + device.display_name = ws_strdup_printf("%s (loopback)", if_string); } else { device.display_name = g_strdup(if_string); } @@ -400,7 +400,7 @@ void ManageInterfacesDialog::updateRemoteInterfaceList(GList* rlist, remote_opti device.timestamp_type = g_strdup(global_capture_opts.default_options.timestamp_type); monitor_mode = prefs_capture_device_monitor_mode(if_string); if (roptions->remote_host_opts.auth_type == CAPTURE_AUTH_PWD) { - auth_str = g_strdup_printf("%s:%s", roptions->remote_host_opts.auth_username, + auth_str = ws_strdup_printf("%s:%s", roptions->remote_host_opts.auth_username, roptions->remote_host_opts.auth_password); } caps = capture_get_if_capabilities(if_string, monitor_mode, auth_str, NULL, NULL, main_window_update); @@ -450,7 +450,7 @@ void ManageInterfacesDialog::updateRemoteInterfaceList(GList* rlist, remote_opti linkr->name = g_strdup(data_link_info->description); linkr->dlt = data_link_info->dlt; } else { - linkr->name = g_strdup_printf("%s (not supported)", data_link_info->name); + linkr->name = ws_strdup_printf("%s (not supported)", data_link_info->name); linkr->dlt = -1; } if (linktype_count == 0) { diff --git a/ui/qt/simple_dialog.cpp b/ui/qt/simple_dialog.cpp index f686e37f50..952713deb1 100644 --- a/ui/qt/simple_dialog.cpp +++ b/ui/qt/simple_dialog.cpp @@ -205,7 +205,7 @@ SimpleDialog::SimpleDialog(QWidget *parent, ESD_TYPE_E type, int btn_mask, const gchar *vmessage; QString message; - vmessage = g_strdup_vprintf(msg_format, ap); + vmessage = ws_strdup_vprintf(msg_format, ap); #ifdef _WIN32 // // On Windows, filename strings inside Wireshark are UTF-8 strings, diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index b8621939ad..842808da20 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -543,7 +543,7 @@ void WiresharkApplication::storeCustomColorsInRecent() recent.custom_colors = NULL; for (int i = 0; i < QColorDialog::customCount(); i++) { QRgb rgb = QColorDialog::customColor(i).rgb(); - recent.custom_colors = g_list_append(recent.custom_colors, g_strdup_printf("%08x", rgb)); + recent.custom_colors = g_list_append(recent.custom_colors, ws_strdup_printf("%08x", rgb)); } } } diff --git a/ui/rtp_stream.h b/ui/rtp_stream.h index be562a7044..5d7ab01d4e 100644 --- a/ui/rtp_stream.h +++ b/ui/rtp_stream.h @@ -106,7 +106,7 @@ struct _rtpstream_tapinfo { #if 0 #define RTP_STREAM_DEBUG(...) { \ - char *RTP_STREAM_DEBUG_MSG = g_strdup_printf(__VA_ARGS__); \ + char *RTP_STREAM_DEBUG_MSG = ws_strdup_printf(__VA_ARGS__); \ ws_warning("rtp_stream: %s:%d %s", G_STRFUNC, __LINE__, RTP_STREAM_DEBUG_MSG); \ g_free(RTP_STREAM_DEBUG_MSG); \ } diff --git a/ui/traffic_table_ui.c b/ui/traffic_table_ui.c index 10a76d87af..22fdd011e2 100644 --- a/ui/traffic_table_ui.c +++ b/ui/traffic_table_ui.c @@ -68,7 +68,7 @@ write_endpoint_geoip_map(FILE *fp, gboolean json_only, hostlist_talker_t *const char *base_html_path = get_datafile_path("ipmap.html"); FILE *base_html_fp = ws_fopen(base_html_path, "rb"); if (!base_html_fp) { - *err_str = g_strdup_printf("Could not open base file %s for reading: %s", + *err_str = ws_strdup_printf("Could not open base file %s for reading: %s", base_html_path, g_strerror(errno)); g_free(base_html_path); return FALSE; @@ -80,13 +80,13 @@ write_endpoint_geoip_map(FILE *fp, gboolean json_only, hostlist_talker_t *const char buf[4096]; while ((n = fread(buf, 1, sizeof(buf), base_html_fp)) != 0) { if (fwrite(buf, 1, n, fp) != n) { - *err_str = g_strdup_printf("Failed to write to map file: %s", g_strerror(errno)); + *err_str = ws_strdup_printf("Failed to write to map file: %s", g_strerror(errno)); fclose(base_html_fp); return FALSE; } } if (ferror(base_html_fp)) { - *err_str = g_strdup_printf("Failed to read base file: %s", g_strerror(errno)); + *err_str = ws_strdup_printf("Failed to read base file: %s", g_strerror(errno)); fclose(base_html_fp); return FALSE; } diff --git a/ui/version_info.c b/ui/version_info.c index 56427e3f0f..079c4b85e1 100644 --- a/ui/version_info.c +++ b/ui/version_info.c @@ -60,7 +60,7 @@ ws_init_version_info(const char *appname, * version - including the VCS version, for a build from * a checkout. */ - appname_with_version = g_strdup_printf("%s %s", + appname_with_version = ws_strdup_printf("%s %s", appname, get_ws_vcs_version_info()); /* Get the compile-time version information string */ diff --git a/ui/voip_calls.c b/ui/voip_calls.c index dd3edb1a5a..bba062c0cf 100644 --- a/ui/voip_calls.c +++ b/ui/voip_calls.c @@ -381,12 +381,12 @@ static int append_to_frame_graph(voip_calls_tapinfo_t *tapinfo, guint32 frame_nu comment = gai->comment; if (new_frame_label != NULL) { - gai->frame_label = g_strdup_printf("%s %s", frame_label, new_frame_label); + gai->frame_label = ws_strdup_printf("%s %s", frame_label, new_frame_label); g_free(frame_label); } if (new_comment != NULL) { - gai->comment = g_strdup_printf("%s %s", comment, new_comment); + gai->comment = ws_strdup_printf("%s %s", comment, new_comment); g_free(comment); } } @@ -743,7 +743,7 @@ rtp_draw(void *tap_offset_ptr) } if(gai != NULL) { const char *comment_fmt_src = "%%s, %%u packets. Duration: %%.%dfs SSRC: 0x%%X"; - char *comment_fmt = g_strdup_printf(comment_fmt_src, prefs.gui_decimal_places1); + char *comment_fmt = ws_strdup_printf(comment_fmt_src, prefs.gui_decimal_places1); /* Found the setup frame*/ conv_num = gai->conv_num; /* if RTP was already in the Graph, just update the comment information */ @@ -751,7 +751,7 @@ rtp_draw(void *tap_offset_ptr) if (gai != NULL) { duration = (gdouble)(nstime_to_msec(&rtp_listinfo->stop_rel_time) - nstime_to_msec(&rtp_listinfo->start_rel_time)); g_free(gai->comment); - gai->comment = g_strdup_printf(comment_fmt, + gai->comment = ws_strdup_printf(comment_fmt, (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->packet_count, duration/1000, rtp_listinfo->id.ssrc); } else { @@ -762,7 +762,7 @@ rtp_draw(void *tap_offset_ptr) new_gai->port_src = rtp_listinfo->id.src_port; new_gai->port_dst = rtp_listinfo->id.dst_port; duration = (gdouble)(nstime_to_msec(&rtp_listinfo->stop_rel_time) - nstime_to_msec(&rtp_listinfo->start_rel_time)); - new_gai->frame_label = g_strdup_printf("%s (%s) %s%s%s", + new_gai->frame_label = ws_strdup_printf("%s (%s) %s%s%s", (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->first_payload_type_name, (rtp_listinfo->rtp_event == -1)? @@ -770,7 +770,7 @@ rtp_draw(void *tap_offset_ptr) (rtp_listinfo->ed137_info!=NULL?" ":""), (rtp_listinfo->ed137_info!=NULL?rtp_listinfo->ed137_info:"") ); - new_gai->comment = g_strdup_printf(comment_fmt, + new_gai->comment = ws_strdup_printf(comment_fmt, (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->packet_count, duration/1000, rtp_listinfo->id.ssrc); new_gai->info_type=GA_INFO_TYPE_RTP; @@ -840,7 +840,7 @@ rtp_packet_draw(void *tap_offset_ptr) if (rtp_listinfo->start_fd->num == gai->frame_number) { duration = (guint32)(nstime_to_msec(&rtp_listinfo->stop_fd->rel_ts) - nstime_to_msec(&rtp_listinfo->start_fd->rel_ts)); g_free(gai->comment); - gai->comment = g_strdup_printf("%s Num packets:%u Duration:%u.%03us SSRC:0x%X", + gai->comment = ws_strdup_printf("%s Num packets:%u Duration:%u.%03us SSRC:0x%X", (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->npackets, duration/1000,(duration%1000), rtp_listinfo->id.ssrc); break; @@ -860,12 +860,12 @@ rtp_packet_draw(void *tap_offset_ptr) new_gai->port_dst = rtp_listinfo->id.dst_port; new_gai->protocol = g_strdup(port_type_to_str(pinfo->ptype)); duration = (guint32)(nstime_to_msec(&rtp_listinfo->stop_fd->rel_ts) - nstime_to_msec(&rtp_listinfo->start_fd->rel_ts)); - new_gai->frame_label = g_strdup_printf("%s (%s) %s", + new_gai->frame_label = ws_strdup_printf("%s (%s) %s", (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->first_payload_type_str, (rtp_listinfo->rtp_event == -1)? "":val_to_str_ext_const(rtp_listinfo->rtp_event, &rtp_event_type_values_ext, "Unknown RTP Event")); - new_gai->comment = g_strdup_printf("%s Num packets:%u Duration:%u.%03us SSRC:0x%X", + new_gai->comment = ws_strdup_printf("%s Num packets:%u Duration:%u.%03us SSRC:0x%X", (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->npackets, duration/1000,(duration%1000), rtp_listinfo->id.ssrc); new_gai->conv_num = conv_num; @@ -1014,7 +1014,7 @@ t38_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, const if (t38_info->type_msg == 0) { /* 0=t30-indicator */ tmp_str1 = val_to_str_wmem(NULL, t38_info->t30ind_value, t38_T30_indicator_vals, "Ukn (0x%02X)"); frame_label = g_strdup(tmp_str1); - comment = g_strdup_printf("t38:t30 Ind:%s", tmp_str1); + comment = ws_strdup_printf("t38:t30 Ind:%s", tmp_str1); wmem_free(NULL, tmp_str1); line_style = 1; } else if (t38_info->type_msg == 1) { /* 1=data */ @@ -1026,7 +1026,7 @@ t38_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, const tmp_str1 = val_to_str_ext_wmem(NULL, t38_info->t30_Facsimile_Control & 0x7F, &t30_facsimile_control_field_vals_short_ext, "Ukn (0x%02X)"); - frame_label = g_strdup_printf("%s %s", + frame_label = ws_strdup_printf("%s %s", tmp_str1, t38_info->desc); wmem_free(NULL, tmp_str1); @@ -1037,7 +1037,7 @@ t38_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, const tmp_str2 = val_to_str_wmem(NULL, t38_info->data_value, t38_T30_data_vals, "Ukn (0x%02X)"); - comment = g_strdup_printf("t38:%s:HDLC:%s", tmp_str2, tmp_str1); + comment = ws_strdup_printf("t38:%s:HDLC:%s", tmp_str2, tmp_str1); wmem_free(NULL, tmp_str1); wmem_free(NULL, tmp_str2); break; @@ -1045,7 +1045,7 @@ t38_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, const case 5: /* hdlc-fcs-BAD-sig-end */ frame_label = g_strdup(t38_info->Data_Field_field_type_value == 3 ? "fcs-BAD" : "fcs-BAD-sig-end"); tmp_str1 = val_to_str_wmem(NULL, t38_info->data_value, t38_T30_data_vals, "Ukn (0x%02X)"); - comment = g_strdup_printf("WARNING: received t38:%s:HDLC:%s", + comment = ws_strdup_printf("WARNING: received t38:%s:HDLC:%s", tmp_str1, t38_info->Data_Field_field_type_value == 3 ? "fcs-BAD" : "fcs-BAD-sig-end"); wmem_free(NULL, tmp_str1); @@ -1053,10 +1053,10 @@ t38_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, const case 7: /* t4-non-ecm-sig-end */ duration = nstime_to_sec(&pinfo->rel_ts) - t38_info->time_first_t4_data; tmp_str1 = val_to_str_wmem(NULL, t38_info->data_value, t38_T30_data_vals, "Ukn (0x%02X)"); - frame_label = g_strdup_printf("t4-non-ecm-data:%s", tmp_str1); + frame_label = ws_strdup_printf("t4-non-ecm-data:%s", tmp_str1); const char *comment_fmt_src = "t38:t4-non-ecm-data:%%s Duration: %%.%dfs %%s"; - char *comment_fmt = g_strdup_printf(comment_fmt_src, prefs.gui_decimal_places1); - comment = g_strdup_printf(comment_fmt, + char *comment_fmt = ws_strdup_printf(comment_fmt_src, prefs.gui_decimal_places1); + comment = ws_strdup_printf(comment_fmt, tmp_str1, duration, t38_info->desc_comment ); insert_to_graph_t38(tapinfo, pinfo, edt, frame_label, comment, (guint16)conv_num, &(pinfo->src), &(pinfo->dst), @@ -1222,8 +1222,8 @@ sip_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt , copy_address(&(tmp_dst), &(pinfo->dst)); if (pi->request_method == NULL) { - frame_label = g_strdup_printf("%u %s", pi->response_code, pi->reason_phrase ); - comment = g_strdup_printf("SIP Status %u %s", pi->response_code, pi->reason_phrase ); + frame_label = ws_strdup_printf("%u %s", pi->response_code, pi->reason_phrase ); + comment = ws_strdup_printf("SIP Status %u %s", pi->response_code, pi->reason_phrase ); if ((tmp_sipinfo && pi->tap_cseq_number == tmp_sipinfo->invite_cseq)&&(addresses_equal(&tmp_dst,&(callsinfo->initial_speaker)))) { if ((pi->response_code > 199) && (pi->response_code<300) && (tmp_sipinfo->sip_state == SIP_INVITE_SENT)) { @@ -1239,7 +1239,7 @@ sip_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt , TODO: is useful but not perfect, what is appended is truncated when displayed in dialog window */ if (pi->response_code >= 200) { old_comment = callsinfo->call_comment; - callsinfo->call_comment=g_strdup_printf("%s %u", + callsinfo->call_comment=ws_strdup_printf("%s %u", callsinfo->call_comment, pi->response_code/*, pi->reason_phrase*/); @@ -1256,7 +1256,7 @@ TODO: is useful but not perfect, what is appended is truncated when displayed in tmp_sipinfo->invite_cseq = pi->tap_cseq_number; callsinfo->call_state = VOIP_CALL_SETUP; /* TODO: sometimes truncated when displayed in dialog window */ - comment = g_strdup_printf("SIP INVITE From: %s To:%s Call-ID:%s CSeq:%d", + comment = ws_strdup_printf("SIP INVITE From: %s To:%s Call-ID:%s CSeq:%d", callsinfo->from_identity, callsinfo->to_identity, callsinfo->call_id, pi->tap_cseq_number); } @@ -1264,21 +1264,21 @@ TODO: is useful but not perfect, what is appended is truncated when displayed in &&(addresses_equal(&tmp_src,&(callsinfo->initial_speaker)))&&(tmp_sipinfo->sip_state==SIP_200_REC) &&(callsinfo->call_state == VOIP_CALL_SETUP)) { callsinfo->call_state = VOIP_IN_CALL; - comment = g_strdup_printf("SIP Request INVITE ACK 200 CSeq:%d", pi->tap_cseq_number); + comment = ws_strdup_printf("SIP Request INVITE ACK 200 CSeq:%d", pi->tap_cseq_number); } else if (strcmp(pi->request_method,"BYE")==0) { callsinfo->call_state = VOIP_COMPLETED; tapinfo->completed_calls++; - comment = g_strdup_printf("SIP Request BYE CSeq:%d", pi->tap_cseq_number); + comment = ws_strdup_printf("SIP Request BYE CSeq:%d", pi->tap_cseq_number); } else if ((strcmp(pi->request_method,"CANCEL")==0)&&(pi->tap_cseq_number == tmp_sipinfo->invite_cseq) &&(addresses_equal(&tmp_src,&(callsinfo->initial_speaker)))&&(callsinfo->call_state==VOIP_CALL_SETUP)) { callsinfo->call_state = VOIP_CANCELLED; tmp_sipinfo->sip_state = SIP_CANCEL_SENT; - comment = g_strdup_printf("SIP Request CANCEL CSeq:%d", pi->tap_cseq_number); + comment = ws_strdup_printf("SIP Request CANCEL CSeq:%d", pi->tap_cseq_number); } else { - /* comment = g_strdup_printf("SIP %s", pi->request_method); */ - comment = g_strdup_printf("SIP %s From: %s To:%s CSeq:%d", + /* comment = ws_strdup_printf("SIP %s", pi->request_method); */ + comment = ws_strdup_printf("SIP %s From: %s To:%s CSeq:%d", pi->request_method, callsinfo->from_identity, callsinfo->to_identity, pi->tap_cseq_number); @@ -1461,16 +1461,16 @@ isup_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, if (callsinfo->npackets == 1) { /* this is the first packet, that must be an IAM */ if ((pi->calling_number!=NULL)&&(pi->called_number !=NULL)) { - comment = g_strdup_printf("Call from %s to %s", + comment = ws_strdup_printf("Call from %s to %s", pi->calling_number, pi->called_number); } } else if (callsinfo->npackets == 2) { /* in the second packet we show the SPs */ if (forward) { - comment = g_strdup_printf("%i-%i -> %i-%i. Cic:%i", + comment = ws_strdup_printf("%i-%i -> %i-%i. Cic:%i", tapinfo->mtp3_ni, tapinfo->mtp3_opc, tapinfo->mtp3_ni, tapinfo->mtp3_dpc, pi->circuit_id); } else { - comment = g_strdup_printf("%i-%i -> %i-%i. Cic:%i", + comment = ws_strdup_printf("%i-%i -> %i-%i. Cic:%i", tapinfo->mtp3_ni, tapinfo->mtp3_dpc, tapinfo->mtp3_ni, tapinfo->mtp3_opc, pi->circuit_id); } @@ -1500,7 +1500,7 @@ isup_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, } /* Overwrite any comment set above */ g_free(comment); - comment = g_strdup_printf("Cause %i - %s", + comment = ws_strdup_printf("Cause %i - %s", pi->cause_value, val_to_str_ext_const(pi->cause_value, &q931_cause_code_vals_ext, "(Unknown)")); break; @@ -1782,12 +1782,12 @@ q931_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, list = g_list_next (list); } - comment = g_strdup_printf("H225 From: %s To:%s TunnH245:%s FS:%s", callsinfo->from_identity, callsinfo->to_identity, (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), + comment = ws_strdup_printf("H225 From: %s To:%s TunnH245:%s FS:%s", callsinfo->from_identity, callsinfo->to_identity, (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), (tapinfo->h225_is_faststart==TRUE?"on":"off")); } else if (tapinfo->h225_cstype == H225_RELEASE_COMPLET) { /* get the Q931 Release cause code */ if (tapinfo->q931_cause_value != 0xFF) { - comment = g_strdup_printf("H225 Q931 Rel Cause (%i):%s", tapinfo->q931_cause_value, + comment = ws_strdup_printf("H225 Q931 Rel Cause (%i):%s", tapinfo->q931_cause_value, val_to_str_ext_const(tapinfo->q931_cause_value, &q931_cause_code_vals_ext, "")); } else { /* Cause not set */ comment = g_strdup("H225 No Q931 Rel Cause"); @@ -1885,7 +1885,7 @@ q931_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, switch(pi->message_type) { case Q931_SETUP: - comment = g_strdup_printf("AC_ISDN trunk:%u Calling: %s Called:%s", tapinfo->actrace_trunk, tapinfo->q931_calling_number, tapinfo->q931_called_number); + comment = ws_strdup_printf("AC_ISDN trunk:%u Calling: %s Called:%s", tapinfo->actrace_trunk, tapinfo->q931_calling_number, tapinfo->q931_called_number); callsinfo->call_state=VOIP_CALL_SETUP; break; case Q931_CONNECT: @@ -1907,7 +1907,7 @@ q931_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, tapinfo->completed_calls++; } if (tapinfo->q931_cause_value != 0xFF) { - comment = g_strdup_printf("AC_ISDN trunk:%u Q931 Rel Cause (%i):%s", tapinfo->actrace_trunk, tapinfo->q931_cause_value, + comment = ws_strdup_printf("AC_ISDN trunk:%u Q931 Rel Cause (%i):%s", tapinfo->actrace_trunk, tapinfo->q931_cause_value, val_to_str_ext_const(tapinfo->q931_cause_value, &q931_cause_code_vals_ext, "")); } else { /* Cause not set */ comment = g_strdup("AC_ISDN No Q931 Rel Cause"); @@ -1916,7 +1916,7 @@ q931_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, } if (!comment) - comment = g_strdup_printf("AC_ISDN trunk:%u", tapinfo->actrace_trunk ); + comment = ws_strdup_printf("AC_ISDN trunk:%u", tapinfo->actrace_trunk ); tmp_str = val_to_str_wmem(NULL, pi->message_type, q931_message_type_vals, ""); add_to_graph(tapinfo, pinfo, edt, tmp_str, comment, callsinfo->call_num, @@ -2151,13 +2151,13 @@ h225_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, if (tmp_h323info->h225SetupAddr.type == AT_NONE) copy_address(&(tmp_h323info->h225SetupAddr), &(pinfo->src)); callsinfo->call_state=VOIP_CALL_SETUP; - comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), + comment = ws_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), (pi->is_faststart==TRUE?"on":"off")); break; case H225_CONNECT: callsinfo->call_state=VOIP_IN_CALL; if (pi->is_faststart == TRUE) tmp_h323info->is_faststart_Proc = TRUE; - comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), + comment = ws_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), (pi->is_faststart==TRUE?"on":"off")); break; case H225_RELEASE_COMPLET: @@ -2179,11 +2179,11 @@ h225_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, case H225_ALERTING: case H225_CALL_PROCEDING: if (pi->is_faststart == TRUE) tmp_h323info->is_faststart_Proc = TRUE; - comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), + comment = ws_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), (pi->is_faststart==TRUE?"on":"off")); break; default: - comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), + comment = ws_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), (pi->is_faststart==TRUE?"on":"off")); } @@ -2199,7 +2199,7 @@ h225_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, /* Fall Through */ case 19: /* LCF */ if (strlen(pi->dialedDigits)) - comment = g_strdup_printf("H225 RAS dialedDigits: %s", pi->dialedDigits); + comment = ws_strdup_printf("H225 RAS dialedDigits: %s", pi->dialedDigits); else comment = g_strdup("H225 RAS"); break; @@ -2469,7 +2469,7 @@ sdp_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt _ g_free(tapinfo->sdp_summary); tapinfo->sdp_frame_num = pinfo->num; /* Append to graph the SDP summary if the packet exists */ - tapinfo->sdp_summary = g_strdup_printf("SDP (%s)", pi->summary_str); + tapinfo->sdp_summary = ws_strdup_printf("SDP (%s)", pi->summary_str); append_to_frame_graph(tapinfo, pinfo->num, tapinfo->sdp_summary, NULL); tapinfo->redraw |= REDRAW_SDP; @@ -2769,7 +2769,7 @@ mgcp_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, { case MGCP_REQUEST: if ( (strcmp(pi->code, "NTFY") == 0) && (pi->observedEvents != NULL) ) { - frame_label = g_strdup_printf("%s ObsEvt:%s",pi->code, pi->observedEvents); + frame_label = ws_strdup_printf("%s ObsEvt:%s",pi->code, pi->observedEvents); if (tmp_mgcpinfo->fromEndpoint) { /* use the Dialed digits to fill the "To" for the call, but use the first NTFY */ @@ -2805,9 +2805,9 @@ mgcp_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, } if (pi->signalReq != NULL) - frame_label = g_strdup_printf("%s%sSigReq:%s",pi->code, (pi->hasDigitMap == TRUE)?" DigitMap ":"", pi->signalReq); + frame_label = ws_strdup_printf("%s%sSigReq:%s",pi->code, (pi->hasDigitMap == TRUE)?" DigitMap ":"", pi->signalReq); else - frame_label = g_strdup_printf("%s%s",pi->code, (pi->hasDigitMap == TRUE)?" DigitMap ":""); + frame_label = ws_strdup_printf("%s%s",pi->code, (pi->hasDigitMap == TRUE)?" DigitMap ":""); /* use the CallerID info to fill the "From" for the call */ if (!tmp_mgcpinfo->fromEndpoint) mgcp_caller_id(pi->signalReq, &(callsinfo->from_identity)); @@ -2827,14 +2827,14 @@ mgcp_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt, if (frame_label == NULL) frame_label = g_strdup(pi->code); break; case MGCP_RESPONSE: - frame_label = g_strdup_printf("%u (%s)",pi->rspcode, pi->code); + frame_label = ws_strdup_printf("%u (%s)",pi->rspcode, pi->code); break; case MGCP_OTHERS: /* XXX what to do? */ break; } - comment = g_strdup_printf("MGCP %s %s%s", tmp_mgcpinfo->endpointId, (pi->mgcp_type == MGCP_REQUEST)?"Request":"Response", pi->is_duplicate?" Duplicate":""); + comment = ws_strdup_printf("MGCP %s %s%s", tmp_mgcpinfo->endpointId, (pi->mgcp_type == MGCP_REQUEST)?"Request":"Response", pi->is_duplicate?" Duplicate":""); callsinfo->stop_fd = pinfo->fd; callsinfo->stop_rel_ts = pinfo->rel_ts; @@ -2982,7 +2982,7 @@ actrace_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e /* increment the packets counter of all calls */ ++(tapinfo->npackets); - comment = g_strdup_printf("AC_CAS trunk:%u", tapinfo->actrace_trunk); + comment = ws_strdup_printf("AC_CAS trunk:%u", tapinfo->actrace_trunk); add_to_graph(tapinfo, pinfo, edt, pi->cas_frame_label, comment, callsinfo->call_num, tapinfo->actrace_direction?&pstn_add:&(pinfo->src), @@ -3093,7 +3093,7 @@ h248_calls_packet_common(voip_calls_tapinfo_t *tapinfo, packet_info *pinfo, epan callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_state = VOIP_NO_STATE; callsinfo->call_active_state = VOIP_ACTIVE; - callsinfo->from_identity = g_strdup_printf("%s : %.8x", mgw_addr, cmd->ctx->id); + callsinfo->from_identity = ws_strdup_printf("%s : %.8x", mgw_addr, cmd->ctx->id); callsinfo->to_identity = g_strdup(""); callsinfo->prot_info = cmd->ctx; callsinfo->free_prot_info = NULL; @@ -3116,7 +3116,7 @@ h248_calls_packet_common(voip_calls_tapinfo_t *tapinfo, packet_info *pinfo, epan gcp_terms_t *ctx_term; g_free(callsinfo->from_identity); - callsinfo->from_identity = g_strdup_printf("%s : %.8x", mgw_addr, ((gcp_ctx_t*)callsinfo->prot_info)->id); + callsinfo->from_identity = ws_strdup_printf("%s : %.8x", mgw_addr, ((gcp_ctx_t*)callsinfo->prot_info)->id); g_free(callsinfo->to_identity); @@ -3521,7 +3521,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_active_state = VOIP_ACTIVE; callsinfo->call_state = VOIP_CALL_SETUP; - callsinfo->from_identity=g_strdup_printf("%x",pi->termid); + callsinfo->from_identity=ws_strdup_printf("%x",pi->termid); callsinfo->to_identity=g_strdup("UNKNOWN"); copy_address(&(callsinfo->initial_speaker),&(pinfo->src)); @@ -3587,11 +3587,11 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e /* Manipulate the data */ if(pi->key_val == 10) { - tmp_unistim_info->key_buffer = g_strdup_printf("%s*",g_tmp->str); + tmp_unistim_info->key_buffer = ws_strdup_printf("%s*",g_tmp->str); } else if(pi->key_val == 11) { - tmp_unistim_info->key_buffer = g_strdup_printf("%s#",g_tmp->str); + tmp_unistim_info->key_buffer = ws_strdup_printf("%s#",g_tmp->str); } else { - tmp_unistim_info->key_buffer = g_strdup_printf("%s%d",g_tmp->str,pi->key_val); + tmp_unistim_info->key_buffer = ws_strdup_printf("%s%d",g_tmp->str,pi->key_val); } } else { @@ -3602,28 +3602,28 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e } else if(pi->key_val == 11) { tmp_unistim_info->key_buffer = g_strdup("#"); } else { - tmp_unistim_info->key_buffer = g_strdup_printf("%d",pi->key_val); + tmp_unistim_info->key_buffer = ws_strdup_printf("%d",pi->key_val); } } /* Select for non-digit characters */ if(pi->key_val == 10) { - comment = g_strdup_printf("Key Input Sent: * (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: * (%d)", pi->sequence); } else if(pi->key_val == 11) { - comment = g_strdup_printf("Key Input Sent: # (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: # (%d)", pi->sequence); } else { - comment = g_strdup_printf("Key Input Sent: %d (%d)",pi->key_val, pi->sequence); + comment = ws_strdup_printf("Key Input Sent: %d (%d)",pi->key_val, pi->sequence); } } else if(pi->key_val == 12) { /* Set label and comment for graph */ - comment = g_strdup_printf("Key Input Sent: UP (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: UP (%d)", pi->sequence); } else if(pi->key_val == 13) { /* Set label and comment for graph */ - comment = g_strdup_printf("Key Input Sent: DOWN (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: DOWN (%d)", pi->sequence); } else if(pi->key_val == 14) { /* Set label and comment for graph */ - comment = g_strdup_printf("Key Input Sent: RIGHT (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: RIGHT (%d)", pi->sequence); } else if(pi->key_val == 15) { if(pi->key_buffer != NULL) { /* Get data */ @@ -3637,13 +3637,13 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e } /* Set label and comment for graph */ - comment = g_strdup_printf("Key Input Sent: LEFT (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: LEFT (%d)", pi->sequence); } else if(pi->key_val == 20) { /* User pressed the soft key 0 probably dial */ - comment = g_strdup_printf("Key Input Sent: S0 (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: S0 (%d)", pi->sequence); } else if(pi->key_val == 21) { /* User pressed the soft key 1 */ - comment = g_strdup_printf("Key Input Sent: S1 (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: S1 (%d)", pi->sequence); } else if(pi->key_val == 22) { /* User pressed the soft key 2 */ /* On cs2k phones, soft key 2 is backspace. */ @@ -3660,10 +3660,10 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e } /* add label and comment */ - comment = g_strdup_printf("Key Input Sent: S2 (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: S2 (%d)", pi->sequence); } else if(pi->key_val == 28) { /* User pressed something */ - comment = g_strdup_printf("Key Input Sent: Release (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: Release (%d)", pi->sequence); } else if(pi->key_val == 23) { /* User pressed the soft key 3 */ /* Cancel on cs2k so clear buffer */ @@ -3671,22 +3671,22 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e tmp_unistim_info->key_buffer = g_strdup("\n"); /* User pressed something, set labels*/ - comment = g_strdup_printf("Key Input Sent: S3 (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: S3 (%d)", pi->sequence); } else if(pi->key_val == 27) { /* User pressed something */ - comment = g_strdup_printf("Key Input Sent: Hold (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: Hold (%d)", pi->sequence); } else if(pi->key_val == 29) { /* User pressed something */ - comment = g_strdup_printf("Key Input Sent: Mute (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: Mute (%d)", pi->sequence); } else if(pi->key_val == 30) { /* User pressed something */ - comment = g_strdup_printf("Key Input Sent: Headset (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: Headset (%d)", pi->sequence); } else if(pi->key_val == 31) { /* Handsfree button */ - comment = g_strdup_printf("Key Input Sent: Handsfree (%d)", pi->sequence); + comment = ws_strdup_printf("Key Input Sent: Handsfree (%d)", pi->sequence); } else if(pi->key_val >= 32 && pi->key_val <= 56) { /* Prog. Key X */ - comment = g_strdup_printf("Key Input Sent: Prog%d (%d)", (pi->key_val & 31), pi->sequence); + comment = ws_strdup_printf("Key Input Sent: Prog%d (%d)", (pi->key_val & 31), pi->sequence); } if(pi->key_val != -1) { @@ -3696,7 +3696,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e if (comment == NULL) /* Ouch! What do you do!? */ /* User pressed something */ - comment = g_strdup_printf("Key Input Sent: UNKNOWN - %d (%d)", pi->key_val, pi->sequence); + comment = ws_strdup_printf("Key Input Sent: UNKNOWN - %d (%d)", pi->key_val, pi->sequence); /* add to the graph */ add_to_graph(tapinfo, pinfo, edt, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); @@ -3708,7 +3708,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e /* Phone is off hook */ frame_label = "OFF HOOK"; - comment = g_strdup_printf("Off Hook (%d)", pi->sequence); + comment = ws_strdup_printf("Off Hook (%d)", pi->sequence); /* add to the graph */ add_to_graph(tapinfo, pinfo, edt, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); @@ -3718,7 +3718,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e /* Phone is on hook */ frame_label = "ON HOOK"; - comment = g_strdup_printf("On Hook (%d)", pi->sequence); + comment = ws_strdup_printf("On Hook (%d)", pi->sequence); /* add to the graph */ add_to_graph(tapinfo, pinfo, edt, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); @@ -3750,7 +3750,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e Call control protocol, we can only guess at the destination by messing with key buffers. */ if(tmp_unistim_info->key_buffer != NULL) { - callsinfo->to_identity = g_strdup_printf("?? %s",tmp_unistim_info->key_buffer); + callsinfo->to_identity = ws_strdup_printf("?? %s",tmp_unistim_info->key_buffer); } /* change sequence number for ACK detection */ @@ -3762,7 +3762,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e /* Add graph data */ frame_label = "STREAM OPENED"; - comment = g_strdup_printf("Stream Opened (%d)",pi->sequence); + comment = ws_strdup_printf("Stream Opened (%d)",pi->sequence); /* add to the graph */ add_to_graph(tapinfo, pinfo, edt, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); @@ -3829,7 +3829,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e Call control protocol, we can only guess at the destination by messing with key buffers. */ if(tmp_unistim_info->key_buffer != NULL) { - callsinfo->to_identity = g_strdup_printf("?? %s",tmp_unistim_info->key_buffer); + callsinfo->to_identity = ws_strdup_printf("?? %s",tmp_unistim_info->key_buffer); } /* change sequence number for ACK detection */ @@ -3841,7 +3841,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e /* Add graph data */ frame_label = "STREAM OPENED"; - comment = g_strdup_printf("Stream Opened (%d)",pi->sequence); + comment = ws_strdup_printf("Stream Opened (%d)",pi->sequence); /* add to the graph */ add_to_graph(tapinfo, pinfo, edt, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); @@ -3865,7 +3865,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e } frame_label = "STREAM CLOSED"; - comment = g_strdup_printf("Stream Closed (%d)",pi->sequence); + comment = ws_strdup_printf("Stream Closed (%d)",pi->sequence); /* add to the graph */ add_to_graph(tapinfo, pinfo, edt, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); @@ -3879,7 +3879,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e if(tmp_unistim_info->sequence == pi->sequence) { frame_label = "ACK"; - comment = g_strdup_printf("ACK for sequence %d",pi->sequence); + comment = ws_strdup_printf("ACK for sequence %d",pi->sequence); /* add to the graph */ add_to_graph(tapinfo, pinfo, edt, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); @@ -3890,7 +3890,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e /* NAK */ frame_label = "NAK"; - comment = g_strdup_printf("NAK for sequence %d",pi->sequence); + comment = ws_strdup_printf("NAK for sequence %d",pi->sequence); /* add to the graph */ add_to_graph(tapinfo, pinfo, edt, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); @@ -4015,7 +4015,7 @@ skinny_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *ed callsinfo = g_new0(voip_calls_info_t, 1); callsinfo->call_state = VOIP_NO_STATE; callsinfo->call_active_state = VOIP_ACTIVE; - /* callsinfo->from_identity = g_strdup_printf("%s : %.8x", "Skinny", 1); */ + /* callsinfo->from_identity = ws_strdup_printf("%s : %.8x", "Skinny", 1); */ callsinfo->from_identity = g_strdup(""); callsinfo->to_identity = g_strdup(""); callsinfo->prot_info = g_new(skinny_calls_info_t, 1); @@ -4053,12 +4053,12 @@ skinny_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *ed if (si->callId) { if (si->passThroughPartyId) - comment = g_strdup_printf("CallId = %u, PTId = %u", si->callId, si->passThroughPartyId); + comment = ws_strdup_printf("CallId = %u, PTId = %u", si->callId, si->passThroughPartyId); else - comment = g_strdup_printf("CallId = %u, LineId = %u", si->callId, si->lineId); + comment = ws_strdup_printf("CallId = %u, LineId = %u", si->callId, si->lineId); } else { if (si->passThroughPartyId) - comment = g_strdup_printf("PTId = %u", si->passThroughPartyId); + comment = ws_strdup_printf("PTId = %u", si->passThroughPartyId); else comment = NULL; } diff --git a/ui/voip_calls.h b/ui/voip_calls.h index 79c709aabb..97f0824a8d 100644 --- a/ui/voip_calls.h +++ b/ui/voip_calls.h @@ -223,7 +223,7 @@ typedef struct _voip_calls_tapinfo { #if 0 #define VOIP_CALLS_DEBUG(...) { \ - char *VOIP_CALLS_DEBUG_MSG = g_strdup_printf(__VA_ARGS__); \ + char *VOIP_CALLS_DEBUG_MSG = ws_strdup_printf(__VA_ARGS__); \ ws_warning("voip_calls: %s:%d %s", G_STRFUNC, __LINE__, VOIP_CALLS_DEBUG_MSG); \ g_free(VOIP_CALLS_DEBUG_MSG); \ } diff --git a/ui/win32/file_dlg_win32.cpp b/ui/win32/file_dlg_win32.cpp index eda04a3ac6..e53287c5dc 100644 --- a/ui/win32/file_dlg_win32.cpp +++ b/ui/win32/file_dlg_win32.cpp @@ -1269,7 +1269,7 @@ save_as_file_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param _U_, LPARAM l_para file_name8 = utf_16to8(notify->lpOFN->lpstrFile); if (files_identical(cf->filename, file_name8)) { /* XXX: Is MessageBox the best way to pop up an error ? How to make text bold ? */ - gchar *str = g_strdup_printf( + gchar *str = ws_strdup_printf( "Capture File \"%s\" identical to loaded file.\n\n" "Please choose a different filename.", file_name8); @@ -1342,7 +1342,7 @@ export_specified_packets_file_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param, file_name8 = utf_16to8(notify->lpOFN->lpstrFile); if (files_identical(cf->filename, file_name8)) { /* XXX: Is MessageBox the best way to pop up an error ? How to make text bold ? */ - gchar *str = g_strdup_printf( + gchar *str = ws_strdup_printf( "Capture File \"%s\" identical to loaded file.\n\n" "Please choose a different filename.", file_name8); diff --git a/wiretap/5views.c b/wiretap/5views.c index 0c525c8c51..42881c9146 100644 --- a/wiretap/5views.c +++ b/wiretap/5views.c @@ -128,7 +128,7 @@ _5views_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("5views: header version %u unsupported", Capture_Header.Info_Header.Version); + *err_info = ws_strdup_printf("5views: header version %u unsupported", Capture_Header.Info_Header.Version); return WTAP_OPEN_ERROR; } @@ -138,7 +138,7 @@ _5views_open(wtap *wth, int *err, gchar **err_info) if((Capture_Header.Info_Header.FileType & CST_5VW_CAPTURE_FILE_TYPE_MASK) != CST_5VW_CAPTURE_FILEID) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("5views: file is not a capture file (filetype is %u)", Capture_Header.Info_Header.Version); + *err_info = ws_strdup_printf("5views: file is not a capture file (filetype is %u)", Capture_Header.Info_Header.Version); return WTAP_OPEN_ERROR; } @@ -152,7 +152,7 @@ _5views_open(wtap *wth, int *err, gchar **err_info) */ default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("5views: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("5views: network type %u unknown or unsupported", Capture_Header.Info_Header.FileType); return WTAP_OPEN_ERROR; } @@ -221,7 +221,7 @@ _5views_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("5views: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("5views: File has %u-byte packet, bigger than maximum of %u", rec->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -270,7 +270,7 @@ _5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr, hdr->Key = pletoh32(&hdr->Key); if (hdr->Key != CST_5VW_RECORDS_HEADER_KEY) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("5views: Time-stamped header has bad key value 0x%08X", + *err_info = ws_strdup_printf("5views: Time-stamped header has bad key value 0x%08X", hdr->Key); return FALSE; } diff --git a/wiretap/aethra.c b/wiretap/aethra.c index c693680107..58e815bb33 100644 --- a/wiretap/aethra.c +++ b/wiretap/aethra.c @@ -309,7 +309,7 @@ aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr, if (rec_size < (sizeof *hdr - sizeof hdr->rec_size)) { /* The record is shorter than a record header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("aethra: File has %u-byte record, less than minimum of %u", + *err_info = ws_strdup_printf("aethra: File has %u-byte record, less than minimum of %u", rec_size, (unsigned int)(sizeof *hdr - sizeof hdr->rec_size)); return FALSE; @@ -321,7 +321,7 @@ aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr, * space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("aethra: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("aethra: File has %u-byte packet, bigger than maximum of %u", rec_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/blf.c b/wiretap/blf.c index c7c054bc6c..6947176572 100644 --- a/wiretap/blf.c +++ b/wiretap/blf.c @@ -542,7 +542,7 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: cannot refresh container"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: cannot refresh container"); ws_debug("cannot refresh container"); return FALSE; } @@ -580,7 +580,7 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: cannot pull in container"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: cannot pull in container"); ws_debug("cannot pull in container"); return FALSE; } @@ -591,7 +591,7 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: cannot refresh container"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: cannot refresh container"); ws_debug("cannot refresh container"); return FALSE; } @@ -602,7 +602,7 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: pulling in container failed hard"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: pulling in container failed hard"); ws_debug("pulling in container failed hard"); return FALSE; } @@ -624,13 +624,13 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: ran out of items in container"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: ran out of items in container"); return FALSE; break; default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("blf: unknown compression method %u", + *err_info = ws_strdup_printf("blf: unknown compression method %u", start_container->compression_method); ws_debug("unknown compression method"); return FALSE; @@ -794,7 +794,7 @@ static gboolean blf_read_log_object_header(blf_params_t *params, int *err, gchar **err_info, gint64 header2_start, gint64 data_start, blf_logobjectheader_t *logheader) { if (data_start - header2_start < (gint64)sizeof(blf_logobjectheader_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: not enough bytes for log object header"); + *err_info = ws_strdup_printf("blf: not enough bytes for log object header"); ws_debug("not enough bytes for timestamp header"); return FALSE; } @@ -820,7 +820,7 @@ blf_read_ethernetframe(blf_params_t *params, int *err, gchar **err_info, gint64 if (object_length < (data_start - block_start) + (int) sizeof(blf_ethernetframeheader_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: ETHERNET_FRAME: not enough bytes for ethernet frame header in object"); + *err_info = ws_strdup_printf("blf: ETHERNET_FRAME: not enough bytes for ethernet frame header in object"); ws_debug("not enough bytes for ethernet frame header in object"); return FALSE; } @@ -894,7 +894,7 @@ blf_read_ethernetframe_ext(blf_params_t *params, int *err, gchar **err_info, gin if (object_length < (data_start - block_start) + (int) sizeof(blf_ethernetframeheader_ex_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: ETHERNET_FRAME_EX: not enough bytes for ethernet frame header in object"); + *err_info = ws_strdup_printf("blf: ETHERNET_FRAME_EX: not enough bytes for ethernet frame header in object"); ws_debug("not enough bytes for ethernet frame header in object"); return FALSE; } @@ -909,7 +909,7 @@ blf_read_ethernetframe_ext(blf_params_t *params, int *err, gchar **err_info, gin if (object_length - (data_start - block_start) - sizeof(blf_ethernetframeheader_ex_t) < ethheader.frame_length) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: ETHERNET_FRAME_EX: frame too short"); + *err_info = ws_strdup_printf("blf: ETHERNET_FRAME_EX: frame too short"); ws_debug("frame too short"); return FALSE; } @@ -937,7 +937,7 @@ blf_read_wlanframe(blf_params_t* params, int* err, gchar** err_info, gint64 bloc if (object_length < (data_start - block_start) + (int)sizeof(blf_wlanframeheader_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: WLAN_FRAME: not enough bytes for wlan frame header in object"); + *err_info = ws_strdup_printf("blf: WLAN_FRAME: not enough bytes for wlan frame header in object"); ws_debug("not enough bytes for wlan frame header in object"); return FALSE; } @@ -952,7 +952,7 @@ blf_read_wlanframe(blf_params_t* params, int* err, gchar** err_info, gint64 bloc if (object_length - (data_start - block_start) - sizeof(blf_wlanframeheader_t) < wlanheader.frame_length) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: WLAN_FRAME: frame too short"); + *err_info = ws_strdup_printf("blf: WLAN_FRAME: frame too short"); ws_debug("frame too short"); return FALSE; } @@ -1018,7 +1018,7 @@ blf_read_canmessage(blf_params_t *params, int *err, gchar **err_info, gint64 blo if (object_length < (data_start - block_start) + (int) sizeof(canheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: %s: not enough bytes for canfd header in object", + *err_info = ws_strdup_printf("blf: %s: not enough bytes for canfd header in object", can_message2 ? "CAN_MESSAGE2" : "CAN_MESSAGE"); ws_debug("not enough bytes for canfd header in object"); return FALSE; @@ -1062,7 +1062,7 @@ blf_read_canmessage(blf_params_t *params, int *err, gchar **err_info, gint64 blo if (can_message2) { if (object_length < (data_start - block_start) + (int) sizeof(canheader) + payload_length_valid + (int) sizeof(can2trailer)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: CAN_MESSAGE2: not enough bytes for can message 2 trailer"); + *err_info = ws_strdup_printf("blf: CAN_MESSAGE2: not enough bytes for can message 2 trailer"); ws_debug("not enough bytes for can message 2 trailer"); return FALSE; } @@ -1094,7 +1094,7 @@ blf_read_canfdmessage(blf_params_t *params, int *err, gchar **err_info, gint64 b if (object_length < (data_start - block_start) + (int) sizeof(canheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: CAN_FD_MESSAGE: not enough bytes for canfd header in object"); + *err_info = ws_strdup_printf("blf: CAN_FD_MESSAGE: not enough bytes for canfd header in object"); ws_debug("not enough bytes for canfd header in object"); return FALSE; } @@ -1163,7 +1163,7 @@ blf_read_canfdmessage64(blf_params_t *params, int *err, gchar **err_info, gint64 if (object_length < (data_start - block_start) + (int) sizeof(canheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: CAN_FD_MESSAGE_64: not enough bytes for canfd header in object"); + *err_info = ws_strdup_printf("blf: CAN_FD_MESSAGE_64: not enough bytes for canfd header in object"); ws_debug("not enough bytes for canfd header in object"); return FALSE; } @@ -1240,7 +1240,7 @@ blf_read_flexraydata(blf_params_t *params, int *err, gchar **err_info, gint64 bl if (object_length < (data_start - block_start) + (int) sizeof(frheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: FLEXRAY_DATA: not enough bytes for flexrayheader in object"); + *err_info = ws_strdup_printf("blf: FLEXRAY_DATA: not enough bytes for flexrayheader in object"); ws_debug("not enough bytes for flexrayheader in object"); return FALSE; } @@ -1317,7 +1317,7 @@ blf_read_flexraymessage(blf_params_t *params, int *err, gchar **err_info, gint64 if (object_length < (data_start - block_start) + (int) sizeof(frheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: FLEXRAY_MESSAGE: not enough bytes for flexrayheader in object"); + *err_info = ws_strdup_printf("blf: FLEXRAY_MESSAGE: not enough bytes for flexrayheader in object"); ws_debug("not enough bytes for flexrayheader in object"); return FALSE; } @@ -1416,7 +1416,7 @@ blf_read_flexrayrcvmessageex(blf_params_t *params, int *err, gchar **err_info, g if ((gint64)object_length < (data_start - block_start) + frheadersize) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: %s: not enough bytes for flexrayheader in object", + *err_info = ws_strdup_printf("blf: %s: not enough bytes for flexrayheader in object", ext ? "FLEXRAY_RCVMESSAGE_EX" : "FLEXRAY_RCVMESSAGE"); ws_debug("not enough bytes for flexrayheader in object"); return FALSE; @@ -1513,7 +1513,7 @@ blf_read_linmessage(blf_params_t *params, int *err, gchar **err_info, gint64 blo if (object_length < (data_start - block_start) + (int)sizeof(linheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: LIN_MESSAGE: not enough bytes for linmessage header in object"); + *err_info = ws_strdup_printf("blf: LIN_MESSAGE: not enough bytes for linmessage header in object"); ws_debug("not enough bytes for linmessage header in object"); return FALSE; } @@ -1559,7 +1559,7 @@ blf_read_linmessage(blf_params_t *params, int *err, gchar **err_info, gint64 blo if (object_length < (data_start - block_start) + (int)sizeof(linheader) + payload_length_valid + (int)sizeof(lintrailer)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: LIN_MESSAGE: not enough bytes for linmessage trailer"); + *err_info = ws_strdup_printf("blf: LIN_MESSAGE: not enough bytes for linmessage trailer"); ws_debug("not enough bytes for linmessage trailer"); return FALSE; } @@ -1613,7 +1613,7 @@ blf_read_block(blf_params_t *params, gint64 start_pos, int *err, gchar **err_inf if (header.header_type != BLF_HEADER_TYPE_DEFAULT) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("blf: unknown header type %u", + *err_info = ws_strdup_printf("blf: unknown header type %u", header.header_type); ws_debug("unknown header type"); return FALSE; @@ -1625,7 +1625,7 @@ blf_read_block(blf_params_t *params, gint64 start_pos, int *err, gchar **err_inf switch (header.object_type) { case BLF_OBJTYPE_LOG_CONTAINER: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("blf: log container in log container not supported"); + *err_info = ws_strdup_printf("blf: log container in log container not supported"); ws_debug("log container in log container not supported"); return FALSE; break; diff --git a/wiretap/btsnoop.c b/wiretap/btsnoop.c index 36904ac86f..806862837a 100644 --- a/wiretap/btsnoop.c +++ b/wiretap/btsnoop.c @@ -103,7 +103,7 @@ wtap_open_return_val btsnoop_open(wtap *wth, int *err, gchar **err_info) hdr.version = g_ntohl(hdr.version); if (hdr.version != 1) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("btsnoop: version %u unsupported", hdr.version); + *err_info = ws_strdup_printf("btsnoop: version %u unsupported", hdr.version); return WTAP_OPEN_ERROR; } @@ -132,7 +132,7 @@ wtap_open_return_val btsnoop_open(wtap *wth, int *err, gchar **err_info) return WTAP_OPEN_ERROR; default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("btsnoop: datalink type %u unknown or unsupported", hdr.datalink); + *err_info = ws_strdup_printf("btsnoop: datalink type %u unknown or unsupported", hdr.datalink); return WTAP_OPEN_ERROR; } @@ -194,7 +194,7 @@ static gboolean btsnoop_read_record(wtap *wth, FILE_T fh, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("btsnoop: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("btsnoop: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -302,7 +302,7 @@ static gboolean btsnoop_dump(wtap_dumper *wdh, case BTHCI_CHANNEL_COMMAND: if (!pseudo_header->bthci.sent) { *err = WTAP_ERR_UNWRITABLE_REC_DATA; - *err_info = g_strdup_printf("btsnoop: Command channel, sent FALSE"); + *err_info = ws_strdup_printf("btsnoop: Command channel, sent FALSE"); return FALSE; } flags = KHciLoggerCommandOrEvent|KHciLoggerHostToController; @@ -311,7 +311,7 @@ static gboolean btsnoop_dump(wtap_dumper *wdh, case BTHCI_CHANNEL_EVENT: if (pseudo_header->bthci.sent) { *err = WTAP_ERR_UNWRITABLE_REC_DATA; - *err_info = g_strdup_printf("btsnoop: Event channel, sent TRUE"); + *err_info = ws_strdup_printf("btsnoop: Event channel, sent TRUE"); return FALSE; } flags = KHciLoggerCommandOrEvent|KHciLoggerControllerToHost; @@ -326,7 +326,7 @@ static gboolean btsnoop_dump(wtap_dumper *wdh, default: *err = WTAP_ERR_UNWRITABLE_REC_DATA; - *err_info = g_strdup_printf("btsnoop: Unknown channel %u", + *err_info = ws_strdup_printf("btsnoop: Unknown channel %u", pseudo_header->bthci.channel); return FALSE; } @@ -350,7 +350,7 @@ static gboolean btsnoop_dump(wtap_dumper *wdh, /* We should never get here - our open routine should only get called for the types above. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("btsnoop: invalid encapsulation %u", + *err_info = ws_strdup_printf("btsnoop: invalid encapsulation %u", wdh->encap); return FALSE; } @@ -403,7 +403,7 @@ static gboolean btsnoop_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _ /* We should never get here - our open routine should only get called for the types above. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("btsnoop: invalid encapsulation %u", + *err_info = ws_strdup_printf("btsnoop: invalid encapsulation %u", wdh->encap); return FALSE; } diff --git a/wiretap/busmaster_parser.lemon b/wiretap/busmaster_parser.lemon index 59b79cd4d4..3e346bfb7a 100644 --- a/wiretap/busmaster_parser.lemon +++ b/wiretap/busmaster_parser.lemon @@ -71,7 +71,7 @@ DIAG_OFF(unreachable-code) g_free(state->parse_error); state->entry_type = LOG_ENTRY_ERROR; - state->parse_error = g_strdup_printf("Syntax Error"); + state->parse_error = ws_strdup_printf("Syntax Error"); busmaster_debug_printf("%s: Syntax Error\n", G_STRFUNC); } diff --git a/wiretap/camins.c b/wiretap/camins.c index f26b5910a5..2a825c6e33 100644 --- a/wiretap/camins.c +++ b/wiretap/camins.c @@ -336,7 +336,7 @@ create_pseudo_hdr(guint8 *buf, guint8 dat_trans_type, guint16 dat_len, else if (dat_trans_type==TRANS_HOST_CAM) buf[1] = DVB_CI_PSEUDO_HDR_HOST_TO_CAM; else { - *err_info = g_strdup_printf("camins: invalid dat_trans_type %u", dat_trans_type); + *err_info = ws_strdup_printf("camins: invalid dat_trans_type %u", dat_trans_type); return -1; } diff --git a/wiretap/candump_parser.lemon b/wiretap/candump_parser.lemon index a8e501424f..3fd659cc05 100644 --- a/wiretap/candump_parser.lemon +++ b/wiretap/candump_parser.lemon @@ -70,7 +70,7 @@ DIAG_OFF(unreachable-code) #endif g_free(state->parse_error); - state->parse_error = g_strdup_printf("Syntax Error"); + state->parse_error = ws_strdup_printf("Syntax Error"); #ifdef CANDUMP_DEBUG candump_debug_printf("%s: Syntax Error\n", G_STRFUNC); #endif diff --git a/wiretap/capsa.c b/wiretap/capsa.c index b8bf256d29..786137fe28 100644 --- a/wiretap/capsa.c +++ b/wiretap/capsa.c @@ -159,7 +159,7 @@ wtap_open_return_val capsa_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("capsa: format indicator %u unsupported", + *err_info = ws_strdup_printf("capsa: format indicator %u unsupported", format_indicator); return WTAP_OPEN_ERROR; } @@ -371,7 +371,7 @@ capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, default: ws_assert_not_reached(); *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("capsa: format indicator is %u", capsa->format_indicator); + *err_info = ws_strdup_printf("capsa: format indicator is %u", capsa->format_indicator); return -1; } if (orig_size > WTAP_MAX_PACKET_SIZE_STANDARD) { @@ -380,7 +380,7 @@ capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("capsa: File has %u-byte original length, bigger than maximum of %u", + *err_info = ws_strdup_printf("capsa: File has %u-byte original length, bigger than maximum of %u", orig_size, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -390,7 +390,7 @@ capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("capsa: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("capsa: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -399,7 +399,7 @@ capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * Probably a corrupt capture file. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("capsa: File has %u-byte packet with %u-byte record header, bigger than record size %u", + *err_info = ws_strdup_printf("capsa: File has %u-byte packet with %u-byte record header, bigger than record size %u", packet_size, header_size, rec_size); return -1; } diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c index bd4af92ac2..9d4a5a0f69 100644 --- a/wiretap/catapult_dct2000.c +++ b/wiretap/catapult_dct2000.c @@ -504,7 +504,7 @@ catapult_dct2000_seek_read(wtap *wth, gint64 seek_off, /* If get here, must have failed */ *err = errno; - *err_info = g_strdup_printf("catapult dct2000: seek_read failed to read/parse " + *err_info = ws_strdup_printf("catapult dct2000: seek_read failed to read/parse " "line at position %" PRId64, seek_off); return FALSE; @@ -1312,7 +1312,7 @@ process_parsed_line(wtap *wth, dct2000_file_externals_t *file_externals, * space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("catapult dct2000: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("catapult dct2000: File has %u-byte packet, bigger than maximum of %u", rec->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/commview.c b/wiretap/commview.c index a30e613c57..6f4ebbad71 100644 --- a/wiretap/commview.c +++ b/wiretap/commview.c @@ -302,7 +302,7 @@ commview_ncf_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, default : *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: unsupported encap for NCF: %u", + *err_info = ws_strdup_printf("commview: unsupported encap for NCF: %u", cv_hdr.flags & FLAGS_MEDIUM); return FALSE; } @@ -803,7 +803,7 @@ commview_ncfx_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, */ if (length_remaining < COMMVIEW_NCFX_RF_HEADER_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: RF header goes past the NCFX data length %u", + *err_info = ws_strdup_printf("commview: RF header goes past the NCFX data length %u", cv_hdr.data_len); return FALSE; } @@ -908,7 +908,7 @@ commview_ncfx_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, */ if (length_remaining < COMMVIEW_NCFX_MCS_HEADER_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: MCS header goes past the NCFX data length %u", + *err_info = ws_strdup_printf("commview: MCS header goes past the NCFX data length %u", cv_hdr.data_len); return FALSE; } @@ -990,7 +990,7 @@ commview_ncfx_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, default : *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: unsupported encap for NCFX: %u", + *err_info = ws_strdup_printf("commview: unsupported encap for NCFX: %u", cv_hdr.medium_type); return FALSE; } @@ -1013,7 +1013,7 @@ commview_ncfx_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("commview: File has %u-byte packet, bigger than maximum of %u", length_remaining, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -1059,7 +1059,7 @@ commview_ncfx_read_header(commview_ncfx_header_t *cv_hdr, FILE_T fh, int *err, /* It must be at least the length of the general header. */ if (cv_hdr->data_len < COMMVIEW_NCFX_HEADER_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: NCFX data length %u < %u", + *err_info = ws_strdup_printf("commview: NCFX data length %u < %u", cv_hdr->data_len, COMMVIEW_NCFX_HEADER_SIZE); return FALSE; diff --git a/wiretap/cosine.c b/wiretap/cosine.c index b9b1f615ab..d7afb03980 100644 --- a/wiretap/cosine.c +++ b/wiretap/cosine.c @@ -377,7 +377,7 @@ parse_cosine_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("cosine: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("cosine: File has %u-byte packet, bigger than maximum of %u", (guint)pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/daintree-sna.c b/wiretap/daintree-sna.c index aa8fd7a6cd..08e2bb3234 100644 --- a/wiretap/daintree-sna.c +++ b/wiretap/daintree-sna.c @@ -184,7 +184,7 @@ daintree_sna_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, /* Daintree doesn't store the FCS, but pads end of packet with 0xffff, which we toss */ if (rec->rec_header.packet_header.len <= FCS_LENGTH) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("daintree_sna: packet length <= %u bytes, no frame data present", + *err_info = ws_strdup_printf("daintree_sna: packet length <= %u bytes, no frame data present", FCS_LENGTH); return FALSE; } @@ -236,14 +236,14 @@ daintree_sna_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, /* Daintree doesn't store the FCS, but pads end of packet with 0xffff, which we toss */ if (bytes <= FCS_LENGTH) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("daintree_sna: Only %u bytes of packet data", + *err_info = ws_strdup_printf("daintree_sna: Only %u bytes of packet data", bytes); return FALSE; } bytes -= FCS_LENGTH; if (bytes > rec->rec_header.packet_header.len) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("daintree_sna: capture length (%u) > packet length (%u)", + *err_info = ws_strdup_printf("daintree_sna: capture length (%u) > packet length (%u)", bytes, rec->rec_header.packet_header.len); return FALSE; } diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c index 83ab8647cd..d620674486 100644 --- a/wiretap/dbs-etherwatch.c +++ b/wiretap/dbs-etherwatch.c @@ -456,7 +456,7 @@ parse_dbs_etherwatch_packet(FILE_T fh, wtap_rec *rec, Buffer* buf, * space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dbs_etherwatch: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("dbs_etherwatch: File has %u-byte packet, bigger than maximum of %u", rec->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/dct3trace.c b/wiretap/dct3trace.c index f361ca4b9c..1476247d6b 100644 --- a/wiretap/dct3trace.c +++ b/wiretap/dct3trace.c @@ -131,7 +131,7 @@ xml_get_int(int *val, const char *str, const char *pattern, int *err, gchar **er ptr = strstr(str, pattern); if (ptr == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: %s not found", pattern); + *err_info = ws_strdup_printf("dct3trace: %s not found", pattern); return FALSE; } /* @@ -140,7 +140,7 @@ xml_get_int(int *val, const char *str, const char *pattern, int *err, gchar **er start = strchr(ptr, '"'); if (start == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: opening quote for %s not found", pattern); + *err_info = ws_strdup_printf("dct3trace: opening quote for %s not found", pattern); return FALSE; } start++; @@ -151,12 +151,12 @@ xml_get_int(int *val, const char *str, const char *pattern, int *err, gchar **er end = strchr(start, '"'); if (end == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: closing quote for %s not found", pattern); + *err_info = ws_strdup_printf("dct3trace: closing quote for %s not found", pattern); return FALSE; } if (end - start > 31) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: %s value is too long", pattern); + *err_info = ws_strdup_printf("dct3trace: %s value is too long", pattern); return FALSE; } @@ -170,16 +170,16 @@ xml_get_int(int *val, const char *str, const char *pattern, int *err, gchar **er *err = WTAP_ERR_BAD_FILE; if (errno == ERANGE) { if (*val < 0) - *err_info = g_strdup_printf("dct3trace: %s value is too small, minimum is %d", pattern, *val); + *err_info = ws_strdup_printf("dct3trace: %s value is too small, minimum is %d", pattern, *val); else - *err_info = g_strdup_printf("dct3trace: %s value is too large, maximum is %d", pattern, *val); + *err_info = ws_strdup_printf("dct3trace: %s value is too large, maximum is %d", pattern, *val); } else - *err_info = g_strdup_printf("dct3trace: %s value \"%s\" not a number", pattern, buf); + *err_info = ws_strdup_printf("dct3trace: %s value \"%s\" not a number", pattern, buf); return FALSE; } if (*endptr != '\0') { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: %s value \"%s\" not a number", pattern, buf); + *err_info = ws_strdup_printf("dct3trace: %s value \"%s\" not a number", pattern, buf); return FALSE; } return TRUE; @@ -322,7 +322,7 @@ static gboolean dct3trace_get_packet(FILE_T fh, wtap_rec *rec, if (len == -1) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: record length %d too long", rec->rec_header.packet_header.caplen); + *err_info = ws_strdup_printf("dct3trace: record length %d too long", rec->rec_header.packet_header.caplen); return FALSE; } } @@ -362,7 +362,7 @@ static gboolean dct3trace_get_packet(FILE_T fh, wtap_rec *rec, if (data_len == -1) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: record length %d too long", rec->rec_header.packet_header.caplen); + *err_info = ws_strdup_printf("dct3trace: record length %d too long", rec->rec_header.packet_header.caplen); return FALSE; } len += data_len; diff --git a/wiretap/dpa400.c b/wiretap/dpa400.c index d348d4b691..671dbdfffd 100644 --- a/wiretap/dpa400.c +++ b/wiretap/dpa400.c @@ -164,7 +164,7 @@ static gboolean dpa400_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (++ctr > WTAP_MAX_PACKET_SIZE_STANDARD) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dpa400: File has data record bigger than maximum of %u", + *err_info = ws_strdup_printf("dpa400: File has data record bigger than maximum of %u", WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -193,7 +193,7 @@ static gboolean dpa400_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, default: *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dpa400: unknown packet type %02x", chunk[0]); + *err_info = ws_strdup_printf("dpa400: unknown packet type %02x", chunk[0]); return FALSE; } diff --git a/wiretap/erf.c b/wiretap/erf.c index a9903b45e2..004f0a4c67 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -696,7 +696,7 @@ static gboolean erf_read_header(wtap *wth, FILE_T fh, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u", *packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -892,7 +892,7 @@ static gboolean erf_read_header(wtap *wth, FILE_T fh, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u", *packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -2435,22 +2435,22 @@ static int erf_populate_interface(erf_t *erf_priv, wtap *wth, union wtap_pseudo_ if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: erf_populate_interface called with wth NULL"); + *err_info = ws_strdup_printf("erf: erf_populate_interface called with wth NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: erf_populate_interface called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: erf_populate_interface called with pseudo_header NULL"); return -1; } if (!erf_priv) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: erf_populate_interface called with erf_priv NULL"); + *err_info = ws_strdup_printf("erf: erf_populate_interface called with erf_priv NULL"); return -1; } if (if_num > 3) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: erf_populate_interface called with if_num %u > 3", + *err_info = ws_strdup_printf("erf: erf_populate_interface called with if_num %u > 3", if_num); return -1; } @@ -2559,22 +2559,22 @@ static int populate_capture_host_info(erf_t *erf_priv, wtap *wth, union wtap_pse if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_capture_host_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_capture_host_info called with wth NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_capture_host_info called with state NULL"); + *err_info = ws_strdup_printf("erf: populate_capture_host_info called with state NULL"); return -1; } if (!wth->shb_hdrs) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_capture_host_info called with wth->shb_hdrs NULL"); + *err_info = ws_strdup_printf("erf: populate_capture_host_info called with wth->shb_hdrs NULL"); return -1; } if (wth->shb_hdrs->len == 0) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_capture_host_info called with wth->shb_hdrs->len 0"); + *err_info = ws_strdup_printf("erf: populate_capture_host_info called with wth->shb_hdrs->len 0"); return -1; } @@ -2725,12 +2725,12 @@ static int populate_module_info(erf_t *erf_priv _U_, wtap *wth, union wtap_pseud if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_module_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_module_info called with wth NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_module_info called with stat NULL"); + *err_info = ws_strdup_printf("erf: populate_module_info called with stat NULL"); return -1; } @@ -2779,22 +2779,22 @@ static int populate_interface_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_interface_info called with wth NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info called with state NULL"); + *err_info = ws_strdup_printf("erf: populate_interface_info called with state NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: populate_interface_info called with pseudo_header NULL"); return -1; } if (!state->if_map) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info called with state->if_map NULL"); + *err_info = ws_strdup_printf("erf: populate_interface_info called with state->if_map NULL"); return -1; } @@ -2856,7 +2856,7 @@ static int populate_interface_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo return 0; } else { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info got interface_index %d < 0 and != -2", interface_index); + *err_info = ws_strdup_printf("erf: populate_interface_info got interface_index %d < 0 and != -2", interface_index); return -1; } } @@ -2999,22 +2999,22 @@ static int populate_stream_info(erf_t *erf_priv _U_, wtap *wth, union wtap_pseud if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_stream_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_stream_info called with wth NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_stream_info called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: populate_stream_info called with pseudo_header NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_stream_info called with state NULL"); + *err_info = ws_strdup_printf("erf: populate_stream_info called with state NULL"); return -1; } if (!state->if_map) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_stream_info called with state->if_map NULL"); + *err_info = ws_strdup_printf("erf: populate_stream_info called with state->if_map NULL"); return -1; } @@ -3147,17 +3147,17 @@ static int populate_anchor_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo_he if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_anchor_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_anchor_info called with wth NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_anchor_info called with state NULL"); + *err_info = ws_strdup_printf("erf: populate_anchor_info called with state NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_anchor_info called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: populate_anchor_info called with pseudo_header NULL"); return -1; } @@ -3230,17 +3230,17 @@ static int populate_summary_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo_h if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_summary_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_summary_info called with wth NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_summary_info called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: populate_summary_info called with pseudo_header NULL"); return -1; } if (!erf_priv) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_summary_info called with erf_priv NULL"); + *err_info = ws_strdup_printf("erf: populate_summary_info called with erf_priv NULL"); return -1; } diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c index 3f2be31f7c..b7acc2cac6 100644 --- a/wiretap/eyesdn.c +++ b/wiretap/eyesdn.c @@ -237,7 +237,7 @@ read_eyesdn_rec(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, if(pkt_len != CELL_LEN) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "eyesdn: ATM cell has a length != 53 (%u)", pkt_len); return FALSE; @@ -293,7 +293,7 @@ read_eyesdn_rec(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, if(pkt_len > WTAP_MAX_PACKET_SIZE_STANDARD) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("eyesdn: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("eyesdn: File has %u-byte packet, bigger than maximum of %u", pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 6d5ede5571..0839523ac7 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -112,7 +112,7 @@ add_extensions(GSList *extensions, const gchar *extension, compression_type_extension != NULL; compression_type_extension = g_slist_next(compression_type_extension)) { extensions = g_slist_prepend(extensions, - g_strdup_printf("%s.%s", extension, + ws_strdup_printf("%s.%s", extension, (const char *)compression_type_extension->data)); } diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c index b11b91c9ac..2755a86c97 100644 --- a/wiretap/hcidump.c +++ b/wiretap/hcidump.c @@ -41,7 +41,7 @@ static gboolean hcidump_read_packet(FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("hcidump: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("hcidump: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c index 09251bd071..e38e1358a6 100644 --- a/wiretap/i4btrace.c +++ b/wiretap/i4btrace.c @@ -228,7 +228,7 @@ i4b_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, if (hdr.length < sizeof(hdr)) { *err = WTAP_ERR_BAD_FILE; /* record length < header! */ - *err_info = g_strdup_printf("i4btrace: record length %u < header length %lu", + *err_info = ws_strdup_printf("i4btrace: record length %u < header length %lu", hdr.length, (unsigned long)sizeof(hdr)); return FALSE; } @@ -239,7 +239,7 @@ i4b_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("i4btrace: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("i4btrace: File has %u-byte packet, bigger than maximum of %u", length, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/ipfix.c b/wiretap/ipfix.c index 32e4ffec2e..b9ed377c4d 100644 --- a/wiretap/ipfix.c +++ b/wiretap/ipfix.c @@ -116,13 +116,13 @@ ipfix_read_message_header(ipfix_message_header_t *pfx_hdr, FILE_T fh, int *err, if (pfx_hdr->version != IPFIX_VERSION) { /* Not an ipfix file. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("ipfix: wrong version %d", pfx_hdr->version); + *err_info = ws_strdup_printf("ipfix: wrong version %d", pfx_hdr->version); return FALSE; } if (pfx_hdr->message_length < 16) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("ipfix: message length %u is too short", pfx_hdr->message_length); + *err_info = ws_strdup_printf("ipfix: message length %u is too short", pfx_hdr->message_length); return FALSE; } diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c index bd84ea040a..f9ae4b8d70 100644 --- a/wiretap/iptrace.c +++ b/wiretap/iptrace.c @@ -218,7 +218,7 @@ iptrace_read_rec_1_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * packet information header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet information header", + *err_info = ws_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet information header", record_length); return FALSE; } @@ -241,7 +241,7 @@ iptrace_read_rec_1_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, rec->rec_header.packet_header.pkt_encap = wtap_encap_ift(info.if_type); if (rec->rec_header.packet_header.pkt_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("iptrace: interface type IFT=0x%02x unknown or unsupported", + *err_info = ws_strdup_printf("iptrace: interface type IFT=0x%02x unknown or unsupported", info.if_type); return FALSE; } @@ -264,7 +264,7 @@ iptrace_read_rec_1_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * the padding. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header", + *err_info = ws_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header", record_length); return FALSE; } @@ -282,7 +282,7 @@ iptrace_read_rec_1_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -472,7 +472,7 @@ iptrace_read_rec_2_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * packet information header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet information header", + *err_info = ws_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet information header", record_length); return FALSE; } @@ -512,7 +512,7 @@ iptrace_read_rec_2_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, */ if (rec->rec_header.packet_header.pkt_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("iptrace: interface type IFT=0x%02x unknown or unsupported", + *err_info = ws_strdup_printf("iptrace: interface type IFT=0x%02x unknown or unsupported", info.if_type); return FALSE; } @@ -536,7 +536,7 @@ iptrace_read_rec_2_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * the padding. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header", + *err_info = ws_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header", record_length); return FALSE; } @@ -554,7 +554,7 @@ iptrace_read_rec_2_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/iseries.c b/wiretap/iseries.c index eb43142802..f8be5025ab 100644 --- a/wiretap/iseries.c +++ b/wiretap/iseries.c @@ -483,7 +483,7 @@ iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info) *err = WTAP_ERR_BAD_FILE; *err_info = - g_strdup_printf ("iseries: next packet header not found within %d lines", + ws_strdup_printf ("iseries: next packet header not found within %d lines", ISERIES_MAX_TRACE_LEN); return -1; } @@ -747,7 +747,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, wtap_rec *rec, * the error message, to avoid an overflow.) */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iseries: File has %" PRIu64 "-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("iseries: File has %" PRIu64 "-byte packet, bigger than maximum of %u", (guint64)pkt_len + 14, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; diff --git a/wiretap/k12.c b/wiretap/k12.c index e5e145cd5a..de4c48149d 100644 --- a/wiretap/k12.c +++ b/wiretap/k12.c @@ -484,12 +484,12 @@ static gint get_record(k12_t *file_data, FILE_T fh, gint64 file_offset, */ if (left < 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Record length %u is less than 8 bytes long",left); + *err_info = ws_strdup_printf("k12: Record length %u is less than 8 bytes long",left); return -1; } if (left > WTAP_MAX_PACKET_SIZE_STANDARD) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Record length %u is greater than the maximum %u",left,WTAP_MAX_PACKET_SIZE_STANDARD); + *err_info = ws_strdup_printf("k12: Record length %u is greater than the maximum %u",left,WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -582,7 +582,7 @@ process_packet_data(wtap_rec *rec, Buffer *target, guint8 *buffer, buffer_offset = (type == K12_REC_D0020) ? K12_PACKET_FRAME_D0020 : K12_PACKET_FRAME; if (buffer_offset > record_len) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Frame data offset %u > record length %u", + *err_info = ws_strdup_printf("k12: Frame data offset %u > record length %u", buffer_offset, record_len); return FALSE; } @@ -590,7 +590,7 @@ process_packet_data(wtap_rec *rec, Buffer *target, guint8 *buffer, length = pntoh32(buffer + K12_RECORD_FRAME_LEN) & 0x00001FFF; if (length > record_len - buffer_offset) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Frame length %u > record frame data %u", + *err_info = ws_strdup_printf("k12: Frame length %u > record frame data %u", length, record_len - buffer_offset); return FALSE; } @@ -699,7 +699,7 @@ static gboolean k12_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, gchar } else if (len < K12_RECORD_SRC_ID + 4) { /* Record not large enough to contain a src ID */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Data record length %d too short", len); + *err_info = ws_strdup_printf("k12: Data record length %d too short", len); return FALSE; } k12->num_of_records--; @@ -884,7 +884,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { file_data->num_of_records = pntoh32( header_buffer + K12_FILE_HDR_RECORD_COUNT_1 ); if ( file_data->num_of_records != pntoh32( header_buffer + K12_FILE_HDR_RECORD_COUNT_2 ) ) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: two different record counts, %u at 0x%02x and %u at 0x%02x", + *err_info = ws_strdup_printf("k12: two different record counts, %u at 0x%02x and %u at 0x%02x", file_data->num_of_records, K12_FILE_HDR_RECORD_COUNT_1, pntoh32( header_buffer + K12_FILE_HDR_RECORD_COUNT_2 ), @@ -926,7 +926,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { if (rec_len < K12_RECORD_TYPE + 4) { /* Record isn't long enough to have a type field */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: record length %u < %u", + *err_info = ws_strdup_printf("k12: record length %u < %u", rec_len, K12_RECORD_TYPE + 4); destroy_k12_file_data(file_data); return WTAP_OPEN_ERROR; @@ -958,7 +958,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { * of the source descriptor field. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: source descriptor record length %u < %u", + *err_info = ws_strdup_printf("k12: source descriptor record length %u < %u", rec_len, K12_SRCDESC_HWPART); destroy_k12_file_data(file_data); g_free(rec); @@ -991,7 +991,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { * field, including the variable-length parts. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: source descriptor record length %u < %u (%u + %u + %u + %u)", + *err_info = ws_strdup_printf("k12: source descriptor record length %u < %u (%u + %u + %u + %u)", rec_len, K12_SRCDESC_HWPART + hwpart_len + name_len + stack_len, K12_SRCDESC_HWPART, hwpart_len, name_len, stack_len); @@ -1004,7 +1004,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { if (hwpart_len < 4) { /* Hardware part isn't long enough to have a type field */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: source descriptor hardware part length %u < 4", + *err_info = ws_strdup_printf("k12: source descriptor hardware part length %u < 4", hwpart_len); destroy_k12_file_data(file_data); g_free(rec); @@ -1024,7 +1024,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { if (hwpart_len < K12_SRCDESC_ATM_VCI + 2) { /* Hardware part isn't long enough to have ATM information */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: source descriptor hardware part length %u < %u", + *err_info = ws_strdup_printf("k12: source descriptor hardware part length %u < %u", hwpart_len, K12_SRCDESC_ATM_VCI + 2); destroy_k12_file_data(file_data); diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c index c9357c0f56..6de5caac51 100644 --- a/wiretap/lanalyzer.c +++ b/wiretap/lanalyzer.c @@ -361,7 +361,7 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info) case RT_Summary: if (record_length < sizeof summary) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: summary record length %u is too short", + *err_info = ws_strdup_printf("lanalyzer: summary record length %u is too short", record_length); return WTAP_OPEN_ERROR; } @@ -406,14 +406,14 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info) break; default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("lanalyzer: board type %u unknown", + *err_info = ws_strdup_printf("lanalyzer: board type %u unknown", board_type); return WTAP_OPEN_ERROR; } if (found_summary) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: file has more than one summary record"); + *err_info = ws_strdup_printf("lanalyzer: file has more than one summary record"); return WTAP_OPEN_ERROR; } found_summary = TRUE; @@ -448,7 +448,7 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info) done: if (!found_summary) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: file has no summary record"); + *err_info = ws_strdup_printf("lanalyzer: file has no summary record"); return WTAP_OPEN_ERROR; } @@ -506,7 +506,7 @@ static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh, * after a Trace Packet Data Record, mark it as an error. */ if (record_type != RT_PacketData) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: record type %u seen after trace summary record", + *err_info = ws_strdup_printf("lanalyzer: record type %u seen after trace summary record", record_type); return FALSE; } @@ -517,7 +517,7 @@ static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh, * descriptor. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: file has a %u-byte record, too small to have even a packet descriptor", + *err_info = ws_strdup_printf("lanalyzer: file has a %u-byte record, too small to have even a packet descriptor", record_length); return FALSE; } diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 9099c143c3..34e74137bf 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -217,7 +217,7 @@ wtap_open_return_val libpcap_open(wtap *wth, int *err, gchar **err_info) if (hdr.version_major < 2) { /* We only support version 2.0 and later. */ *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("pcap: major version %u unsupported", + *err_info = ws_strdup_printf("pcap: major version %u unsupported", hdr.version_major); return WTAP_OPEN_ERROR; } @@ -329,7 +329,7 @@ wtap_open_return_val libpcap_open(wtap *wth, int *err, gchar **err_info) file_encap = wtap_pcap_encap_to_wtap_encap(hdr.network & 0x03FFFFFF); if (file_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("pcap: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("pcap: network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -853,7 +853,7 @@ libpcap_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, */ *err = WTAP_ERR_BAD_FILE; if (err_info != NULL) { - *err_info = g_strdup_printf("pcap: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("pcap: File has %u-byte packet, bigger than maximum of %u", hdr.hdr.incl_len, wtap_max_snaplen_for_encap(wth->file_encap)); } diff --git a/wiretap/log3gpp.c b/wiretap/log3gpp.c index 6b3d4a5321..5cab675eee 100644 --- a/wiretap/log3gpp.c +++ b/wiretap/log3gpp.c @@ -459,7 +459,7 @@ log3gpp_seek_read(wtap *wth, gint64 seek_off, /* If get here, must have failed */ *err = errno; - *err_info = g_strdup_printf("prot 3gpp: seek_read failed to read/parse " + *err_info = ws_strdup_printf("prot 3gpp: seek_read failed to read/parse " "line at position %" PRId64, seek_off); return FALSE; diff --git a/wiretap/logcat_text.c b/wiretap/logcat_text.c index 25f6907f1b..db982c8c50 100644 --- a/wiretap/logcat_text.c +++ b/wiretap/logcat_text.c @@ -108,28 +108,28 @@ static gchar *logcat_log(const struct dumper_t *dumper, guint32 seconds, switch (dumper->type) { case WTAP_ENCAP_LOGCAT_BRIEF: - return g_strdup_printf("%c/%-8s(%5i): %s\n", + return ws_strdup_printf("%c/%-8s(%5i): %s\n", priority, tag, pid, log); case WTAP_ENCAP_LOGCAT_PROCESS: /* NOTE: Last parameter should be "process name", not tag; Unfortunately, we do not have process name */ - return g_strdup_printf("%c(%5i) %s (%s)\n", + return ws_strdup_printf("%c(%5i) %s (%s)\n", priority, pid, log, ""); case WTAP_ENCAP_LOGCAT_TAG: - return g_strdup_printf("%c/%-8s: %s\n", + return ws_strdup_printf("%c/%-8s: %s\n", priority, tag, log); case WTAP_ENCAP_LOGCAT_THREAD: - return g_strdup_printf("%c(%5i:%5i) %s\n", + return ws_strdup_printf("%c(%5i:%5i) %s\n", priority, pid, tid, log); case WTAP_ENCAP_LOGCAT_TIME: tm = gmtime(&datetime); if (tm != NULL) { strftime(time_buffer, sizeof(time_buffer), "%m-%d %H:%M:%S", tm); - return g_strdup_printf("%s.%03i %c/%-8s(%5i): %s\n", + return ws_strdup_printf("%s.%03i %c/%-8s(%5i): %s\n", time_buffer, milliseconds, priority, tag, pid, log); } else { - return g_strdup_printf("Not representable %c/%-8s(%5i): %s\n", + return ws_strdup_printf("Not representable %c/%-8s(%5i): %s\n", priority, tag, pid, log); } case WTAP_ENCAP_LOGCAT_THREADTIME: @@ -137,10 +137,10 @@ static gchar *logcat_log(const struct dumper_t *dumper, guint32 seconds, if (tm != NULL) { strftime(time_buffer, sizeof(time_buffer), "%m-%d %H:%M:%S", tm); - return g_strdup_printf("%s.%03i %5i %5i %c %-8s: %s\n", + return ws_strdup_printf("%s.%03i %5i %5i %c %-8s: %s\n", time_buffer, milliseconds, pid, tid, priority, tag, log); } else { - return g_strdup_printf("Not representable %5i %5i %c %-8s: %s\n", + return ws_strdup_printf("Not representable %5i %5i %c %-8s: %s\n", pid, tid, priority, tag, log); } case WTAP_ENCAP_LOGCAT_LONG: @@ -148,10 +148,10 @@ static gchar *logcat_log(const struct dumper_t *dumper, guint32 seconds, if (tm != NULL) { strftime(time_buffer, sizeof(time_buffer), "%m-%d %H:%M:%S", tm); - return g_strdup_printf("[ %s.%03i %5i:%5i %c/%-8s ]\n%s\n\n", + return ws_strdup_printf("[ %s.%03i %5i:%5i %c/%-8s ]\n%s\n\n", time_buffer, milliseconds, pid, tid, priority, tag, log); } else { - return g_strdup_printf("[ Not representable %5i:%5i %c/%-8s ]\n%s\n\n", + return ws_strdup_printf("[ Not representable %5i:%5i %c/%-8s ]\n%s\n\n", pid, tid, priority, tag, log); } default: @@ -522,7 +522,7 @@ static gboolean logcat_text_dump_text(wtap_dumper *wdh, msg_begin = msg_payload + msg_pre_skip; } else { *err = WTAP_ERR_UNWRITABLE_REC_DATA; - *err_info = g_strdup_printf("logcat: version %d isn't supported", + *err_info = ws_strdup_printf("logcat: version %d isn't supported", logcat_version); return FALSE; } diff --git a/wiretap/netmon.c b/wiretap/netmon.c index df3bf02c62..e3628d00b7 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -454,7 +454,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: major version %u unsupported", hdr.ver_major); + *err_info = ws_strdup_printf("netmon: major version %u unsupported", hdr.ver_major); return WTAP_OPEN_ERROR; } @@ -462,7 +462,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) if (hdr.network >= NUM_NETMON_ENCAPS || netmon_encap[hdr.network] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("netmon: network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -554,13 +554,13 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) frame_table_size = frame_table_length / (guint32)sizeof (guint32); if ((frame_table_size * sizeof (guint32)) != frame_table_length) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: frame table length is %u, which is not a multiple of the size of an entry", + *err_info = ws_strdup_printf("netmon: frame table length is %u, which is not a multiple of the size of an entry", frame_table_length); return WTAP_OPEN_ERROR; } if (frame_table_size == 0) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: frame table length is %u, which means it's less than one entry in size", + *err_info = ws_strdup_printf("netmon: frame table length is %u, which means it's less than one entry in size", frame_table_length); return WTAP_OPEN_ERROR; } @@ -579,7 +579,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) */ if (frame_table_size > 512*1024*1024) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: frame table length is %u, which is larger than we support", + *err_info = ws_strdup_printf("netmon: frame table length is %u, which is larger than we support", frame_table_length); return WTAP_OPEN_ERROR; } @@ -600,21 +600,21 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) */ if (comment_table_size > 512*1024*1024) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment table size is %u, which is larger than we support", + *err_info = ws_strdup_printf("netmon: comment table size is %u, which is larger than we support", comment_table_size); return WTAP_OPEN_ERROR; } if (comment_table_size < 17) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment table size is %u, which is too small to use", + *err_info = ws_strdup_printf("netmon: comment table size is %u, which is too small to use", comment_table_size); return WTAP_OPEN_ERROR; } if (comment_table_offset > file_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment table offset (%u) is larger than file", + *err_info = ws_strdup_printf("netmon: comment table offset (%u) is larger than file", comment_table_offset); return WTAP_OPEN_ERROR; } @@ -631,14 +631,14 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) */ if (process_info_table_count > 512*1024) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: process info table size is %u, which is larger than we support", + *err_info = ws_strdup_printf("netmon: process info table size is %u, which is larger than we support", process_info_table_count); return WTAP_OPEN_ERROR; } if (process_info_table_offset > file_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: process info table offset (%u) is larger than file", + *err_info = ws_strdup_printf("netmon: process info table offset (%u) is larger than file", process_info_table_offset); return WTAP_OPEN_ERROR; } @@ -711,7 +711,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) } if (title_length > comment_table_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment title size is %u, which is larger than the amount remaining in the comment section (%u)", + *err_info = ws_strdup_printf("netmon: comment title size is %u, which is larger than the amount remaining in the comment section (%u)", title_length, comment_table_size); g_hash_table_destroy(comment_table); return WTAP_OPEN_ERROR; @@ -763,7 +763,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) /* Make sure comment size is sane */ if (comment_rec->descLength > comment_table_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment description size is %u, which is larger than the amount remaining in the comment section (%u)", + *err_info = ws_strdup_printf("netmon: comment description size is %u, which is larger than the amount remaining in the comment section (%u)", comment_rec->descLength, comment_table_size); g_hash_table_destroy(comment_table); return WTAP_OPEN_ERROR; @@ -823,7 +823,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) path_size = pletoh32(&tmp32); if (path_size > MATH_PROCINFO_PATH_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: Path size for process info record is %u, which is larger than allowed max value (%u)", + *err_info = ws_strdup_printf("netmon: Path size for process info record is %u, which is larger than allowed max value (%u)", path_size, MATH_PROCINFO_PATH_SIZE); g_free(process_info); g_hash_table_destroy(process_info_table); @@ -1071,7 +1071,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("netmon: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FAILURE; } @@ -1095,7 +1095,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: ATM file has a %u-byte packet, too small to have even an ATM pseudo-header", + *err_info = ws_strdup_printf("netmon: ATM file has a %u-byte packet, too small to have even an ATM pseudo-header", packet_size); return FAILURE; } @@ -1240,7 +1240,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, case 0xE089: // "Pef Ndis Msg"; case 0xE08A: // "Pef Ndis Wifi Meta Msg"; *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: network type %u unknown or unsupported", network); + *err_info = ws_strdup_printf("netmon: network type %u unknown or unsupported", network); return FAILURE; case 0xE083: pkt_encap = WTAP_ENCAP_MA_WFP_CAPTURE_V4; @@ -1273,7 +1273,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, pkt_encap = wtap_pcap_encap_to_wtap_encap(network); if (pkt_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: converted pcap network type %u unknown or unsupported", + *err_info = ws_strdup_printf("netmon: converted pcap network type %u unknown or unsupported", network); return FAILURE; } @@ -1284,7 +1284,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, pkt_encap = netmon_encap[network]; if (pkt_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("netmon: network type %u unknown or unsupported", network); return FAILURE; } @@ -1343,7 +1343,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("netmon: network type %u unknown or unsupported", network); return FAILURE; } diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c index 084413b826..d0b6395cba 100644 --- a/wiretap/netscreen.c +++ b/wiretap/netscreen.c @@ -288,7 +288,7 @@ parse_netscreen_packet(FILE_T fh, wtap_rec *rec, Buffer* buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netscreen: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("netscreen: File has %u-byte packet, bigger than maximum of %u", (guint)pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/nettl.c b/wiretap/nettl.c index e9b43a82aa..e2b5a472c1 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -337,7 +337,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, hdr_len = g_ntohs(rec_hdr.hdr_len); if (hdr_len < NETTL_REC_HDR_LEN) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettl: record header length %u too short", + *err_info = ws_strdup_printf("nettl: record header length %u too short", hdr_len); return FALSE; } @@ -537,7 +537,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, if (length < padlen) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u", + *err_info = ws_strdup_printf("nettl: packet length %u in record header too short, less than %u", length, padlen); return FALSE; } @@ -547,7 +547,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, rec->rec_header.packet_header.len = length - padlen; if (caplen < padlen) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u", + *err_info = ws_strdup_printf("nettl: captured length %u in record header too short, less than %u", caplen, padlen); return FALSE; } @@ -568,7 +568,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u", rec->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/nettrace_3gpp_32_423.c b/wiretap/nettrace_3gpp_32_423.c index 235bfba2a2..7bf214514b 100644 --- a/wiretap/nettrace_3gpp_32_423.c +++ b/wiretap/nettrace_3gpp_32_423.c @@ -249,7 +249,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re /* We should always and only be called with a payload */ if (0 != strncmp(input, c_s_msg, CLEN(c_s_msg))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Did not start with \"%s\"", c_s_msg); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Did not start with \"%s\"", c_s_msg); return FALSE; } @@ -288,7 +288,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re if (!next_msg_pos) { /* Something's wrong, bail out */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_e_msg); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_e_msg); status = FALSE; goto end; } @@ -331,7 +331,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re name_str_len = (int)(next_pos - curr_pos); if (name_str_len > MAX_NAME_LEN) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: name_str_len > %d", MAX_NAME_LEN); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: name_str_len > %d", MAX_NAME_LEN); goto end; } @@ -377,14 +377,14 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re raw_msg_pos = STRNSTR(start_msg_tag_cont, c_s_rawmsg); if (raw_msg_pos == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_s_rawmsg); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_s_rawmsg); status = FALSE; goto end; } curr_pos = STRNSTR(raw_msg_pos, c_protocol); if (curr_pos == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_protocol); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_protocol); status = FALSE; goto end; } @@ -612,7 +612,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re } else { /* Something wrong, bail out */ - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Could not parse hex data, bufsize %u index %u %c%c", + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Could not parse hex data, bufsize %u index %u %c%c", (pkt_data_len + exp_pdu_tags_len), i, chr1, @@ -681,7 +681,7 @@ nettrace_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, */ msg_start = g_strrstr_len(buf_start, (guint)(msg_end - buf_start), c_s_msg); if (msg_start == NULL || msg_start > msg_end) { - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Found \"%s\" without matching \"%s\"", c_e_msg, c_s_msg); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Found \"%s\" without matching \"%s\"", c_e_msg, c_s_msg); *err = WTAP_ERR_BAD_FILE; goto end; } diff --git a/wiretap/netxray.c b/wiretap/netxray.c index f62734420c..0aa59bc1e5 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -530,7 +530,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) file_type = netxray_2_00x_file_type_subtype; } else { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: version \"%.8s\" unsupported", hdr.version); + *err_info = ws_strdup_printf("netxray: version \"%.8s\" unsupported", hdr.version); return WTAP_OPEN_ERROR; } } @@ -558,7 +558,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: the byte after the network type has the value %u, which I don't understand", + *err_info = ws_strdup_printf("netxray: the byte after the network type has the value %u, which I don't understand", hdr.network_plus); return WTAP_OPEN_ERROR; } @@ -566,7 +566,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (network_type >= NUM_NETXRAY_ENCAPS || netxray_encap[network_type] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: network type %u (%u) unknown or unsupported", + *err_info = ws_strdup_printf("netxray: network type %u (%u) unknown or unsupported", network_type, hdr.network_plus); return WTAP_OPEN_ERROR; } @@ -602,7 +602,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: /* "Can't happen" - we rejected that above */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("netxray: version %d.%d somehow didn't get rejected", + *err_info = ws_strdup_printf("netxray: version %d.%d somehow didn't get rejected", version_major, version_minor); return WTAP_OPEN_ERROR; } @@ -623,7 +623,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) case CAPTYPE_NDIS: if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/CAPTYPE_NDIS version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -647,7 +647,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS_GIGPOD || TpS_gigpod[hdr.timeunit] == 0.0) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/ETH_CAPTYPE_GIGPOD version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -667,7 +667,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS_OTHERPOD || TpS_otherpod[hdr.timeunit] == 0.0) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/ETH_CAPTYPE_OTHERPOD version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -687,7 +687,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS_OTHERPOD2 || TpS_otherpod2[hdr.timeunit] == 0.0) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/ETH_CAPTYPE_OTHERPOD2 version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -709,7 +709,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS_GIGPOD2 || TpS_gigpod2[hdr.timeunit] == 0.0) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/ETH_CAPTYPE_GIGPOD2 version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -729,7 +729,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown capture type %u for Ethernet version %.8s capture", hdr.captype, hdr.version); return WTAP_OPEN_ERROR; @@ -739,7 +739,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for %u/%u version %.8s capture", hdr.timeunit, network_type, hdr.captype, hdr.version); @@ -766,7 +766,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) } else { /* "Can't happen" - we rejected that above */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("netxray: version %d.%d somehow didn't get rejected", + *err_info = ws_strdup_printf("netxray: version %d.%d somehow didn't get rejected", version_major, version_minor); return WTAP_OPEN_ERROR; } @@ -836,7 +836,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: WAN HDLC capture subsubtype 0x%02x unknown or unsupported", + *err_info = ws_strdup_printf("netxray: WAN HDLC capture subsubtype 0x%02x unknown or unsupported", hdr.wan_hdlc_subsub_captype); return WTAP_OPEN_ERROR; } @@ -858,7 +858,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: WAN capture subtype 0x%02x unknown or unsupported", + *err_info = ws_strdup_printf("netxray: WAN capture subtype 0x%02x unknown or unsupported", hdr.captype); return WTAP_OPEN_ERROR; } diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index bc92244235..22972740b6 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -613,7 +613,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info) if (version.network >= NUM_NGSNIFF_ENCAPS || sniffer_encap[version.network] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("ngsniffer: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("ngsniffer: network type %u unknown or unsupported", version.network); return WTAP_OPEN_ERROR; } @@ -621,7 +621,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info) /* Check the time unit */ if (version.timeunit >= NUM_NGSNIFF_TIMEUNITS) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("ngsniffer: Unknown timeunit %u", version.timeunit); + *err_info = ws_strdup_printf("ngsniffer: Unknown timeunit %u", version.timeunit); return WTAP_OPEN_ERROR; } @@ -911,7 +911,7 @@ process_rec_header2_v2(wtap *wth, unsigned char *buffer, guint16 length, wth->file_encap = WTAP_ENCAP_LAPB; } else { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("ngsniffer: WAN capture protocol string %.*s unknown", + *err_info = ws_strdup_printf("ngsniffer: WAN capture protocol string %.*s unknown", length, buffer); return -1; } @@ -1018,7 +1018,7 @@ process_rec_header2_v145(wtap *wth, unsigned char *buffer, guint16 length, * Reject these until we can figure them out. */ *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("ngsniffer: WAN network subtype %u unknown or unsupported", + *err_info = ws_strdup_printf("ngsniffer: WAN network subtype %u unknown or unsupported", buffer[4]); return -1; } diff --git a/wiretap/observer.c b/wiretap/observer.c index 2817fedd4f..03872a87aa 100644 --- a/wiretap/observer.c +++ b/wiretap/observer.c @@ -159,7 +159,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) * The packet data begins before the file header ends. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: The first packet begins in the middle of the file header"); + *err_info = ws_strdup_printf("Observer: The first packet begins in the middle of the file header"); return WTAP_OPEN_ERROR; } @@ -182,7 +182,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) * but we have the IE header to read. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: TLVs run into the first packet data"); + *err_info = ws_strdup_printf("Observer: TLVs run into the first packet data"); return WTAP_OPEN_ERROR; } @@ -194,7 +194,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) if (tlvh.length < sizeof tlvh) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (TLV length %u < %zu)", + *err_info = ws_strdup_printf("Observer: bad record (TLV length %u < %zu)", tlvh.length, sizeof tlvh); return WTAP_OPEN_ERROR; } @@ -210,7 +210,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) * but we have the IE data to read. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: TLVs run into the first packet data"); + *err_info = ws_strdup_printf("Observer: TLVs run into the first packet data"); return WTAP_OPEN_ERROR; } @@ -220,7 +220,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) case INFORMATION_TYPE_TIME_INFO: if (tlv_data_length != sizeof private_state->time_format) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (time information TLV length %u != %zu)", + *err_info = ws_strdup_printf("Observer: bad record (time information TLV length %u != %zu)", tlvh.length, sizeof tlvh + sizeof private_state->time_format); return WTAP_OPEN_ERROR; @@ -268,7 +268,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) * EOF, so there *are* no records. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: No records in the file, so we can't determine the link-layer type"); + *err_info = ws_strdup_printf("Observer: No records in the file, so we can't determine the link-layer type"); } return WTAP_OPEN_ERROR; } @@ -277,14 +277,14 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) /* check the packet's magic number */ if (packet_header.packet_magic != observer_packet_magic) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("Observer: unsupported packet version %ul", packet_header.packet_magic); + *err_info = ws_strdup_printf("Observer: unsupported packet version %ul", packet_header.packet_magic); return WTAP_OPEN_ERROR; } /* check the data link type */ if (observer_to_wtap_encap(packet_header.network_type) == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("Observer: network type %u unknown or unsupported", packet_header.network_type); + *err_info = ws_strdup_printf("Observer: network type %u unknown or unsupported", packet_header.network_type); return WTAP_OPEN_ERROR; } wth->file_encap = observer_to_wtap_encap(packet_header.network_type); @@ -307,7 +307,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) err_str = init_gmt_to_localtime_offset(); if (err_str != NULL) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("observer: %s", err_str); + *err_info = ws_strdup_printf("observer: %s", err_str); return WTAP_OPEN_ERROR; } @@ -442,7 +442,7 @@ read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header } *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record: Invalid magic number 0x%08x", + *err_info = ws_strdup_printf("Observer: bad record: Invalid magic number 0x%08x", packet_header->packet_magic); return -1; } @@ -475,7 +475,7 @@ read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header if (tlvh.length < sizeof tlvh) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (TLV length %u < %zu)", + *err_info = ws_strdup_printf("Observer: bad record (TLV length %u < %zu)", tlvh.length, sizeof tlvh); return -1; } @@ -486,7 +486,7 @@ read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header case INFORMATION_TYPE_WIRELESS: if (tlv_data_length != sizeof wireless_header) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (wireless TLV length %u != %zu)", + *err_info = ws_strdup_printf("Observer: bad record (wireless TLV length %u != %zu)", tlvh.length, sizeof tlvh + sizeof wireless_header); return -1; } @@ -575,7 +575,7 @@ process_packet_header(wtap *wth, packet_entry_header *packet_header, */ if (packet_header->network_size < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record: Packet length %u < 4", + *err_info = ws_strdup_printf("Observer: bad record: Packet length %u < 4", packet_header->network_size); return FALSE; } @@ -632,7 +632,7 @@ read_packet_data(FILE_T fh, int offset_to_frame, int current_offset_from_packet_ /* validate offsets */ if (offset_to_frame < current_offset_from_packet_header) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (offset to packet data %d < %d)", + *err_info = ws_strdup_printf("Observer: bad record (offset to packet data %d < %d)", offset_to_frame, current_offset_from_packet_header); return -1; } @@ -663,7 +663,7 @@ skip_to_next_packet(wtap *wth, int offset_to_next_packet, int current_offset_fro /* validate offsets */ if (offset_to_next_packet < current_offset_from_packet_header) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (offset to next packet %d < %d)", + *err_info = ws_strdup_printf("Observer: bad record (offset to next packet %d < %d)", offset_to_next_packet, current_offset_from_packet_header); return FALSE; } @@ -797,7 +797,7 @@ static gboolean observer_dump_open(wtap_dumper *wdh, int *err, err_str = init_gmt_to_localtime_offset(); if (err_str != NULL) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("observer: %s", err_str); + *err_info = ws_strdup_printf("observer: %s", err_str); return FALSE; } diff --git a/wiretap/packetlogger.c b/wiretap/packetlogger.c index 54cdec3900..a657903640 100644 --- a/wiretap/packetlogger.c +++ b/wiretap/packetlogger.c @@ -351,7 +351,7 @@ packetlogger_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, if (pl_hdr.len < 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("packetlogger: record length %u is too small", pl_hdr.len); + *err_info = ws_strdup_printf("packetlogger: record length %u is too small", pl_hdr.len); return FALSE; } if (pl_hdr.len - 8 > WTAP_MAX_PACKET_SIZE_STANDARD) { @@ -360,7 +360,7 @@ packetlogger_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("packetlogger: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("packetlogger: File has %u-byte packet, bigger than maximum of %u", pl_hdr.len - 8, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index 2f9a1dcfab..5c28343061 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -808,7 +808,7 @@ pcap_read_nokiaatm_pseudoheader(FILE_T fh, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: Nokia IPSO ATM file has a %u-byte packet, too small to have even an ATM pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: Nokia IPSO ATM file has a %u-byte packet, too small to have even an ATM pseudo-header", packet_size); return -1; } @@ -855,7 +855,7 @@ pcap_read_sunatm_pseudoheader(FILE_T fh, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: SunATM file has a %u-byte packet, too small to have even an ATM pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: SunATM file has a %u-byte packet, too small to have even an ATM pseudo-header", packet_size); return -1; } @@ -999,7 +999,7 @@ pcap_read_irda_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: IrDA file has a %u-byte packet, too small to have even an IrDA pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: IrDA file has a %u-byte packet, too small to have even an IrDA pseudo-header", packet_size); return -1; } @@ -1056,7 +1056,7 @@ pcap_read_mtp2_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: MTP2 file has a %u-byte packet, too small to have even an MTP2 pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: MTP2 file has a %u-byte packet, too small to have even an MTP2 pseudo-header", packet_size); return -1; } @@ -1116,7 +1116,7 @@ pcap_read_lapd_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: LAPD file has a %u-byte packet, too small to have even a LAPD pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: LAPD file has a %u-byte packet, too small to have even a LAPD pseudo-header", packet_size); return -1; } @@ -1178,7 +1178,7 @@ pcap_read_sita_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: SITA file has a %u-byte packet, too small to have even a SITA pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: SITA file has a %u-byte packet, too small to have even a SITA pseudo-header", packet_size); return -1; } @@ -1238,7 +1238,7 @@ pcap_read_bt_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: Bluetooth file has a %u-byte packet, too small to have even a pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: Bluetooth file has a %u-byte packet, too small to have even a pseudo-header", packet_size); return -1; } @@ -1286,7 +1286,7 @@ pcap_read_bt_monitor_pseudoheader(FILE_T fh, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: Bluetooth monitor file has a %u-byte packet, too small to have even a pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: Bluetooth monitor file has a %u-byte packet, too small to have even a pseudo-header", packet_size); return -1; } @@ -1330,7 +1330,7 @@ pcap_read_llcp_pseudoheader(FILE_T fh, if (packet_size < LLCP_HEADER_LEN) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: NFC LLCP file has a %u-byte packet, too small to have even a pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: NFC LLCP file has a %u-byte packet, too small to have even a pseudo-header", packet_size); return -1; } @@ -1377,7 +1377,7 @@ pcap_read_ppp_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: PPP file has a %u-byte packet, too small to have even a pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: PPP file has a %u-byte packet, too small to have even a pseudo-header", packet_size); return -1; } @@ -1418,7 +1418,7 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to have even an ERF pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to have even an ERF pseudo-header", packet_size); return -1; } @@ -1469,13 +1469,13 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, do { if (phdr_len > INT_MAX - 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", INT_MAX); return -1; } if (packet_size < (guint)phdr_len + 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the extension headers", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the extension headers", packet_size); return -1; } @@ -1505,13 +1505,13 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, /* Extract the Multi Channel header to include it in the pseudo header part */ if (phdr_len > INT_MAX - (int)sizeof(erf_mc_header_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", INT_MAX); return -1; } if (packet_size < (guint)(phdr_len + (int)sizeof(erf_mc_header_t))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the Multi Channel header", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the Multi Channel header", packet_size); return -1; } @@ -1524,13 +1524,13 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, /* Extract the AAL2 header to include it in the pseudo header part */ if (phdr_len > INT_MAX - (int)sizeof(erf_aal2_header_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", INT_MAX); return -1; } if (packet_size < (guint)(phdr_len + (int)sizeof(erf_aal2_header_t))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the AAL2 header", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the AAL2 header", packet_size); return -1; } @@ -1546,13 +1546,13 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, /* Extract the Ethernet additional header to include it in the pseudo header part */ if (phdr_len > INT_MAX - (int)sizeof(erf_eth_header_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", INT_MAX); return -1; } if (packet_size < (guint)(phdr_len + (int)sizeof(erf_eth_header_t))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the Ethernet additional header", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the Ethernet additional header", packet_size); return -1; } @@ -1682,7 +1682,7 @@ pcap_read_i2c_linux_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_hea * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: I2C file has a %u-byte packet, too small to have even a I2C pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: I2C file has a %u-byte packet, too small to have even a I2C pseudo-header", packet_size); return -1; } diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index 8af358d1a0..604b348e09 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -797,7 +797,7 @@ pcapng_process_custom_option(wtapng_block_t *wblock, if (option_length < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: option length (%d) too small for custom option", + *err_info = ws_strdup_printf("pcapng: option length (%d) too small for custom option", option_length); return FALSE; } @@ -826,7 +826,7 @@ pcapng_process_custom_option(wtapng_block_t *wblock, * us. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("pcapng: invalid byte order %d passed to pcapng_process_custom_option()", + *err_info = ws_strdup_printf("pcapng: invalid byte order %d passed to pcapng_process_custom_option()", byte_order); return FALSE; } @@ -934,7 +934,7 @@ pcapng_process_options(FILE_T fh, wtapng_block_t *wblock, /* Sanity check: don't run past the end of the options. */ if (sizeof (*oh) > opt_bytes_remaining) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: Not enough data for option header"); + *err_info = ws_strdup_printf("pcapng: Not enough data for option header"); g_free(option_content); return FALSE; } @@ -962,7 +962,7 @@ pcapng_process_options(FILE_T fh, wtapng_block_t *wblock, default: /* Don't do that. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("pcapng: invalid byte order %d passed to pcapng_process_options()", + *err_info = ws_strdup_printf("pcapng: invalid byte order %d passed to pcapng_process_options()", byte_order); return FALSE; } @@ -975,7 +975,7 @@ pcapng_process_options(FILE_T fh, wtapng_block_t *wblock, /* Sanity check: don't run past the end of the options. */ if (rounded_option_length > opt_bytes_remaining) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: Not enough data to handle option of length %u", + *err_info = ws_strdup_printf("pcapng: Not enough data to handle option of length %u", option_length); g_free(option_content); return FALSE; @@ -1129,7 +1129,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, default: /* Not a "pcapng" magic number we know about. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: unknown byte-order magic number 0x%08x", shb.magic); + *err_info = ws_strdup_printf("pcapng: unknown byte-order magic number 0x%08x", shb.magic); /* * See above comment about PCAPNG_BLOCK_NOT_SHB. @@ -1153,7 +1153,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an SHB is less than the minimum SHB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an SHB is less than the minimum SHB size %u", bh->block_total_length, MIN_SHB_SIZE); return PCAPNG_BLOCK_ERROR; } @@ -1170,7 +1170,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, likely to be treated as bad pcapng files. */ if (bh->block_total_length > MAX_BLOCK_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u is too large (> %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u is too large (> %u)", bh->block_total_length, MAX_BLOCK_SIZE); return PCAPNG_BLOCK_ERROR; } @@ -1192,7 +1192,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, if (!(version_major == 1 && (version_minor == 0 || version_minor == 2))) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("pcapng: unknown SHB version %u.%u", + *err_info = ws_strdup_printf("pcapng: unknown SHB version %u.%u", version_major, version_minor); return PCAPNG_BLOCK_ERROR; } @@ -1284,7 +1284,7 @@ pcapng_process_if_descr_block_option(wtapng_block_t *wblock, case(OPT_IDB_FILTER): /* if_filter */ if (option_length < 1) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block verdict option length %u is < 1", + *err_info = ws_strdup_printf("pcapng: packet block verdict option length %u is < 1", option_length); /* XXX - free anything? */ return FALSE; @@ -1436,7 +1436,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an IDB is less than the minimum IDB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an IDB is less than the minimum IDB size %u", bh->block_total_length, MIN_IDB_SIZE); return FALSE; } @@ -1610,7 +1610,7 @@ pcapng_read_decryption_secrets_block(FILE_T fh, pcapng_block_header_t *bh, /* Sanity check: assume the secrets are not larger than 1 GiB */ if (dsb_mand->secrets_len > 1024 * 1024 * 1024) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: secrets block is too large: %u", dsb_mand->secrets_len); + *err_info = ws_strdup_printf("pcapng: secrets block is too large: %u", dsb_mand->secrets_len); return FALSE; } dsb_mand->secrets_data = (guint8 *)g_malloc0(dsb_mand->secrets_len); @@ -1666,7 +1666,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_FLAGS): if (option_length != 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block flags option length %u is not 4", + *err_info = ws_strdup_printf("pcapng: packet block flags option length %u is not 4", option_length); /* XXX - free anything? */ return FALSE; @@ -1683,7 +1683,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_DROPCOUNT): if (option_length != 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block drop count option length %u is not 8", + *err_info = ws_strdup_printf("pcapng: packet block drop count option length %u is not 8", option_length); /* XXX - free anything? */ return FALSE; @@ -1696,7 +1696,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_PACKETID): if (option_length != 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block packet id option length %u is not 8", + *err_info = ws_strdup_printf("pcapng: packet block packet id option length %u is not 8", option_length); /* XXX - free anything? */ return FALSE; @@ -1709,7 +1709,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_QUEUE): if (option_length != 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block queue option length %u is not 4", + *err_info = ws_strdup_printf("pcapng: packet block queue option length %u is not 4", option_length); /* XXX - free anything? */ return FALSE; @@ -1722,7 +1722,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_VERDICT): if (option_length < 1) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block verdict option length %u is < 1", + *err_info = ws_strdup_printf("pcapng: packet block verdict option length %u is < 1", option_length); /* XXX - free anything? */ return FALSE; @@ -1740,7 +1740,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_VERDICT_TYPE_TC): if (option_length != 9) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block TC verdict option length %u is != 9", + *err_info = ws_strdup_printf("pcapng: packet block TC verdict option length %u is != 9", option_length); /* XXX - free anything? */ return FALSE; @@ -1759,7 +1759,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_VERDICT_TYPE_XDP): if (option_length != 9) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block XDP verdict option length %u is != 9", + *err_info = ws_strdup_printf("pcapng: packet block XDP verdict option length %u is != 9", option_length); /* XXX - free anything? */ return FALSE; @@ -1826,7 +1826,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an EPB is less than the minimum EPB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an EPB is less than the minimum EPB size %u", bh->block_total_length, MIN_EPB_SIZE); return FALSE; } @@ -1862,7 +1862,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a PB is less than the minimum PB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of a PB is less than the minimum PB size %u", bh->block_total_length, MIN_PB_SIZE); return FALSE; } @@ -1909,7 +1909,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an EPB is too small for %u bytes of packet data", + *err_info = ws_strdup_printf("pcapng: total block length %u of an EPB is too small for %u bytes of packet data", bh->block_total_length, packet.cap_len); return FALSE; } @@ -1920,7 +1920,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a PB is too small for %u bytes of packet data", + *err_info = ws_strdup_printf("pcapng: total block length %u of a PB is too small for %u bytes of packet data", bh->block_total_length, packet.cap_len); return FALSE; } @@ -1933,7 +1933,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, if (packet.interface_id >= section_info->interfaces->len) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: interface index %u is not less than section interface count %u", + *err_info = ws_strdup_printf("pcapng: interface index %u is not less than section interface count %u", packet.interface_id, section_info->interfaces->len); return FALSE; @@ -1943,7 +1943,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, if (packet.cap_len > wtap_max_snaplen_for_encap(iface_info.wtap_encap)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: cap_len %u is larger than %u", + *err_info = ws_strdup_printf("pcapng: cap_len %u is larger than %u", packet.cap_len, wtap_max_snaplen_for_encap(iface_info.wtap_encap)); return FALSE; @@ -2064,7 +2064,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an SPB is less than the minimum SPB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an SPB is less than the minimum SPB size %u", bh->block_total_length, MIN_SPB_SIZE); return FALSE; } @@ -2117,14 +2117,14 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, * not a *minimum* length. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an SPB is too small for %u bytes of packet data", + *err_info = ws_strdup_printf("pcapng: total block length %u of an SPB is too small for %u bytes of packet data", bh->block_total_length, simple_packet.packet_len); return FALSE; } if (simple_packet.cap_len > wtap_max_snaplen_for_encap(iface_info.wtap_encap)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: cap_len %u is larger than %u", + *err_info = ws_strdup_printf("pcapng: cap_len %u is larger than %u", simple_packet.cap_len, wtap_max_snaplen_for_encap(iface_info.wtap_encap)); return FALSE; @@ -2294,7 +2294,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an NRB is less than the minimum NRB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an NRB is less than the minimum NRB size %u", bh->block_total_length, MIN_NRB_SIZE); return FALSE; } @@ -2322,7 +2322,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, if ((size_t)(to_read - block_read) < sizeof nrb) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: %d bytes left in the block < NRB record header size %u", + *err_info = ws_strdup_printf("pcapng: %d bytes left in the block < NRB record header size %u", to_read - block_read, (guint)sizeof nrb); return FALSE; @@ -2342,7 +2342,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, if (to_read - block_read < nrb.record_len + PADDING4(nrb.record_len)) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: %d bytes left in the block < NRB record length + padding %u", + *err_info = ws_strdup_printf("pcapng: %d bytes left in the block < NRB record length + padding %u", to_read - block_read, nrb.record_len + PADDING4(nrb.record_len)); return FALSE; @@ -2370,7 +2370,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, if (nrb.record_len < 4) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: NRB record length for IPv4 record %u < minimum length 4", + *err_info = ws_strdup_printf("pcapng: NRB record length for IPv4 record %u < minimum length 4", nrb.record_len); return FALSE; } @@ -2432,14 +2432,14 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, if (nrb.record_len < 16) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: NRB record length for IPv6 record %u < minimum length 16", + *err_info = ws_strdup_printf("pcapng: NRB record length for IPv6 record %u < minimum length 16", nrb.record_len); return FALSE; } if (to_read < nrb.record_len) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: NRB record length for IPv6 record %u > remaining data in NRB", + *err_info = ws_strdup_printf("pcapng: NRB record length for IPv6 record %u > remaining data in NRB", nrb.record_len); return FALSE; } @@ -2603,7 +2603,7 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an ISB is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of an ISB is too small (< %u)", bh->block_total_length, MIN_ISB_SIZE); return FALSE; } @@ -2671,7 +2671,7 @@ pcapng_read_nflx_custom_block(FILE_T fh, pcapng_block_header_t *bh, if (bh->block_total_length < MIN_NFLX_CB_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a Netflix CB is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a Netflix CB is too small (< %u)", bh->block_total_length, MIN_NFLX_CB_SIZE); return FALSE; } @@ -2704,7 +2704,7 @@ pcapng_read_nflx_custom_block(FILE_T fh, pcapng_block_header_t *bh, */ if (bh->block_total_length < MIN_NFLX_CB_SIZE + (guint32)sizeof(guint32)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a Netflix skip CB is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a Netflix skip CB is too small (< %u)", bh->block_total_length, MIN_NFLX_CB_SIZE + (guint32)sizeof(guint32)); return FALSE; @@ -2778,7 +2778,7 @@ pcapng_read_custom_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a CB is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a CB is too small (< %u)", bh->block_total_length, MIN_CB_SIZE); return FALSE; } @@ -2844,7 +2844,7 @@ pcapng_read_sysdig_event_block(FILE_T fh, pcapng_block_header_t *bh, if (bh->block_total_length < min_event_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a Sysdig event block is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a Sysdig event block is too small (< %u)", bh->block_total_length, min_event_size); return FALSE; } @@ -2937,7 +2937,7 @@ pcapng_read_systemd_journal_export_block(wtap *wth, FILE_T fh, pcapng_block_head if (bh->block_total_length < MIN_SYSTEMD_JOURNAL_EXPORT_BLOCK_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a systemd journal export block is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a systemd journal export block is too small (< %u)", bh->block_total_length, MIN_SYSTEMD_JOURNAL_EXPORT_BLOCK_SIZE); return FALSE; } @@ -2963,7 +2963,7 @@ pcapng_read_systemd_journal_export_block(wtap *wth, FILE_T fh, pcapng_block_head if (entry_length < MIN_SYSTEMD_JOURNAL_EXPORT_ENTRY_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: entry length %u is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: entry length %u is too small (< %u)", bh->block_total_length, MIN_SYSTEMD_JOURNAL_EXPORT_ENTRY_SIZE); return FALSE; } @@ -3032,7 +3032,7 @@ pcapng_read_unknown_block(FILE_T fh, pcapng_block_header_t *bh, if (bh->block_total_length < MIN_BLOCK_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an unknown block type is less than the minimum block size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an unknown block type is less than the minimum block size %u", bh->block_total_length, MIN_BLOCK_SIZE); return FALSE; } @@ -3100,7 +3100,7 @@ pcapng_read_and_check_block_trailer(FILE_T fh, pcapng_block_header_t *bh, if (block_total_length != bh->block_total_length) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block lengths (first %u and second %u) don't match", + *err_info = ws_strdup_printf("pcapng: total block lengths (first %u and second %u) don't match", bh->block_total_length, block_total_length); return FALSE; } @@ -3216,7 +3216,7 @@ pcapng_read_block(wtap *wth, FILE_T fh, pcapng_t *pn, We do that by imposing a maximum block size of MAX_BLOCK_SIZE. */ if (bh.block_total_length > MAX_BLOCK_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u is too large (> %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u is too large (> %u)", bh.block_total_length, MAX_BLOCK_SIZE); return FALSE; } @@ -4848,7 +4848,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec, * Our caller is doing something bad. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("pcapng: epb.interface_id (%u) >= wdh->interface_data->len (%u)", + *err_info = ws_strdup_printf("pcapng: epb.interface_id (%u) >= wdh->interface_data->len (%u)", epb.interface_id, wdh->interface_data->len); return FALSE; } @@ -4860,7 +4860,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec, * Our caller is doing something bad. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("pcapng: interface %u encap %d != packet encap %d", + *err_info = ws_strdup_printf("pcapng: interface %u encap %d != packet encap %d", epb.interface_id, int_data_mand->wtap_encap, rec->rec_header.packet_header.pkt_encap); diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c index 4c0b3fb38f..3fffc80caa 100644 --- a/wiretap/peekclassic.c +++ b/wiretap/peekclassic.c @@ -499,7 +499,7 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh, */ if (rec->rec_header.packet_header.len < RADIO_INFO_SIZE || rec->rec_header.packet_header.caplen < RADIO_INFO_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peekclassic: 802.11 packet has length < 4"); + *err_info = ws_strdup_printf("peekclassic: 802.11 packet has length < 4"); return -1; } rec->rec_header.packet_header.len -= RADIO_INFO_SIZE; @@ -551,7 +551,7 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh, */ if (rec->rec_header.packet_header.len < 4 || rec->rec_header.packet_header.caplen < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peekclassic: 802.11 packet has length < 8"); + *err_info = ws_strdup_printf("peekclassic: 802.11 packet has length < 8"); return -1; } rec->rec_header.packet_header.len -= 4; diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c index f7d940d690..ef9bbbc568 100644 --- a/wiretap/peektagged.c +++ b/wiretap/peektagged.c @@ -299,7 +299,7 @@ wtap_open_return_val peektagged_open(wtap *wth, int *err, gchar **err_info) if (fileVersion != 9) { /* We only support version 9. */ *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("peektagged: version %u unsupported", + *err_info = ws_strdup_printf("peektagged: version %u unsupported", fileVersion); return WTAP_OPEN_ERROR; } @@ -352,7 +352,7 @@ wtap_open_return_val peektagged_open(wtap *wth, int *err, gchar **err_info) if (mediaSubType >= NUM_PEEKTAGGED_ENCAPS || peektagged_encap[mediaSubType] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("peektagged: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("peektagged: network type %u unknown or unsupported", mediaSubType); return WTAP_OPEN_ERROR; } @@ -725,7 +725,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peektagged: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("peektagged: File has %u-byte packet, bigger than maximum of %u", sliceLength, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -857,7 +857,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, else { if (rec->rec_header.packet_header.len < 4 || rec->rec_header.packet_header.caplen < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peektagged: 802.11 packet has length < 4"); + *err_info = ws_strdup_printf("peektagged: 802.11 packet has length < 4"); return FALSE; } rec->rec_header.packet_header.pseudo_header.ieee_802_11.fcs_len = 0; @@ -876,7 +876,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, */ if (rec->rec_header.packet_header.len < 4 || rec->rec_header.packet_header.caplen < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peektagged: Ethernet packet has length < 4"); + *err_info = ws_strdup_printf("peektagged: Ethernet packet has length < 4"); return FALSE; } rec->rec_header.packet_header.pseudo_header.eth.fcs_len = 0; diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c index 1ce6368fa0..94cbaa4c91 100644 --- a/wiretap/pppdump.c +++ b/wiretap/pppdump.c @@ -433,7 +433,7 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd, if (num_written > PPPD_BUF_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", num_written, PPPD_BUF_SIZE); return -1; } @@ -528,7 +528,7 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd, if (pkt->cnt >= PPPD_BUF_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", pkt->cnt - 1, PPPD_BUF_SIZE); return -1; } @@ -698,7 +698,7 @@ collate(pppdump_t* state, FILE_T fh, int *err, gchar **err_info, guint8 *pd, default: /* XXX - bad file */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pppdump: bad ID byte 0x%02x", id); + *err_info = ws_strdup_printf("pppdump: bad ID byte 0x%02x", id); return FALSE; } diff --git a/wiretap/radcom.c b/wiretap/radcom.c index 28e78c5c11..1547a0ec21 100644 --- a/wiretap/radcom.c +++ b/wiretap/radcom.c @@ -201,7 +201,7 @@ wtap_open_return_val radcom_open(wtap *wth, int *err, gchar **err_info) wth->file_encap = WTAP_ENCAP_ATM_RFC1483; else { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("radcom: network type \"%.4s\" unknown", search_encap); + *err_info = ws_strdup_printf("radcom: network type \"%.4s\" unknown", search_encap); return WTAP_OPEN_ERROR; } diff --git a/wiretap/snoop.c b/wiretap/snoop.c index ee0d43d7da..cb2cd8910b 100644 --- a/wiretap/snoop.c +++ b/wiretap/snoop.c @@ -283,7 +283,7 @@ wtap_open_return_val snoop_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("snoop: version %u unsupported", hdr.version); + *err_info = ws_strdup_printf("snoop: version %u unsupported", hdr.version); return WTAP_OPEN_ERROR; } @@ -370,7 +370,7 @@ wtap_open_return_val snoop_open(wtap *wth, int *err, gchar **err_info) if (hdr.network >= NUM_SHOMITI_ENCAPS || shomiti_encap[hdr.network] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("snoop: Shomiti network type %u unknown or unsupported", + *err_info = ws_strdup_printf("snoop: Shomiti network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -379,7 +379,7 @@ wtap_open_return_val snoop_open(wtap *wth, int *err, gchar **err_info) if ((hdr.network^SNOOP_PRIVATE_BIT) >= NUM_SNOOP_PRIVATE_ENCAPS || snoop_private_encap[hdr.network^SNOOP_PRIVATE_BIT] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("snoop: private network type %u unknown or unsupported", + *err_info = ws_strdup_printf("snoop: private network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -388,7 +388,7 @@ wtap_open_return_val snoop_open(wtap *wth, int *err, gchar **err_info) if (hdr.network >= NUM_SNOOP_ENCAPS || snoop_encap[hdr.network] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("snoop: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("snoop: network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -517,7 +517,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: File has %u-byte original length, bigger than maximum of %u", + *err_info = ws_strdup_printf("snoop: File has %u-byte original length, bigger than maximum of %u", orig_size, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -527,7 +527,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("snoop: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -536,7 +536,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * Probably a corrupt capture file. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: File has %u-byte packet, bigger than record size %u", + *err_info = ws_strdup_printf("snoop: File has %u-byte packet, bigger than record size %u", packet_size, rec_size); return -1; } @@ -556,7 +556,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: atmsnoop file has a %u-byte packet, too small to have even an ATM pseudo-header", + *err_info = ws_strdup_printf("snoop: atmsnoop file has a %u-byte packet, too small to have even an ATM pseudo-header", packet_size); return -1; } @@ -591,7 +591,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: Shomiti wireless file has a %u-byte packet, too small to have even a wireless pseudo-header", + *err_info = ws_strdup_printf("snoop: Shomiti wireless file has a %u-byte packet, too small to have even a wireless pseudo-header", packet_size); return -1; } @@ -621,7 +621,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * What, *negative* padding? Bogus. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: File has %u-byte record with packet size of %u", + *err_info = ws_strdup_printf("snoop: File has %u-byte record with packet size of %u", rec_size, packet_size); return -1; } @@ -751,7 +751,7 @@ snoop_read_shomiti_wireless_pseudoheader(FILE_T fh, */ if (whdr.pad[3] < 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: Header length in Surveyor record is %u, less than minimum of 8", + *err_info = ws_strdup_printf("snoop: Header length in Surveyor record is %u, less than minimum of 8", whdr.pad[3]); return FALSE; } diff --git a/wiretap/stanag4607.c b/wiretap/stanag4607.c index a22992af78..0edbcd1dd4 100644 --- a/wiretap/stanag4607.c +++ b/wiretap/stanag4607.c @@ -77,7 +77,7 @@ static gboolean stanag4607_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("stanag4607: File has %" PRIu32 "d-byte packet, " + *err_info = ws_strdup_printf("stanag4607: File has %" PRIu32 "d-byte packet, " "bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -87,7 +87,7 @@ static gboolean stanag4607_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, * infinitely if the size is zero. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("stanag4607: File has %" PRIu32 "d-byte packet, " + *err_info = ws_strdup_printf("stanag4607: File has %" PRIu32 "d-byte packet, " "smaller than minimum of %u", packet_size, PKT_HDR_SIZE+SEG_HDR_SIZE); return FALSE; } diff --git a/wiretap/systemd_journal.c b/wiretap/systemd_journal.c index 98f51ccd59..1cce5e5919 100644 --- a/wiretap/systemd_journal.c +++ b/wiretap/systemd_journal.c @@ -195,7 +195,7 @@ systemd_journal_read_export_entry(FILE_T fh, wtap_rec *rec, Buffer *buf, int *er // Start of binary data. if (fld_end >= MAX_EXPORT_ENTRY_LENGTH - 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("systemd: binary length too long"); + *err_info = ws_strdup_printf("systemd: binary length too long"); return FALSE; } guint64 data_len, le_data_len; @@ -207,7 +207,7 @@ systemd_journal_read_export_entry(FILE_T fh, wtap_rec *rec, Buffer *buf, int *er data_len = pletoh64(&le_data_len); if (data_len < 1 || data_len - 1 >= MAX_EXPORT_ENTRY_LENGTH - fld_end) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("systemd: binary data too long"); + *err_info = ws_strdup_printf("systemd: binary data too long"); return FALSE; } // Data + trailing \n diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c index 19baf7e562..97badfa004 100644 --- a/wiretap/toshiba.c +++ b/wiretap/toshiba.c @@ -308,7 +308,7 @@ parse_toshiba_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("toshiba: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("toshiba: File has %u-byte packet, bigger than maximum of %u", (guint)pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/visual.c b/wiretap/visual.c index bc0ea26ad5..0897a55f3e 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -193,7 +193,7 @@ wtap_open_return_val visual_open(wtap *wth, int *err, gchar **err_info) if (vfile_hdr.file_version != 1) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("visual: file version %u unsupported", vfile_hdr.file_version); + *err_info = ws_strdup_printf("visual: file version %u unsupported", vfile_hdr.file_version); return WTAP_OPEN_ERROR; } @@ -234,7 +234,7 @@ wtap_open_return_val visual_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("visual: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("visual: network type %u unknown or unsupported", vfile_hdr.media_type); return WTAP_OPEN_ERROR; } @@ -369,7 +369,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (rec->rec_header.packet_header.len < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: Ethernet packet has %u-byte original packet, less than the FCS length", + *err_info = ws_strdup_printf("visual: Ethernet packet has %u-byte original packet, less than the FCS length", rec->rec_header.packet_header.len); return FALSE; } @@ -385,7 +385,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (rec->rec_header.packet_header.len < 2) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: Cisco HDLC packet has %u-byte original packet, less than the FCS length", + *err_info = ws_strdup_printf("visual: Cisco HDLC packet has %u-byte original packet, less than the FCS length", rec->rec_header.packet_header.len); return FALSE; } @@ -406,7 +406,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (rec->rec_header.packet_header.len < 2) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: Frame Relay packet has %u-byte original packet, less than the FCS length", + *err_info = ws_strdup_printf("visual: Frame Relay packet has %u-byte original packet, less than the FCS length", rec->rec_header.packet_header.len); return FALSE; } @@ -421,7 +421,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (rec->rec_header.packet_header.len < 2) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: Frame Relay packet has %u-byte original packet, less than the FCS length", + *err_info = ws_strdup_printf("visual: Frame Relay packet has %u-byte original packet, less than the FCS length", rec->rec_header.packet_header.len); return FALSE; } @@ -517,7 +517,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, /* Probably a corrupt capture file; don't blow up trying to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("visual: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/vms.c b/wiretap/vms.c index 600282e506..00da6ff359 100644 --- a/wiretap/vms.c +++ b/wiretap/vms.c @@ -391,7 +391,7 @@ parse_vms_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, gchar **err_in if (!ws_strtou32(p, &endp, &pkt_len) || (*endp != '\0' && !g_ascii_isspace(*endp))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("vms: Length field '%s' not valid", p); + *err_info = ws_strdup_printf("vms: Length field '%s' not valid", p); return FALSE; } break; @@ -404,7 +404,7 @@ parse_vms_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, gchar **err_in * space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("vms: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("vms: File has %u-byte packet, bigger than maximum of %u", pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/vwr.c b/wiretap/vwr.c index 0620074802..48272b2691 100644 --- a/wiretap/vwr.c +++ b/wiretap/vwr.c @@ -944,7 +944,7 @@ static gboolean vwr_read_rec_header(vwr_t *vwr, FILE_T fh, int *rec_size, int *I if ((f_len = decode_msg(vwr, header, &v_type, IS_TX, log_mode)) != 0) { if (f_len > B_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("vwr: Invalid message record length %d", f_len); + *err_info = ws_strdup_printf("vwr: Invalid message record length %d", f_len); return FALSE; } else if (v_type != VT_FRAME) { @@ -1174,7 +1174,7 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, wtap_rec *record, * The record data must be large enough to hold the statistics trailer. */ if (rec_size < v22_W_STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, v22_W_STATS_LEN); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1205,7 +1205,7 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, wtap_rec *record, * Report an error if it is. */ if (actual_octets > rec_size - v22_W_STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1227,7 +1227,7 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, wtap_rec *record, if (actual_octets >= plcp_hdr_len) actual_octets -= plcp_hdr_len; else { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include %u-byte PLCP header)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include %u-byte PLCP header)", actual_octets, plcp_hdr_len); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1248,7 +1248,7 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, wtap_rec *record, */ if (actual_octets < 4) { if (actual_octets != 0) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include %u-byte PLCP header and 4 bytes of FCS)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include %u-byte PLCP header and 4 bytes of FCS)", actual_octets, plcp_hdr_len); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1453,7 +1453,7 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, wtap_rec *record, * the PLCP, and the statistics trailer. */ if ((guint)rec_size < vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN); *err = WTAP_ERR_BAD_FILE; @@ -1503,7 +1503,7 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, wtap_rec *record, * Report an error if it is. */ if (actual_octets > rec_size - (vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN)) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1649,7 +1649,7 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, wtap_rec *record, */ if (actual_octets < 4) { if (actual_octets != 0) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1871,7 +1871,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, */ if (IS_TX == 3) { /*IS_TX =3, i.e., command type is RF Modified*/ if ((guint)rec_size < OCTO_MODIFIED_RF_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, OCTO_MODIFIED_RF_LEN); *err = WTAP_ERR_BAD_FILE; @@ -1918,7 +1918,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, { stats_offset = OCTO_RF_MOD_ACTUAL_LEN; if ((guint)rec_size < stats_offset + vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, stats_offset + vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN); *err = WTAP_ERR_BAD_FILE; @@ -1931,7 +1931,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, { stats_offset = 0; if ((guint)rec_size < vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN); *err = WTAP_ERR_BAD_FILE; @@ -2020,7 +2020,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, * Report an error if it is. */ if (actual_octets > rec_size - (stats_offset + vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN)) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -2143,7 +2143,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, */ if (actual_octets < 4) { if (actual_octets != 0) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -2218,7 +2218,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, * so that our caller doesn't blow up trying to allocate * space for an immensely-large packet. */ - *err_info = g_strdup_printf("vwr: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("vwr: File has %u-byte packet, bigger than maximum of %u", record->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -2582,7 +2582,7 @@ static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, wtap_rec *record, guint16 vw_flags; /* VeriWave-specific packet flags */ if ((guint)rec_size < vwr->STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->STATS_LEN); + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->STATS_LEN); *err = WTAP_ERR_BAD_FILE; return FALSE; } @@ -2603,7 +2603,7 @@ static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, wtap_rec *record, * Report an error if it is. */ if (actual_octets > rec_size - vwr->STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -2655,7 +2655,7 @@ static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, wtap_rec *record, */ if (actual_octets < 4) { if (actual_octets != 0) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h index 1c8c7fd65d..193808c45a 100644 --- a/wiretap/wtap-int.h +++ b/wiretap/wtap-int.h @@ -9,7 +9,7 @@ #ifndef __WTAP_INT_H__ #define __WTAP_INT_H__ -#include +#include "wtap.h" #include #ifdef _WIN32 @@ -18,7 +18,6 @@ #include -#include "wtap.h" #include "wtap_opttypes.h" void wtap_init_file_type_subtypes(void); diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 1547b5dfaf..9f8308740d 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -1759,7 +1759,7 @@ wtap_full_file_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, int * * Avoid allocating space for an immensely-large file. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("%s: File has %" PRId64 "-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("%s: File has %" PRId64 "-byte packet, bigger than maximum of %u", wtap_encap_name(wth->file_encap), file_size, G_MAXINT); return FALSE; } @@ -1773,7 +1773,7 @@ wtap_full_file_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, int * for (;;) { if (buffer_size <= 0) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("%s: Uncompressed file is bigger than maximum of %u", + *err_info = ws_strdup_printf("%s: Uncompressed file is bigger than maximum of %u", wtap_encap_name(wth->file_encap), G_MAXINT); return FALSE; } diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 1b2bf702ca..fca49eb67e 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -9,14 +9,12 @@ #ifndef __WTAP_H__ #define __WTAP_H__ -#include +#include #include #include #include #include #include "wtap_opttypes.h" -#include "ws_symbol_export.h" -#include "ws_attributes.h" #ifdef __cplusplus extern "C" { diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c index 35056f2a4e..15522043e2 100644 --- a/wiretap/wtap_opttypes.c +++ b/wiretap/wtap_opttypes.c @@ -923,7 +923,7 @@ wtap_block_add_string_option_vformat(wtap_block_t block, guint option_id, const ret = wtap_block_add_option_common(block, option_id, WTAP_OPTTYPE_STRING, &opt); if (ret != WTAP_OPTTYPE_SUCCESS) return ret; - opt->value.stringval = g_strdup_vprintf(format, va); + opt->value.stringval = ws_strdup_vprintf(format, va); return WTAP_OPTTYPE_SUCCESS; } @@ -938,7 +938,7 @@ wtap_block_add_string_option_format(wtap_block_t block, guint option_id, const c if (ret != WTAP_OPTTYPE_SUCCESS) return ret; va_start(va, format); - opt->value.stringval = g_strdup_vprintf(format, va); + opt->value.stringval = ws_strdup_vprintf(format, va); va_end(va); return WTAP_OPTTYPE_SUCCESS; } @@ -1004,7 +1004,7 @@ wtap_block_set_string_option_value_format(wtap_block_t block, guint option_id, c } g_free(optval->stringval); va_start(va, format); - optval->stringval = g_strdup_vprintf(format, va); + optval->stringval = ws_strdup_vprintf(format, va); va_end(va); return WTAP_OPTTYPE_SUCCESS; } @@ -1021,7 +1021,7 @@ wtap_block_set_nth_string_option_value_format(wtap_block_t block, guint option_i return ret; g_free(optval->stringval); va_start(va, format); - optval->stringval = g_strdup_vprintf(format, va); + optval->stringval = ws_strdup_vprintf(format, va); va_end(va); return WTAP_OPTTYPE_SUCCESS; }