forked from osmocom/wireshark
Fix various gcc -Wshadow warnings.
svn path=/trunk/; revision=31729
This commit is contained in:
parent
9cc7ad9f66
commit
e4d6610bd5
|
@ -370,7 +370,7 @@ get_auth_arguments(capture_options *capture_opts, const char *arg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg)
|
capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str_p)
|
||||||
{
|
{
|
||||||
long adapter_index;
|
long adapter_index;
|
||||||
char *p;
|
char *p;
|
||||||
|
@ -388,7 +388,7 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg)
|
||||||
* names that begin with digits. It can be useful on Windows, where
|
* names that begin with digits. It can be useful on Windows, where
|
||||||
* more than one interface can have the same name.
|
* more than one interface can have the same name.
|
||||||
*/
|
*/
|
||||||
adapter_index = strtol(optarg, &p, 10);
|
adapter_index = strtol(optarg_str_p, &p, 10);
|
||||||
if (p != NULL && *p == '\0') {
|
if (p != NULL && *p == '\0') {
|
||||||
if (adapter_index < 0) {
|
if (adapter_index < 0) {
|
||||||
cmdarg_err("The specified adapter index is a negative number");
|
cmdarg_err("The specified adapter index is a negative number");
|
||||||
|
@ -430,47 +430,47 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg)
|
||||||
*/
|
*/
|
||||||
free_interface_list(if_list);
|
free_interface_list(if_list);
|
||||||
} else {
|
} else {
|
||||||
capture_opts->iface = g_strdup(optarg);
|
capture_opts->iface = g_strdup(optarg_str_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg, gboolean *start_capture)
|
capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_str_p, gboolean *start_capture)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'a': /* autostop criteria */
|
case 'a': /* autostop criteria */
|
||||||
if (set_autostop_criterion(capture_opts, optarg) == FALSE) {
|
if (set_autostop_criterion(capture_opts, optarg_str_p) == FALSE) {
|
||||||
cmdarg_err("Invalid or unknown -a flag \"%s\"", optarg);
|
cmdarg_err("Invalid or unknown -a flag \"%s\"", optarg_str_p);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_PCAP_REMOTE
|
#ifdef HAVE_PCAP_REMOTE
|
||||||
case 'A':
|
case 'A':
|
||||||
if (get_auth_arguments(capture_opts, optarg) == FALSE) {
|
if (get_auth_arguments(capture_opts, optarg_str_p) == FALSE) {
|
||||||
cmdarg_err("Invalid or unknown -A arg \"%s\"", optarg);
|
cmdarg_err("Invalid or unknown -A arg \"%s\"", optarg_str_p);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'b': /* Ringbuffer option */
|
case 'b': /* Ringbuffer option */
|
||||||
capture_opts->multi_files_on = TRUE;
|
capture_opts->multi_files_on = TRUE;
|
||||||
if (get_ring_arguments(capture_opts, optarg) == FALSE) {
|
if (get_ring_arguments(capture_opts, optarg_str_p) == FALSE) {
|
||||||
cmdarg_err("Invalid or unknown -b arg \"%s\"", optarg);
|
cmdarg_err("Invalid or unknown -b arg \"%s\"", optarg_str_p);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
case 'B': /* Buffer size */
|
case 'B': /* Buffer size */
|
||||||
capture_opts->buffer_size = get_positive_int(optarg, "buffer size");
|
capture_opts->buffer_size = get_positive_int(optarg_str_p, "buffer size");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'c': /* Capture n packets */
|
case 'c': /* Capture n packets */
|
||||||
capture_opts->has_autostop_packets = TRUE;
|
capture_opts->has_autostop_packets = TRUE;
|
||||||
capture_opts->autostop_packets = get_positive_int(optarg, "packet count");
|
capture_opts->autostop_packets = get_positive_int(optarg_str_p, "packet count");
|
||||||
break;
|
break;
|
||||||
case 'f': /* capture filter */
|
case 'f': /* capture filter */
|
||||||
if (capture_opts->has_cfilter) {
|
if (capture_opts->has_cfilter) {
|
||||||
|
@ -479,13 +479,13 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
|
||||||
}
|
}
|
||||||
capture_opts->has_cfilter = TRUE;
|
capture_opts->has_cfilter = TRUE;
|
||||||
g_free(capture_opts->cfilter);
|
g_free(capture_opts->cfilter);
|
||||||
capture_opts->cfilter = g_strdup(optarg);
|
capture_opts->cfilter = g_strdup(optarg_str_p);
|
||||||
break;
|
break;
|
||||||
case 'H': /* Hide capture info dialog box */
|
case 'H': /* Hide capture info dialog box */
|
||||||
capture_opts->show_info = FALSE;
|
capture_opts->show_info = FALSE;
|
||||||
break;
|
break;
|
||||||
case 'i': /* Use interface x */
|
case 'i': /* Use interface x */
|
||||||
status = capture_opts_add_iface_opt(capture_opts, optarg);
|
status = capture_opts_add_iface_opt(capture_opts, optarg_str_p);
|
||||||
if(status != 0) {
|
if(status != 0) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -496,8 +496,8 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
|
||||||
/*case 'l':*/ /* Automatic scrolling in live capture mode */
|
/*case 'l':*/ /* Automatic scrolling in live capture mode */
|
||||||
#ifdef HAVE_PCAP_SETSAMPLING
|
#ifdef HAVE_PCAP_SETSAMPLING
|
||||||
case 'm':
|
case 'm':
|
||||||
if (get_sampling_arguments(capture_opts, optarg) == FALSE) {
|
if (get_sampling_arguments(capture_opts, optarg_str_p) == FALSE) {
|
||||||
cmdarg_err("Invalid or unknown -m arg \"%s\"", optarg);
|
cmdarg_err("Invalid or unknown -m arg \"%s\"", optarg_str_p);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -519,7 +519,7 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
|
||||||
#endif
|
#endif
|
||||||
case 's': /* Set the snapshot (capture) length */
|
case 's': /* Set the snapshot (capture) length */
|
||||||
capture_opts->has_snaplen = TRUE;
|
capture_opts->has_snaplen = TRUE;
|
||||||
capture_opts->snaplen = get_natural_int(optarg, "snapshot length");
|
capture_opts->snaplen = get_natural_int(optarg_str_p, "snapshot length");
|
||||||
/*
|
/*
|
||||||
* Make a snapshot length of 0 equivalent to the maximum packet
|
* Make a snapshot length of 0 equivalent to the maximum packet
|
||||||
* length, mirroring what tcpdump does.
|
* length, mirroring what tcpdump does.
|
||||||
|
@ -540,17 +540,17 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
|
||||||
g_free(capture_opts->save_file);
|
g_free(capture_opts->save_file);
|
||||||
#if defined _WIN32 && GLIB_CHECK_VERSION(2,6,0)
|
#if defined _WIN32 && GLIB_CHECK_VERSION(2,6,0)
|
||||||
/* since GLib 2.6, we need to convert filenames to utf8 for Win32 */
|
/* since GLib 2.6, we need to convert filenames to utf8 for Win32 */
|
||||||
capture_opts->save_file = g_locale_to_utf8(optarg, -1, NULL, NULL, NULL);
|
capture_opts->save_file = g_locale_to_utf8(optarg_str_p, -1, NULL, NULL, NULL);
|
||||||
#else
|
#else
|
||||||
capture_opts->save_file = g_strdup(optarg);
|
capture_opts->save_file = g_strdup(optarg_str_p);
|
||||||
#endif
|
#endif
|
||||||
status = capture_opts_output_to_pipe(capture_opts->save_file, &capture_opts->output_to_pipe);
|
status = capture_opts_output_to_pipe(capture_opts->save_file, &capture_opts->output_to_pipe);
|
||||||
return status;
|
return status;
|
||||||
case 'y': /* Set the pcap data link type */
|
case 'y': /* Set the pcap data link type */
|
||||||
capture_opts->linktype = linktype_name_to_val(optarg);
|
capture_opts->linktype = linktype_name_to_val(optarg_str_p);
|
||||||
if (capture_opts->linktype == -1) {
|
if (capture_opts->linktype == -1) {
|
||||||
cmdarg_err("The specified data link type \"%s\" isn't valid",
|
cmdarg_err("The specified data link type \"%s\" isn't valid",
|
||||||
optarg);
|
optarg_str_p);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -992,22 +992,22 @@ _U_
|
||||||
/* read a number of bytes from a pipe */
|
/* read a number of bytes from a pipe */
|
||||||
/* (blocks until enough bytes read or an error occurs) */
|
/* (blocks until enough bytes read or an error occurs) */
|
||||||
static int
|
static int
|
||||||
pipe_read_bytes(int pipe, char *bytes, int required) {
|
pipe_read_bytes(int pipe_fd, char *bytes, int required) {
|
||||||
int newly;
|
int newly;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
while(required) {
|
while(required) {
|
||||||
newly = read(pipe, &bytes[offset], required);
|
newly = read(pipe_fd, &bytes[offset], required);
|
||||||
if (newly == 0) {
|
if (newly == 0) {
|
||||||
/* EOF */
|
/* EOF */
|
||||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
||||||
"read from pipe %d: EOF (capture closed?)", pipe);
|
"read from pipe %d: EOF (capture closed?)", pipe_fd);
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
if (newly < 0) {
|
if (newly < 0) {
|
||||||
/* error */
|
/* error */
|
||||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
||||||
"read from pipe %d: error(%u): %s", pipe, errno, strerror(errno));
|
"read from pipe %d: error(%u): %s", pipe_fd, errno, strerror(errno));
|
||||||
return newly;
|
return newly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,9 +1018,9 @@ pipe_read_bytes(int pipe, char *bytes, int required) {
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean pipe_data_available(int pipe) {
|
static gboolean pipe_data_available(int pipe_fd) {
|
||||||
#ifdef _WIN32 /* PeekNamedPipe */
|
#ifdef _WIN32 /* PeekNamedPipe */
|
||||||
HANDLE hPipe = (HANDLE) _get_osfhandle(pipe);
|
HANDLE hPipe = (HANDLE) _get_osfhandle(pipe_fd);
|
||||||
DWORD bytes_avail;
|
DWORD bytes_avail;
|
||||||
|
|
||||||
if (hPipe == INVALID_HANDLE_VALUE)
|
if (hPipe == INVALID_HANDLE_VALUE)
|
||||||
|
@ -1037,11 +1037,11 @@ static gboolean pipe_data_available(int pipe) {
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
|
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_SET(pipe, &rfds);
|
FD_SET(pipe_fd, &rfds);
|
||||||
timeout.tv_sec = 0;
|
timeout.tv_sec = 0;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
if (select(pipe+1, &rfds, NULL, NULL, &timeout) > 0)
|
if (select(pipe_fd+1, &rfds, NULL, NULL, &timeout) > 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1094,17 +1094,17 @@ pipe_convert_header(const guchar *header, int header_len, char *indicator, int *
|
||||||
(1-byte message indicator, 3-byte message length (excluding length
|
(1-byte message indicator, 3-byte message length (excluding length
|
||||||
and indicator field), and the rest is the message) */
|
and indicator field), and the rest is the message) */
|
||||||
static int
|
static int
|
||||||
pipe_read_block(int pipe, char *indicator, int len, char *msg) {
|
pipe_read_block(int pipe_fd, char *indicator, int len, char *msg) {
|
||||||
int required;
|
int required;
|
||||||
int newly;
|
int newly;
|
||||||
guchar header[4];
|
guchar header[4];
|
||||||
|
|
||||||
|
|
||||||
/* read header (indicator and 3-byte length) */
|
/* read header (indicator and 3-byte length) */
|
||||||
newly = pipe_read_bytes(pipe, header, 4);
|
newly = pipe_read_bytes(pipe_fd, header, 4);
|
||||||
if(newly != 4) {
|
if(newly != 4) {
|
||||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
||||||
"read %d failed to read header: %u", pipe, newly);
|
"read %d failed to read header: %u", pipe_fd, newly);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1114,7 +1114,7 @@ pipe_read_block(int pipe, char *indicator, int len, char *msg) {
|
||||||
/* only indicator with no value? */
|
/* only indicator with no value? */
|
||||||
if(required == 0) {
|
if(required == 0) {
|
||||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
||||||
"read %d indicator: %c empty value", pipe, *indicator);
|
"read %d indicator: %c empty value", pipe_fd, *indicator);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,18 +1122,18 @@ pipe_read_block(int pipe, char *indicator, int len, char *msg) {
|
||||||
if(required > len) {
|
if(required > len) {
|
||||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
||||||
"read %d length error, required %d > len %d, indicator: %u",
|
"read %d length error, required %d > len %d, indicator: %u",
|
||||||
pipe, required, len, *indicator);
|
pipe_fd, required, len, *indicator);
|
||||||
|
|
||||||
/* we have a problem here, try to read some more bytes from the pipe to debug where the problem really is */
|
/* we have a problem here, try to read some more bytes from the pipe to debug where the problem really is */
|
||||||
memcpy(msg, header, sizeof(header));
|
memcpy(msg, header, sizeof(header));
|
||||||
newly = read(pipe, &msg[sizeof(header)], len-sizeof(header));
|
newly = read(pipe_fd, &msg[sizeof(header)], len-sizeof(header));
|
||||||
g_warning("Unknown message from dumpcap, try to show it as a string: %s", msg);
|
g_warning("Unknown message from dumpcap, try to show it as a string: %s", msg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len = required;
|
len = required;
|
||||||
|
|
||||||
/* read the actual block data */
|
/* read the actual block data */
|
||||||
newly = pipe_read_bytes(pipe, msg, required);
|
newly = pipe_read_bytes(pipe_fd, msg, required);
|
||||||
if(newly != required) {
|
if(newly != required) {
|
||||||
g_warning("Unknown message from dumpcap, try to show it as a string: %s", msg);
|
g_warning("Unknown message from dumpcap, try to show it as a string: %s", msg);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1141,7 +1141,7 @@ pipe_read_block(int pipe, char *indicator, int len, char *msg) {
|
||||||
|
|
||||||
/* XXX If message is "2part", the msg probably won't be sent to debug log correctly */
|
/* XXX If message is "2part", the msg probably won't be sent to debug log correctly */
|
||||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
||||||
"read %d ok indicator: %c len: %u msg: %s", pipe, *indicator,
|
"read %d ok indicator: %c len: %u msg: %s", pipe_fd, *indicator,
|
||||||
len, msg);
|
len, msg);
|
||||||
return newly + 4;
|
return newly + 4;
|
||||||
}
|
}
|
||||||
|
|
4
dftest.c
4
dftest.c
|
@ -62,7 +62,7 @@ main(int argc, char **argv)
|
||||||
char *gpf_path, *pf_path;
|
char *gpf_path, *pf_path;
|
||||||
int gpf_open_errno, gpf_read_errno;
|
int gpf_open_errno, gpf_read_errno;
|
||||||
int pf_open_errno, pf_read_errno;
|
int pf_open_errno, pf_read_errno;
|
||||||
e_prefs *prefs;
|
e_prefs *prefs_p;
|
||||||
dfilter_t *df;
|
dfilter_t *df;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -97,7 +97,7 @@ main(int argc, char **argv)
|
||||||
/* set the c-language locale to the native environment. */
|
/* set the c-language locale to the native environment. */
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
|
prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
|
||||||
&pf_open_errno, &pf_read_errno, &pf_path);
|
&pf_open_errno, &pf_read_errno, &pf_path);
|
||||||
if (gpf_path != NULL) {
|
if (gpf_path != NULL) {
|
||||||
if (gpf_open_errno != 0) {
|
if (gpf_open_errno != 0) {
|
||||||
|
|
56
editcap.c
56
editcap.c
|
@ -166,14 +166,14 @@ abs_time_to_str_with_sec_resolution(const struct wtap_nstime *abs_time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar*
|
static gchar*
|
||||||
fileset_get_filename_by_pattern(guint idx, const struct wtap_nstime *time,
|
fileset_get_filename_by_pattern(guint idx, const struct wtap_nstime *time_val,
|
||||||
gchar *fprefix, gchar *fsuffix)
|
gchar *fprefix, gchar *fsuffix)
|
||||||
{
|
{
|
||||||
gchar filenum[5+1];
|
gchar filenum[5+1];
|
||||||
gchar *timestr;
|
gchar *timestr;
|
||||||
gchar *abs_str;
|
gchar *abs_str;
|
||||||
|
|
||||||
timestr = abs_time_to_str_with_sec_resolution(time);
|
timestr = abs_time_to_str_with_sec_resolution(time_val);
|
||||||
g_snprintf(filenum, sizeof(filenum), "%05u", idx);
|
g_snprintf(filenum, sizeof(filenum), "%05u", idx);
|
||||||
abs_str = g_strconcat(fprefix, "_", filenum, "_", timestr, fsuffix, NULL);
|
abs_str = g_strconcat(fprefix, "_", filenum, "_", timestr, fsuffix, NULL);
|
||||||
g_free(timestr);
|
g_free(timestr);
|
||||||
|
@ -294,40 +294,40 @@ check_timestamp(wtap *wth)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_time_adjustment(char *optarg)
|
set_time_adjustment(char *optarg_str_p)
|
||||||
{
|
{
|
||||||
char *frac, *end;
|
char *frac, *end;
|
||||||
long val;
|
long val;
|
||||||
size_t frac_digits;
|
size_t frac_digits;
|
||||||
|
|
||||||
if (!optarg)
|
if (!optarg_str_p)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* skip leading whitespace */
|
/* skip leading whitespace */
|
||||||
while (*optarg == ' ' || *optarg == '\t') {
|
while (*optarg_str_p == ' ' || *optarg_str_p == '\t') {
|
||||||
optarg++;
|
optarg_str_p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for a negative adjustment */
|
/* check for a negative adjustment */
|
||||||
if (*optarg == '-') {
|
if (*optarg_str_p == '-') {
|
||||||
time_adj.is_negative = 1;
|
time_adj.is_negative = 1;
|
||||||
optarg++;
|
optarg_str_p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* collect whole number of seconds, if any */
|
/* collect whole number of seconds, if any */
|
||||||
if (*optarg == '.') { /* only fractional (i.e., .5 is ok) */
|
if (*optarg_str_p == '.') { /* only fractional (i.e., .5 is ok) */
|
||||||
val = 0;
|
val = 0;
|
||||||
frac = optarg;
|
frac = optarg_str_p;
|
||||||
} else {
|
} else {
|
||||||
val = strtol(optarg, &frac, 10);
|
val = strtol(optarg_str_p, &frac, 10);
|
||||||
if (frac == NULL || frac == optarg || val == LONG_MIN || val == LONG_MAX) {
|
if (frac == NULL || frac == optarg_str_p || val == LONG_MIN || val == LONG_MAX) {
|
||||||
fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
|
fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
|
||||||
optarg);
|
optarg_str_p);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (val < 0) { /* implies '--' since we caught '-' above */
|
if (val < 0) { /* implies '--' since we caught '-' above */
|
||||||
fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
|
fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
|
||||||
optarg);
|
optarg_str_p);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ set_time_adjustment(char *optarg)
|
||||||
if (*frac != '.' || end == NULL || end == frac
|
if (*frac != '.' || end == NULL || end == frac
|
||||||
|| val < 0 || val > ONE_MILLION || val == LONG_MIN || val == LONG_MAX) {
|
|| val < 0 || val > ONE_MILLION || val == LONG_MIN || val == LONG_MAX) {
|
||||||
fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
|
fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
|
||||||
optarg);
|
optarg_str_p);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,39 +365,39 @@ set_time_adjustment(char *optarg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_rel_time(char *optarg)
|
set_rel_time(char *optarg_str_p)
|
||||||
{
|
{
|
||||||
char *frac, *end;
|
char *frac, *end;
|
||||||
long val;
|
long val;
|
||||||
size_t frac_digits;
|
size_t frac_digits;
|
||||||
|
|
||||||
if (!optarg)
|
if (!optarg_str_p)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* skip leading whitespace */
|
/* skip leading whitespace */
|
||||||
while (*optarg == ' ' || *optarg == '\t') {
|
while (*optarg_str_p == ' ' || *optarg_str_p == '\t') {
|
||||||
optarg++;
|
optarg_str_p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ignore negative adjustment */
|
/* ignore negative adjustment */
|
||||||
if (*optarg == '-') {
|
if (*optarg_str_p == '-') {
|
||||||
optarg++;
|
optarg_str_p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* collect whole number of seconds, if any */
|
/* collect whole number of seconds, if any */
|
||||||
if (*optarg == '.') { /* only fractional (i.e., .5 is ok) */
|
if (*optarg_str_p == '.') { /* only fractional (i.e., .5 is ok) */
|
||||||
val = 0;
|
val = 0;
|
||||||
frac = optarg;
|
frac = optarg_str_p;
|
||||||
} else {
|
} else {
|
||||||
val = strtol(optarg, &frac, 10);
|
val = strtol(optarg_str_p, &frac, 10);
|
||||||
if (frac == NULL || frac == optarg || val == LONG_MIN || val == LONG_MAX) {
|
if (frac == NULL || frac == optarg_str_p || val == LONG_MIN || val == LONG_MAX) {
|
||||||
fprintf(stderr, "1: editcap: \"%s\" isn't a valid rel time value\n",
|
fprintf(stderr, "1: editcap: \"%s\" isn't a valid rel time value\n",
|
||||||
optarg);
|
optarg_str_p);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (val < 0) { /* implies '--' since we caught '-' above */
|
if (val < 0) { /* implies '--' since we caught '-' above */
|
||||||
fprintf(stderr, "2: editcap: \"%s\" isn't a valid rel time value\n",
|
fprintf(stderr, "2: editcap: \"%s\" isn't a valid rel time value\n",
|
||||||
optarg);
|
optarg_str_p);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ set_rel_time(char *optarg)
|
||||||
if (*frac != '.' || end == NULL || end == frac
|
if (*frac != '.' || end == NULL || end == frac
|
||||||
|| val < 0 || val > ONE_BILLION || val == LONG_MIN || val == LONG_MAX) {
|
|| val < 0 || val > ONE_BILLION || val == LONG_MIN || val == LONG_MAX) {
|
||||||
fprintf(stderr, "3: editcap: \"%s\" isn't a valid rel time value\n",
|
fprintf(stderr, "3: editcap: \"%s\" isn't a valid rel time value\n",
|
||||||
optarg);
|
optarg_str_p);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,7 +445,7 @@ main(int argc, char *argv[])
|
||||||
int err;
|
int err;
|
||||||
gchar *pipe_name = NULL;
|
gchar *pipe_name = NULL;
|
||||||
gchar *rfilters[64];
|
gchar *rfilters[64];
|
||||||
e_prefs *prefs;
|
e_prefs *prefs_p;
|
||||||
char badopt;
|
char badopt;
|
||||||
GLogLevelFlags log_flags;
|
GLogLevelFlags log_flags;
|
||||||
GPtrArray *disp_fields = g_ptr_array_new();
|
GPtrArray *disp_fields = g_ptr_array_new();
|
||||||
|
@ -520,7 +520,7 @@ main(int argc, char *argv[])
|
||||||
/* Set the C-language locale to the native environment. */
|
/* Set the C-language locale to the native environment. */
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
|
prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
|
||||||
&pf_open_errno, &pf_read_errno, &pf_path);
|
&pf_open_errno, &pf_read_errno, &pf_path);
|
||||||
if (gpf_path != NULL) {
|
if (gpf_path != NULL) {
|
||||||
if (gpf_open_errno != 0) {
|
if (gpf_open_errno != 0) {
|
||||||
|
@ -546,7 +546,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the name resolution code's flags from the preferences. */
|
/* Set the name resolution code's flags from the preferences. */
|
||||||
g_resolv_flags = prefs->name_resolve;
|
g_resolv_flags = prefs_p->name_resolve;
|
||||||
|
|
||||||
/* Read the disabled protocols file. */
|
/* Read the disabled protocols file. */
|
||||||
read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
|
read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
|
||||||
|
@ -777,7 +777,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the column format array */
|
/* Build the column format array */
|
||||||
build_column_format_array(&cfile.cinfo, prefs->num_cols, TRUE);
|
build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE);
|
||||||
|
|
||||||
if (n_rfilters != 0) {
|
if (n_rfilters != 0) {
|
||||||
for (i = 0; i < n_rfilters; i++) {
|
for (i = 0; i < n_rfilters; i++) {
|
||||||
|
|
|
@ -614,13 +614,13 @@ iostat_init(const char *optarg, void* userdata _U_)
|
||||||
{
|
{
|
||||||
float interval_float;
|
float interval_float;
|
||||||
gint32 interval;
|
gint32 interval;
|
||||||
int pos=0;
|
int idx=0;
|
||||||
io_stat_t *io;
|
io_stat_t *io;
|
||||||
const char *filter=NULL;
|
const char *filter=NULL;
|
||||||
|
|
||||||
if(sscanf(optarg,"io,stat,%f,%n",&interval_float,&pos)==1){
|
if(sscanf(optarg,"io,stat,%f,%n",&interval_float,&idx)==1){
|
||||||
if(pos){
|
if(idx){
|
||||||
filter=optarg+pos;
|
filter=optarg+idx;
|
||||||
} else {
|
} else {
|
||||||
filter=NULL;
|
filter=NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
|
||||||
{
|
{
|
||||||
wspstat_t *sp=psp;
|
wspstat_t *sp=psp;
|
||||||
const wsp_info_value_t *value=pri;
|
const wsp_info_value_t *value=pri;
|
||||||
gint index = pdut2index(value->pdut);
|
gint idx = pdut2index(value->pdut);
|
||||||
int retour=0;
|
int retour=0;
|
||||||
|
|
||||||
if (value->status_code != 0) {
|
if (value->status_code != 0) {
|
||||||
|
@ -160,8 +160,8 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (index!=0) {
|
if (idx!=0) {
|
||||||
sp->pdu_stats[ index ].packets++;
|
sp->pdu_stats[ idx ].packets++;
|
||||||
retour = 1;
|
retour = 1;
|
||||||
}
|
}
|
||||||
return retour;
|
return retour;
|
||||||
|
|
10
tshark.c
10
tshark.c
|
@ -762,7 +762,7 @@ main(int argc, char *argv[])
|
||||||
struct bpf_program fcode;
|
struct bpf_program fcode;
|
||||||
#endif
|
#endif
|
||||||
dfilter_t *rfcode = NULL;
|
dfilter_t *rfcode = NULL;
|
||||||
e_prefs *prefs;
|
e_prefs *prefs_p;
|
||||||
char badopt;
|
char badopt;
|
||||||
GLogLevelFlags log_flags;
|
GLogLevelFlags log_flags;
|
||||||
int optind_initial;
|
int optind_initial;
|
||||||
|
@ -926,7 +926,7 @@ main(int argc, char *argv[])
|
||||||
/* Set the C-language locale to the native environment. */
|
/* Set the C-language locale to the native environment. */
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
|
prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
|
||||||
&pf_open_errno, &pf_read_errno, &pf_path);
|
&pf_open_errno, &pf_read_errno, &pf_path);
|
||||||
if (gpf_path != NULL) {
|
if (gpf_path != NULL) {
|
||||||
if (gpf_open_errno != 0) {
|
if (gpf_open_errno != 0) {
|
||||||
|
@ -952,7 +952,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the name resolution code's flags from the preferences. */
|
/* Set the name resolution code's flags from the preferences. */
|
||||||
g_resolv_flags = prefs->name_resolve;
|
g_resolv_flags = prefs_p->name_resolve;
|
||||||
|
|
||||||
/* Read the disabled protocols file. */
|
/* Read the disabled protocols file. */
|
||||||
read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
|
read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
|
||||||
|
@ -1445,7 +1445,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the column format array */
|
/* Build the column format array */
|
||||||
build_column_format_array(&cfile.cinfo, prefs->num_cols, TRUE);
|
build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE);
|
||||||
|
|
||||||
#ifdef HAVE_LIBPCAP
|
#ifdef HAVE_LIBPCAP
|
||||||
capture_opts_trim_snaplen(&global_capture_opts, MIN_PACKET_SIZE);
|
capture_opts_trim_snaplen(&global_capture_opts, MIN_PACKET_SIZE);
|
||||||
|
@ -1581,7 +1581,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
/* trim the interface name and exit if that failed */
|
/* trim the interface name and exit if that failed */
|
||||||
if (!capture_opts_trim_iface(&global_capture_opts,
|
if (!capture_opts_trim_iface(&global_capture_opts,
|
||||||
(prefs->capture_device) ? get_if_name(prefs->capture_device) : NULL)) {
|
(prefs_p->capture_device) ? get_if_name(prefs_p->capture_device) : NULL)) {
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue