src/SDL_error.c


Log

Author Commit Date CI Message
Pierre Wendling d0bbfdbf 2022-12-01T16:07:03 Clang-Tidy fixes (#6725) (cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
Sylvain d4e6047e 2022-06-28T09:46:12 Fix SIGSEV in SDL_error (After removing the limit on the size of the SDL error message) (see #5795)
Sam Lantinga cbd01874 2022-06-27T16:59:50 Removed the limit on the size of the SDL error message Also added SDL_GetOriginalMemoryFunctions() Fixes https://github.com/libsdl-org/SDL/issues/5795
Nhalrath b3260e7e 2022-06-11T23:34:20 Remove macro definition for SDL_ERRBUFIZE I was looking at how errors are handled by SDL and came across this #define SDL_ERRBUFIZE which looks like a typo for SDL_ERRBUFSIZE, but either way, it looks like this isn't being used anywhere anymore because it was getting reported whenever I compile SDL with -Wunused-macros, and the last time it was mentioned in the code was from commit 09ca66b.
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Ryan C. Gordon 09ca66bf 2020-04-21T01:30:36 SDL_error: simplified error string management. This patch removes deferred error string formatting: now we do it during SDL_SetError(), so there's no limit on printf-style arguments used. Also removes stub for managing error string translations; we don't have the facilities to maintain that and the way we set arbitrary error strings doesn't really make this practical anyhow. Since the final error string is set right away and unique to the thread, we no longer need a static buffer for legacy SDL_GetError(), and we don't have to allocate 5x 128-byte argument fields per-thread. Also, since we now use SDL_vsnprintf instead of parsing the format string ourselves, there's a lot of code deleted and we have access to more robust formatting powers now. This does mean the final error strings can't be more than 128 bytes, down from the theoretical maximum of around 768, but I think this is probably okay. They might truncate but they will always be null-terminated! Fixes Bugzilla #5092.
Sam Lantinga b6afbe63 2020-04-07T09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
Sam Lantinga 1ff483d1 2020-03-13T21:28:09 Added SDL_GetErrorMsg() to get the error message in a thread-safe way
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sylvain Becker 81cdd500 2019-10-30T17:35:40 Remove redundant 'SDL_GetErrBuf' declaration
Jimb Esser 58ca76be 2019-03-16T18:11:09 Fix DirectInput error codes being lost
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Ozkan Sezer 926d803f 2017-10-29T14:15:00 bug #3739: handle %lu, %li and %ld in SDL_SetError.
Sam Lantinga cd79d8cc 2017-07-10T17:16:12 Fixed bug 3696 - SDL_ShowMessageBox displays different error from intended Mark Callow SDL_ShowMessageBox calls SDL_CaptureMouse which, in the UIKit driver, raises a ?That operation is not supported? error, overwriting the SDL error that an application may be trying to report. This is because UIKit SDL_CaptureMouse returns SDL_Unsupported() which ends up calling SDL_SetError() which has the following code: /* If we are in debug mode, print out an error message */ SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError()); The SDL_GetError call here overwrites the static buffer?.. Although an application can avoid this by using SDL_GetErrorMsg(char* errstr, int maxlen) to avoid the static buffer, SDL should be fixed. The fix is simple. In SDL_SetError change SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError()); to SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", error); where error is the pointer to the buffer where it assembled the message.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Ryan C. Gordon 232ae688 2016-11-23T17:20:28 Still more compiler warning fixes for various platforms.
Ryan C. Gordon 40c2a6fb 2016-11-23T11:49:26 Fixed more compiler warnings.
Sam Lantinga 53e22e4b 2016-10-01T11:22:39 Only use GCC pragmas when we're building with GCC
Bastien Nocera 7edd2261 2016-10-01T10:36:24 Fix "format not a string literal" errors With GCC 6.1. https://bugzilla.libsdl.org/show_bug.cgi?id=3375
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga f9abea20 2015-05-28T12:31:25 Fixed bug 2210 - Initializing Video produces unnecessary errors hiduei Overview: Initializing the Video Subsystem causes many errors though everything works as it should. Steps to Reproduce: 1) Set Loglevel to SDL_LOG_PRIORITY_ERROR 2) Initialize the Video Subsystem (SDL_Init(SDL_INIT_VIDEO)) Actual Results: Many errors (see attachment) are printed on stderr, then the application continues as expected. Expected Results: The errors should have been warnings at most.
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Ryan C. Gordon d9f37853 2015-03-24T03:12:35 Make SDL error string formatting deal with nasty corner cases. We continued looping while maxlen > 0, but maxlen was unsigned, so an overflow would make it a large number instead of negative. Fixed. Some snprintf() implementations might return a negative value if there isn't enough space, and we now check for that. Don't overrun the SDL error message buffer, if snprintf() returned the number of chars it wanted to write instead of the number it did. snprintf is a portability mess, we should just never use the C runtime for it. Fixes Bugzilla #2049.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Sam Lantinga da6d9a9f 2014-06-04T10:56:56 Added annotations to help code analysis tools CR: Bruce Dawson
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
Sam Lantinga 1ad936eb 2013-08-11T19:56:43 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow() Rainer Deyke I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.