Commit graph

58 commits

Author SHA1 Message Date
Sam Lantinga
9df90cd84b 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
1b24bfad38 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Ryan C. Gordon
87e88cc821 Still more compiler warning fixes for various platforms. 2016-11-23 17:20:28 -05:00
Ryan C. Gordon
95f124004f Fixed more compiler warnings.
--HG--
extra : amend_source : 1308f531582719c674844d7aff00a60cc7d36c68
2016-11-23 11:49:26 -05:00
Sam Lantinga
e8128466a6 Only use GCC pragmas when we're building with GCC 2016-10-01 11:22:39 -07:00
Bastien Nocera
d9190db2eb 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
7ee8dda270 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Sam Lantinga
9d1a2cb9bf 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
56b58afdbe Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Ryan C. Gordon
1816bcb659 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.

--HG--
extra : histedit_source : 4c21dac5eefc6070bc54a5a83be523d28d484844%2C790b58948a82e2a4322d9ddd1e298bc873d44d4a
2015-03-24 03:12:35 -04:00
Sam Lantinga
53d9d2c232 Added annotations to help code analysis tools
CR: Bruce Dawson
2014-06-04 10:56:56 -07:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Ryan C. Gordon
82edee6971 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.

--HG--
extra : rebase_source : ddf4a4c0dc2c554b98c82700798f343cd91b16e3
2013-11-24 23:56:17 -05:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Ryan C. Gordon
4f438b70a2 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
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -08:00
Andreas Schiffler
b4a190fb6f 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
a20096403e 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
f380ecb137 Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Sam Lantinga
028e5dcdbd Happy New Year! 2011-12-31 09:28:07 -05:00
Andreas Schiffler
9db859c159 Fixed SDL_SetError() by making NULL fmt a no-op, update test automation 2011-07-17 20:59:34 -07:00
Sam Lantinga
b0660ba5ff SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
e5803d148c Happy 2011! :) 2011-02-11 22:37:15 -08:00
Sam Lantinga
f582f9e58e Added a simple log message API 2011-02-07 16:45:40 -08:00
Sam Lantinga
6e69fae33e Added an extra line for consistency 2011-01-12 21:21:08 -08:00
Sam Lantinga
74b33811bd Added SDL errors to the Android log stream if DEBUG_ERROR is defined 2011-01-12 13:52:27 -08:00
Sam Lantinga
adc9598f1a While you can actually write to the error buffer, conceptually it's read-only. 2010-08-29 12:00:09 -07:00
Sam Lantinga
7685a1892c Documentation updates 2010-07-29 20:24:05 -07:00
Sam Lantinga
d8e7cebd11 Merged Sunny's XRender changes from SDL-gsoc2010_xrender 2010-07-28 00:54:23 -07:00
Sunny Sachanandani
a2983659fb Respect environment variables. 2010-07-19 21:02:49 +05:30
Sunny Sachanandani
6a534a4046 Start experimental branch for client-side rasterization.
--HG--
branch : experimental
2010-07-18 12:43:04 +05:30
Sam Lantinga
95fbd50b15 Mostly cleaned up warnings with -Wmissing-prototypes 2010-06-26 08:56:48 -07:00
Sam Lantinga
4d3df8b3e3 Fixed bug #926
Updated copyright to LGPL version 2.1 and year 2010

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404453
2010-01-24 21:10:53 +00:00
Sam Lantinga
0990e2250c Fixed bug #765
Added SDL_SetError case for SDL_UNSUPPORTED

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403909
2009-09-26 10:19:19 +00:00
Sam Lantinga
d123950aa3 Reverted Bob's indent checkin
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403475
2009-01-10 21:50:26 +00:00
Bob Pendleton
44fa7675c8 I ran a global "make indent" it modified the following files.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403473
2009-01-09 20:43:30 +00:00
Sam Lantinga
0c30a927ed Updated copyright date
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403321
2008-12-08 00:27:32 +00:00
Sam Lantinga
ede44c4b85 Final merge of Google Summer of Code 2008 work...
Port SDL 1.3 to the Nintendo DS
by Darren Alton, mentored by Sam Lantinga

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403188
2008-08-27 15:10:03 +00:00
Ryan C. Gordon
0089ba6cbe Merged SDL-ryan-multiple-audio-device branch r2803:2871 into the trunk.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402195
2006-10-17 09:15:21 +00:00
Sam Lantinga
0f030a1802 SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401938
2006-07-10 21:04:37 +00:00
Sam Lantinga
c1d479762f Updated RPM spec file with License keyword
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401808
2006-05-17 06:09:27 +00:00
Sam Lantinga
8aa4c7fdb9 Fixed signed/unsigned issues
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401785
2006-05-12 04:21:19 +00:00
Sam Lantinga
b31509f7be 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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401779
2006-05-11 21:03:23 +00:00
Sam Lantinga
26cb9c7c80 Fixed some ultra-pedantic gcc warnings
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401619
2006-03-24 06:10:24 +00:00
Sam Lantinga
c36118165e 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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401406
2006-02-21 08:46:50 +00:00
Sam Lantinga
1da8cb0143 Use only safe string functions
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401383
2006-02-19 23:46:34 +00:00
Sam Lantinga
d3805eef09 New configure-based build system. Still work in progress, but much improved
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401365
2006-02-16 10:11:48 +00:00
Sam Lantinga
684909fae2 More header massaging... works great on Windows. ;-)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401362
2006-02-10 06:48:43 +00:00
Sam Lantinga
09cd73f1b5 Removed uses of stdlib.h and string.h
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401342
2006-02-07 09:29:18 +00:00
Sam Lantinga
5d53175e4d 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...

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401340
2006-02-07 06:59:48 +00:00