Unify error message buffer lengths

This commit is contained in:
Camilla Löwy 2017-08-17 14:25:10 +02:00
parent 08737bdc02
commit 0c70eb8d5c
4 changed files with 7 additions and 5 deletions

View File

@ -148,7 +148,7 @@ static void terminate(void)
void _glfwInputError(int code, const char* format, ...)
{
_GLFWerror* error;
char description[1024];
char description[_GLFW_MESSAGE_SIZE];
if (format)
{

View File

@ -54,6 +54,8 @@
#define _GLFW_POLL_BUTTONS 2
#define _GLFW_POLL_ALL (_GLFW_POLL_AXES | _GLFW_POLL_BUTTONS)
#define _GLFW_MESSAGE_SIZE 1024
typedef int GLFWbool;
typedef struct _GLFWerror _GLFWerror;
@ -263,7 +265,7 @@ struct _GLFWerror
{
_GLFWerror* next;
int code;
char description[1024];
char description[_GLFW_MESSAGE_SIZE];
};
/*! @brief Initialization configuration.

View File

@ -412,8 +412,8 @@ char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source)
//
void _glfwInputErrorWin32(int error, const char* description)
{
WCHAR buffer[1024] = L"";
char message[2048] = "";
WCHAR buffer[_GLFW_MESSAGE_SIZE] = L"";
char message[_GLFW_MESSAGE_SIZE] = "";
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS |

View File

@ -779,7 +779,7 @@ void _glfwReleaseErrorHandlerX11(void)
//
void _glfwInputErrorX11(int error, const char* message)
{
char buffer[8192];
char buffer[_GLFW_MESSAGE_SIZE];
XGetErrorText(_glfw.x11.display, _glfw.x11.errorCode,
buffer, sizeof(buffer));