diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index c1c4c661f3621..4bd92e27494af 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 2; private static final int SDL_MINOR_VERSION = 32; - private static final int SDL_MICRO_VERSION = 2; + private static final int SDL_MICRO_VERSION = 4; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/build.zig b/build.zig index 11590a47dee71..565ee5eb08ffb 100644 --- a/build.zig +++ b/build.zig @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void { const lib = b.addLibrary(.{ .name = "SDL2", - .version = .{ .major = 2, .minor = 32, .patch = 2 }, + .version = .{ .major = 2, .minor = 32, .patch = 4 }, .linkage = if (t.abi.isAndroid()) .dynamic else .static, .root_module = b.createModule(.{ .target = target, diff --git a/build.zig.zon b/build.zig.zon index 81c10f8953b12..f94163a05bb86 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,6 +1,6 @@ .{ .name = .SDL, - .version = "2.32.2", + .version = "2.32.4", .fingerprint = 0x7ac4ce41df223a25, .minimum_zig_version = "0.14.0", .dependencies = .{}, diff --git a/include/SDL_render.h b/include/SDL_render.h index 2118ed99cc8bc..5274172179d33 100644 --- a/include/SDL_render.h +++ b/include/SDL_render.h @@ -244,7 +244,7 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window, * \since This function is available since SDL 2.0.0. * * \sa SDL_CreateRenderer - * \sa SDL_CreateWindowRenderer + * \sa SDL_CreateWindowAndRenderer * \sa SDL_DestroyRenderer */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface); @@ -787,7 +787,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, * Get the current render target. * * The default render target is the window for which the renderer was created, - * and is reported a NULL here. + * and is reported as NULL here. * * \param renderer the rendering context. * \returns the current render target or NULL for the default render target. diff --git a/include/SDL_version.h b/include/SDL_version.h index 0465020776924..1b57c9a3a5ffc 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -58,7 +58,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 32 -#define SDL_PATCHLEVEL 2 +#define SDL_PATCHLEVEL 4 /** * Macro to determine SDL version program was compiled against. diff --git a/src/SDL_assert.c b/src/SDL_assert.c index 76c7491fa7dce..99a376e948ca8 100644 --- a/src/SDL_assert.c +++ b/src/SDL_assert.c @@ -42,15 +42,7 @@ #endif #if defined(__EMSCRIPTEN__) - #include - /* older Emscriptens don't have this, but we need to for wasm64 compatibility. */ - #ifndef MAIN_THREAD_EM_ASM_PTR - #ifdef __wasm64__ - #error You need to upgrade your Emscripten compiler to support wasm64 - #else - #define MAIN_THREAD_EM_ASM_PTR MAIN_THREAD_EM_ASM_INT - #endif - #endif +#include #endif /* The size of the stack buffer to use for rendering assert messages. */ @@ -259,7 +251,7 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, for (;;) { SDL_bool okay = SDL_TRUE; /* *INDENT-OFF* */ /* clang-format off */ - char *buf = (char *) MAIN_THREAD_EM_ASM_PTR({ + int reply = MAIN_THREAD_EM_ASM_INT({ var str = UTF8ToString($0) + '\n\n' + 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :'; @@ -267,26 +259,31 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, if (reply === null) { reply = "i"; } - return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL); + return reply.length === 1 ? reply.charCodeAt(0) : -1; }, message); /* *INDENT-ON* */ /* clang-format on */ - if (SDL_strcmp(buf, "a") == 0) { + switch (reply) { + case 'a': state = SDL_ASSERTION_ABORT; #if 0 /* (currently) no break functionality on Emscripten */ - } else if (SDL_strcmp(buf, "b") == 0) { + case 'b': state = SDL_ASSERTION_BREAK; + break; #endif - } else if (SDL_strcmp(buf, "r") == 0) { + case 'r': state = SDL_ASSERTION_RETRY; - } else if (SDL_strcmp(buf, "i") == 0) { + break; + case 'i': state = SDL_ASSERTION_IGNORE; - } else if (SDL_strcmp(buf, "A") == 0) { + break; + case 'A': state = SDL_ASSERTION_ALWAYS_IGNORE; - } else { + break; + default: okay = SDL_FALSE; + break; } - free(buf); if (okay) { break; diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c index 889e05decb293..5d1bfc28dedb7 100644 --- a/src/audio/pipewire/SDL_pipewire.c +++ b/src/audio/pipewire/SDL_pipewire.c @@ -590,7 +590,7 @@ static void node_event_info(void *object, const struct pw_node_info *info) /* Need to parse the parameters to get the sample rate */ for (i = 0; i < info->n_params; ++i) { - pw_node_enum_params(node->proxy, 0, info->params[i].id, 0, 0, NULL); + pw_node_enum_params((struct pw_node*)node->proxy, 0, info->params[i].id, 0, 0, NULL); } hotplug_core_sync(node); diff --git a/src/core/linux/SDL_udev.c b/src/core/linux/SDL_udev.c index 06eefa31f500a..6c0fc14da2213 100644 --- a/src/core/linux/SDL_udev.c +++ b/src/core/linux/SDL_udev.c @@ -424,9 +424,12 @@ static int device_class(struct udev_device *dev) } val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER"); - if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE) && - val && SDL_strcmp(val, "1") == 0) { - devclass |= SDL_UDEV_DEVICE_JOYSTICK; + if (val && SDL_strcmp(val, "1") == 0) { + if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_FALSE)) { + devclass |= SDL_UDEV_DEVICE_JOYSTICK; + } else { + devclass |= SDL_UDEV_DEVICE_ACCELEROMETER; + } } val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_MOUSE"); diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index b839ef79c7386..62e3633f6b29d 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -890,10 +890,8 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf return NULL; } device->magic = &SDL_HIDAPI_device_magic; - device->path = SDL_strdup(info->path); - if (!device->path) { - SDL_free(device); - return NULL; + if (info->path) { + device->path = SDL_strdup(info->path); } device->seen = SDL_TRUE; device->vendor_id = info->vendor_id; diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 9728780ac2350..cd958b1ff9eb0 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -908,9 +908,11 @@ static void RAWINPUT_AddDevice(HANDLE hDevice) char *product_string = NULL; WCHAR string[128]; + string[0] = 0; if (SDL_HidD_GetManufacturerString(hFile, string, sizeof(string))) { manufacturer_string = WIN_StringToUTF8W(string); } + string[0] = 0; if (SDL_HidD_GetProductString(hFile, string, sizeof(string))) { product_string = WIN_StringToUTF8W(string); } diff --git a/src/main/windows/version.rc b/src/main/windows/version.rc index 28a6a0669114b..a8861af3dd2ac 100644 --- a/src/main/windows/version.rc +++ b/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,32,2,0 - PRODUCTVERSION 2,32,2,0 + FILEVERSION 2,32,4,0 + PRODUCTVERSION 2,32,4,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 32, 2, 0\0" + VALUE "FileVersion", "2, 32, 4, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 32, 2, 0\0" + VALUE "ProductVersion", "2, 32, 4, 0\0" END END BLOCK "VarFileInfo" diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index 2ce22186e3c56..38b5201c624a0 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -81,14 +81,12 @@ static size_t SDL_ScanUnsignedLongLongInternal(const char *text, int count, int negative = *text == '-'; ++text; } - if ((radix == 0 || radix == 16) && *text == '0' && text[1] != '\0') { + if ((radix == 0 || radix == 16) && *text == '0' && (text[1] == 'x' || text[1] == 'X')) { + text += 2; + radix = 16; + } else if (radix == 0 && *text == '0' && (text[1] >= '0' && text[1] <= '9')) { ++text; - if (*text == 'x' || *text == 'X') { - radix = 16; - ++text; - } else if (radix == 0) { - radix = 8; - } + radix = 8; } else if (radix == 0) { radix = 10; }