From 5f583eda0dbd09034ae44dd726b710a18d1aaec5 Mon Sep 17 00:00:00 2001 From: md5 Date: Sun, 15 May 2011 13:46:22 +0300 Subject: SWORD25 (LUA): Removed unused non-portable locale code --- engines/sword25/util/lua/llex.cpp | 13 +++---------- engines/sword25/util/lua/loslib.cpp | 10 ++-------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/engines/sword25/util/lua/llex.cpp b/engines/sword25/util/lua/llex.cpp index 91413ba55c..87eafea45a 100644 --- a/engines/sword25/util/lua/llex.cpp +++ b/engines/sword25/util/lua/llex.cpp @@ -6,7 +6,6 @@ #include -#include #include #define llex_c @@ -176,17 +175,11 @@ static void buffreplace (LexState *ls, char from, char to) { static void trydecpoint (LexState *ls, SemInfo *seminfo) { /* format error: try to update decimal point separator */ -#if defined(__ANDROID__) - // Android is missing the decimal_point member from the lconv struct. - // For more information, refer to: - // http://www.damonkohler.com/2008/12/lua-on-android.html + // Non-portable call to update the decimal point separator. + // It has been simplified in ScummVM to not use any system locale + // information, as it's not used in sword25. char old = ls->decpoint; ls->decpoint = '.'; -#else - struct lconv *cv = localeconv(); - char old = ls->decpoint; - ls->decpoint = (cv ? cv->decimal_point[0] : '.'); -#endif buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */ if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) { /* format error with correct decimal point: no more options */ diff --git a/engines/sword25/util/lua/loslib.cpp b/engines/sword25/util/lua/loslib.cpp index de96860812..578a7cb09a 100644 --- a/engines/sword25/util/lua/loslib.cpp +++ b/engines/sword25/util/lua/loslib.cpp @@ -5,7 +5,6 @@ */ -#include #include #include #include @@ -183,13 +182,8 @@ static int os_difftime (lua_State *L) { static int os_setlocale (lua_State *L) { - static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, - LC_NUMERIC, LC_TIME}; - static const char *const catnames[] = {"all", "collate", "ctype", "monetary", - "numeric", "time", NULL}; - const char *l = luaL_optstring(L, 1, NULL); - int op = luaL_checkoption(L, 2, "all", catnames); - lua_pushstring(L, setlocale(cat[op], l)); + // Non-portable call to set the numeric locale. Removed in ScummVM, as it's + // not used in sword25. return 1; } -- cgit v1.2.3