Added switch

This commit is contained in:
Snowiiii 2021-12-30 10:49:14 +01:00 committed by GitHub
parent d18408516c
commit 5562aa575b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,25 +150,17 @@ char* _glfw_strdup(const char* source)
float _glfw_fminf(float a, float b)
{
if (a != a)
return b;
else if (b != b)
if (b != b || a < b)
return a;
else if (a < b)
return a;
else
return b;
}
float _glfw_fmaxf(float a, float b)
{
if (a != a)
return b;
else if (b != b)
if (b != b || a > b)
return a;
else if (a > b)
return a;
else
return b;
}
@ -249,37 +241,54 @@ void _glfwInputError(int code, const char* format, ...)
}
else
{
if (code == GLFW_NOT_INITIALIZED)
switch (code)
{
case GLFW_NOT_INITIALIZED:
strcpy(description, "The GLFW library is not initialized");
else if (code == GLFW_NO_CURRENT_CONTEXT)
break;
case GLFW_NO_CURRENT_CONTEXT:
strcpy(description, "There is no current context");
else if (code == GLFW_INVALID_ENUM)
break;
case GLFW_INVALID_ENUM:
strcpy(description, "Invalid argument for enum parameter");
else if (code == GLFW_INVALID_VALUE)
break;
case GLFW_INVALID_VALUE:
strcpy(description, "Invalid value for parameter");
else if (code == GLFW_OUT_OF_MEMORY)
break;
case GLFW_OUT_OF_MEMORY:
strcpy(description, "Out of memory");
else if (code == GLFW_API_UNAVAILABLE)
break;
case GLFW_API_UNAVAILABLE:
strcpy(description, "The requested API is unavailable");
else if (code == GLFW_VERSION_UNAVAILABLE)
break;
case GLFW_VERSION_UNAVAILABLE:
strcpy(description, "The requested API version is unavailable");
else if (code == GLFW_PLATFORM_ERROR)
break;
case GLFW_PLATFORM_ERROR:
strcpy(description, "A platform-specific error occurred");
else if (code == GLFW_FORMAT_UNAVAILABLE)
break;
case GLFW_FORMAT_UNAVAILABLE:
strcpy(description, "The requested format is unavailable");
else if (code == GLFW_NO_WINDOW_CONTEXT)
break;
case GLFW_NO_WINDOW_CONTEXT:
strcpy(description, "The specified window has no context");
else if (code == GLFW_CURSOR_UNAVAILABLE)
break;
case GLFW_CURSOR_UNAVAILABLE:
strcpy(description, "The specified cursor shape is unavailable");
else if (code == GLFW_FEATURE_UNAVAILABLE)
break;
case GLFW_FEATURE_UNAVAILABLE:
strcpy(description, "The requested feature cannot be implemented for this platform");
else if (code == GLFW_FEATURE_UNIMPLEMENTED)
break;
case GLFW_FEATURE_UNIMPLEMENTED:
strcpy(description, "The requested feature has not yet been implemented for this platform");
else if (code == GLFW_PLATFORM_UNAVAILABLE)
break;
case GLFW_PLATFORM_UNAVAILABLE:
strcpy(description, "The requested platform is unavailable");
else
break;
default:
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
}
}
if (_glfw.initialized)
{