summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matthew Maurer <mmaurer@google.com> 2022-08-11 11:53:14 -0700
committer Matthew Maurer <mmaurer@google.com> 2022-08-11 15:21:00 -0700
commit26bcc2a7eddd80e931efdbca2a78bd1db9df2533 (patch)
tree7e7606a852be66e8f740ebd2de719d723bc50871
parente03fbcc4b97a46992b34e08ced303c7c340af7da (diff)
rust: Defaulting --size_t-is-usize
We're defaulting to --size_t-is-usize across the repository to keep things consistent. This updates bindgen users to deal with the new signatures. Bug: 193455107 Test: m Change-Id: I3ff5f967cfbe75ef19d73a4f6a8e2409fe5b4462
-rw-r--r--libs/binder/rust/src/parcel/parcelable.rs14
1 files changed, 3 insertions, 11 deletions
diff --git a/libs/binder/rust/src/parcel/parcelable.rs b/libs/binder/rust/src/parcel/parcelable.rs
index c241e4d2d3..6f4c37530f 100644
--- a/libs/binder/rust/src/parcel/parcelable.rs
+++ b/libs/binder/rust/src/parcel/parcelable.rs
@@ -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;
@@ -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) {
@@ -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,