aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/util/lua/lbaselib.cpp
diff options
context:
space:
mode:
authorMax Horn2012-01-28 01:15:49 +0100
committerMax Horn2012-02-15 16:51:37 +0100
commit658080deeda79d20ea40643569fbcb072573e7cf (patch)
treed604bf668909a6db44a1ec83e7c51088a5d85592 /engines/sword25/util/lua/lbaselib.cpp
parent37e5b209a71af725456a42be2605dea28ffceb84 (diff)
downloadscummvm-rg350-658080deeda79d20ea40643569fbcb072573e7cf.tar.gz
scummvm-rg350-658080deeda79d20ea40643569fbcb072573e7cf.tar.bz2
scummvm-rg350-658080deeda79d20ea40643569fbcb072573e7cf.zip
ALL: Avoid using is* macros from ctype.h
On some systems, passing signed chars to macros like isspace() etc. lead to a runtime error. Hence, mark these macros as forbidden by default, and introduce otherwise equivalent alternatives for them.
Diffstat (limited to 'engines/sword25/util/lua/lbaselib.cpp')
-rw-r--r--engines/sword25/util/lua/lbaselib.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/engines/sword25/util/lua/lbaselib.cpp b/engines/sword25/util/lua/lbaselib.cpp
index 3f0b645164..940ddcd4f9 100644
--- a/engines/sword25/util/lua/lbaselib.cpp
+++ b/engines/sword25/util/lua/lbaselib.cpp
@@ -6,10 +6,7 @@
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "common/util.h"
#define lbaselib_c
#define LUA_LIB
@@ -62,7 +59,7 @@ static int luaB_tonumber (lua_State *L) {
luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
n = strtoul(s1, &s2, base);
if (s1 != s2) { /* at least one valid digit? */
- while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */
+ while (isSpace(*s2)) s2++; /* skip trailing spaces */
if (*s2 == '\0') { /* no invalid trailing characters? */
lua_pushnumber(L, (lua_Number)n);
return 1;