Carl Åstholm
eb199176e6
stdlib: Conditionally undef some SDL_strtox tests
...
Some test cases have implementation-defined results,
so we should only test these when we know SDL's own
implementations of the functions are used.
2024-09-13 12:30:58 -07:00
Carl Åstholm
59ec034412
stdlib: Use macros to define SDL_strtox tests
2024-09-13 12:30:58 -07:00
Carl Åstholm
a78f612d4b
stdlib: Add some tests for SDL_strtod
2024-09-13 12:30:58 -07:00
Carl Åstholm
61bc856b04
stdlib: Use new parser for scanf %p specifier
2024-09-13 12:30:58 -07:00
Carl Åstholm
e109aa09aa
stdlib: Rewrite SDL_strto(ll?|ul) impl
2024-09-13 12:30:58 -07:00
Carl Åstholm
e326540a45
stdlib: Add failing tests for SDL_strto(ll?|ul)
2024-09-13 12:30:58 -07:00
Carl Åstholm
5331f36789
stdlib: Add failing tests for SDL_strtoull
2024-09-13 12:30:58 -07:00
Carl Åstholm
5d30980df4
stdlib: Add failing tests for SDL_wcstol
...
These help illustrate some key differences between a specs-compliant
libc wcstol and SDL's own implementation.
2024-09-13 12:30:58 -07:00
Anonymous Maarten
db96ddca34
SDL_test: use SDLCALL calling convention
...
This is needed when using a pre-built static SDL3_test library.
2024-09-06 14:19:05 +02:00
Anonymous Maarten
baa1a5e2f4
Add SDL_strpbrk
2024-09-06 01:35:43 +02:00
Sam Lantinga
eacf119923
Renamed SDL_size_add_overflow() and SDL_size_mul_overflow()
2024-09-02 17:17:48 -07:00
Anonymous Maarten
0fa2049fef
Document iconv functions + add testautomation ( #10131 )
...
* stdinc: document SDL_iconv* functions
* iconv: add automation tests
* iconv: don't potentially crash on invalid inputs
2024-08-06 10:12:25 -07:00
Sam Lantinga
f59d66f4b1
Implemented left-justification in SDL_PrintString()
...
Fixes https://github.com/libsdl-org/SDL/issues/10310
2024-08-04 20:04:58 -07:00
Sam Lantinga
473feab2a4
Added SDL_unsetenv()
2024-07-27 09:10:08 -07:00
Sam Lantinga
b854e1fe0b
Fixed some issues found with static analysis
2024-07-27 09:07:42 -07:00
Sam Lantinga
29f0fd33dc
SDL_getenv() should return const
...
This also allows us to use SDL_FreeLater() and make SDL_getenv() thread-safe on Windows.
2024-07-22 13:00:39 -07:00
Sam Lantinga
1938d25b7e
Use "%S" format specifier for wide-character strings
2024-06-06 10:59:15 -07:00
Anonymous Maarten
31d133db40
Define SDL_PLATFORM_* macros instead of underscored ones ( #8875 )
2024-01-24 01:40:51 +00:00
Sam Lantinga
5e70ee29cc
Build SDL with the static C runtime on Visual Studio
2024-01-21 06:55:29 -08:00
Sam Lantinga
7f75178908
Verify that the %p format specifier works for 64-bit pointers
2023-12-17 08:14:20 -08:00
Sam Lantinga
ac0751a652
Added SDL_strnstr()
2023-12-03 15:06:46 -08:00
Sylvain
d8600f717e
Pointer as bool (libsdl-org#7214)
2023-11-09 14:18:36 -08:00
Ryan C. Gordon
c53843a961
docs: Remove Doxygen \brief
tags.
...
Doxygen and the wiki bridge don't need them; they'll both just use the first
line/sentence instead.
Fixes #8446 .
2023-11-06 10:26:06 -05:00
Sam Lantinga
39a961ba41
Added support for "%[]" sscanf syntax
...
Fixes https://github.com/libsdl-org/SDL/issues/8423
2023-10-24 17:28:15 -07:00
Brick
c03f5b4b69
Fixed rounding up in SDL_PrintFloat
...
This wasn't caught by the 9.9999999 case, because that value is actually just equal to 10.0
2023-08-07 14:15:19 -07:00
Sam Lantinga
0a4e6f6d29
Added SDL_strnlen() and SDL_wcsnlen()
2023-07-17 19:37:51 -07:00
Sam Lantinga
f4bd17deee
Fixed %p formatting when there is following text
2023-07-06 08:04:20 -07:00
Sam Lantinga
c63aa9545e
Fixed printf formatting for "%p" and added a unit test to check it
2023-07-05 20:06:59 -07:00
Sam Lantinga
128ca70160
Added support for printing wide strings using "%ls" syntax
2023-05-26 13:58:10 -07:00
Sam Lantinga
c9d8a04945
Added SDL_swprintf() and SDL_vswprintf()
2023-05-26 08:19:04 -07:00
Anonymous Maarten
b6ae281e97
Use #ifdef/#ifndef instead of #if defined/#if \!defined
2023-03-30 21:35:01 +00:00
Sylvain
c963f02571
More fix warnings about static function and prototype
2023-03-08 16:14:09 +01:00
Anonymous Maarten
08bcee8570
test: don't use wiki urls for documentation comments
...
Also make consistent use of \ as documentation escape character.
2023-02-02 00:49:09 +01:00
Sam Lantinga
1c83c1fadd
Fixed build warnings in Xcode
2023-01-26 13:58:59 -08:00
Sam Lantinga
2aa9569b3e
Replaced SDL_SIMDAlloc(), SDL_SIMDRealloc(), and SDL_SIMDFree() with SDL_aligned_alloc() and SDL_aligned_free()
...
Fixes https://github.com/libsdl-org/SDL/issues/5641
2023-01-09 18:01:59 -08:00
Sam Lantinga
38b138cd0a
Fixed rounding of floating point values in snprintf
2023-01-03 06:35:25 -08:00
Sam Lantinga
ead4f122e4
Added basic support for %g snprintf format specifier
2022-12-29 23:12:19 -08:00
Sam Lantinga
63724c113b
Removed the vi format comments from the source
...
Vim users can use the [editorconfig plugin](https://github.com/editorconfig/editorconfig-vim ) to automatically set tab spacing for the SDL coding style.
Fixes https://github.com/libsdl-org/SDL/issues/6903
2022-12-26 11:17:23 -08:00
Pierre Wendling
3c501b963d
Clang-Tidy fixes ( #6725 )
2022-12-01 13:07:03 -08:00
Sam Lantinga
5750bcb174
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
2022-11-30 12:51:59 -08:00
Sylvain Becker
6a2200823c
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
2022-11-27 08:38:43 -08:00
Sam Lantinga
0a48abc860
Switch header convention from #include "SDL.h"
to #include <SDL3/SDLh>
...
I ran this script in the include directory:
```sh
sed -i '' -e 's,#include "\(SDL.*\)",#include <SDL3/\1>,' *.h
```
I ran this script in the src directory:
```sh
for i in ../include/SDL3/SDL*.h
do hdr=$(basename $i)
if [ x"$(echo $hdr | egrep 'SDL_main|SDL_name|SDL_test|SDL_syswm|SDL_opengl|SDL_egl|SDL_vulkan')" != x ]; then
find . -type f -exec sed -i '' -e 's,#include "\('$hdr'\)",#include <SDL3/\1>,' {} \;
else
find . -type f -exec sed -i '' -e '/#include "'$hdr'"/d' {} \;
fi
done
```
Fixes https://github.com/libsdl-org/SDL/issues/6575
2022-11-26 22:15:18 -08:00
Sam Lantinga
63f307fe1f
Remove SDL_config.h from the public headers
...
The SDL headers are no longer dependent on the build configuration.
Fixes https://github.com/libsdl-org/SDL/issues/6643 and https://github.com/libsdl-org/SDL/issues/6641
2022-11-26 04:48:36 -08:00
Anonymous Maarten
274ec02581
testautomation: avoid format related warnings by using a few pragma's
...
ci: enable -Werror to a few platforms
2022-10-08 23:41:07 +02:00
Sam Lantinga
c70ffc2a35
Added size_t format specifier test coverage for SDL_snprintf and SDL_sscanf
2022-09-19 15:34:17 -07:00
Sam Lantinga
9065897514
Added test for digit count in sscanf, e.g. "%1x"
2022-06-18 06:53:05 -07:00
Simon McVittie
d15f6e379c
test: Add a unit test for overflow detection
...
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-09 21:31:39 -07:00
Sam Lantinga
dc4c7d9539
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
2021-11-10 09:48:49 -08:00
Sam Lantinga
cdb4d8f22f
Added a test case for snprintf of 0.0
...
This verifies regressions in https://github.com/libsdl-org/SDL/issues/4795
2021-11-07 09:39:57 -08:00
Sam Lantinga
79b0aae86c
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
2021-09-22 11:46:24 -07:00