Commit Graph

33 Commits

Author SHA1 Message Date
Sam Lantinga 996b3dc37a Fixed warning building with Visual Studio 2022-05-15 09:33:28 -07:00
Eddy Jansson d7866ffac8 assert: Check for integer overflow.
Move rendering of the assert message into a separate
function so we can remove the ugly loop construction.

Changes the logic such that allocation failure no longer
immediately returns SDL_ASSERTION_ABORT, instead we
fall back to the truncated message.

If an error is indicated from SDL_snprintf, then we do
abort with SDL_ASSERTION_ABORT.
2022-05-11 12:55:49 -07:00
Eddy Jansson ca26df3404 assert: Allow messages of any length.
Messages are no longer truncated to SDL_MAX_LOG_MESSAGE.
2022-04-29 10:39:02 -07:00
Eddy Jansson 73448fe245 assert: Remove use of alloca()
For short messages, use a stack buffer that is
significantly smaller than SDL_MAX_LOG_MESSAGE.

For larger messages, fall back to allocation.
2022-04-29 10:39:02 -07:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sylvain Becker 3d100df36f Readability: remove const-qualifation from function declaration
const-qualification of parameters only has an effect in function definitions
2019-10-30 15:43:49 +01:00
Sam Lantinga 097b9c3084 Better fix for iOS build 2019-10-17 17:51:49 -07:00
Ryan C. Gordon ec04110d8e dynapi: Deal with failure cases better, other fixes.
Fixes Bugzilla #4803.
2019-10-14 12:41:06 -04:00
Ozkan Sezer ceee7def84 minor build fixes. 2019-07-31 00:05:28 +03:00
Ryan C. Gordon fffa791fce assert: Another attempt to quiet compiler warnings. 2019-06-14 22:29:13 -04:00
Ryan C. Gordon 59e510b0b6 assert: Possibly fixing compiler warning on Android. 2019-06-14 21:39:51 -04:00
Ryan C. Gordon b530d75afb assert: Fixed some compiler warnings. 2019-06-12 15:35:06 -04:00
Ryan C. Gordon f5a347853d assert: mark SDL_ExitProcess as SDL_NORETURN again.
Put in a hack to (hopefully) make MingW happy.

Fixes Bugzilla #4100.
2019-06-11 21:57:30 -04:00
Sam Lantinga f79190f407 Use _Exit() when available 2019-04-23 07:59:31 -07:00
Charlie Birks 4a2888af10 Emscripten: use UTF8ToString instead of Pointer_stringify 2019-01-29 12:19:03 +00:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Ryan C. Gordon b262b0ebc9 Small stack allocations fall back to malloc if they're unexpectedly large. 2018-10-22 20:50:32 -04:00
Ozkan Sezer 08de74ec49 use the 'aborts' pragma of Watcom for SDL_NORETURN functions
SDL_ExitProcess(), SDL_AbortAssertion() and SDLTest_BailOut().

(Commit 303c1e0fb0cf for bug #4100 removed SDL_NORETURN from
SDL_ExitProcess() and SDL_AbortAssertion() in order to avoid
warnings from windows builds, but that's temporary I guess..)
2018-06-13 14:45:02 +03:00
Sam Lantinga 2419d26724 Progress fixing bug 4100 - errors and warnings after changeset 11917
Ozkan Sezer 2018-03-02 20:02:37 UTC
http://hg.libsdl.org/SDL/rev/d702b0c54e52 resulted in an error and
two warnings when compiled with mingw.

1.  Error from SDL_windowstaskdialog.h:
In file included from src/video/windows/SDL_windowsmessagebox.c:29:0:
src/video/windows/SDL_windowstaskdialog.h:23:54: error: expected ')' before 'HWND'

This is fixed by removing unnecessary annotations:

2.  Warning from SDL_assert.c:
src/SDL_assert.c: In function 'SDL_ExitProcess':
src/SDL_assert.c:138:1: warning: 'noreturn' function does return

Indeed ExitProcess() is prototyped with DECLSPEC_NORETURN, but
TerminateProcess() is not.  This can be rectified by adding an
exit() call in there. Do NOTE, however, that requires building
with a libc:

3.  Warning from SDL_windowsmessagebox.c:
src/video/windows/SDL_windowsmessagebox.c: In function 'WIN_ShowMessageBox':
src/video/windows/SDL_windowsmessagebox.c:513:9: warning: 'nCancelButton' may be used uninitialized in this function

My lazy solution was manually initializing nCancelButton to 0.
2018-03-02 22:53:25 -08:00
Ryan C. Gordon cef1c1c2ee windows: Restore patches for Task Dialogs and TerminateProcess().
2.0.8 has shipped, these can live in revision control now!
2018-03-02 14:10:25 -05:00
Ryan C. Gordon 3537c3e7a9 Back out Task Dialog and TerminateProcess patches for 2.0.8.
These can return to revision control once we ship.
2018-02-28 10:39:41 -05:00
Ryan C. Gordon 8536130aa2 assert: Use TerminateProcess() on Windows, vs ExitProcess (thanks, Jack!).
"What I have done is use TerminateProcess rather than ExitProcess.
ExitProcess will cause Microsoft's leak detection to continue, TerminateProcess
won't. It is also technically wrong to use ExitProcess in the case of aborting
the application.

Jack Powell
Twitter @jack9267"
2018-02-28 01:23:49 -05:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga 8e98bdaa6f Fixed bug 3883 - SDL_assert / SDL_PromptAssertion in TTY mode does not accept options ("abriA")
shoerbaffen

fgets can read a newline and SDL_strcmp will never return zero.
2017-10-15 21:21:19 -07:00
Sam Lantinga ca5c304814 Fixed bug 3744 - missing SDLCALL in several functions
Ozkan Sezer

The attached patch adds missing SDLCALL to several functions, so that
they properly match the headers as intended.
2017-08-13 21:06:52 -07:00
Ryan C. Gordon e889757bb3 assert: Better Emscripten support.
(Better than nothing, that is.)

Fixes Bugzilla #3459.
2017-05-19 14:51:03 -04:00
Ryan C. Gordon 8917f8634d assert: allow assertions to work on platforms without threads.
Partially fixes Bugzilla #3459.
2017-05-19 12:54:17 -04:00
Sam Lantinga 45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga 818d1d3e80 Fixed bug 1646 - Warnings from clang with -Weverything 2016-11-15 01:30:08 -08:00
Sam Lantinga 42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Philipp Wiesemann 0e45984fa0 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().
2015-06-21 17:33:46 +02:00