summaryrefslogtreecommitdiff
path: root/epan/wslua
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-10-16 23:20:52 -0700
committerGuy Harris <guy@alum.mit.edu>2014-10-17 06:22:20 +0000
commit44d4339eb335b6d6f7a8ffad6846e82aba90b233 (patch)
treed96b79014f892cb0fd0cd3625c715f7ae18257f5 /epan/wslua
parent25d9a7b5f1b880ab283947da28a8216dc9b7e551 (diff)
downloadwireshark-44d4339eb335b6d6f7a8ffad6846e82aba90b233.tar.gz
Don't use <ctype.h> macros, and eliminate an include of <ctype.h>.
This avoids locale-dependent tests, and fixes cases where we passed signed char values to those macros (which is not safe with char being signed, as it is on most, but not all, platforms). Change-Id: I51d9716fe3eb02a6e98208334285c07597a6be79 Reviewed-on: https://code.wireshark.org/review/4761 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/wslua_struct.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/epan/wslua/wslua_struct.c b/epan/wslua/wslua_struct.c
index db7e957a9c..e6b5471eb9 100644
--- a/epan/wslua/wslua_struct.c
+++ b/epan/wslua/wslua_struct.c
@@ -77,7 +77,6 @@
#include <assert.h>
-#include <ctype.h>
#include <limits.h>
#include <stddef.h>
#include <string.h>
@@ -212,13 +211,13 @@ typedef struct Header {
/* For options that take a number argument, gets the number */
static int getnum (const gchar **fmt, int df) {
- if (!isdigit(**fmt)) /* no number? */
+ if (!g_ascii_isdigit(**fmt)) /* no number? */
return df; /* return default value */
else {
int a = 0;
do {
a = a*10 + *((*fmt)++) - '0';
- } while (isdigit(**fmt));
+ } while (g_ascii_isdigit(**fmt));
return a;
}
}
@@ -484,7 +483,7 @@ WSLUA_CONSTRUCTOR Struct_unpack (lua_State *L) {
switch (opt) {
case 'b': case 'B': case 'h': case 'H':
case 'l': case 'L': case 'T': case 'i': case 'I': { /* integer types */
- int issigned = islower(opt);
+ int issigned = g_ascii_islower(opt);
lua_Number res = getinteger(data+pos, h.endian, issigned, (int)size);
lua_pushnumber(L, res);
break;
@@ -563,7 +562,7 @@ WSLUA_CONSTRUCTOR Struct_size (lua_State *L) {
luaL_argerror(L, 1, "option 's' has no fixed size");
else if (opt == 'c' && size == 0)
luaL_argerror(L, 1, "option 'c0' has no fixed size");
- if (!isalnum(opt))
+ if (!g_ascii_isalnum(opt))
controloptions(L, opt, &fmt, &h);
pos += size;
}
@@ -599,7 +598,7 @@ WSLUA_CONSTRUCTOR Struct_values (lua_State *L) {
default:
break;
}
- if (!isalnum(opt))
+ if (!g_ascii_isalnum(opt))
controloptions(L, opt, &fmt, &h);
else if (size && !h.noassign)
vals++;