mirror of
https://github.com/wiiu-env/libgui.git
synced 2025-01-11 15:59:13 +01:00
Fix charToWideChar
in FreeTypeGX
This commit is contained in:
parent
d89093de78
commit
e6b07f9e67
@ -70,17 +70,18 @@ FreeTypeGX::~FreeTypeGX() {
|
||||
wchar_t *FreeTypeGX::charToWideChar(const char *strChar) {
|
||||
if (!strChar) { return NULL; }
|
||||
|
||||
wchar_t *strWChar = new(std::nothrow) wchar_t[strlen(strChar) + 1];
|
||||
size_t len = strlen(strChar) + 1;
|
||||
wchar_t *strWChar = new(std::nothrow) wchar_t[len];
|
||||
if (!strWChar) { return NULL; }
|
||||
|
||||
int32_t bt = mbstowcs(strWChar, strChar, strlen(strChar));
|
||||
if (bt > 0) {
|
||||
strWChar[bt] = 0;
|
||||
return strWChar;
|
||||
size_t bt = mbstowcs(strWChar, strChar, len);
|
||||
if (bt == (size_t) -1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wchar_t *tempDest = strWChar;
|
||||
while ((*tempDest++ = *strChar++));
|
||||
if (bt < --len) {
|
||||
strWChar[bt] = 0;
|
||||
}
|
||||
|
||||
return strWChar;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user