diff options
-rw-r--r-- | capture_loop.c | 4 | ||||
-rw-r--r-- | capture_opts.c | 4 | ||||
-rw-r--r-- | capture_sync.c | 2 | ||||
-rw-r--r-- | doc/ethereal.pod | 4 | ||||
-rw-r--r-- | doc/tethereal.pod | 4 | ||||
-rw-r--r-- | gtk/capture_dlg.c | 45 | ||||
-rw-r--r-- | tethereal.c | 2 |
7 files changed, 21 insertions, 44 deletions
diff --git a/capture_loop.c b/capture_loop.c index c6dfd67fe6..97d8fe9967 100644 --- a/capture_loop.c +++ b/capture_loop.c @@ -1212,9 +1212,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct *stats_known = FALSE; g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_INFO, "Capture child starting ..."); -#ifdef LOG_CAPTURE_VERBOSE capture_opts_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, capture_opts); -#endif /* open the output file (temporary/specified name/ringbuffer) */ if (!capture_loop_open_output(capture_opts, &save_file_fd, errmsg, sizeof(errmsg))) { @@ -1257,7 +1255,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct /* create stop conditions */ if (capture_opts->has_autostop_filesize) cnd_autostop_size = - cnd_new(CND_CLASS_CAPTURESIZE,(long)capture_opts->autostop_filesize); + cnd_new(CND_CLASS_CAPTURESIZE,(long)capture_opts->autostop_filesize * 1024); if (capture_opts->has_autostop_duration) cnd_autostop_duration = cnd_new(CND_CLASS_TIMEOUT,(gint32)capture_opts->autostop_duration); diff --git a/capture_opts.c b/capture_opts.c index 6cb03a7a29..8024fc15a2 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -76,7 +76,7 @@ capture_opts_init(capture_options *capture_opts, void *cfile) capture_opts->has_autostop_packets = FALSE; capture_opts->autostop_packets = 0; capture_opts->has_autostop_filesize = FALSE; - capture_opts->autostop_filesize = 1024 * 1024; /* 1 MB */ + capture_opts->autostop_filesize = 1024; /* 1 MB */ capture_opts->has_autostop_duration = FALSE; capture_opts->autostop_duration = 60; /* 1 min */ @@ -113,7 +113,7 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio g_log(log_domain, log_level, "AutostopFiles (%u): %u", capture_opts->has_autostop_files, capture_opts->autostop_files); g_log(log_domain, log_level, "AutostopPackets (%u): %u", capture_opts->has_autostop_packets, capture_opts->autostop_packets); - g_log(log_domain, log_level, "AutostopFilesize(%u): %u", capture_opts->has_autostop_filesize, capture_opts->autostop_filesize); + g_log(log_domain, log_level, "AutostopFilesize(%u): %u (KB)", capture_opts->has_autostop_filesize, capture_opts->autostop_filesize); g_log(log_domain, log_level, "AutostopDuration(%u): %u", capture_opts->has_autostop_duration, capture_opts->autostop_duration); g_log(log_domain, log_level, "ForkChild : %d", capture_opts->fork_child); diff --git a/capture_sync.c b/capture_sync.c index cb0d50652e..9e02b26c44 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -335,9 +335,7 @@ sync_pipe_start(capture_options *capture_opts) { g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_start"); -#ifdef LOG_CAPTURE_VERBOSE capture_opts_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, capture_opts); -#endif capture_opts->fork_child = -1; diff --git a/doc/ethereal.pod b/doc/ethereal.pod index b36b5a6b66..d8463bc26d 100644 --- a/doc/ethereal.pod +++ b/doc/ethereal.pod @@ -174,7 +174,7 @@ where I<test> is one of: B<duration>:I<value> Stop writing to a capture file after I<value> seconds have elapsed. B<filesize>:I<value> Stop writing to a capture file after it reaches a size of I<value> -kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes). If this option +kilobytes (where a kilobyte is 1024 bytes). If this option is used together with the -b option, Ethereal will stop writing to the current capture file and switch to the next one if filesize is reached. @@ -204,7 +204,7 @@ B<duration>:I<value> switch to the next file after I<value> seconds have elapsed, even if the current file is not completely filled up. B<filesize>:I<value> switch to the next file after it reaches a size of -I<value> kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes). +I<value> kilobytes (where a kilobyte is 1024 bytes). B<files>:I<value> begin again with the first file after I<value> number of files were written (form a ring buffer). diff --git a/doc/tethereal.pod b/doc/tethereal.pod index d3257c4285..063de402fb 100644 --- a/doc/tethereal.pod +++ b/doc/tethereal.pod @@ -245,7 +245,7 @@ where I<test> is one of: B<duration>:I<value> Stop writing to a capture file after I<value> seconds have elapsed. B<filesize>:I<value> Stop writing to a capture file after it reaches a size of I<value> -kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes). If this option +kilobytes (where a kilobyte is 1024 bytes). If this option is used together with the -b option, Ethereal will stop writing to the current capture file and switch to the next one if filesize is reached. @@ -275,7 +275,7 @@ B<duration>:I<value> switch to the next file after I<value> seconds have elapsed, even if the current file is not completely filled up. B<filesize>:I<value> switch to the next file after it reaches a size of -I<value> kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes). +I<value> kilobytes (where a kilobyte is 1024 bytes). B<files>:I<value> begin again with the first file after I<value> number of files were written (form a ring buffer). diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c index 1da5705cfe..8746bf6ba9 100644 --- a/gtk/capture_dlg.c +++ b/gtk/capture_dlg.c @@ -381,13 +381,11 @@ guint32 value) } -#define SIZE_UNIT_BYTES 0 -#define SIZE_UNIT_KILOBYTES 1 -#define SIZE_UNIT_MEGABYTES 2 -#define SIZE_UNIT_GIGABYTES 3 -#define MAX_SIZE_UNITS 4 +#define SIZE_UNIT_KILOBYTES 0 +#define SIZE_UNIT_MEGABYTES 1 +#define SIZE_UNIT_GIGABYTES 2 +#define MAX_SIZE_UNITS 3 static const char *size_unit_name[MAX_SIZE_UNITS] = { - "byte(s)", "kilobyte(s)", "megabyte(s)", "gigabyte(s)", @@ -410,20 +408,15 @@ static GtkWidget *size_unit_option_menu_new(guint32 value) { /* the selected menu item can't be changed, once the option_menu is created, so set the matching menu item now */ /* gigabytes */ - if(value >= 1024 * 1024 * 1024) { + if(value >= 1024 * 1024) { gtk_menu_set_active(GTK_MENU(menu), SIZE_UNIT_GIGABYTES); } else { /* megabytes */ - if(value >= 1024 * 1024) { + if(value >= 1024) { gtk_menu_set_active(GTK_MENU(menu), SIZE_UNIT_MEGABYTES); } else { /* kilobytes */ - if(value >= 1024) { - gtk_menu_set_active(GTK_MENU(menu), SIZE_UNIT_KILOBYTES); - } else { - /* bytes */ - gtk_menu_set_active(GTK_MENU(menu), SIZE_UNIT_BYTES); - } + gtk_menu_set_active(GTK_MENU(menu), SIZE_UNIT_KILOBYTES); } } @@ -437,21 +430,16 @@ static guint32 size_unit_option_menu_set_value( guint32 value) { /* gigabytes */ - if(value >= 1024 * 1024 * 1024) { - return value / (1024 * 1024 * 1024); - } - - /* megabytes */ if(value >= 1024 * 1024) { return value / (1024 * 1024); } - /* kilobytes */ + /* megabytes */ if(value >= 1024) { - return value / 1024; + return value / (1024); } - /* bytes */ + /* kilobytes */ return value; } @@ -469,30 +457,23 @@ guint32 value) switch(unit) { - case(SIZE_UNIT_BYTES): + case(SIZE_UNIT_KILOBYTES): return value; break; - case(SIZE_UNIT_KILOBYTES): + case(SIZE_UNIT_MEGABYTES): if(value > G_MAXINT / 1024) { return 0; } else { return value * 1024; } break; - case(SIZE_UNIT_MEGABYTES): + case(SIZE_UNIT_GIGABYTES): if(value > G_MAXINT / (1024 * 1024)) { return 0; } else { return value * 1024 * 1024; } break; - case(SIZE_UNIT_GIGABYTES): - if(value > G_MAXINT / (1024 * 1024 * 1024)) { - return 0; - } else { - return value * 1024 * 1024 * 1024; - } - break; default: g_assert_not_reached(); return 0; diff --git a/tethereal.c b/tethereal.c index e2d7592e72..b78250a88a 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1745,7 +1745,7 @@ capture(char *save_file, int out_file_type) /* create stop conditions */ if (capture_opts.has_autostop_filesize) cnd_stop_capturesize = cnd_new((const char*)CND_CLASS_CAPTURESIZE, - (long)capture_opts.autostop_filesize * 1000); + (long)capture_opts.autostop_filesize * 1024); if (capture_opts.has_autostop_duration) cnd_stop_timeout = cnd_new((const char*)CND_CLASS_TIMEOUT, (gint32)capture_opts.autostop_duration); |