Bug 1355187 - Rename some struct fields so that the Rust/C++ names are the same. r=rhunt

The binding generator just takes the Rust field names and uses that in the
generated C++ structs. So installing the autogenerated bindings is easier if
we make sure the names are the same ahead of time.

MozReview-Commit-ID: 6cuzmtI5Qqw
This commit is contained in:
Kartikaya Gupta 2017-04-10 17:38:02 -04:00
parent 2e1233a137
commit 1358415529
3 changed files with 6 additions and 6 deletions

View file

@ -480,7 +480,7 @@ inline WrByteSlice RangeToByteSlice(mozilla::Range<uint8_t> aRange) {
} }
inline mozilla::Range<uint8_t> ByteSliceToRange(WrByteSlice aWrSlice) { inline mozilla::Range<uint8_t> ByteSliceToRange(WrByteSlice aWrSlice) {
return mozilla::Range<uint8_t>(aWrSlice.mBuffer, aWrSlice.mLength); return mozilla::Range<uint8_t>(aWrSlice.buffer, aWrSlice.len);
} }
struct BuiltDisplayList { struct BuiltDisplayList {

View file

@ -550,18 +550,18 @@ impl WrImageDescriptor {
#[repr(C)] #[repr(C)]
pub struct WrVecU8 { pub struct WrVecU8 {
ptr: *mut u8, data: *mut u8,
length: usize, length: usize,
capacity: usize, capacity: usize,
} }
impl WrVecU8 { impl WrVecU8 {
fn to_vec(self) -> Vec<u8> { fn to_vec(self) -> Vec<u8> {
unsafe { Vec::from_raw_parts(self.ptr, self.length, self.capacity) } unsafe { Vec::from_raw_parts(self.data, self.length, self.capacity) }
} }
fn from_vec(mut v: Vec<u8>) -> WrVecU8 { fn from_vec(mut v: Vec<u8>) -> WrVecU8 {
let w = WrVecU8 { let w = WrVecU8 {
ptr: v.as_mut_ptr(), data: v.as_mut_ptr(),
length: v.len(), length: v.len(),
capacity: v.capacity(), capacity: v.capacity(),
}; };

View file

@ -66,8 +66,8 @@ WR_DECL_FFI_2(WrFontKey, uint32_t, uint32_t)
// view of a buffer of bytes. // view of a buffer of bytes.
// The canonical gecko equivalent is mozilla::Range<uint8_t>. // The canonical gecko equivalent is mozilla::Range<uint8_t>.
struct WrByteSlice { struct WrByteSlice {
uint8_t* mBuffer; uint8_t* buffer;
size_t mLength; size_t len;
}; };
// ---- // ----