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:
Guy Harris 2014-10-17 16:42:40 -07:00
parent 19b7819694
commit a91799ebfa
5 changed files with 8 additions and 13 deletions

View File

@ -28,7 +28,6 @@
#ifdef HAVE_LIBPCAP
#include <string.h>
#include <ctype.h>
#ifdef HAVE_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
* 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) {

View File

@ -29,7 +29,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <wsutil/filesystem.h>
@ -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;
}

View File

@ -44,7 +44,6 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <glib.h>
@ -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;
}

View File

@ -37,7 +37,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <locale.h>
#include <limits.h>

View File

@ -107,7 +107,6 @@
# define __EXTENSIONS__
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.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[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);