Sam Lantinga
be6ed6e9c4
Fixed sscanf("026", "%1x%1x%1x", &r, &g, &b)
...
Fixes https://github.com/libsdl-org/SDL/issues/12510
2025-03-10 14:45:08 -07:00
Sam Lantinga
6980325310
Added support for the "%n" sscanf format specifier
2025-02-24 20:02:59 -08:00
Ryan C. Gordon
6a0405b933
testautomation: Added a test to stdlib_swprintf that previously would fail.
2025-01-05 02:45:15 -05:00
Anonymous Maarten
b713e7581b
stdlib: fix SDL_strtol of "0" with base 0
...
SDL_strtol("0") skipped the "0" octal prefix
and returned a failure because the remainder of the string was empty.
2025-01-02 01:15:28 +01:00
Ozkan Sezer
41dfe2c246
test/testautomation_stdlib.c: fix gcc warning on 32 bit
...
test/testautomation_stdlib.c:361: warning: integer constant is too large for 'long' type
2024-10-10 21:10:24 +03:00
Sam Lantinga
8262072d91
Fixed possible memset(NULL) call in testautomation's SDL_aligned_alloc() check
...
Fixes https://github.com/libsdl-org/SDL/issues/11144
2024-10-10 08:06:18 -07:00
Ozkan Sezer
254b36361e
Add SDL_PRILL? format specifiers specifically for long long type.
2024-09-21 23:03:50 +03:00
Ozkan Sezer
88a01fbc96
testautomation_stdlib.c: fix -Wformat warnings from mingw with %lld/%llu
...
i.e.: unknown conversion type character 'l' in format
See https://github.com/libsdl-org/SDL/pull/10789#issuecomment-2354011906
2024-09-19 20:37:11 +03:00
Sam Lantinga
a90ad3b0e2
Removed SDL_bool in favor of plain bool
...
We require stdbool.h in the build environment, so we might as well use the plain bool type.
If your environment doesn't have stdbool.h, this simple replacement will suffice:
typedef signed char bool;
2024-09-18 08:32:30 -07:00
Ozkan Sezer
8caf25f7b3
testautomation_stdlib.c (stdlib_strtox): fix warning from gcc-4.9:
...
test/testautomation_stdlib.c: In function 'stdlib_strtox':
test/testautomation_stdlib.c:1339:9: warning: this decimal constant is unsigned only in ISO C90
STRTOX_TEST_CASE(SDL_strtoul, unsigned long, "%lu", "4294967295", 10, 4294967295, 10);
^
test/testautomation_stdlib.c:1340:9: warning: this decimal constant is unsigned only in ISO C90
STRTOX_TEST_CASE(SDL_strtoul, unsigned long, "%lu", "4294967296", 10, 4294967295, 10);
^
2024-09-18 01:03:10 +03:00
Sam Lantinga
90e01040c5
Added thread-safe environment functions
...
Also marked the existing functions as unsafe, as they can cause crashes if used in multi-threaded applications.
As a bonus, since the new functions are hashtable based, hint environment lookups are much faster.
2024-09-13 22:14:54 -07:00
Carl Åstholm
84361bcf0a
stdlib: Remove test cases with impl-defined results
2024-09-13 12:30:58 -07:00
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