MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / _glfwInputError

Function _glfwInputError

extern/glfw/src/init.c:155–217  ·  view source on GitHub ↗

Notifies shared code of an error

Source from the content-addressed store, hash-verified

153// Notifies shared code of an error
154//
155void _glfwInputError(int code, const char* format, ...)
156{
157 _GLFWerror* error;
158 char description[_GLFW_MESSAGE_SIZE];
159
160 if (format)
161 {
162 va_list vl;
163
164 va_start(vl, format);
165 vsnprintf(description, sizeof(description), format, vl);
166 va_end(vl);
167
168 description[sizeof(description) - 1] = '\0';
169 }
170 else
171 {
172 if (code == GLFW_NOT_INITIALIZED)
173 strcpy(description, "The GLFW library is not initialized");
174 else if (code == GLFW_NO_CURRENT_CONTEXT)
175 strcpy(description, "There is no current context");
176 else if (code == GLFW_INVALID_ENUM)
177 strcpy(description, "Invalid argument for enum parameter");
178 else if (code == GLFW_INVALID_VALUE)
179 strcpy(description, "Invalid value for parameter");
180 else if (code == GLFW_OUT_OF_MEMORY)
181 strcpy(description, "Out of memory");
182 else if (code == GLFW_API_UNAVAILABLE)
183 strcpy(description, "The requested API is unavailable");
184 else if (code == GLFW_VERSION_UNAVAILABLE)
185 strcpy(description, "The requested API version is unavailable");
186 else if (code == GLFW_PLATFORM_ERROR)
187 strcpy(description, "A platform-specific error occurred");
188 else if (code == GLFW_FORMAT_UNAVAILABLE)
189 strcpy(description, "The requested format is unavailable");
190 else if (code == GLFW_NO_WINDOW_CONTEXT)
191 strcpy(description, "The specified window has no context");
192 else
193 strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
194 }
195
196 if (_glfw.initialized)
197 {
198 error = _glfwPlatformGetTls(&_glfw.errorSlot);
199 if (!error)
200 {
201 error = calloc(1, sizeof(_GLFWerror));
202 _glfwPlatformSetTls(&_glfw.errorSlot, error);
203 _glfwPlatformLockMutex(&_glfw.errorLock);
204 error->next = _glfw.errorListHead;
205 _glfw.errorListHead = error;
206 _glfwPlatformUnlockMutex(&_glfw.errorLock);
207 }
208 }
209 else
210 error = &_glfwMainThreadError;
211
212 error->code = code;

Callers 15

_glfwPlatformCreateTlsFunction · 0.85
_glfwPlatformCreateMutexFunction · 0.85
glfwInitHintFunction · 0.85
deviceCallbackFunction · 0.85
_glfwInitJoysticksWin32Function · 0.85
_glfwInitVulkanFunction · 0.85
glfwCreateWindowSurfaceFunction · 0.85
createNativeWindowFunction · 0.85

Calls 4

_glfwPlatformGetTlsFunction · 0.70
_glfwPlatformSetTlsFunction · 0.70
_glfwPlatformLockMutexFunction · 0.70
_glfwPlatformUnlockMutexFunction · 0.70

Tested by

no test coverage detected