Bug 1453551 - Don't use i8 as c_char in xpcom-gtest. r?mystor
c_char isn't i8 on some platforms such as Android/arm, so we should use c_char
instead.
MozReview-Commit-ID: 486BCGvYAE0
--- a/xpcom/rust/gtest/xpcom/test.rs
+++ b/xpcom/rust/gtest/xpcom/test.rs
@@ -4,16 +4,17 @@
#![allow(non_snake_case)]
#[macro_use]
extern crate xpcom;
extern crate nserror;
+use std::os::raw::c_char;
use std::ptr;
use std::ffi::{CStr, CString};
use xpcom::interfaces;
use nserror::{NsresultExt, nsresult, NS_OK};
#[no_mangle]
pub unsafe extern fn Rust_ObserveFromRust() -> *const interfaces::nsIObserverService {
let obssvc = xpcom::services::get_ObserverService().unwrap();
@@ -24,17 +25,17 @@ pub unsafe extern fn Rust_ObserveFromRus
#[refcnt = "nonatomic"]
struct InitObserver {
run: *mut bool
}
impl Observer {
unsafe fn Observe(
&self,
_subject: *const interfaces::nsISupports,
- topic: *const i8,
+ topic: *const c_char,
_data: *const i16
) -> nsresult {
*self.run = true;
assert!(CStr::from_ptr(topic).to_str() == Ok("test-rust-observe"));
NS_OK
}
}