From a91799ebfa3a3aac705132722e57acc92fe4eddb Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 17 Oct 2014 16:42:40 -0700 Subject: 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 --- capture_opts.c | 9 ++++----- color_filters.c | 5 ++--- fileset.c | 3 +-- rawshark.c | 1 - text2pcap.c | 3 +-- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/capture_opts.c b/capture_opts.c index 5f43d28d31..9e75aa4d0b 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -28,7 +28,6 @@ #ifdef HAVE_LIBPCAP #include -#include #ifdef HAVE_UNISTD_H #include @@ -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 * allow it here). */ - while (isspace((guchar)*p)) + while (g_ascii_isspace((guchar)*p)) p++; 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 * allow it here). */ - while (isspace((guchar)*p)) + while (g_ascii_isspace((guchar)*p)) p++; if (*p == '\0') { /* @@ -356,7 +355,7 @@ get_sampling_arguments(capture_options *capture_opts, const char *arg) p = colonp; *p++ = '\0'; - while (isspace((guchar)*p)) + while (g_ascii_isspace((guchar)*p)) p++; if (*p == '\0') { *colonp = ':'; @@ -414,7 +413,7 @@ get_auth_arguments(capture_options *capture_opts, const char *arg) p = colonp; *p++ = '\0'; - while (isspace((guchar)*p)) + while (g_ascii_isspace((guchar)*p)) p++; if (capture_opts->ifaces->len > 0) { diff --git a/color_filters.c b/color_filters.c index 297d4ead4c..d9e2ecfdc4 100644 --- a/color_filters.c +++ b/color_filters.c @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -469,7 +468,7 @@ read_filters_file(FILE *f, gpointer user_data) guint32 name_len = INIT_BUF_SIZE; guint32 filter_exp_len = INIT_BUF_SIZE; guint32 i = 0; - gint32 c; + int c; guint16 fg_r, fg_g, fg_b, bg_r, bg_g, bg_b; gboolean disabled = FALSE; gboolean skip_end_of_line = FALSE; @@ -489,7 +488,7 @@ read_filters_file(FILE *f, gpointer user_data) skip_end_of_line = FALSE; } - while ((c = getc(f)) != EOF && isspace(c)) { + while ((c = getc(f)) != EOF && g_ascii_isspace(c)) { if (c == '\n') { continue; } diff --git a/fileset.c b/fileset.c index afa9e38c8d..4c23790bb9 100644 --- a/fileset.c +++ b/fileset.c @@ -44,7 +44,6 @@ #include #include -#include #include @@ -109,7 +108,7 @@ fileset_filename_match_pattern(const char *fname) while(minlen--) { baselen--; - if(!isdigit( (guchar) filename[baselen])) { + if(!g_ascii_isdigit( filename[baselen])) { g_free(filename); return FALSE; } diff --git a/rawshark.c b/rawshark.c index 1ca43f865f..9f54e472e5 100644 --- a/rawshark.c +++ b/rawshark.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include diff --git a/text2pcap.c b/text2pcap.c index 8d218405e0..9b8b9ebd14 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -107,7 +107,6 @@ # define __EXTENSIONS__ #endif -#include #include #include #include @@ -1355,7 +1354,7 @@ parse_token (token_t token, char *str) tmp_str[1] = pkt_lnstart[i*3+1]; tmp_str[2] = '\0'; /* 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; } s2[i] = (char)strtoul(tmp_str, (char **)NULL, 16); -- cgit v1.2.1