From 0ab2d81085280ffe088b9af1b4bac42dd09484d7 Mon Sep 17 00:00:00 2001 From: Vitali Sazanovich Date: Sun, 20 Apr 2025 21:48:20 +0200 Subject: [PATCH 1/5] Try to fix "expected `*const i8`, found `*const u8" on aarch64 build --- src/sdl2/locale.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/sdl2/locale.rs b/src/sdl2/locale.rs index d879d7608d..9f152c96f6 100644 --- a/src/sdl2/locale.rs +++ b/src/sdl2/locale.rs @@ -75,18 +75,19 @@ unsafe fn get_locale(ptr: *const sys::SDL_Locale) -> Option { .to_string_lossy() .into_owned(); - let region = try_get_string(sdl_locale.country); + let region = if sdl_locale.country.is_null() { + None + } else { + Some( + std::ffi::CStr::from_ptr(sdl_locale.country) + .to_string_lossy() + .into_owned(), + ) + }; + // let region = try_get_string(sdl_locale.country); Some(Locale { lang, country: region, }) } - -unsafe fn try_get_string(ptr: *const i8) -> Option { - if ptr.is_null() { - None - } else { - Some(std::ffi::CStr::from_ptr(ptr).to_string_lossy().into_owned()) - } -} From d5e31daed0bcf5c5e4e97acfa5936e2b0b14c306 Mon Sep 17 00:00:00 2001 From: Vitali Sazanovich Date: Sun, 20 Apr 2025 21:51:32 +0200 Subject: [PATCH 2/5] Remove comment --- src/sdl2/locale.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sdl2/locale.rs b/src/sdl2/locale.rs index 9f152c96f6..d072f6b12f 100644 --- a/src/sdl2/locale.rs +++ b/src/sdl2/locale.rs @@ -84,7 +84,6 @@ unsafe fn get_locale(ptr: *const sys::SDL_Locale) -> Option { .into_owned(), ) }; - // let region = try_get_string(sdl_locale.country); Some(Locale { lang, From 20388edf2399a371c480cf488a3be7b6251a51af Mon Sep 17 00:00:00 2001 From: Vitali Sazanovich Date: Sun, 20 Apr 2025 21:59:13 +0200 Subject: [PATCH 3/5] Try to update the repository --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5053f7cbec..0087824b14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sdl2" description = "SDL2 bindings for Rust" -repository = "https://github.com/Rust-SDL2/rust-sdl2" +repository = "https://github.com/geniot/rust-sdl2" documentation = "https://docs.rs/sdl2" version = "0.37.0" license = "MIT" From 6d83ffc22faedfaf3fcc7653c44e9b00c989e9ae Mon Sep 17 00:00:00 2001 From: Vitali Sazanovich Date: Sun, 20 Apr 2025 22:05:31 +0200 Subject: [PATCH 4/5] Revert repository name --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0087824b14..5053f7cbec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sdl2" description = "SDL2 bindings for Rust" -repository = "https://github.com/geniot/rust-sdl2" +repository = "https://github.com/Rust-SDL2/rust-sdl2" documentation = "https://docs.rs/sdl2" version = "0.37.0" license = "MIT" From e0755d29acdd7a39e17a84f4bba0e573698b39f8 Mon Sep 17 00:00:00 2001 From: Vitali Sazanovich Date: Mon, 21 Apr 2025 12:23:33 +0200 Subject: [PATCH 5/5] Update change log --- changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.md b/changelog.md index 80c052d7b4..da01db952f 100644 --- a/changelog.md +++ b/changelog.md @@ -37,6 +37,8 @@ when upgrading from a version of rust-sdl2 to another. [PR #1427](https://github.com/Rust-SDL2/rust-sdl2/pull/1427) **BREAKING CHANGE** Add system locale support. A new event type `Event::LocaleChanged` has been added. +[PR #1479](https://github.com/Rust-SDL2/rust-sdl2/pull/1479) Fix get_locale in locale.rs for platforms where c_char is u8. + ### v0.37.0 [PR #1406](https://github.com/Rust-SDL2/rust-sdl2/pull/1406) Update bindings to SDL 2.0.26, add Event.is\_touch() for mouse events, upgrade wgpu to 0.20 in examples