Jeff Morris's change to make the autostop file size 64-bit. Fixes bug
5691. svn path=/trunk/; revision=36551
This commit is contained in:
parent
f10a13b748
commit
4ad4d3e678
|
@ -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): %u (KB)", capture_opts->has_autostop_filesize, capture_opts->autostop_filesize);
|
||||
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, "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_int(p,"autostop filesize");
|
||||
capture_opts->autostop_filesize = get_positive_int64(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_int(p, "ring buffer filesize");
|
||||
capture_opts->autostop_filesize = get_positive_int64(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");
|
||||
|
|
|
@ -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 */
|
||||
gint32 autostop_filesize; /**< Maximum capture file size */
|
||||
gint64 autostop_filesize; /**< Maximum capture file size in KB */
|
||||
gboolean has_autostop_duration; /**< TRUE if maximum capture duration
|
||||
is specified */
|
||||
gint32 autostop_duration; /**< Maximum capture duration */
|
||||
|
|
|
@ -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:%d",capture_opts->autostop_filesize);
|
||||
g_snprintf(sfilesize, ARGV_NUMBER_LEN, "filesize:%" G_GINT64_MODIFIER "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:%d",capture_opts->autostop_filesize);
|
||||
g_snprintf(sautostop_filesize, ARGV_NUMBER_LEN, "filesize:%" G_GINT64_MODIFIER "d",capture_opts->autostop_filesize);
|
||||
argv = sync_pipe_add_arg(argv, &argc, sautostop_filesize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,3 +74,50 @@ 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;
|
||||
}
|
||||
|
|
|
@ -30,9 +30,11 @@ 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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
Loading…
Reference in New Issue