Skip to content

Commit 8e9aca3

Browse files
committed
Remove dependency on widestring
We should be able to get by with the text-handling functions from `std`
1 parent 999dd61 commit 8e9aca3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

ctru-rs/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pthread-3ds = { workspace = true }
2424
libc = { workspace = true, default-features = true }
2525
bitflags = "2.6.0"
2626
macaddr = "1.0.1"
27-
widestring = "1.1.0"
2827

2928
[build-dependencies]
3029
toml = "0.9.4"

ctru-rs/src/applets/swkbd.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -772,13 +772,13 @@ impl SoftwareKeyboard {
772772

773773
if swkbd.text_length > 0 {
774774
let text16 = unsafe {
775-
widestring::Utf16Str::from_slice_unchecked(std::slice::from_raw_parts(
775+
std::slice::from_raw_parts(
776776
swkbd_shared_mem_ptr.add(swkbd.text_offset as _).cast(),
777777
swkbd.text_length as _,
778-
))
778+
)
779779
};
780780

781-
*output = text16.to_string();
781+
*output = String::from_utf16(text16).unwrap();
782782
}
783783

784784
if swkbd.save_state_flags & (1 << 0) != 0 {
@@ -825,13 +825,13 @@ impl SoftwareKeyboard {
825825
let data = unsafe { &*user.cast::<MessageCallbackData>() };
826826

827827
let text16 = unsafe {
828-
widestring::Utf16Str::from_slice_unchecked(std::slice::from_raw_parts(
828+
std::slice::from_raw_parts(
829829
data.swkbd_shared_mem_ptr.add(swkbd.text_offset as _).cast(),
830830
swkbd.text_length as _,
831-
))
831+
)
832832
};
833833

834-
let text8 = text16.to_string();
834+
let text8 = String::from_utf16(text16).unwrap();
835835

836836
let result = unsafe { &mut **data.filter_callback }(&text8);
837837

0 commit comments

Comments
 (0)