Skip to content

Commit

Permalink
Fix up Servo_StyleSheet_GetOrigin for Linux 32-bit ABI
Browse files Browse the repository at this point in the history
Bindgen bitfield enums don't work as return values with the Linux 32-bit ABI at
the moment because they wrap the value in a struct.

This causes the Rust side to believe the caller will pass along space for the
struct return value, while C++ believes it's just an integer value.

MozReview-Commit-ID: JHDp0XAmQCG
  • Loading branch information
jryans committed Aug 22, 2017
1 parent eb80e8f commit 214c59b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ports/geckolib/glue.rs
Expand Up @@ -1059,12 +1059,16 @@ pub extern "C" fn Servo_StyleSheet_SizeOfIncludingThis(
#[no_mangle]
pub extern "C" fn Servo_StyleSheet_GetOrigin(
sheet: RawServoStyleSheetContentsBorrowed
) -> OriginFlags {
match StylesheetContents::as_arc(&sheet).origin {
) -> u8 {
let origin = match StylesheetContents::as_arc(&sheet).origin {
Origin::UserAgent => OriginFlags_UserAgent,
Origin::User => OriginFlags_User,
Origin::Author => OriginFlags_Author,
}
};
// We'd like to return `OriginFlags` here, but bindgen bitfield enums don't
// work as return values with the Linux 32-bit ABI at the moment because
// they wrap the value in a struct, so for now just unwrap it.
origin.0
}

#[no_mangle]
Expand Down

0 comments on commit 214c59b

Please sign in to comment.