diff options
author | rubidium <rubidium@openttd.org> | 2009-07-31 23:13:53 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-31 23:13:53 +0000 |
commit | 5186d1d4f6c0fd866ef45046ac8368f5ab5693ae (patch) | |
tree | 30608e4a59805fcb211ab4a8e75c799798c2ef74 /src | |
parent | 8d768f5b30b4415591fafa23345d81cc306e28ea (diff) | |
download | openttd-5186d1d4f6c0fd866ef45046ac8368f5ab5693ae.tar.xz |
(svn r17013) -Fix [FS#3074]: concatenating strings in Squirrel when non-ASCII strings were received from OpenTTD failed. The number of bytes in an UTF-8 encoded string isn't always the same as the number of characters in the decoded (into wchars) string
Diffstat (limited to 'src')
-rw-r--r-- | src/script/squirrel_helper.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index ba4069d74..580f49cbd 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -80,8 +80,8 @@ namespace SQConvert { template <> inline int Return<int64> (HSQUIRRELVM vm, int64 res) { sq_pushinteger(vm, ClampToI32(res)); return 1; } template <> inline int Return<Money> (HSQUIRRELVM vm, Money res) { sq_pushinteger(vm, ClampToI32(res)); return 1; } template <> inline int Return<bool> (HSQUIRRELVM vm, bool res) { sq_pushbool (vm, res); return 1; } - template <> inline int Return<char *> (HSQUIRRELVM vm, char *res) { if (res == NULL) sq_pushnull(vm); else {sq_pushstring (vm, OTTD2FS(res), strlen(res)); free(res);} return 1; } - template <> inline int Return<const char *>(HSQUIRRELVM vm, const char *res) { if (res == NULL) sq_pushnull(vm); else {sq_pushstring (vm, OTTD2FS(res), strlen(res));} return 1; } + template <> inline int Return<char *> (HSQUIRRELVM vm, char *res) { if (res == NULL) sq_pushnull(vm); else { sq_pushstring(vm, OTTD2FS(res), -1); free(res); } return 1; } + template <> inline int Return<const char *>(HSQUIRRELVM vm, const char *res) { if (res == NULL) sq_pushnull(vm); else { sq_pushstring(vm, OTTD2FS(res), -1); } return 1; } template <> inline int Return<void *> (HSQUIRRELVM vm, void *res) { sq_pushuserpointer(vm, res); return 1; } /** |