Sylvain Becker
bb6c28da07
Readability: remove redundant cast to the same type
2019-10-30 15:13:55 +01:00
Ryan C. Gordon
b8bbb98cac
stdlib: Patched to compile.
2019-09-26 13:44:49 -04:00
Ryan C. Gordon
d50976e0eb
stdlib: Try to coerce VS2019 to not replace some loops with memset() calls.
...
Fixes (?) Bugzilla #4759 .
2019-09-26 12:55:05 -04:00
Ozkan Sezer
18f946e1ce
better readability..
2019-07-31 00:07:15 +03:00
Ozkan Sezer
311b444829
SDL_iconv_string: add (char*) casts before SDL_malloc() calls.
2019-07-31 00:06:50 +03:00
Cameron Cawley
a15f1bbc30
riscos: Fix iconv warnings
2019-01-13 23:36:31 +00:00
Sam Lantinga
a7609d9e2a
Updated copyright for 2019
2019-01-04 22:01:14 -08:00
Ozkan Sezer
84655a97bb
os/2 bits for SDL_malloc.c -- from libffi
2018-11-18 19:28:20 +03:00
Sam Lantinga
9fc360ae14
Fixed bug 4283 - SDL's version of memset is different from libc's
...
janisozaur
memset's documentation reads:
* The memset() function shall copy c (converted to an unsigned char) into each of the first n bytes of the object pointed to by s. (http://pubs.opengroup.org/onlinepubs/9699919799/functions/memset.html )
* Sets the first count characters of dest to the character c. (https://msdn.microsoft.com/en-us/library/1fdeehz6.aspx )
* write a byte to a byte string (https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/memset.3.html )
The highlight here is they all mean a single _byte_, even though memset receives a parameter of type int, which can hold more data than a single byte. SDL's implementation of memset, however, does not clear any of the higher bits, causing an erroneous behaviour when passed an argument bigger than 0xff.
2018-09-28 20:48:18 -07:00
Ozkan Sezer
be55d5101a
SDL_vsnprintf: implemented '+' flag for signed integers printing.
...
it is, of course, ignored for %u, %x, %o and %p.
2018-09-29 01:24:10 +03:00
Ozkan Sezer
6e7826b49c
SDL_vsnprintf: fix numerics if both zero-padding and a field are given.
...
it used to place zeroes between the sign and the number. (space-padding
from within SDL_PrintString() seems OK: spaces are added before sign.)
also fixed the maxlen handling if the number has a sign.
2018-09-29 00:51:24 +03:00
Ozkan Sezer
5d3b29940e
SDL_vsnprintf() updates for zero-padding:
...
- remove force-enabling of pad_zeroes for %u for compatibility
(was added in https://hg.libsdl.org/SDL/rev/701f4a25df89 )
- ignore pad_zeroes for %s and %S
- ignore pad_zeroes for %d, %i and %u if a precision is given
2018-09-27 09:37:36 +03:00
Ozkan Sezer
8d8ae9b0c0
SDL_string.c (SDL_PrintString): avoid MSVC signed/unsigned mismatch warning
2018-09-27 01:10:50 +03:00
Ozkan Sezer
ec0e4edc8d
SDL_string.c (SDL_IntPrecisionAdjust): avoid MSVC generating a memset()
2018-09-27 01:00:50 +03:00
Ozkan Sezer
38b504d966
SDL_vsnprintf: implement precision for the integral value printers.
2018-09-27 00:32:15 +03:00
Ozkan Sezer
c7f80df3ba
SDL_string.c: added comments to three SDL_FormatInfo members.
2018-09-26 20:47:34 +03:00
Ozkan Sezer
e15e153eef
SDL_vsnprintf: when '.' is specified, take precision as 0 if it is < 0.
2018-09-26 17:11:40 +03:00
Ozkan Sezer
d5e5c6c90d
SDL_vsnprintf: string printer now honors the precision. (bug #4263.)
2018-09-26 10:40:02 +03:00
Ozkan Sezer
5ca98d3506
SDL_vsnprintf: %.* and %* now parse precision and width. (bug #4263.)
2018-09-26 10:38:40 +03:00
Sam Lantinga
85b2a541a6
Fixed whitespace
2018-09-24 11:49:25 -07:00
Sam Lantinga
a7f26f9e6c
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
2018-08-09 16:00:17 -07:00
Ozkan Sezer
ca308172db
SDL_expf: return SDL_exp() instead of SDL_uclibc_exp() for consistency.
2018-08-05 10:01:01 +03:00
Ethan Lee
8c5c6c609f
SDL_exp
2018-08-04 11:52:46 -04:00
Ozkan Sezer
4b1296e5dd
make sure SDL_vsnprintf() nul terminates if it is using _vsnprintf
...
The change makes sure that SDL_vsnprintf() nul terminates if it is
using _vsnprintf() for the job.
I made this patch for Watcom, whose _vsnprintf() doesn't guarantee
nul termination. The preprocessor check can be extended to windows
in general too, if required.
Closes bug #3769 .
2018-05-10 09:02:39 +03:00
Sam Lantinga
add5711436
Fixed bug 3947 - replace strlcpy with memcpy in SDL_strdup()
2018-02-13 08:13:29 -08:00
Ethan Lee
ff50cc0958
SDL_log10
2018-01-17 11:53:09 -05:00
Sam Lantinga
a9072159b2
Updated copyright for 2018
2018-01-03 10:03:25 -08:00
Sam Lantinga
644c159d94
Added SDL_fmod() and SDL_fmodf()
2017-11-04 17:35:03 -07:00
Sam Lantinga
48bcdfd8cc
Added float versions of SDL's math functions
2017-11-04 15:34:14 -07:00
Sam Lantinga
46bbc5d328
Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable
...
We're going to push the manifest environment variables from the Java side instead of continually querying for them from the native side.
2017-11-04 09:37:29 -07:00
Sam Lantinga
467aa0904e
Added the ability to set SDL hints from AndroidManifest.xml (thanks Rachel!)
...
This is especially useful for things like the accelerometer hint which could be needed before application main().
2017-10-24 00:17:07 -07:00
Sam Lantinga
e7ae12dc1e
Fixed compiler warning
2017-10-12 17:17:09 -07:00
Sam Lantinga
8c0edbc4f1
Fixed compiler warning
2017-10-12 14:02:24 -07:00
Sam Lantinga
eea9c57d52
Added functions to query and set the SDL memory allocation functions:
...
SDL_GetMemoryFunctions()
SDL_SetMemoryFunctions()
SDL_GetNumAllocations()
2017-10-12 13:44:28 -07:00
Ozkan Sezer
4ec40a6c1c
make sure that SDL_malloc(0) or SDL_calloc(0,x) doesn't return NULL.
2017-10-12 14:28:05 +03:00
Sam Lantinga
6da32ac3e6
Fixed bug 3813 - gcc7 fallthrough warnings in SDL_iconv.c and SDL_pixels.c
2017-09-10 12:42:38 -07:00
Sam Lantinga
9d72fa278b
Fixed compile warning
2017-09-10 10:43:04 -07:00
Sam Lantinga
c98185d075
Fixed 64-bit build warning
2017-09-08 15:08:03 -07:00
Sam Lantinga
13bf98643c
Fixed compiler warning with mingw-w64
2017-09-04 22:14:57 -07:00
Ryan C. Gordon
99577816ec
Fixed a bunch of compiler warnings.
2017-08-29 15:52:49 -04:00
Ryan C. Gordon
f285a037e2
stdlib: An implementation of SDL_scalbn using ldexp() (thanks, Ozkan!).
...
Fixes Bugzilla #3767 .
2017-08-29 00:36:17 -04:00
Sam Lantinga
7d193c1273
Fixed bug 3768 - provide a quick copysign() solution for watcom
...
Ozkan Sezer
The following patch provides a quick copysign solution for Watcom/x86
2017-08-21 16:30:24 -07:00
Sam Lantinga
2f632ba2c6
Added SDL_wcscmp()
2017-08-13 20:37:49 -07:00
Sam Lantinga
1ba7e20948
More fixes for the SDL_scanf code
2017-08-12 00:01:24 -07:00
Sam Lantinga
48323f50d8
Fixed bug 3284 - minor correction for SDL_setenv on _WIN32__ platform
...
Coriiander
Here is a minor correction for a non-breaking mistake in SDL_setenv for __WIN32__ platform. See below for details.
FILE:
"SDL/src/stdlib/SDL_getenv.c"
FUNCTION: (__WIN32__ platform)
int SDL_setenv(const char *name, const char *value, int overwrite)
CODE:
if (!overwrite) {
char ch = 0;
const size_t len = GetEnvironmentVariableA(name, &ch, sizeof (ch));
if (len > 0) {
return 0; /* asked not to overwrite existing value. */
}
}
WHAT'S WRONG:
The 3th argument to GetEnvironmentVariable (being DWORD nSize) must be the number of characters, not the number of bytes. SDL currently passes "the size of 1 char", rather "1". While it is non-breaking (1=1 after all), it is incorrect. Furthermore there is no need to specify the 2nd and 3th arguments at all.
CORRECTION 1: (corrected argument_
if (!overwrite) {
char ch = 0;
const size_t len = GetEnvironmentVariableA(name, &ch, 1);
if (len > 0) {
return 0; /* asked not to overwrite existing value. */
}
}
CORRECTION 2: (stripped of unneeded code)
if (!overwrite) {
if (GetEnvironmentVariableA(name, NULL, 0) > 0) {
return 0; /* asked not to overwrite existing value. */
}
}
2017-08-11 21:30:06 -07:00
Sam Lantinga
118d289bbb
Fixed bug 3341 - SDL_sscanf() problem
...
e_pluschauskas
Why does SDL_sscanf() always returns the number of format specifiers and doesn't implements standard C library behavior?
2017-08-11 19:36:12 -07:00
Ryan C. Gordon
23b242bba7
Fixed whitespace code style.
2017-05-29 00:51:38 -04:00
Ryan C. Gordon
bf09ce5fce
stdlib: added SDL_utf8strlen().
2017-05-29 03:01:05 -04:00
Ryan C. Gordon
32ada55b55
stdlib: Fixed crash on SDL_snprintf("%s", NULL).
...
Like other C runtimes, it should probably produce the string "(null)".
This bug probably only affected Windows, as most platforms use their standard
C runtime's snprintf().
2017-02-14 02:49:08 -05:00
Sam Lantinga
83184dca24
Fixed building with mingw32
2017-01-18 11:57:27 -08:00