The packet counts and drop counts reported by libpcap are unsigned.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 19 Aug 2008 05:10:16 +0000 (05:10 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 19 Aug 2008 05:10:16 +0000 (05:10 +0000)
Clean up indentation a bit.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@26037 f5534014-38df-0310-8fa8-9805f1628bb7

capture.c
capture.h
capture_sync.c
dumpcap.c
tshark.c

index 14dab6573100645189c05333d96c9e17b0dad551..adc6ffdf5091f96a50a75f13fa41b17f4b94a194 100644 (file)
--- a/capture.c
+++ b/capture.c
@@ -446,9 +446,9 @@ capture_input_new_packets(capture_options *capture_opts, int to_read)
 /* Capture child told us how many dropped packets it counted.
  */
 void
-capture_input_drops(capture_options *capture_opts, int dropped)
+capture_input_drops(capture_options *capture_opts, guint32 dropped)
 {
-  g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_INFO, "%d packet%s dropped", dropped, plurality(dropped, "", "s"));
+  g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_INFO, "%u packet%s dropped", dropped, plurality(dropped, "", "s"));
 
   g_assert(capture_opts->state == CAPTURE_RUNNING);
 
index 955e2a519410e82aaf16e1dd6edb084d74f1b51a..168660fdc5354ecb072d3c5549f2ee58248245b6 100644 (file)
--- a/capture.h
+++ b/capture.h
@@ -83,7 +83,7 @@ extern void capture_input_new_packets(capture_options *capture_opts, int to_read
 /**
  * Capture child told us how many dropped packets it counted.
  */
-extern void capture_input_drops(capture_options *capture_opts, int dropped);
+extern void capture_input_drops(capture_options *capture_opts, guint32 dropped);
 
 /**
  * Capture child told us that an error has occurred while starting the capture.
index 489c4f776287fa366bb812e14354d91c62bbff83..ba819677c1e89a1d7ea6665b416095d30eab8ae8 100644 (file)
@@ -1227,7 +1227,7 @@ sync_pipe_input_cb(gint source, gpointer user_data)
     /* the capture child will close the sync_pipe, nothing to do for now */
     break;
   case SP_DROPS:
-    capture_input_drops(capture_opts, atoi(buffer));
+    capture_input_drops(capture_opts, (guint32)strtoul(buffer, NULL, 10));
     break;
   default:
     g_assert_not_reached();
index 9476ce4044feb580e34cba93ecf28b622ae39bc7..a8aa166ce7292ca9479e1b4e9e0f38b3de2085bc 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -259,7 +259,7 @@ static void exit_main(int err);
 
 static void report_new_capture_file(const char *filename);
 static void report_packet_count(int packet_count);
-static void report_packet_drops(int drops);
+static void report_packet_drops(guint32 drops);
 static void report_capture_error(const char *error_msg, const char *secondary_error_msg);
 static void report_cfilter_error(const char *cfilter, const char *errmsg);
 
@@ -460,10 +460,10 @@ print_statistics_loop(gboolean machine_readable)
             pcap_stats(if_stat->pch, &ps);
 
             if (!machine_readable) {
-                printf("%-15s  %10d  %10d\n", if_stat->name,
+                printf("%-15s  %10u  %10u\n", if_stat->name,
                     ps.ps_recv, ps.ps_drop);
             } else {
-                printf("%s\t%d\t%d\n", if_stat->name,
+                printf("%s\t%u\t%u\n", if_stat->name,
                     ps.ps_recv, ps.ps_drop);
                 fflush(stdout);
             }
@@ -2869,11 +2869,11 @@ report_capture_error(const char *error_msg, const char *secondary_error_msg)
 }
 
 void
-report_packet_drops(int drops)
+report_packet_drops(guint32 drops)
 {
     char tmp[SP_DECISIZE+1+1];
 
-    g_snprintf(tmp, sizeof(tmp), "%d", drops);
+    g_snprintf(tmp, sizeof(tmp), "%u", drops);
 
     if(capture_child) {
         g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "Packets dropped: %s", tmp);
index f385fac2306dfa5e637240e326564b55fd534bdb..fe2b978bfdc65ad3026d0842782137d135b7d59d 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -2075,19 +2075,19 @@ report_counts_siginfo(int signum _U_)
 
 /* capture child detected any packet drops? */
 void
-capture_input_drops(capture_options *capture_opts _U_, int dropped)
+capture_input_drops(capture_options *capture_opts _U_, guint32 dropped)
 {
-       if (print_packet_counts) {
-       /* We're printing packet counts to stderr.
-          Send a newline so that we move to the line after the packet count. */
-         fprintf(stderr, "\n");
-       }
-
-       if(dropped != 0) {
-               /* We're printing packet counts to stderr.
-                  Send a newline so that we move to the line after the packet count. */
-                 fprintf(stderr, "%u packet%s dropped\n", dropped, plurality(dropped, "", "s"));
-       }
+  if (print_packet_counts) {
+    /* We're printing packet counts to stderr.
+       Send a newline so that we move to the line after the packet count. */
+    fprintf(stderr, "\n");
+  }
+
+  if (dropped != 0) {
+    /* We're printing packet counts to stderr.
+       Send a newline so that we move to the line after the packet count. */
+    fprintf(stderr, "%u packet%s dropped\n", dropped, plurality(dropped, "", "s"));
+  }
 }