Don't use ctype.h routines.
That avoids locale dependency and handles possibly-signed chars(which we weren't always doing before). Change-Id: I89e50678abb8c3e535081c92ca25bc1bab672c68 Reviewed-on: https://code.wireshark.org/review/4798 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
19b7819694
commit
a91799ebfa
|
@ -28,7 +28,6 @@
|
||||||
#ifdef HAVE_LIBPCAP
|
#ifdef HAVE_LIBPCAP
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -259,7 +258,7 @@ set_autostop_criterion(capture_options *capture_opts, const char *autostoparg)
|
||||||
* as we allow it in the preferences file, we might as well
|
* as we allow it in the preferences file, we might as well
|
||||||
* allow it here).
|
* allow it here).
|
||||||
*/
|
*/
|
||||||
while (isspace((guchar)*p))
|
while (g_ascii_isspace((guchar)*p))
|
||||||
p++;
|
p++;
|
||||||
if (*p == '\0') {
|
if (*p == '\0') {
|
||||||
/*
|
/*
|
||||||
|
@ -310,7 +309,7 @@ get_ring_arguments(capture_options *capture_opts, const char *arg)
|
||||||
* as we allow it in the preferences file, we might as well
|
* as we allow it in the preferences file, we might as well
|
||||||
* allow it here).
|
* allow it here).
|
||||||
*/
|
*/
|
||||||
while (isspace((guchar)*p))
|
while (g_ascii_isspace((guchar)*p))
|
||||||
p++;
|
p++;
|
||||||
if (*p == '\0') {
|
if (*p == '\0') {
|
||||||
/*
|
/*
|
||||||
|
@ -356,7 +355,7 @@ get_sampling_arguments(capture_options *capture_opts, const char *arg)
|
||||||
p = colonp;
|
p = colonp;
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
|
|
||||||
while (isspace((guchar)*p))
|
while (g_ascii_isspace((guchar)*p))
|
||||||
p++;
|
p++;
|
||||||
if (*p == '\0') {
|
if (*p == '\0') {
|
||||||
*colonp = ':';
|
*colonp = ':';
|
||||||
|
@ -414,7 +413,7 @@ get_auth_arguments(capture_options *capture_opts, const char *arg)
|
||||||
p = colonp;
|
p = colonp;
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
|
|
||||||
while (isspace((guchar)*p))
|
while (g_ascii_isspace((guchar)*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (capture_opts->ifaces->len > 0) {
|
if (capture_opts->ifaces->len > 0) {
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <wsutil/filesystem.h>
|
#include <wsutil/filesystem.h>
|
||||||
|
@ -469,7 +468,7 @@ read_filters_file(FILE *f, gpointer user_data)
|
||||||
guint32 name_len = INIT_BUF_SIZE;
|
guint32 name_len = INIT_BUF_SIZE;
|
||||||
guint32 filter_exp_len = INIT_BUF_SIZE;
|
guint32 filter_exp_len = INIT_BUF_SIZE;
|
||||||
guint32 i = 0;
|
guint32 i = 0;
|
||||||
gint32 c;
|
int c;
|
||||||
guint16 fg_r, fg_g, fg_b, bg_r, bg_g, bg_b;
|
guint16 fg_r, fg_g, fg_b, bg_r, bg_g, bg_b;
|
||||||
gboolean disabled = FALSE;
|
gboolean disabled = FALSE;
|
||||||
gboolean skip_end_of_line = FALSE;
|
gboolean skip_end_of_line = FALSE;
|
||||||
|
@ -489,7 +488,7 @@ read_filters_file(FILE *f, gpointer user_data)
|
||||||
skip_end_of_line = FALSE;
|
skip_end_of_line = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((c = getc(f)) != EOF && isspace(c)) {
|
while ((c = getc(f)) != EOF && g_ascii_isspace(c)) {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -109,7 +108,7 @@ fileset_filename_match_pattern(const char *fname)
|
||||||
while(minlen--) {
|
while(minlen--) {
|
||||||
baselen--;
|
baselen--;
|
||||||
|
|
||||||
if(!isdigit( (guchar) filename[baselen])) {
|
if(!g_ascii_isdigit( filename[baselen])) {
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,6 @@
|
||||||
# define __EXTENSIONS__
|
# define __EXTENSIONS__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -1355,7 +1354,7 @@ parse_token (token_t token, char *str)
|
||||||
tmp_str[1] = pkt_lnstart[i*3+1];
|
tmp_str[1] = pkt_lnstart[i*3+1];
|
||||||
tmp_str[2] = '\0';
|
tmp_str[2] = '\0';
|
||||||
/* it is a valid convertable string */
|
/* it is a valid convertable string */
|
||||||
if (!isxdigit(tmp_str[0]) || !isxdigit(tmp_str[0])) {
|
if (!g_ascii_isxdigit(tmp_str[0]) || !g_ascii_isxdigit(tmp_str[0])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s2[i] = (char)strtoul(tmp_str, (char **)NULL, 16);
|
s2[i] = (char)strtoul(tmp_str, (char **)NULL, 16);
|
||||||
|
|
Loading…
Reference in New Issue