mirror of
https://github.com/glfw/glfw.git
synced 2025-06-15 12:12:16 +00:00
fix C89 forbidden mixed declarations
This commit is contained in:
parent
5ddb905a6a
commit
3c44229af8
@ -2907,7 +2907,7 @@ GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark Do not forget to free the returned char* when you are done with it.
|
||||
*
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
*
|
||||
* @sa @ref window_title
|
||||
@ -2935,7 +2935,7 @@ GLFWAPI char* glfwGetWindowTitle(GLFWwindow* window);
|
||||
*
|
||||
* @sa @ref window_title
|
||||
* @sa @ref glfwGetWindowTitle
|
||||
*
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter.
|
||||
*
|
||||
|
@ -1464,11 +1464,14 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
||||
|
||||
char* _glfwPlatformGetWindowTitle(_GLFWwindow* window)
|
||||
{
|
||||
int count = GetWindowTextLengthW(window->win32.handle);
|
||||
int count;
|
||||
SetLastError(0);
|
||||
|
||||
count = GetWindowTextLengthW(window->win32.handle);
|
||||
if(count == 0)
|
||||
{
|
||||
SetLastError(0);
|
||||
int error = GetLastError();
|
||||
int error;
|
||||
error = GetLastError();
|
||||
|
||||
if(error != 0)
|
||||
{
|
||||
@ -1477,18 +1480,21 @@ char* _glfwPlatformGetWindowTitle(_GLFWwindow* window)
|
||||
}
|
||||
else
|
||||
return calloc(1, sizeof(char)); // single \0
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR* wideTitle;
|
||||
char* title;
|
||||
count += 1; // the \0
|
||||
WCHAR* wideTitle = calloc(count, sizeof(WCHAR));
|
||||
|
||||
wideTitle = calloc(count, sizeof(WCHAR));
|
||||
GetWindowTextW(window->win32.handle, wideTitle, count);
|
||||
|
||||
char* title = _glfwCreateUTF8FromWideStringWin32(wideTitle);
|
||||
|
||||
title = _glfwCreateUTF8FromWideStringWin32(wideTitle);
|
||||
if(!title)
|
||||
return calloc(1, sizeof(char)); // single \0
|
||||
|
||||
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
@ -2084,7 +2084,7 @@ char* _glfwPlatformGetWindowTitle(_GLFWwindow* window)
|
||||
char* title;
|
||||
|
||||
_glfwGrabErrorHandlerX11();
|
||||
|
||||
|
||||
if (XGetWMName(_glfw.x11.display, window->x11.handle, &textProperty) == 0)
|
||||
{
|
||||
_glfwInputErrorX11(GLFW_PLATFORM_ERROR, "X11: Could not get window title");
|
||||
@ -2100,10 +2100,10 @@ char* _glfwPlatformGetWindowTitle(_GLFWwindow* window)
|
||||
_glfwInputErrorX11(GLFW_PLATFORM_ERROR, "X11: No memory to convert window title to UTF-8");
|
||||
else if (ret == XLocaleNotSupported || ret == XConverterNotFound)
|
||||
_glfwInputErrorX11(GLFW_PLATFORM_ERROR, "X11: Cannot convert window title, unsupported locale");
|
||||
|
||||
|
||||
if (textProperty.value != NULL)
|
||||
XFree(textProperty.value);
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2112,19 +2112,19 @@ char* _glfwPlatformGetWindowTitle(_GLFWwindow* window)
|
||||
_glfwReleaseErrorHandlerX11();
|
||||
|
||||
if (textProperty.value != NULL)
|
||||
XFree(textProperty.value);
|
||||
XFree(textProperty.value);
|
||||
if (charList != NULL)
|
||||
XFreeStringList(charList);
|
||||
|
||||
|
||||
return calloc(1, sizeof(char));
|
||||
}
|
||||
|
||||
|
||||
title = _glfw_strdup(charList[0]);
|
||||
|
||||
|
||||
_glfwReleaseErrorHandlerX11();
|
||||
|
||||
if (textProperty.value != NULL)
|
||||
XFree(textProperty.value);
|
||||
XFree(textProperty.value);
|
||||
if (charList != NULL)
|
||||
XFreeStringList(charList);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user