From 214c59b25ea009f6431ddb8d4fab2806e5299450 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 21 Aug 2017 18:42:40 -0500 Subject: [PATCH] Fix up Servo_StyleSheet_GetOrigin for Linux 32-bit ABI 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 --- ports/geckolib/glue.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index c2763e85bbaf..15385b66f1fa 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -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]