summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-09-07 06:46:03 +0000
committerrubidium <rubidium@openttd.org>2014-09-07 06:46:03 +0000
commitf41b4a8e1bc6176670cf31b06e90c14a93a378f7 (patch)
treeb67731aa5dd57be36a608ae88b998bccd219d3b9 /src/script
parent6bf8a63ed99f17098f185b84886200af9afa6379 (diff)
downloadopenttd-f41b4a8e1bc6176670cf31b06e90c14a93a378f7.tar.xz
(svn r26784) -Codechange [Squirrel]: use WChar for the lexer
Diffstat (limited to 'src/script')
-rw-r--r--src/script/squirrel.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index 7697edd24..ae8b9b03a 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -380,14 +380,14 @@ public:
}
};
-static SQInteger _io_file_lexfeed_ASCII(SQUserPointer file)
+static WChar _io_file_lexfeed_ASCII(SQUserPointer file)
{
char c;
if (((SQFile *)file)->Read(&c, sizeof(c), 1) > 0) return c;
return 0;
}
-static SQInteger _io_file_lexfeed_UTF8(SQUserPointer file)
+static WChar _io_file_lexfeed_UTF8(SQUserPointer file)
{
static const SQInteger utf8_lengths[16] =
{
@@ -399,7 +399,7 @@ static SQInteger _io_file_lexfeed_UTF8(SQUserPointer file)
};
static unsigned char byte_masks[5] = {0, 0, 0x1F, 0x0F, 0x07};
unsigned char inchar;
- SQInteger c = 0;
+ WChar c = 0;
if (((SQFile *)file)->Read(&inchar, sizeof(inchar), 1) != 1) return 0;
c = inchar;
@@ -419,19 +419,19 @@ static SQInteger _io_file_lexfeed_UTF8(SQUserPointer file)
return c;
}
-static SQInteger _io_file_lexfeed_UCS2_no_swap(SQUserPointer file)
+static WChar _io_file_lexfeed_UCS2_no_swap(SQUserPointer file)
{
- wchar_t c;
- if (((SQFile *)file)->Read(&c, sizeof(c), 1) > 0) return (SQChar)c;
+ unsigned short c;
+ if (((SQFile *)file)->Read(&c, sizeof(c), 1) > 0) return (WChar)c;
return 0;
}
-static SQInteger _io_file_lexfeed_UCS2_swap(SQUserPointer file)
+static WChar _io_file_lexfeed_UCS2_swap(SQUserPointer file)
{
unsigned short c;
if (((SQFile *)file)->Read(&c, sizeof(c), 1) > 0) {
c = ((c >> 8) & 0x00FF)| ((c << 8) & 0xFF00);
- return (SQChar)c;
+ return (WChar)c;
}
return 0;
}