mirror of
https://github.com/minetest/minetest.git
synced 2025-01-12 08:17:31 +01:00
Fix minor memory leak (Android)
This commit is contained in:
parent
14f7df980b
commit
338e66af5f
@ -40,6 +40,7 @@ static bool parseHexColorString(const std::string &value, video::SColor &color);
|
|||||||
static bool parseNamedColorString(const std::string &value, video::SColor &color);
|
static bool parseNamedColorString(const std::string &value, video::SColor &color);
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
|
|
||||||
const wchar_t* wide_chars =
|
const wchar_t* wide_chars =
|
||||||
L" !\"#$%&'()*+,-./0123456789:;<=>?@"
|
L" !\"#$%&'()*+,-./0123456789:;<=>?@"
|
||||||
L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
|
L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
|
||||||
@ -62,14 +63,18 @@ int wctomb(char *s, wchar_t wc)
|
|||||||
|
|
||||||
int mbtowc(wchar_t *pwc, const char *s, size_t n)
|
int mbtowc(wchar_t *pwc, const char *s, size_t n)
|
||||||
{
|
{
|
||||||
const wchar_t *tmp = narrow_to_wide_c(s);
|
if (s == NULL || *s == '\0')
|
||||||
|
|
||||||
if (tmp[0] != '\0') {
|
|
||||||
*pwc = tmp[0];
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
const wchar_t *tmp = narrow_to_wide_c(s);
|
||||||
|
bool success = tmp[0] != '\0';
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
*pwc = tmp[0];
|
||||||
|
|
||||||
|
delete tmp;
|
||||||
|
|
||||||
|
return success ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// You must free the returned string!
|
// You must free the returned string!
|
||||||
|
Loading…
Reference in New Issue
Block a user