The packet counts and drop counts reported by libpcap are unsigned.

Clean up indentation a bit.

svn path=/trunk/; revision=26037
This commit is contained in:
Guy Harris 2008-08-19 05:10:16 +00:00
parent d9416525b6
commit e8ba2515de
5 changed files with 20 additions and 20 deletions

View File

@ -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);

View File

@ -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.

View 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();

View File

@ -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);

View File

@ -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 (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 (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"));
}
}