From 1ff78d0fc9e89972f34895886aba058ba5260f17 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 9 Feb 2011 12:12:52 +0100 Subject: [PATCH] Various error system fixes. --- src/error.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/error.c b/src/error.c index 956f4d07..01e26170 100644 --- a/src/error.c +++ b/src/error.c @@ -65,6 +65,7 @@ void _glfwSetError(int error, const char* description) //======================================================================== // Returns the current error value +// This function may be called without GLFW having been initialized //======================================================================== GLFWAPI int glfwGetError(void) @@ -77,6 +78,7 @@ GLFWAPI int glfwGetError(void) //======================================================================== // Returns a string representation of the specified error value +// This function may be called without GLFW having been initialized //======================================================================== GLFWAPI const char* glfwErrorString(int error) @@ -102,8 +104,7 @@ GLFWAPI const char* glfwErrorString(int error) case GLFW_PLATFORM_ERROR: return "A platform-specific error occurred"; default: - // TODO: Set GLFW_INVALID_ENUM here? - return NULL; + return "ERROR: UNKNOWN ERROR TOKEN"; } } @@ -116,9 +117,10 @@ GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun) { if (!_glfwInitialized) { - // TODO: Uhm... Hmm... - - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + // We can't call _glfwSetError here as _glfwLibrary is uninitialized + // This should be the only place outside of _glfwSetError where we set + // the global error status directly + _glfwError = GLFW_NOT_INITIALIZED; return; }