This changes the old behavior of having values in the -32768 - 32767
range, like regular joystick axis. Now "button as axis" triggers (like
on Logitech controllers) and regular axis triggers (like on Xbox
controllers) have the same resting value, 0.
This has the benefit of ending the otherwise-bogus complaints that
SDL_GetError() reports "Passed a NULL mutex" if you call it instead of
checking if SDL_CreateWindow() actually succeeded. :)
Nitz
In Function,
MonitorInfo *
decode_edid (const uchar *edid)
In this function "info" is going out of scope and leaks the storage it points to, if the first if condition get true:
if (!decode_header (edid))
return NULL;
So while returning from this if statement there should be free for "info" pointer.
Nitz
In SDL_x11mouse.c file there is function named
static Cursor
X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
{
// Some code
data_bits = SDL_calloc(1, surface->h * width_bytes);
mask_bits = SDL_calloc(1, surface->h * width_bytes);
if (!data_bits || !mask_bits) {
SDL_OutOfMemory();
return None;
}
// Some code
}
Here is the problem in if statement,
suppose if !data_bits is false and !mask_bits is true then,
data_bits will go out of scope and leaks the memory it points to.
Solution is that data_bits and mask_bits should be checked separately, not by using OR operator.
Philipp Wiesemann
There is a NULL pointer dereference in SDL_AllocRW() if the system is out of memory. The "type" field is always written. This may be fixed with an early return.
Or an else{} or not writing the field and using slower SDL_calloc().
This fault was recently introduced (http://hg.libsdl.org/SDL/rev/681820ca0e78).
Philipp Wiesemann
SDL_RWFromFile() sets an error to be queried with SDL_GetError() on Android although a valid SDL_RWops pointer is returned.
This happens if the fallback implemented in SDL_android.cpp is used to load compressed assets (see README.android in section "Loading assets") and results in a message like "java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed". I think this is confusing and not needed because the loading works as expected.
I attached a patch which changes SDL_android.cpp to not set an error if compressed assets are loaded. In this case also no Exception is queried and no additional string are created.
Philipp Wiesemann
SDL sets an error to be queried with SDL_GetError() for the initial touch on Android.
Android_OnTouch() in SDL_androidtouch.c uses SDL_GetTouch() to check if a touch device was already added. SDL_GetTouch() sets the error "Unknown touch device" for an out of range access because touch devices are added after initial touch. I think this error is confusing because it always happens by design.
I attached a patch which removes the call to SDL_GetTouch() and only uses SDL_AddTouch() which does the check (if already added) again and does not set an error (if not added yet).
This lets us change things like this...
if (Failed) {
SDL_SetError("We failed");
return -1;
}
...into this...
if (Failed) {
return SDL_SetError("We failed");
}
Fixes Bugzilla #1778.