WIN32: Simplify string conversion
This commit is contained in:
parent
6e0c93dc46
commit
da978f3a2f
4 changed files with 6 additions and 32 deletions
|
@ -105,16 +105,4 @@ char *unicodeToAnsi(const wchar_t *s, uint codePage) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
wchar_t *UTF8ToUnicode(const char *s) {
|
||||
DWORD size = MultiByteToWideChar(CP_UTF8, 0, s, -1, NULL, 0);
|
||||
|
||||
if (size > 0) {
|
||||
LPWSTR result = (LPWSTR)calloc(size, sizeof(WCHAR));
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, s, -1, result, size) != 0)
|
||||
return result;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue