Commit Graph

20 Commits

Author SHA1 Message Date
Sam Lantinga
d622c3c9cc Verify that the %p format specifier works for 64-bit pointers
(cherry picked from commit 7f75178908355046e37d908648c44cf4d4625f09)
2023-12-17 08:15:19 -08:00
Sylvain Becker
a14b948b6c
[SDL2] pointer boolean (#8523) 2023-11-10 06:30:56 -08:00
Sam Lantinga
4194a902e8 Added support for "%[]" sscanf syntax
Fixes https://github.com/libsdl-org/SDL/issues/8423

(cherry picked from commit 39a961ba41430788774f1b8c0e6d63f7308116e7)
2023-10-24 17:32:23 -07:00
Sam Lantinga
3054c0dc50 Fixed %p formatting when there is following text
(cherry picked from commit f4bd17deeeca6957d92979cf07fa436c249a9eda)
2023-07-06 08:37:27 -07:00
Sam Lantinga
1ab452fc57 Fixed printf formatting for "%p" and added a unit test to check it
(cherry picked from commit c63aa9545eb800390176fd2fd86036da81f91100)
2023-07-05 22:17:15 -07:00
Sam Lantinga
7308325559 Added support for printing wide strings using "%ls" syntax
(cherry picked from commit 128ca7016018178c0c3231db7db2005dbf234068)
2023-05-26 14:59:30 -07:00
Pierre Wendling
d0bbfdbfb8 Clang-Tidy fixes (#6725)
(cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
2022-12-01 13:08:50 -08:00
Sam Lantinga
b8d85c6939 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)
2022-11-30 12:57:41 -08:00
Sylvain Becker
fb0ce375f0 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)
2022-11-28 12:33:03 -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
Ryan C. Gordon
70c8bd2481 Fixed a bunch of compiler warnings in the test code. 2017-01-07 22:24:45 -05:00
Philipp Wiesemann
b524657118 Fixed three source comments in tests. 2016-06-28 21:15:16 +02:00
Philipp Wiesemann
b5aa5b04d6 Added a simple test case for SDL_sscanf() to tests.
It fails on platforms where SDL's custom implementation is used.

Relates to Bugzilla #3341.
2016-06-28 21:14:11 +02:00
Philipp Wiesemann
0e45984fa0 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().
2015-06-21 17:33:46 +02:00