aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-12 23:59:58 +0100
committerEugene Sandulenko2019-12-12 23:59:58 +0100
commit4b0fcd411b8723aea48755dedfeefe5c21952d70 (patch)
treef828eb06c3a5cf6c00b022870967e85d283a21ee
parentf0b7a28c51cd71826f578154ee5fb694b735660a (diff)
downloadscummvm-rg350-4b0fcd411b8723aea48755dedfeefe5c21952d70.tar.gz
scummvm-rg350-4b0fcd411b8723aea48755dedfeefe5c21952d70.tar.bz2
scummvm-rg350-4b0fcd411b8723aea48755dedfeefe5c21952d70.zip
COMMON: Fix string length in U32String::encode()
Our method expects length in bytes, not in characters, which is 4x for U32
-rw-r--r--common/str-enc.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/str-enc.cpp b/common/str-enc.cpp
index 3aba06d58f..7d887e8a65 100644
--- a/common/str-enc.cpp
+++ b/common/str-enc.cpp
@@ -395,7 +395,7 @@ String U32String::encode(CodePage page) const {
page >= ARRAYSIZE(g_codePageMap)) {
error("Invalid codepage");
}
- char *result = Encoding::convert(g_codePageMap[page], "UTF-32", (const char *)_str, _size);
+ char *result = Encoding::convert(g_codePageMap[page], "UTF-32", (const char *)_str, _size * 4);
if (result) {
// Encodings in CodePage all use '\0' as string ending
// That would be problematic if CodePage has UTF-16 or UTF-32