[Scummvm-cvs-logs] scummvm master -> 5f583eda0dbd09034ae44dd726b710a18d1aaec5

bluegr md5 at scummvm.org
Sun May 15 12:48:30 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5f583eda0d SWORD25 (LUA): Removed unused non-portable locale code


Commit: 5f583eda0dbd09034ae44dd726b710a18d1aaec5
    https://github.com/scummvm/scummvm/commit/5f583eda0dbd09034ae44dd726b710a18d1aaec5
Author: md5 (md5 at scummvm.org)
Date: 2011-05-15T03:46:22-07:00

Commit Message:
SWORD25 (LUA): Removed unused non-portable locale code

Changed paths:
    engines/sword25/util/lua/llex.cpp
    engines/sword25/util/lua/loslib.cpp



diff --git a/engines/sword25/util/lua/llex.cpp b/engines/sword25/util/lua/llex.cpp
index 91413ba..87eafea 100644
--- a/engines/sword25/util/lua/llex.cpp
+++ b/engines/sword25/util/lua/llex.cpp
@@ -6,7 +6,6 @@
 
 
 #include <ctype.h>
-#include <locale.h>
 #include <string.h>
 
 #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 de96860..578a7cb 100644
--- a/engines/sword25/util/lua/loslib.cpp
+++ b/engines/sword25/util/lua/loslib.cpp
@@ -5,7 +5,6 @@
 */
 
 
-#include <locale.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
@@ -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;
 }
 






More information about the Scummvm-git-logs mailing list