diff --git a/capture/capture_sync.c b/capture/capture_sync.c index 7980399de5..50f5661403 100644 --- a/capture/capture_sync.c +++ b/capture/capture_sync.c @@ -419,7 +419,7 @@ sync_pipe_start(capture_options *capture_opts, GPtrArray *capture_comments, if (interface_opts->extcap_fifo != NULL) { #ifdef _WIN32 - char *pipe = ws_strdup_printf("%s%" PRIuPTR, EXTCAP_PIPE_PREFIX, interface_opts->extcap_pipe_h); + char *pipe = ws_strdup_printf("%s%" PRIuMAX, EXTCAP_PIPE_PREFIX, (uintmax_t)interface_opts->extcap_pipe_h); argv = sync_pipe_add_arg(argv, &argc, pipe); g_free(pipe); i_handles++; @@ -519,7 +519,7 @@ sync_pipe_start(capture_options *capture_opts, GPtrArray *capture_comments, #ifndef DEBUG_CHILD argv = sync_pipe_add_arg(argv, &argc, "-Z"); #ifdef _WIN32 - snprintf(control_id, ARGV_NUMBER_LEN, "%d", GetCurrentProcessId()); + snprintf(control_id, ARGV_NUMBER_LEN, "%ld", GetCurrentProcessId()); argv = sync_pipe_add_arg(argv, &argc, control_id); #else argv = sync_pipe_add_arg(argv, &argc, SIGNAL_PIPE_CTRL_ID_NONE); @@ -2100,7 +2100,7 @@ static void create_dummy_signal_pipe() { if (dummy_signal_pipe != NULL) return; if (!dummy_control_id) { - dummy_control_id = ws_strdup_printf("%d.dummy", GetCurrentProcessId()); + dummy_control_id = ws_strdup_printf("%ld.dummy", GetCurrentProcessId()); } /* Create the signal pipe */ diff --git a/capture_opts.c b/capture_opts.c index 498aaacfc0..40df74d7dc 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -194,7 +194,7 @@ capture_opts_log(const char *log_domain, enum ws_log_level log_level, capture_op ws_log(log_domain, log_level, "Promiscuous Mode[%02d]: %s", i, interface_opts->promisc_mode?"TRUE":"FALSE"); ws_log(log_domain, log_level, "Extcap[%02d] : %s", i, interface_opts->extcap ? interface_opts->extcap : "(unspecified)"); ws_log(log_domain, log_level, "Extcap FIFO[%02d] : %s", i, interface_opts->extcap_fifo ? interface_opts->extcap_fifo : "(unspecified)"); - ws_log(log_domain, log_level, "Extcap PID[%02d] : %d", i, interface_opts->extcap_pid); + ws_log(log_domain, log_level, "Extcap PID[%02d] : %"PRIdMAX, i, (intmax_t)interface_opts->extcap_pid); #ifdef CAN_SET_CAPTURE_BUFFER_SIZE ws_log(log_domain, log_level, "Buffer size[%02d] : %d (MB)", i, interface_opts->buffer_size); #endif diff --git a/epan/dissectors/packet-protobuf.c b/epan/dissectors/packet-protobuf.c index 3aef28dcc5..0ccbfd6ccf 100644 --- a/epan/dissectors/packet-protobuf.c +++ b/epan/dissectors/packet-protobuf.c @@ -506,13 +506,13 @@ abs_time_to_rfc3339(wmem_allocator_t *scope, const nstime_t *nstime, bool use_ut if (use_utc) { tm = gmtime(&nstime->secs); if (tm != NULL) - strftime(datetime_format, sizeof(datetime_format), "%FT%T%%sZ", tm); + strftime(datetime_format, sizeof(datetime_format), "%Y-%m-%dT%H:%M:%S%%sZ", tm); else snprintf(datetime_format, sizeof(datetime_format), "Not representable"); } else { tm = localtime(&nstime->secs); if (tm != NULL) - strftime(datetime_format, sizeof(datetime_format), "%FT%T%%s%z", tm); + strftime(datetime_format, sizeof(datetime_format), "%Y-%m-%dT%H:%M:%S%%s%z", tm); else snprintf(datetime_format, sizeof(datetime_format), "Not representable"); } diff --git a/epan/dissectors/packet-snort.c b/epan/dissectors/packet-snort.c index e3c753d206..8d6d42a03a 100644 --- a/epan/dissectors/packet-snort.c +++ b/epan/dissectors/packet-snort.c @@ -417,7 +417,7 @@ static void snort_reaper(GPid pid, gint status _U_, gpointer data) session->working = session->running = FALSE; /* XXX, cleanup */ } else { - g_print("Errrrmm snort_reaper() %d != %d\n", session->pid, pid); + g_print("Errrrmm snort_reaper() %"PRIdMAX" != %"PRIdMAX"\n", (intmax_t)session->pid, (intmax_t)pid); } /* Close the snort pid (may only make a difference on Windows?) */ diff --git a/extcap.c b/extcap.c index f27337e2bd..db909b34a8 100644 --- a/extcap.c +++ b/extcap.c @@ -1255,8 +1255,8 @@ void extcap_request_stop(capture_session *cap_session) continue; } - ws_debug("Extcap [%s] - Requesting stop PID: %d", interface_opts->name, - interface_opts->extcap_pid); + ws_debug("Extcap [%s] - Requesting stop PID: %"PRIdMAX, interface_opts->name, + (intmax_t)interface_opts->extcap_pid); #ifndef _WIN32 if (interface_opts->extcap_pid != WS_INVALID_PID) @@ -1499,8 +1499,8 @@ static void extcap_child_watch_cb(GPid pid, gint status _U_, gpointer user_data) interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i); if (interface_opts->extcap_pid == pid) { - ws_debug("Extcap [%s] - Closing spawned PID: %d", interface_opts->name, - interface_opts->extcap_pid); + ws_debug("Extcap [%s] - Closing spawned PID: %"PRIdMAX, interface_opts->name, + (intmax_t)interface_opts->extcap_pid); interface_opts->extcap_pid = WS_INVALID_PID; extcap_watch_removed(cap_session, interface_opts); break; @@ -1648,13 +1648,13 @@ static gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, HANDLE *ha if (*handle_out == INVALID_HANDLE_VALUE) { - ws_debug("Error creating pipe => (%d)", GetLastError()); + ws_debug("Error creating pipe => (%ld)", GetLastError()); g_free (pipename); return FALSE; } else { - ws_debug("Wireshark Created pipe =>(%s) handle (%" PRIuPTR ")", pipename, *handle_out); + ws_debug("Wireshark Created pipe =>(%s) handle (%" PRIuMAX ")", pipename, (uintmax_t)*handle_out); *fifo = g_strdup(pipename); } diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index c80f92070b..6e5ba34889 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -624,7 +624,7 @@ configuration_init_w32(const char* arg0 _U_) /* * Gak. We can't format the message. */ - return ws_strdup_printf("GetModuleFileName failed: %u (FormatMessage failed: %u)", + return ws_strdup_printf("GetModuleFileName failed: %lu (FormatMessage failed: %lu)", error, GetLastError()); } msg = utf_16to8(msg_w); @@ -638,7 +638,7 @@ configuration_init_w32(const char* arg0 _U_) msg[msglen - 1] = '\0'; msg[msglen - 2] = '\0'; } - return ws_strdup_printf("GetModuleFileName failed: %s (%u)", + return ws_strdup_printf("GetModuleFileName failed: %s (%lu)", msg, error); } diff --git a/wsutil/win32-utils.c b/wsutil/win32-utils.c index fe49001c4f..97f586768c 100644 --- a/wsutil/win32-utils.c +++ b/wsutil/win32-utils.c @@ -183,7 +183,7 @@ win32strexception(DWORD exception) if (exceptions[i].code == exception) return exceptions[i].msg; } - snprintf(errbuf, (gulong)sizeof errbuf, "Exception 0x%08x", exception); + snprintf(errbuf, (gulong)sizeof errbuf, "Exception 0x%08lx", exception); return errbuf; } diff --git a/wsutil/ws_pipe.c b/wsutil/ws_pipe.c index da3b3a274b..af81f9de80 100644 --- a/wsutil/ws_pipe.c +++ b/wsutil/ws_pipe.c @@ -125,7 +125,7 @@ ws_pipe_create_overlapped_read(HANDLE *read_pipe_handle, HANDLE *write_pipe_hand SECURITY_ATTRIBUTES *sa, DWORD suggested_buffer_size) { HANDLE read_pipe, write_pipe; - guchar *name = ws_strdup_printf("\\\\.\\Pipe\\WiresharkWsPipe.%08x.%08x", + guchar *name = ws_strdup_printf("\\\\.\\Pipe\\WiresharkWsPipe.%08lx.%08lx", GetCurrentProcessId(), InterlockedIncrement(&pipe_serial_number)); gunichar2 *wname = g_utf8_to_utf16(name, -1, NULL, NULL, NULL); @@ -336,7 +336,7 @@ gboolean ws_pipe_spawn_sync(const gchar *working_directory, const gchar *command { if (GetLastError() != ERROR_IO_PENDING) { - ws_debug("ReadFile on child stdout pipe failed. Error %d", GetLastError()); + ws_debug("ReadFile on child stdout pipe failed. Error %ld", GetLastError()); pending_stdout = FALSE; } } @@ -345,7 +345,7 @@ gboolean ws_pipe_spawn_sync(const gchar *working_directory, const gchar *command { if (GetLastError() != ERROR_IO_PENDING) { - ws_debug("ReadFile on child stderr pipe failed. Error %d", GetLastError()); + ws_debug("ReadFile on child stderr pipe failed. Error %ld", GetLastError()); pending_stderr = FALSE; } } @@ -396,7 +396,7 @@ gboolean ws_pipe_spawn_sync(const gchar *working_directory, const gchar *command pending_stdout = FALSE; continue; } - ws_debug("GetOverlappedResult on stdout failed. Error %d", GetLastError()); + ws_debug("GetOverlappedResult on stdout failed. Error %ld", GetLastError()); } if (process_finished && (bytes_read == 0)) { @@ -409,7 +409,7 @@ gboolean ws_pipe_spawn_sync(const gchar *working_directory, const gchar *command { if (GetLastError() != ERROR_IO_PENDING) { - ws_debug("ReadFile on child stdout pipe failed. Error %d", GetLastError()); + ws_debug("ReadFile on child stdout pipe failed. Error %ld", GetLastError()); pending_stdout = FALSE; } } @@ -425,7 +425,7 @@ gboolean ws_pipe_spawn_sync(const gchar *working_directory, const gchar *command pending_stderr = FALSE; continue; } - ws_debug("GetOverlappedResult on stderr failed. Error %d", GetLastError()); + ws_debug("GetOverlappedResult on stderr failed. Error %ld", GetLastError()); } if (process_finished && (bytes_read == 0)) { @@ -436,7 +436,7 @@ gboolean ws_pipe_spawn_sync(const gchar *working_directory, const gchar *command { if (GetLastError() != ERROR_IO_PENDING) { - ws_debug("ReadFile on child stderr pipe failed. Error %d", GetLastError()); + ws_debug("ReadFile on child stderr pipe failed. Error %ld", GetLastError()); pending_stderr = FALSE; } } @@ -444,7 +444,7 @@ gboolean ws_pipe_spawn_sync(const gchar *working_directory, const gchar *command } else { - ws_debug("WaitForMultipleObjects returned 0x%08X. Error %d", dw, GetLastError()); + ws_debug("WaitForMultipleObjects returned 0x%08lX. Error %ld", dw, GetLastError()); } } @@ -721,7 +721,7 @@ ws_pipe_wait_for_pipe(HANDLE * pipe_handles, int num_pipe_handles, HANDLE pid) break; default: - ws_debug("ConnectNamedPipe failed with %d\n.", error); + ws_debug("ConnectNamedPipe failed with %ld\n.", error); result = FALSE; } } @@ -776,7 +776,7 @@ ws_pipe_wait_for_pipe(HANDLE * pipe_handles, int num_pipe_handles, HANDLE pid) TRUE); // wait if (!success) { - ws_debug("Error %d \n.", GetLastError()); + ws_debug("Error %ld \n.", GetLastError()); result = FALSE; } pipeinsts[i].pendingIO = FALSE; @@ -785,7 +785,7 @@ ws_pipe_wait_for_pipe(HANDLE * pipe_handles, int num_pipe_handles, HANDLE pid) } else { - ws_debug("WaitForMultipleObjects returned 0x%08X. Error %d", dw, GetLastError()); + ws_debug("WaitForMultipleObjects returned 0x%08lX. Error %ld", dw, GetLastError()); result = FALSE; } }