include/SDL_stdinc.h


Log

Author Commit Date CI Message
Knightly a23d1af0 2023-02-10T19:23:59 Guard against _USE_MATH_DEFINES redefinition
Sam Lantinga 0479df53 2023-01-09T09:48:21 Updated copyright for 2023
Sam Lantinga 297ecb70 2022-11-05T15:58:30 Added SDL_strcasestr() for a case insensitive version of SDL_strstr()
Sam Lantinga c6e89619 2022-10-19T08:05:47 Define _USE_MATH_DEFINES for Visual Studio (thanks @pionere!) Fixes https://github.com/libsdl-org/SDL/issues/3790
Pierre Wendling 65527537 2021-03-30T04:32:39 N3DS port (squashed) A dedicated renderer using Citro3D would likely allow for better much better graphical performances.
Sam Lantinga f6b81125 2022-08-18T16:05:22 Always define SDL_COMPILE_TIME_ASSERT as static_assert() in C++ Apparently some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode. Fixes https://github.com/libsdl-org/SDL/issues/6078
Sam Lantinga b4c4dd84 2022-08-11T09:52:58 Added SDL_crc16() to be used in joystick GUIDs after 2.24.0
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
chalonverse 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
Sam Lantinga adc68758 2022-06-17T10:22:28 Added SDL_copyp to avoid size mismatch when copying values (thanks @1bsyl!) Closes https://github.com/libsdl-org/SDL/pull/5811
Guldoman 74bcc5a0 2022-05-05T02:23:05 stdlib: Add `SDL_utf8strnlen`
Cameron Cawley 0cca71a8 2022-05-18T22:12:05 Use SDLCALL for callbacks in public APIs
Simon McVittie 8ab3ae98 2022-05-10T09:44:23 stdinc: Add a comment to clarify why inline functions are needed here Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie f661654f 2022-05-09T14:36:27 stdinc: Add overflow-checking add and multiply for size_t This can be used to check whether untrusted sizes would cause overflow when used to calculate how much memory is needed. Signed-off-by: Simon McVittie <smcv@collabora.com>
Ozkan Sezer e9ff4fdd 2022-04-25T23:55:50 add SDL_bsearch
Eddy Jansson 00feca27 2022-04-20T07:51:04 Add SDL_FLT_EPSILON.
Ryan C. Gordon 3425e995 2022-03-30T10:12:49 stdinc: SDL_COMPILE_TIME_ASSERT defines shouldn't have a semicolon.
Ozkan Sezer f0d2747d 2022-03-17T14:56:04 use _Static_assert for SDL_COMPILE_TIME_ASSERT(), when available
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Misa 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.
Sam Lantinga 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
Misa 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.
Sam Lantinga 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.
Kevin Colour 6cbee063 2021-11-05T01:17:29 include: Swap parameter names in atan2 functions
SDL Wiki Bot c7dafb15 2021-10-27T01:36:05 Sync wiki -> header
Ryan C. Gordon 1b49f092 2021-10-08T20:22:48 include: manually ran wikiheaders.pl and cleaned up the obvious issues.
Cameron Cawley 25a614bc 2021-09-14T20:37:35 Add SDL_asprintf and SDL_vasprintf
Brick 72f41d1f 2021-08-14T21:11:17 Added missing parenthesis around SDL_clamp
David Gow 35c1bbfa 2021-08-13T21:43:00 SDL_stdinc.h: Add an SDL_clamp() function Add a function to clamp a value to a range. SDL_clamp(x, a, b) is equivalent to SDL_min(a, SDL_max(x, b)): it ensures that x is not smaller than a, nor larger than b. While, as best I can tell, this isn't actually standardised anywhere, it's a very useful function/macro to have.
Joshua Root 9bf65575 2021-08-13T06:36:49 Correctly check for bswap builtins before using The __clang_major__ and __clang_minor__ macros provide a marketing version, which is not necessarily comparable for clang distributions from different vendors[1]. In practice, the versioning scheme for Apple's clang is indeed completely different to that of the llvm.org releases. It is thus preferable to check for features directly rather than comparing versions. In this specific case, __builtin_bswap16 was being used with older Apple clang versions that don't support it. [1] https://clang.llvm.org/docs/LanguageExtensions.html#builtin-macros
Sam Lantinga d5ad6f6e 2021-08-10T16:51:03 Clarified that you should never have side-effects in the parameters to SDL_min/SDL_max
Ryan C. Gordon c88eb7a8 2021-07-14T17:07:04 Sync wiki -> header.
Ryan C. Gordon 25fc40b0 2021-06-10T13:56:22 stdinc: Silence clang warning for -Wimplicit-fallthrough. In a more ideal world, we'd use the appropriate `__attribute__` here, but it's one thing in a public header that probably shouldn't be there at all, so this is good enough for now. Fixes #4307.
Ivan Epifanov ca5e5d61 2020-12-18T16:34:24 VITASDK compatibility
Ozkan Sezer a2fbc452 2021-02-15T03:02:32 replace i386 checks with __i386__
Misa 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()
Jay Petacat f443a6fc 2021-02-11T02:05:02 Fix format string warnings for width-based integers The DJGPP compiler emits many warnings for conflicts between print format specifiers and argument types. To fix the warnings, I added `SDL_PRIx32` macros for use with `Sint32` and `Uint32` types. The macros alias those found in <inttypes.h> or fallback to a reasonable default. As an alternative, print arguments could be cast to plain old integers. I opted slightly for the current solution as it felt more technically correct, despite making the format strings more verbose.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga 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.
Ozkan Sezer bca9decb 2020-12-12T23:28:10 fix bug #5394 - define _DARWIN_C_SOURCE only if not already defined
Sam Lantinga 46a84478 2020-11-24T12:43:01 Added SDL_wcscasecmp() and SDL_wcsncasecmp()
Sam Lantinga 71e32f5e 2020-11-16T15:00:15 Added SDL_crc32()
Ozkan Sezer 79221e85 2020-10-29T20:00:20 SDL_stdinc.h: define _DARWIN_C_SOURCE on macOS for memset_pattern4() hopefully fixes https://bugzilla.libsdl.org/show_bug.cgi?id=5107
Ryan C. Gordon 6aec6da4 2020-06-28T17:45:07 stdinc: Let Clang static analysis see more C runtime functions. For systems without strlcpy and strlcat, just declare them as if they exist; the analyzer possibly still knows the details of these functions and can utilize that in its analysis. Most of this patch was from meyraud705 at gmail and Martin Gerhardy. Thanks! Fixes Bugzilla #5163.
Ryan C. Gordon d292f6bd 2020-04-10T12:17:14 stdlib: Add SDL_trunc and SDL_truncf
Sam Lantinga aa384ad0 2020-03-02T15:21:07 Fixed bug 5001 - Feature request: SDL_isupper & SDL_islower
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 65096446 2019-11-20T16:42:50 Improved XInput VID/PID detection and added SDL_wcsstr() and SDL_wcsncmp()
Ozkan Sezer eb8f14bb 2019-11-20T20:40:50 added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.)
Ryan C. Gordon f49c07b5 2019-09-04T00:39:47 stdinc: On macOS and iOS, use memset_pattern4() for SDL_memset4(). Fixes Bugzilla #4724.
Ozkan Sezer 7a47c292 2019-07-31T01:22:02 Fix bug 4746 - introduce SDL_zeroa macro.
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sam Lantinga d2042e1e 2018-08-09T16:00:17 Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms. Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
Ethan Lee b4fe7412 2018-08-04T11:52:46 SDL_exp
Ozkan Sezer c11ae93a 2018-05-10T08:28:00 SDL_stdinc.h: move the alloca() includes before begin_code.h
sezero 4c2a444e 2018-02-08T17:07:47 add SDL_log10 and SDL_log10f to include and dynapi
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga bcdf8b91 2017-11-04T17:35:03 Added SDL_fmod() and SDL_fmodf()
Sam Lantinga 34502143 2017-11-04T15:34:14 Added float versions of SDL's math functions
Sam Lantinga a225ffc1 2017-10-16T14:39:56 Added min/max macros for the sized SDL datatypes
Sam Lantinga fc60db86 2017-10-12T17:17:09 Fixed compiler warning
Sam Lantinga 9c580e14 2017-10-12T13:44:28 Added functions to query and set the SDL memory allocation functions: SDL_GetMemoryFunctions() SDL_SetMemoryFunctions() SDL_GetNumAllocations()
Sam Lantinga 4ca5d862 2017-09-06T04:32:30 Fixed bug 3780 - GCC 7 implicit fallthrough warnings Martin Gerhardy 2017-08-28 06:58:01 UTC SDL_blit.h, SDL_fillrect.c and SDL_stdinc.h produces a lot of the (new) gcc-7 implicit fallthrough warnings.
Sam Lantinga f8de064c 2017-08-13T22:26:44 Added wchar.h to fix build on some platforms with new wcs* functions
Sam Lantinga f1829d95 2017-08-13T20:37:49 Added SDL_wcscmp()
Ryan C. Gordon 43d62b74 2017-06-10T15:38:14 Make compile-time assert error messages more clear. Now the compiler might say this: 'SDL_compile_time_assert_mytest' declared as an array with a negative size instead of 'SDL_dummy_mytest' declared as an array with a negative size
Philipp Wiesemann cbcc256f 2017-06-04T23:15:39 Fixed comments in headers for doxygen output.
Ryan C. Gordon d4086e4a 2017-05-29T03:01:05 stdlib: added SDL_utf8strlen().
Ryan C. Gordon ca0bf151 2017-03-03T16:38:17 Fix some more compiler warnings on armcc.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 36156335 2016-11-20T21:34:54 Renaming of guard header names to quiet -Wreserved-id-macro Patch contributed by Sylvain
Sam Lantinga 73f2c541 2016-10-07T16:44:42 Fixed bug 2885 - SDL_stdinc.h doesn't need to include iconv.h Ryan C. Gordon We still include iconv.h in SDL_stdinc.h, probably because this header might have referenced the native iconv functions and types directly. Since these are hidden behind a stable ABI now and never just a #define for the system iconv, we shouldn't need this header included from a public SDL header anymore, slowing down external apps compiles and pulling tons of stuff into the namespace.
Sam Lantinga b7e45f8a 2016-10-01T10:28:00 Fixed bug 3336 - Failure to build with MinGW-w64 Kai Sterker There are already patches available from mingw64 that fix the issue https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-SDL2 With those applied, I could compile SDL2 without problems. But of course, it would be preferable if SDL built cleanly from source.
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 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 1339ce71 2015-04-08T01:42:47 Make SDL_stdinc.h work when compiling with -Wundef (thanks, Ben!). Fixes Bugzilla #2664.
Ryan C. Gordon 483ea8b7 2015-03-02T21:36:45 Fixed SDL_PRI?64 for 64-bit Linux. 64-bit Linux uses a "long" instead of "long long" for 64-bit ints. Added a special-case this so SDL_PRI?64 doesn't trigger compiler warnings when used with SDL's 64-bit datatypes on 64-bit Linux.
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.
Ryan C. Gordon a823982e 2015-01-05T01:41:42 Clang static analysis builds should use C runtime directly. This is a little macro magic to use malloc() directly instead of SDL_malloc(), etc, so static analysis tests that know about the C runtime can function properly, and understand that we are dealing with heap allocations, etc. This changed our static analysis report from 5 outstanding bugs to 30. 5x as many bugs were hidden by SDL_malloc() not being recognized as malloc() by the static analyzer!
Edward Rudd 623b9d6d 2014-12-03T12:47:39 ugh.. stray character
Edward Rudd 06d357fb 2014-12-03T12:45:04 fix SDL_PRIs64 on windows compilers.. (should end in d)
Edward Rudd 73daadb7 2014-12-03T12:23:17 switch to use SDL_PRI* macros for long long formatting everywhere.
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 1ea86978 2014-08-17T13:11:55 Removed SDL_round() because the license wasn't compatible with zlib
Sam Lantinga 4e7db78e 2014-08-16T23:23:15 Added SDL_round(), contributed by Benoit Pierre - thanks!
Sam Lantinga 3344db40 2014-06-23T11:06:50 Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga ce84813a 2014-06-21T11:24:06 commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5 Author: Sam Clegg <sbc@chromium.org> Date: Fri Jun 20 12:52:11 2014 Fix win32 build which was failing due to missing PRIs64. This change adds definitions for the C99 PRIs16 and PRIu64 which are missing from <stdint.h> on at last win32 and possibly other platforms. These already existed in testgesture.c so I removed them from there also.
Philipp Wiesemann 0ad1dc18 2014-06-08T12:51:02 Fixed typo in source comment.
Sam Lantinga 6101e4b2 2014-06-07T18:20:01 Added SDL_sqrtf(), SDL_tan(), SDL_tanf()
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 1367bf87 2014-03-09T11:36:47 Integrated David Ludwig's support for Windows RT
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.