Browse Source

Use .is_null() instead of comparing to std::ptr::null()

pull/157/head
Fenrir 10 months ago
parent
commit
5413e77ec3
  1. 8
      ctru-rs/src/applets/swkbd.rs

8
ctru-rs/src/applets/swkbd.rs

@ -687,7 +687,7 @@ impl SoftwareKeyboard {
let mut swkbd_shared_mem_handle = 0; let mut swkbd_shared_mem_handle = 0;
if unsafe { SWKBD_SHARED_MEM == std::ptr::null_mut() } { if unsafe { SWKBD_SHARED_MEM.is_null() } {
(*swkbd).result = SWKBD_OUTOFMEM; (*swkbd).result = SWKBD_OUTOFMEM;
return SWKBD_BUTTON_NONE; return SWKBD_BUTTON_NONE;
} }
@ -711,7 +711,7 @@ impl SoftwareKeyboard {
} }
// Copy stuff to shared mem // Copy stuff to shared mem
if extra.initial_text != std::ptr::null() { if !extra.initial_text.is_null() {
(*swkbd).initial_text_offset = 0; (*swkbd).initial_text_offset = 0;
let utf16_iter = CStr::from_ptr(extra.initial_text) let utf16_iter = CStr::from_ptr(extra.initial_text)
@ -728,7 +728,7 @@ impl SoftwareKeyboard {
} }
} }
if extra.dict != std::ptr::null() { if !extra.dict.is_null() {
(*swkbd).dict_offset = dict_off as _; (*swkbd).dict_offset = dict_off as _;
unsafe { unsafe {
libc::memcpy( libc::memcpy(
@ -890,7 +890,7 @@ impl SoftwareKeyboard {
text8.len(), text8.len(),
) as _; ) as _;
let retmsg = if retmsg != std::ptr::null() { let retmsg = if !retmsg.is_null() {
unsafe { unsafe {
let len = libc::strlen(retmsg); let len = libc::strlen(retmsg);
std::str::from_utf8_unchecked(std::slice::from_raw_parts(retmsg, len + 1)) std::str::from_utf8_unchecked(std::slice::from_raw_parts(retmsg, len + 1))

Loading…
Cancel
Save