diff --git a/capture_opts.c b/capture_opts.c index 81aadb85f8..de857ad06c 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -172,7 +172,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): %" G_GINT64_MODIFIER "d (KB)", 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); @@ -220,7 +220,7 @@ set_autostop_criterion(capture_options *capture_opts, const char *autostoparg) capture_opts->autostop_duration = get_positive_int(p,"autostop duration"); } else if (strcmp(autostoparg,"filesize") == 0) { capture_opts->has_autostop_filesize = TRUE; - capture_opts->autostop_filesize = get_positive_int64(p,"autostop filesize"); + capture_opts->autostop_filesize = get_positive_int(p,"autostop filesize"); } else if (strcmp(autostoparg,"files") == 0) { capture_opts->multi_files_on = TRUE; capture_opts->has_autostop_files = TRUE; @@ -272,7 +272,7 @@ get_ring_arguments(capture_options *capture_opts, const char *arg) capture_opts->ring_num_files = get_positive_int(p, "number of ring buffer files"); } else if (strcmp(arg,"filesize") == 0) { capture_opts->has_autostop_filesize = TRUE; - capture_opts->autostop_filesize = get_positive_int64(p, "ring buffer filesize"); + capture_opts->autostop_filesize = get_positive_int(p, "ring buffer filesize"); } else if (strcmp(arg,"duration") == 0) { capture_opts->has_file_duration = TRUE; capture_opts->file_duration = get_positive_int(p, "ring buffer duration"); diff --git a/capture_opts.h b/capture_opts.h index c6f55b2478..9cd688c32e 100644 --- a/capture_opts.h +++ b/capture_opts.h @@ -144,7 +144,7 @@ typedef struct capture_options_tag { int autostop_packets; /**< Maximum packet count */ gboolean has_autostop_filesize; /**< TRUE if maximum capture file size is specified */ - gint64 autostop_filesize; /**< Maximum capture file size in KB */ + gint32 autostop_filesize; /**< Maximum capture file size */ gboolean has_autostop_duration; /**< TRUE if maximum capture duration is specified */ gint32 autostop_duration; /**< Maximum capture duration */ diff --git a/capture_sync.c b/capture_sync.c index e18161888f..68b79f7928 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -391,7 +391,7 @@ sync_pipe_start(capture_options *capture_opts) { if(capture_opts->multi_files_on) { if (capture_opts->has_autostop_filesize) { argv = sync_pipe_add_arg(argv, &argc, "-b"); - g_snprintf(sfilesize, ARGV_NUMBER_LEN, "filesize:%" G_GINT64_MODIFIER "d",capture_opts->autostop_filesize); + g_snprintf(sfilesize, ARGV_NUMBER_LEN, "filesize:%d",capture_opts->autostop_filesize); argv = sync_pipe_add_arg(argv, &argc, sfilesize); } @@ -415,7 +415,7 @@ sync_pipe_start(capture_options *capture_opts) { } else { if (capture_opts->has_autostop_filesize) { argv = sync_pipe_add_arg(argv, &argc, "-a"); - g_snprintf(sautostop_filesize, ARGV_NUMBER_LEN, "filesize:%" G_GINT64_MODIFIER "d",capture_opts->autostop_filesize); + g_snprintf(sautostop_filesize, ARGV_NUMBER_LEN, "filesize:%d",capture_opts->autostop_filesize); argv = sync_pipe_add_arg(argv, &argc, sautostop_filesize); } } diff --git a/clopts_common.c b/clopts_common.c index 411c59cce1..1c7cea9b16 100644 --- a/clopts_common.c +++ b/clopts_common.c @@ -74,50 +74,3 @@ get_positive_int(const char *string, const char *name) return number; } - -gint64 -get_natural_int64(const char *string, const char *name) -{ - gint64 number; - char *p; - -#if GLIB_CHECK_VERSION(2,12,0) - number = g_ascii_strtoll(string, &p, 10); -#elif defined(HAVE_STRTOLL) - number = strtoll(string, &p, 10); -#else - /* Punt and grab a 32-bit value */ - number = strtol(string, &p, 10); -#endif - - if (p == string || *p != '\0') { - cmdarg_err("The specified %s \"%s\" isn't a decimal number", name, string); - exit(1); - } - if (number < 0) { - cmdarg_err("The specified %s \"%s\" is a negative number", name, string); - exit(1); - } - if (number > G_MAXINT64) { /* XXX - ??? */ - cmdarg_err("The specified %s \"%s\" is too large (greater than %" G_GINT64_MODIFIER "d)", - name, string, G_MAXINT64); - exit(1); - } - return number; -} - - -gint64 -get_positive_int64(const char *string, const char *name) -{ - gint64 number; - - number = get_natural_int64(string, name); - - if (number == 0) { - cmdarg_err("The specified %s is zero", name); - exit(1); - } - - return number; -} diff --git a/clopts_common.h b/clopts_common.h index 9077ead647..3341fd0519 100644 --- a/clopts_common.h +++ b/clopts_common.h @@ -30,10 +30,8 @@ extern "C" { #endif /* __cplusplus */ int get_natural_int(const char *string, const char *name); -int get_positive_int(const char *string, const char *name); -gint64 get_natural_int64(const char *string, const char *name); -gint64 get_positive_int64(const char *string, const char *name); +int get_positive_int(const char *string, const char *name); #ifdef __cplusplus }