Commit Graph

58 Commits

Author SHA1 Message Date
Sam Lantinga
26e2a3b1c7 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.
2017-07-10 17:16:12 -07:00
Sam Lantinga
d77ab77a7a Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Ryan C. Gordon
67072748a7 Still more compiler warning fixes for various platforms. 2016-11-23 17:20:28 -05:00
Ryan C. Gordon
4cdffc800c Fixed more compiler warnings. 2016-11-23 11:49:26 -05:00
Sam Lantinga
439151b60f Only use GCC pragmas when we're building with GCC 2016-10-01 11:22:39 -07:00
Bastien Nocera
d6c44c41f6 Fix "format not a string literal" errors
With GCC 6.1.

https://bugzilla.libsdl.org/show_bug.cgi?id=3375
2016-10-01 10:36:24 -07:00
Sam Lantinga
255c182471 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Sam Lantinga
0c8868d653 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.
2015-05-28 12:31:25 -07:00
Sam Lantinga
78f2198e6c Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Ryan C. Gordon
7a857c0208 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.
2015-03-24 03:12:35 -04:00
Sam Lantinga
667b15f3c8 Added annotations to help code analysis tools
CR: Bruce Dawson
2014-06-04 10:56:56 -07:00
Sam Lantinga
dba255c1e5 Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Ryan C. Gordon
03d5719413 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.
2013-11-24 23:56:17 -05:00
Sam Lantinga
0d9b661db8 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Ryan C. Gordon
16cdc59bab Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this...

    if (Failed) {
        SDL_SetError("We failed");
        return -1;
    }

...into this...

    if (Failed) {
        return SDL_SetError("We failed");
    }


 Fixes Bugzilla #1778.
2013-03-31 12:48:50 -04:00
Sam Lantinga
019c60c1e8 Happy New Year! 2013-02-15 08:47:44 -08:00
Andreas Schiffler
0720db59b2 Update SDL_InvalidParamError to take param name; add additional fuzzer function; add new tests to keyboard test suite; improve surface test suite 2013-01-12 22:58:12 -08:00
Andreas Schiffler
298c11033b Add new internal error message for invalid parameters; add validation of input rect in SDL_SetTextInputRect; add test cases for SDL_SetTextInputRect to keyboard suite 2013-01-11 20:36:39 -08:00
Sam Lantinga
b3d60cfcbb Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Sam Lantinga
e256711bb9 Happy New Year! 2011-12-31 09:28:07 -05:00
Andreas Schiffler
f4722e408f Fixed SDL_SetError() by making NULL fmt a no-op, update test automation 2011-07-17 20:59:34 -07:00
Sam Lantinga
6196aa221e SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
a2cdcf5486 Happy 2011! :) 2011-02-11 22:37:15 -08:00
Sam Lantinga
47818cfba9 Added a simple log message API 2011-02-07 16:45:40 -08:00
Sam Lantinga
03bc98ed24 Added an extra line for consistency 2011-01-12 21:21:08 -08:00
Sam Lantinga
bac790d9b0 Added SDL errors to the Android log stream if DEBUG_ERROR is defined 2011-01-12 13:52:27 -08:00
Sam Lantinga
39db467ca6 While you can actually write to the error buffer, conceptually it's read-only. 2010-08-29 12:00:09 -07:00
Sam Lantinga
b8b0d2faaa Documentation updates 2010-07-29 20:24:05 -07:00
Sam Lantinga
617542daf6 Merged Sunny's XRender changes from SDL-gsoc2010_xrender 2010-07-28 00:54:23 -07:00
Sunny Sachanandani
b496cf6550 Respect environment variables. 2010-07-19 21:02:49 +05:30
Sunny Sachanandani
666481e9a9 Start experimental branch for client-side rasterization.
--HG--
branch : experimental
2010-07-18 12:43:04 +05:30
Sam Lantinga
b90f3fea9c Mostly cleaned up warnings with -Wmissing-prototypes 2010-06-26 08:56:48 -07:00
Sam Lantinga
7052036491 Fixed bug #926
Updated copyright to LGPL version 2.1 and year 2010
2010-01-24 21:10:53 +00:00
Sam Lantinga
9b2bca8c06 Fixed bug #765
Added SDL_SetError case for SDL_UNSUPPORTED
2009-09-26 10:19:19 +00:00
Sam Lantinga
19b003367c Reverted Bob's indent checkin 2009-01-10 21:50:26 +00:00
Bob Pendleton
68ff2ab932 I ran a global "make indent" it modified the following files. 2009-01-09 20:43:30 +00:00
Sam Lantinga
befb0f7f42 Updated copyright date 2008-12-08 00:27:32 +00:00
Sam Lantinga
9c4b835e49 Final merge of Google Summer of Code 2008 work...
Port SDL 1.3 to the Nintendo DS
by Darren Alton, mentored by Sam Lantinga
2008-08-27 15:10:03 +00:00
Ryan C. Gordon
7f17eb8863 Merged SDL-ryan-multiple-audio-device branch r2803:2871 into the trunk. 2006-10-17 09:15:21 +00:00
Sam Lantinga
6bc598ea61 SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head. 2006-07-10 21:04:37 +00:00
Sam Lantinga
a13c34cfef Updated RPM spec file with License keyword 2006-05-17 06:09:27 +00:00
Sam Lantinga
579795df41 Fixed signed/unsigned issues 2006-05-12 04:21:19 +00:00
Sam Lantinga
5400b91864 Fixed some bugs in string handling
Cleaned up error message code, UTF-8 is used instead of UCS2
Added detection for MPEG Layer 3 audio for more informative errors.
2006-05-11 21:03:23 +00:00
Sam Lantinga
63695e2f76 Fixed some ultra-pedantic gcc warnings 2006-03-24 06:10:24 +00:00
Sam Lantinga
190b425364 Use consistent identifiers for the various platforms we support.
Make sure every source file includes SDL_config.h, so the proper system
headers are chosen.
2006-02-21 08:46:50 +00:00
Sam Lantinga
0ef73d9eae Use only safe string functions 2006-02-19 23:46:34 +00:00
Sam Lantinga
f05187e232 New configure-based build system. Still work in progress, but much improved 2006-02-16 10:11:48 +00:00
Sam Lantinga
769424426d More header massaging... works great on Windows. ;-) 2006-02-10 06:48:43 +00:00
Sam Lantinga
1e037cc218 Removed uses of stdlib.h and string.h 2006-02-07 09:29:18 +00:00
Sam Lantinga
02cc6c0f11 Use SDL_ prefixed versions of C library functions.
FIXME:
Change #include <stdlib.h> to #include "SDL_stdlib.h"
Change #include <string.h> to #include "SDL_string.h"
Make sure nothing else broke because of this...
2006-02-07 06:59:48 +00:00