|
5bfdb6e0
|
2023-08-10T23:43:58
|
|
Fix overflow when doing SDL_sscanf("%hd", ...)
An overflow occured in the stdlib_sscanf test, when using msys2 clang32 toolchain.
(cherry picked from commit 342ec5113171214154cb197bb3e0e3a0056ea2ad)
(cherry picked from commit 10135b2d7bbed6ea0cba24410ebc12887d92968d)
|
|
4700fbcb
|
2023-06-04T05:37:06
|
|
Don't bother re-encoding Latin1 characters in the ASCII range
(cherry picked from commit 6150b5b3cbde0e592c4ffe822f66aa5f9c90c3d9)
|
|
2660da6f
|
2023-02-28T17:50:26
|
|
Always allocate zt in output of SDL_iconv_string()
Before this, the function could not be used on buffers,
as it would not account for the zero-termination unless
it was included in the input.
(cherry picked from commit 5f5abb680523e1adedd3fca2a8e252db01fc1c52)
|
|
7c86d96e
|
2023-06-04T01:01:06
|
|
Fixed SDL_iconv_string() truncation when handling SDL_ICONV_E2BIG
(cherry picked from commit c369b900199f905c51edb372bd7780f67a544a8c)
|
|
a1dea11d
|
2023-06-04T14:29:10
|
|
fix MSVC build error.
|
|
bfef7c30
|
2023-06-04T02:06:52
|
|
Only convert the result of XLookupString() if it's not already UTF-8
Fixes https://github.com/libsdl-org/SDL/issues/7766
(cherry picked from commit 491ae20d963cff397b5980b31d142d576e74becb)
|
|
73083255
|
2023-05-26T13:57:49
|
|
Added support for printing wide strings using "%ls" syntax
(cherry picked from commit 128ca7016018178c0c3231db7db2005dbf234068)
|
|
3f1fd5ab
|
2023-05-23T10:59:03
|
|
Updated source to match SDL function prototype style
|
|
d1dc1952
|
2023-03-23T06:45:19
|
|
Implement _intel_fast_(memcpy|memset)
The classic Intel compiler generates calls to these functions when
building the SDL library with SDL_LIBC=OFF.
|
|
0c7346ec
|
2023-02-26T09:42:04
|
|
USE_DEV_RANDOM close the file descriptor even in the rare case it can't read it
|
|
17515f4a
|
2023-02-04T15:51:37
|
|
Backport simplify flags PR #7220
|
|
0479df53
|
2023-01-09T09:48:21
|
|
Updated copyright for 2023
|
|
d0bbfdbf
|
2022-12-01T16:07:03
|
|
Clang-Tidy fixes (#6725)
(cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
|
|
b067ab92
|
2022-12-01T03:11:00
|
|
restore SDL_malloc.c original formatting.
(cherry picked from commit 45025799b75f544251f4a853e1c3f206243f0109)
|
|
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)
|
|
fb0ce375
|
2022-11-27T17:38:43
|
|
Cleanup add brace (#6545)
* Add braces after if conditions
* More add braces after if conditions
* Add braces after while() conditions
* Fix compilation because of macro being modified
* Add braces to for loop
* Add braces after if/goto
* Move comments up
* Remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements after merge
* Fix inconsistent patterns are xxx == NULL vs !xxx
* More "{}" for "if() break;" and "if() continue;"
* More "{}" after if() short statement
* More "{}" after "if () return;" statement
* More fix inconsistent patterns are xxx == NULL vs !xxx
* Revert some modificaion on SDL_RLEaccel.c
* SDL_RLEaccel: no short statement
* Cleanup 'if' where the bracket is in a new line
* Cleanup 'while' where the bracket is in a new line
* Cleanup 'for' where the bracket is in a new line
* Cleanup 'else' where the bracket is in a new line
(cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
|
|
cd0d5a5f
|
2022-11-17T11:23:15
|
|
Don't compare pointer against '0', but NULL
|
|
ce5da5d5
|
2022-11-16T21:47:43
|
|
Don't compare pointer against '0', but NULL
|
|
ec58a817
|
2022-10-05T19:26:09
|
|
Fixes made in response to running a static code analyzer under MS Windows.
Most of these are probably harmless, but the changes to SDL_immdevice.c and SDL_pixels.c appear to have fixed genuine bugs.
SDL_audiocvt.c: By separating the calculation of the divisor, I got rid of the suspicion that dividing a double by an integer led to loss of precision.
SDL_immdevice.c: Added a missing test, one that could have otherwise led to dereferencing a null pointer.
SDL_events.c, SDL_gamecontroller.c, SDL_joystick.c, SDL_malloc.c, SDL_video.c: Made it clear the return values weren't used.
SDL_hidapi_shield.c: The size is zero, so nothing bad would have happened, but the SDL_memset() was still being given an address outside of the array's range.
SDL_dinputjoystick.c: Initialize local data, just in case IDirectInputDevice8_GetProperty() isn't guaranteed to write to it.
SDL_render_sw.c: drawstate.viewport could be null (as seen on line 691).
SDL.c: SDL_MostSignificantBitIndex32() could return -1, though I don't know if you want to cope with that (what I did) or SDL_assert() that it can't happen.
SDL_hints.c: Replaced boolean tests on pointer values with comparisons to NULL.
SDL_pixels.c: Looks like the switch is genuinely missing a break!
SDL_rect_impl.h: The MacOS static checker pointed out issues with the X comparisons that were handled by assertions; I added assertions for the Y comparisons.
SDL_yuv.c, SDL_windowskeyboard.c, SDL_windowswindow.c: Checked error-result returns.
|
|
02ab7f37
|
2022-11-15T12:57:07
|
|
Fixed release build using clang on Windows
|
|
297ecb70
|
2022-11-05T15:58:30
|
|
Added SDL_strcasestr() for a case insensitive version of SDL_strstr()
|
|
c3b13346
|
2022-10-21T18:32:53
|
|
On x86, pass -nodefaultlib to linker when wanting to avoid the C library
|
|
b51a88a9
|
2022-10-06T02:23:57
|
|
SDL_malloc.c: fix variable 'used' set but not used
Emitted by clang-cl
|
|
5c150ddc
|
2022-10-06T02:21:49
|
|
SDL_mslibc.c: fix unknown pragma ignored [-Wunknown-pragmas]
Emitted by clang-cl
|
|
dc2a682a
|
2022-09-20T09:22:43
|
|
Use the right kind of 0
|
|
24619306
|
2022-09-20T09:16:10
|
|
Fixed build on RISC OS
|
|
887ae0c6
|
2022-09-20T18:20:00
|
|
fix build failure after commit 2a8d00634ddf if strtod isn't available.
|
|
2a8d0063
|
2022-09-20T07:25:49
|
|
Fixed scanning a negative number as an unsigned value
e.g. sscanf("-1", "%zu", &v)
Thanks to @sezero for the test case
|
|
3f5c4666
|
2022-09-20T11:56:40
|
|
SDL_vsscanf: fix an uninitialized warning
|
|
216e3f10
|
2022-09-19T15:42:11
|
|
Implemented size_t format specifiers for SDL_snprintf() and SDL_sscanf()
Fixes https://github.com/libsdl-org/SDL/issues/6264
|
|
7115ceb7
|
2022-09-17T11:52:19
|
|
Vita: restore sceClibMemcmp
|
|
67cb3874
|
2022-08-12T20:51:28
|
|
Fixed potential uninitialized variable usage
|
|
9f30d498
|
2022-08-11T14:27:08
|
|
Added note about CRC algorithm compatibility
|
|
b4c4dd84
|
2022-08-11T09:52:58
|
|
Added SDL_crc16() to be used in joystick GUIDs after 2.24.0
|
|
7f42fb54
|
2022-07-30T16:34:40
|
|
Applied DragonFly BSD patch
https://github.com/DragonFlyBSD/DeltaPorts/blob/master/ports/devel/sdl20/dragonfly/patch-src_stdlib_SDL__malloc.c
|
|
36dfbe5d
|
2022-07-28T02:06:29
|
|
stdlib: exclude mslibc functions using SDL_STATIC_LIB macro
|
|
5da85376
|
2022-07-26T21:47:52
|
|
stdlib: move all mslibc functions to SDL_mslibc.c
This allows disabling LTO on them by only specifying a single file.
|
|
51f75b8b
|
2022-07-04T16:42:46
|
|
Fix fallback implementations of SDL_strchr and SDL_strrchr for '\0'
strchr and strrchr return a pointer to the first/last occurrence of a
character in a string, or NULL if the character is not found. According
to the C standard, the final null terminator is part of the string, and
it should thus be possible to get a pointer to the final null with
these functions. The fallback implementations of SDL_strchr and
SDL_strrchr would always return NULL if trying to find '\0', and this
commit fixes that.
|
|
f317d619
|
2022-07-01T13:59:14
|
|
Xbox GDKX support (#5869)
* Xbox GDK support (14 squashed commits)
* Added basic keyboard testing
* Update readme
* Code review fixes
* Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
|
|
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
|
|
3b191580
|
2022-06-27T17:19:39
|
|
Windows GDK Support (#5830)
* Added GDK
* Simplfied checks in SDL_config_wingdk.h
* Added testgdk sample
* Added GDK readme
* Fixed error in merge of SDL_windows.h
* Additional GDK fixes
* OpenWatcom should not export _SDL_GDKGetTaskQueue
* Formatting fixes
* Moved initialization code into SDL_GDKRunApp
|
|
12f14bdb
|
2022-06-18T07:02:38
|
|
Fixed digit count in sscanf, e.g. "%1x"
|
|
ae7446a9
|
2022-06-15T20:48:54
|
|
stlib: Extract SDL_memcpy and SDL_memset to its own file respectively
This is done such that we can disable LTO for these 2 functions when
building with MSVC.
This is due to a limitation of Link Time Code Generation (LTCG).
Code generation might generate a new reference to memset after linking
has started. The LTCG must make assumptions about where memset is
defined which is normally the C runtime.
|
|
74bcc5a0
|
2022-05-05T02:23:05
|
|
stdlib: Add `SDL_utf8strnlen`
|
|
501a4991
|
2022-05-05T18:44:32
|
|
Add clang-format on/off comments where necessary.
Comments were added in places where INDENT-ON/OFF comments are. Places
like stdlib's asm don't need it as clang-format doesn't try to indent it.
|
|
0cca71a8
|
2022-05-18T22:12:05
|
|
Use SDLCALL for callbacks in public APIs
|
|
ec1a0f62
|
2022-05-17T01:33:02
|
|
SDL_malloc.c: workaround calling convention issues for real_xxx procs.
|
|
0e63b514
|
2022-05-07T14:52:35
|
|
Don't define memcpy(), memset() when using static VC runtime.
The linker will complain about duplicated symbols otherwise
(see #3662, #5156).
|
|
8cd908e0
|
2022-05-06T10:51:55
|
|
Fixed building with Visual Studio 2013
Added SDL_vacopy.h since it needs to be included after Windows headers
|
|
97774cdf
|
2022-04-29T14:01:03
|
|
Move in va_copy() define block from stdlib.
|
|
e9ff4fdd
|
2022-04-25T23:55:50
|
|
add SDL_bsearch
|
|
8df045cc
|
2022-03-22T15:53:40
|
|
stdlib: just cast iconv()'s 2nd arg to void *.
This makes the compiler happy (enough) regardless of whether the C runtime
headers think this argument should be const or not.
Fixes #4966.
|
|
25203222
|
2022-02-05T11:01:25
|
|
optimize the SDL_str(case)cmp functions
|
|
aec58d82
|
2022-02-05T10:56:43
|
|
make SDL_strcasecmp standard compliant
|
|
b59ca92e
|
2022-02-05T10:55:09
|
|
use != '\0' comparison instead of SDL_strlen in the functions of SDL_getenv
|
|
bdafe1e0
|
2022-03-04T11:01:55
|
|
Fixed whitespace
|
|
0abc0a6f
|
2022-01-12T20:37:32
|
|
SDL_string.c: tidy-up gcc2 va_copy defines after previous haiku commit.
|
|
d37c9777
|
2022-01-12T06:48:00
|
|
haiku: updated for Haiku
|
|
120c76c8
|
2022-01-03T09:40:00
|
|
Updated copyright for 2022
|
|
ab6d0d4d
|
2021-12-28T15:58:15
|
|
Fixed undefined behavior in SDL_memset() (thanks andrewrk!)
Fixes https://github.com/libsdl-org/SDL/issues/5147
|
|
840339c4
|
2021-12-18T14:01:02
|
|
SDL_utf8strlcpy: store trailing_bytes explicity as unsigned type.
|
|
507d4bcd
|
2021-12-18T14:01:02
|
|
SDL_utf8strlen: run bit-test explicitly on unsigned char
|
|
a2b13e58
|
2021-12-02T02:28:24
|
|
SDL_iconv_string: avoid memory leak if realloc() fails.
|
|
f14a8bfa
|
2021-12-01T21:33:02
|
|
fix whitespace.
|
|
b71bfdaa
|
2021-12-01T20:50:40
|
|
SDL_iconv.c (encodings): mark "WCHAR_T" as ENCODING_UTF16LE for OS/2 too
whcar_t is unsigned short in os/2, like windows
|
|
3bf7994f
|
2021-09-27T14:38:12
|
|
Add and use `SDL_FALLTHROUGH` for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.
So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).
Clang before Clang 10 and GCC before GCC 7 have problems with using
__attribute__ as a sole statement and warn about a "declaration not
declaring anything", so fall back to using the /* fallthrough */ comment
if we are using those older compiler versions.
Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).
All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
|
|
abc12a83
|
2021-11-11T15:58:44
|
|
Revert "Add and use `SDL_FALLTHROUGH` for fallthroughs"
This reverts commit 66a08aa3914a98667f212e79b4f0b9453203d656.
This causes problems with older compilers:
https://github.com/libsdl-org/SDL/pull/4791#issuecomment-966630997
|
|
66a08aa3
|
2021-09-27T14:38:12
|
|
Add and use `SDL_FALLTHROUGH` for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.
So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).
Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).
All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
|
|
dc4c7d95
|
2021-11-10T09:48:49
|
|
Fixed infinite loop in SDL_vsnprintf() if the format string is too large for the output buffer
Fixes https://github.com/libsdl-org/SDL/issues/4940
|
|
e8731933
|
2021-11-09T13:32:28
|
|
Fixed warning: macro is not used
|
|
5b646cd1
|
2021-11-07T22:58:44
|
|
Build hidapi code into SDL as a new public API
This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
|
|
3acb1725
|
2021-11-07T12:26:39
|
|
stdlib: SDL_snprintf now adds decimal places for ("%f", 0.0).
This patch was from @Markvy (thanks!).
Fixes #4795.
|
|
6407d4b0
|
2021-11-05T17:10:02
|
|
remove unnecessary parentheses from SDL_abs()
|
|
6cbee063
|
2021-11-05T01:17:29
|
|
include: Swap parameter names in atan2 functions
|
|
3ea35fe5
|
2021-10-04T21:32:00
|
|
fix SDL_atoi()
fixes https://github.com/libsdl-org/SDL/issues/4811
|
|
4ec259a7
|
2021-09-22T19:06:11
|
|
Fixed building on Visual Studio 2013 and older
|
|
25a614bc
|
2021-09-14T20:37:35
|
|
Add SDL_asprintf and SDL_vasprintf
|
|
79b0aae8
|
2021-09-22T11:42:10
|
|
The return value of SDL_snprintf is the number of characters that would have been written.
Fixes https://github.com/libsdl-org/SDL/issues/4762
|
|
a91ab883
|
2021-08-06T12:28:03
|
|
Fixed building on Windows with cmake, ninja, and clang
|
|
8f38ba4d
|
2021-07-29T18:02:47
|
|
Fix casts that should be using uintptr_t
This is needed to support CHERI, and thus Arm's experimental Morello
prototype, where pointers are implemented using unforgeable capabilities
that include bounds and permissions metadata to provide fine-grained
spatial and referential memory safety, as well as revocation by sweeping
memory to provide heap temporal memory safety.
On most systems (anything with a flat memory hierarchy rather than using
segment-based addressing), size_t and uintptr_t are the same type.
However, on CHERI, size_t is just an integer offset, whereas uintptr_t
is still a capability as described above. Casting a pointer to size_t
will strip the metadata and validity tag, and casting from size_t to a
pointer will result in a null-derived capability whose validity tag is
not set, and thus cannot be dereferenced without faulting.
The audio and cursor casts were harmless as they intend to stuff an
integer into a pointer, but using uintptr_t is the idiomatic way to do
that and silences our compiler warnings (which our build tool makes
fatal by default as they often indicate real problems). The iconv and
egl casts were true positives as SDL_iconv_t and iconv_t are pointer
types, as is NativeDisplayType on most OSes, so this would have trapped
at run time when using the round-tripped pointers. The gles2 casts were
also harmless; the OpenGL API defines this argument to be a pointer type
(and uses the argument name "pointer"), but it in fact represents an
integer offset, so like audio and cursor the additional idiomatic cast
is needed to silence the warning.
|
|
559be8aa
|
2021-03-15T15:18:10
|
|
fix invalid out of bounds UTF8 handling
|
|
1957ffd2
|
2021-03-14T11:04:28
|
|
fixed a typo in SDL_ceilf()
|
|
dacf6cfb
|
2021-03-11T12:03:22
|
|
Fix compilation with iconv on FreeBSD
|
|
a2fbc452
|
2021-02-15T03:02:32
|
|
replace i386 checks with __i386__
|
|
3da58b47
|
2021-02-13T15:11:40
|
|
Fix errors with fallback impls of SDL_isxdigit() and SDL_ispunct()
SDL_isxdigit() should only accept A-Fa-f, not A-Za-z (it shouldn't use
SDL_isalpha()).
SDL_ispunct() shouldn't accept spaces (it should use SDL_isgraph()
instead).
|
|
dfe219ec
|
2021-02-13T11:21:19
|
|
Add all missing "is characteristic" stdlib functions
SDL has been missing a bunch of these 'isX' functions for some time,
where X is some characteristic of a given character.
This commit adds the rest of them to the SDL stdlib, so now we have:
- SDL_isalpha()
- SDL_isalnum()
- SDL_isblank()
- SDL_iscntrl()
- SDL_isxdigit()
- SDL_ispunct()
- SDL_isprint()
- SDL_isgraph()
|
|
9130f7c3
|
2021-01-02T10:25:38
|
|
Updated copyright for 2021
|
|
8a32ee24
|
2020-12-30T01:00:24
|
|
removed MSVC strtok_s use from SDL_strtokr().
no other ??_s are used elsewhere in SDL_stdinc. besides, C11 has a
strtok_s with a different signature.
|
|
93ccdee8
|
2020-12-23T13:47:49
|
|
Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
Cameron Cawley
stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
The default implementation is based on the one used in the Windows RT video driver.
|
|
cb361896
|
2020-12-09T07:16:22
|
|
Fixed bug 5235 - All internal sources should include SDL_assert.h
Ryan C. Gordon
We should really stick this in SDL_internal.h or something so it's always available.
|
|
f487d63a
|
2020-12-03T18:16:56
|
|
Fixed crash when printing NULL wide character string
|
|
46a84478
|
2020-11-24T12:43:01
|
|
Added SDL_wcscasecmp() and SDL_wcsncasecmp()
|
|
55e59a4f
|
2020-11-16T18:48:13
|
|
crc32: Fixed include path.
|
|
71e32f5e
|
2020-11-16T15:00:15
|
|
Added SDL_crc32()
|
|
8b29aadd
|
2020-11-12T14:34:11
|
|
Fixed warning when building on Windows
|
|
e410b34f
|
2020-07-24T22:24:03
|
|
stdlib: Corrected implementation of SDL_wcsncmp.
It was a copy/paste of SDL_strcmp, apparently, not SDL_strncmp, so it ignored
the maxlen parameter.
Thanks to Jack Powell for pointing this out!
|
|
31916f11
|
2020-05-27T09:22:12
|
|
Fixed compiler warning building on FreeBSD
|
|
b0a20a15
|
2020-05-05T12:48:55
|
|
stdlib: Fixed compiler warnings about int vs size_t.
|
|
8b60d39c
|
2020-05-02T14:43:17
|
|
Fixed bug 5112 - CMake won't compile in VS2019
dark_sylinc
Trying to build SDL with VS2019 using CMake will encounter a linking error
More specifically:
1>SDL_string.obj : error LNK2019: unresolved external symbol memset referenced in function SDL_vsnprintf_REAL
|
|
1d879787
|
2020-04-13T13:24:56
|
|
Fixed implicit linkage to ftol2() on Windows
|