all: Don't use ctype.h macros

The ctype macros (eg, isalnum(), tolower()) are locale-dependent. Use
glib's ASCII-only versions instead.

Also, replace isascii() with g_ascii_isprint(), since isascii()
accepts control characters, which isn't what the code wanted in any of
the places where it was using it.
This commit is contained in:
Dan Winship
2012-09-25 10:44:23 -04:00
parent 74b6b9c768
commit 6878d20ac4
26 changed files with 34 additions and 60 deletions

View File

@@ -24,7 +24,6 @@
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
#include "NetworkManagerUtils.h"
@@ -410,12 +409,12 @@ parse_subchannels (const char *subchannels, guint32 *a, guint32 *b, guint32 *c)
g_return_val_if_fail (*c == 0, FALSE);
/* sanity check */
if (!isxdigit (subchannels[0]))
if (!g_ascii_isxdigit (subchannels[0]))
return FALSE;
/* Get the first channel */
while (*p && (*p != ',')) {
if (!isxdigit (*p) && (*p != '.'))
if (!g_ascii_isxdigit (*p) && (*p != '.'))
return FALSE; /* Invalid chars */
if (i >= BUFSIZE)
return FALSE; /* Too long to be a subchannel */