aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2015-02-11 02:27:43 -0500
committerCraig Robbins <kde.psych@gmail.com>2015-02-14 20:59:45 +1000
commit9e9688fc613a74e81aa5ce544482b512071c4677 (patch)
treec4ef11060b62a7f661dec3819e5cea33eddefd09
parent93e5ab367abe9f68cf1fe3ed8a198f563d9452af (diff)
downloadminetest-9e9688fc613a74e81aa5ce544482b512071c4677.tar.gz
minetest-9e9688fc613a74e81aa5ce544482b512071c4677.tar.bz2
minetest-9e9688fc613a74e81aa5ce544482b512071c4677.zip
Fix Android build of narrow_to_wide
-rw-r--r--src/util/string.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/util/string.cpp b/src/util/string.cpp
index 00499ff32..de669b473 100644
--- a/src/util/string.cpp
+++ b/src/util/string.cpp
@@ -62,20 +62,21 @@ int wctomb(char *s, wchar_t wc)
int mbtowc(wchar_t *pwc, const char *s, size_t n)
{
- wchar_t *intermediate = narrow_to_wide(s);
+ const wchar_t *tmp = narrow_to_wide_c(s);
- if (intermediate.length() > 0) {
- *pwc = intermediate[0];
+ if (tmp[0] != '\0') {
+ *pwc = tmp[0];
return 1;
} else {
return -1;
}
}
+
// You must free the returned string!
const wchar_t *narrow_to_wide_c(const char *mbs)
{
size_t mbl = strlen(mbs);
- wchar_t wcs = new wchar_t[mbl + 1];
+ wchar_t *wcs = new wchar_t[mbl + 1];
for (size_t i = 0; i < mbl; i++) {
if (((unsigned char) mbs[i] > 31) &&