Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26bcc2a7 authored by Matthew Maurer's avatar Matthew Maurer
Browse files

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
parent e03fbcc4
Loading
Loading
Loading
Loading
+3 −11
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ use crate::sys;
use std::convert::{TryFrom, TryInto};
use std::convert::{TryFrom, TryInto};
use std::ffi::c_void;
use std::ffi::c_void;
use std::mem::{self, ManuallyDrop, MaybeUninit};
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::ptr;
use std::slice;
use std::slice;


@@ -103,12 +103,8 @@ pub trait SerializeArray: Serialize + Sized {
unsafe extern "C" fn serialize_element<T: Serialize>(
unsafe extern "C" fn serialize_element<T: Serialize>(
    parcel: *mut sys::AParcel,
    parcel: *mut sys::AParcel,
    array: *const c_void,
    array: *const c_void,
    index: c_ulong,
    index: usize,
) -> status_t {
) -> 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 slice: &[T] = slice::from_raw_parts(array.cast(), index + 1);


    let mut parcel = match BorrowedParcel::from_raw(parcel) {
    let mut parcel = match BorrowedParcel::from_raw(parcel) {
@@ -158,12 +154,8 @@ pub trait DeserializeArray: Deserialize {
unsafe extern "C" fn deserialize_element<T: Deserialize>(
unsafe extern "C" fn deserialize_element<T: Deserialize>(
    parcel: *const sys::AParcel,
    parcel: *const sys::AParcel,
    array: *mut c_void,
    array: *mut c_void,
    index: c_ulong,
    index: usize,
) -> status_t {
) -> 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 = &mut *(array as *mut Option<Vec<MaybeUninit<T>>>);
    let vec = match vec {
    let vec = match vec {
        Some(v) => v,
        Some(v) => v,