From d5de48ab537027599d150220a77df5427464c598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 27 Jun 2017 16:35:18 +0200 Subject: [PATCH] Report invalid constants in the appropriate base If the expected constants are defined in hexadecimal in the header then the error string should also use hexadecimal. Idea by IntellectualKitty. Related to #970. --- src/context.c | 10 +++++----- src/init.c | 2 +- src/input.c | 8 ++++---- src/window.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/context.c b/src/context.c index 5a4c3372..1a26356e 100644 --- a/src/context.c +++ b/src/context.c @@ -45,7 +45,7 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) ctxconfig->source != GLFW_OSMESA_CONTEXT_API) { _glfwInputError(GLFW_INVALID_ENUM, - "Invalid context creation API %i", + "Invalid context creation API 0x%08X", ctxconfig->source); return GLFW_FALSE; } @@ -55,7 +55,7 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) ctxconfig->client != GLFW_OPENGL_ES_API) { _glfwInputError(GLFW_INVALID_ENUM, - "Invalid client API %i", + "Invalid client API 0x%08X", ctxconfig->client); return GLFW_FALSE; } @@ -85,7 +85,7 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE) { _glfwInputError(GLFW_INVALID_ENUM, - "Invalid OpenGL profile %i", + "Invalid OpenGL profile 0x%08X", ctxconfig->profile); return GLFW_FALSE; } @@ -134,7 +134,7 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET) { _glfwInputError(GLFW_INVALID_ENUM, - "Invalid context robustness mode %i", + "Invalid context robustness mode 0x%08X", ctxconfig->robustness); return GLFW_FALSE; } @@ -146,7 +146,7 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH) { _glfwInputError(GLFW_INVALID_ENUM, - "Invalid context release behavior %i", + "Invalid context release behavior 0x%08X", ctxconfig->release); return GLFW_FALSE; } diff --git a/src/init.c b/src/init.c index b999149c..307ca009 100644 --- a/src/init.c +++ b/src/init.c @@ -238,7 +238,7 @@ GLFWAPI void glfwInitHint(int hint, int value) return; } - _glfwInputError(GLFW_INVALID_ENUM, "Invalid init hint %i", hint); + _glfwInputError(GLFW_INVALID_ENUM, "Invalid init hint 0x%08X", hint); } GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev) diff --git a/src/input.c b/src/input.c index 7d7ccf3f..6a510ec7 100644 --- a/src/input.c +++ b/src/input.c @@ -225,7 +225,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode) case GLFW_STICKY_MOUSE_BUTTONS: return window->stickyMouseButtons; default: - _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode %i", mode); + _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode); return 0; } } @@ -246,7 +246,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value) value != GLFW_CURSOR_DISABLED) { _glfwInputError(GLFW_INVALID_ENUM, - "Invalid cursor mode %i", + "Invalid cursor mode 0x%08X", value); return; } @@ -309,7 +309,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value) } } - _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode %i", mode); + _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode); } GLFWAPI const char* glfwGetKeyName(int key, int scancode) @@ -466,7 +466,7 @@ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape) shape != GLFW_HRESIZE_CURSOR && shape != GLFW_VRESIZE_CURSOR) { - _glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor %i", shape); + _glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor 0x%08X", shape); return NULL; } diff --git a/src/window.c b/src/window.c index 1d717c30..b7498e1b 100644 --- a/src/window.c +++ b/src/window.c @@ -388,7 +388,7 @@ GLFWAPI void glfwWindowHint(int hint, int value) _glfw.hints.refreshRate = value; break; default: - _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint %i", hint); + _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint 0x%08X", hint); break; } } @@ -757,7 +757,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib) return window->context.noerror; } - _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute %i", attrib); + _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib); return 0; } @@ -804,7 +804,7 @@ GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value) return; } - _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute %i", attrib); + _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib); } GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* handle)