|
@@ -357,19 +357,19 @@ static HWND createHelperWindow(void)
|
|
|
WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source)
|
|
|
{
|
|
|
WCHAR* target;
|
|
|
- int length;
|
|
|
+ int count;
|
|
|
|
|
|
- length = MultiByteToWideChar(CP_UTF8, 0, source, -1, NULL, 0);
|
|
|
- if (!length)
|
|
|
+ count = MultiByteToWideChar(CP_UTF8, 0, source, -1, NULL, 0);
|
|
|
+ if (!count)
|
|
|
{
|
|
|
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
|
|
"Win32: Failed to convert string from UTF-8");
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
- target = calloc(length, sizeof(WCHAR));
|
|
|
+ target = calloc(count, sizeof(WCHAR));
|
|
|
|
|
|
- if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, length))
|
|
|
+ if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, count))
|
|
|
{
|
|
|
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
|
|
"Win32: Failed to convert string from UTF-8");
|
|
@@ -385,19 +385,19 @@ WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source)
|
|
|
char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source)
|
|
|
{
|
|
|
char* target;
|
|
|
- int length;
|
|
|
+ int size;
|
|
|
|
|
|
- length = WideCharToMultiByte(CP_UTF8, 0, source, -1, NULL, 0, NULL, NULL);
|
|
|
- if (!length)
|
|
|
+ size = WideCharToMultiByte(CP_UTF8, 0, source, -1, NULL, 0, NULL, NULL);
|
|
|
+ if (!size)
|
|
|
{
|
|
|
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
|
|
"Win32: Failed to convert string to UTF-8");
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
- target = calloc(length, 1);
|
|
|
+ target = calloc(size, 1);
|
|
|
|
|
|
- if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, length, NULL, NULL))
|
|
|
+ if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, size, NULL, NULL))
|
|
|
{
|
|
|
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
|
|
"Win32: Failed to convert string to UTF-8");
|