aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormd52011-05-13 20:52:33 +0300
committermd52011-05-13 20:52:33 +0300
commit854783ea93d89a28c0bf1617dfd89c84e30d6423 (patch)
treef2153ba9fd5b2e762f85a039dd995f8f29e09bad
parente3a487702abb7c6f09aae8b0bdf53d3089112af2 (diff)
downloadscummvm-rg350-854783ea93d89a28c0bf1617dfd89c84e30d6423.tar.gz
scummvm-rg350-854783ea93d89a28c0bf1617dfd89c84e30d6423.tar.bz2
scummvm-rg350-854783ea93d89a28c0bf1617dfd89c84e30d6423.zip
SWORD25 (LUA): Hopefully fixed compilation for the Android platform
-rw-r--r--engines/sword25/util/lua/llex.cpp8
-rw-r--r--engines/sword25/util/lua/lvm.cpp7
2 files changed, 15 insertions, 0 deletions
diff --git a/engines/sword25/util/lua/llex.cpp b/engines/sword25/util/lua/llex.cpp
index fdde2b8e5f..91413ba55c 100644
--- a/engines/sword25/util/lua/llex.cpp
+++ b/engines/sword25/util/lua/llex.cpp
@@ -176,9 +176,17 @@ 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
+ 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/lvm.cpp b/engines/sword25/util/lua/lvm.cpp
index ae70fe2645..15013397ba 100644
--- a/engines/sword25/util/lua/lvm.cpp
+++ b/engines/sword25/util/lua/lvm.cpp
@@ -202,7 +202,14 @@ static int l_strcmp (const TString *ls, const TString *rs) {
const char *r = getstr(rs);
size_t lr = rs->tsv.len;
for (;;) {
+#if defined(__ANDROID__)
+ // Android is missing strcoll().
+ // For more information, refer to:
+ // http://www.damonkohler.com/2008/12/lua-on-android.html
+ int temp = strcmp(l, r);
+#else
int temp = strcoll(l, r);
+#endif
if (temp != 0) return temp;
else { /* strings are equal up to a `\0' */
size_t len = strlen(l); /* index of first `\0' in both strings */