Loading libs/binder/rust/src/parcel/parcelable.rs +3 −11 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ use crate::sys; use std::convert::{TryFrom, TryInto}; use std::ffi::c_void; use std::mem::{self, ManuallyDrop, MaybeUninit}; use std::os::raw::{c_char, c_ulong}; use std::os::raw::c_char; use std::ptr; use std::slice; Loading Loading @@ -103,12 +103,8 @@ pub trait SerializeArray: Serialize + Sized { unsafe extern "C" fn serialize_element<T: Serialize>( parcel: *mut sys::AParcel, array: *const c_void, index: c_ulong, index: usize, ) -> status_t { // c_ulong and usize are the same, but we need the explicitly sized version // so the function signature matches what bindgen generates. let index = index as usize; let slice: &[T] = slice::from_raw_parts(array.cast(), index + 1); let mut parcel = match BorrowedParcel::from_raw(parcel) { Loading Loading @@ -158,12 +154,8 @@ pub trait DeserializeArray: Deserialize { unsafe extern "C" fn deserialize_element<T: Deserialize>( parcel: *const sys::AParcel, array: *mut c_void, index: c_ulong, index: usize, ) -> status_t { // c_ulong and usize are the same, but we need the explicitly sized version // so the function signature matches what bindgen generates. let index = index as usize; let vec = &mut *(array as *mut Option<Vec<MaybeUninit<T>>>); let vec = match vec { Some(v) => v, Loading Loading
libs/binder/rust/src/parcel/parcelable.rs +3 −11 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ use crate::sys; use std::convert::{TryFrom, TryInto}; use std::ffi::c_void; use std::mem::{self, ManuallyDrop, MaybeUninit}; use std::os::raw::{c_char, c_ulong}; use std::os::raw::c_char; use std::ptr; use std::slice; Loading Loading @@ -103,12 +103,8 @@ pub trait SerializeArray: Serialize + Sized { unsafe extern "C" fn serialize_element<T: Serialize>( parcel: *mut sys::AParcel, array: *const c_void, index: c_ulong, index: usize, ) -> status_t { // c_ulong and usize are the same, but we need the explicitly sized version // so the function signature matches what bindgen generates. let index = index as usize; let slice: &[T] = slice::from_raw_parts(array.cast(), index + 1); let mut parcel = match BorrowedParcel::from_raw(parcel) { Loading Loading @@ -158,12 +154,8 @@ pub trait DeserializeArray: Deserialize { unsafe extern "C" fn deserialize_element<T: Deserialize>( parcel: *const sys::AParcel, array: *mut c_void, index: c_ulong, index: usize, ) -> status_t { // c_ulong and usize are the same, but we need the explicitly sized version // so the function signature matches what bindgen generates. let index = index as usize; let vec = &mut *(array as *mut Option<Vec<MaybeUninit<T>>>); let vec = match vec { Some(v) => v, Loading