Bug 1453551 - Don't use i8 as c_char in xpcom-gtest. r?mystor draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Thu, 12 Apr 2018 15:28:08 +0900
changeset 780912 e274a62bfe3f7ef912ba5ea9b7cf6a4ba6b24e47
parent 780873 2318adaec61f07eccf66c3f742497aa973b15f2f
push id106160
push userbmo:m_kato@ga2.so-net.ne.jp
push dateThu, 12 Apr 2018 07:47:58 +0000
reviewersmystor
bugs1453551
milestone61.0a1
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
xpcom/rust/gtest/xpcom/test.rs
--- 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
         }
     }