Format remaining files

This commit is contained in:
Pyfisch 2018-11-06 13:01:35 +01:00
parent bf47f90da6
commit cb07debcb6
252 changed files with 5944 additions and 3744 deletions

View file

@ -3,7 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate egl;
#[macro_use] extern crate log;
#[macro_use]
extern crate log;
extern crate servo;
extern crate smallvec;
@ -62,10 +63,10 @@ pub enum MLLogLevel {
}
#[repr(transparent)]
pub struct MLLogger(extern "C" fn (MLLogLevel, *const c_char));
pub struct MLLogger(extern "C" fn(MLLogLevel, *const c_char));
#[repr(transparent)]
pub struct MLHistoryUpdate(extern "C" fn (MLApp, bool, *const c_char, bool));
pub struct MLHistoryUpdate(extern "C" fn(MLApp, bool, *const c_char, bool));
#[repr(transparent)]
#[derive(Clone, Copy)]
@ -74,17 +75,18 @@ pub struct MLApp(*mut c_void);
const LOG_LEVEL: log::LevelFilter = log::LevelFilter::Info;
#[no_mangle]
pub unsafe extern "C" fn init_servo(ctxt: EGLContext,
surf: EGLSurface,
disp: EGLDisplay,
app: MLApp,
logger: MLLogger,
history_update: MLHistoryUpdate,
url: *const c_char,
width: u32,
height: u32,
hidpi: f32) -> *mut ServoInstance
{
pub unsafe extern "C" fn init_servo(
ctxt: EGLContext,
surf: EGLSurface,
disp: EGLDisplay,
app: MLApp,
logger: MLLogger,
history_update: MLHistoryUpdate,
url: *const c_char,
width: u32,
height: u32,
hidpi: f32,
) -> *mut ServoInstance {
// Servo initialization goes here!
servo::embedder_traits::resources::set(Box::new(ResourceReaderInstance::new()));
let _ = log::set_boxed_logger(Box::new(logger));
@ -112,9 +114,7 @@ pub unsafe extern "C" fn init_servo(ctxt: EGLContext,
let blank_url = ServoUrl::parse("about:blank").expect("Failed to parse about:blank!");
let url = CStr::from_ptr(url).to_str().unwrap_or("about:blank");
let url = ServoUrl::parse(url).unwrap_or(blank_url);
servo.handle_events(vec![
WindowEvent::NewBrowser(url, browser_id),
]);
servo.handle_events(vec![WindowEvent::NewBrowser(url, browser_id)]);
let result = Box::new(ServoInstance {
app: app,
@ -157,7 +157,12 @@ pub unsafe extern "C" fn heartbeat_servo(servo: *mut ServoInstance) {
if let Ok(cstr) = CString::new(url.as_str()) {
let can_go_back = index > 0;
let can_go_fwd = (index + 1) < urls.len();
(servo.history_update.0)(servo.app, can_go_back, cstr.as_ptr(), can_go_fwd);
(servo.history_update.0)(
servo.app,
can_go_back,
cstr.as_ptr(),
can_go_fwd,
);
}
}
},
@ -204,13 +209,17 @@ pub unsafe extern "C" fn move_servo(servo: *mut ServoInstance, x: f32, y: f32) {
ScrollState::TriggerUp,
WindowEvent::MouseWindowMoveEventClass(point),
),
ScrollState::TriggerDown(start) if (start - point).square_length() < DRAG_CUTOFF_SQUARED => return,
ScrollState::TriggerDown(start)
if (start - point).square_length() < DRAG_CUTOFF_SQUARED =>
{
return
},
ScrollState::TriggerDown(start) => (
ScrollState::TriggerDragging(start, point),
WindowEvent::Scroll(
ScrollLocation::Delta((point - start) * servo.scroll_scale),
start.to_i32(),
TouchEventType::Down
TouchEventType::Down,
),
),
ScrollState::TriggerDragging(start, prev) => (
@ -218,7 +227,7 @@ pub unsafe extern "C" fn move_servo(servo: *mut ServoInstance, x: f32, y: f32) {
WindowEvent::Scroll(
ScrollLocation::Delta((point - prev) * servo.scroll_scale),
start.to_i32(),
TouchEventType::Move
TouchEventType::Move,
),
),
};
@ -235,16 +244,22 @@ pub unsafe extern "C" fn trigger_servo(servo: *mut ServoInstance, x: f32, y: f32
let (new_state, window_events) = match servo.scroll_state {
ScrollState::TriggerUp if down => (
ScrollState::TriggerDown(point),
vec![
WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseDown(MouseButton::Left, point)),
],
vec![WindowEvent::MouseWindowEventClass(
MouseWindowEvent::MouseDown(MouseButton::Left, point),
)],
),
ScrollState::TriggerDown(start) if !down => (
ScrollState::TriggerUp,
vec![
WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseUp(MouseButton::Left, start)),
WindowEvent::MouseWindowEventClass(MouseWindowEvent::Click(MouseButton::Left, start)),
WindowEvent::MouseWindowMoveEventClass(point),
WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseUp(
MouseButton::Left,
start,
)),
WindowEvent::MouseWindowEventClass(MouseWindowEvent::Click(
MouseButton::Left,
start,
)),
WindowEvent::MouseWindowMoveEventClass(point),
],
),
ScrollState::TriggerDragging(start, prev) if !down => (
@ -253,9 +268,12 @@ pub unsafe extern "C" fn trigger_servo(servo: *mut ServoInstance, x: f32, y: f32
WindowEvent::Scroll(
ScrollLocation::Delta((point - prev) * servo.scroll_scale),
start.to_i32(),
TouchEventType::Up
TouchEventType::Up,
),
WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseUp(MouseButton::Left, point)),
WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseUp(
MouseButton::Left,
point,
)),
WindowEvent::MouseWindowMoveEventClass(point),
],
),
@ -275,7 +293,10 @@ pub unsafe extern "C" fn traverse_servo(servo: *mut ServoInstance, delta: i32) {
} else if delta < 0 {
WindowEvent::Navigation(servo.browser_id, TraversalDirection::Back(-delta as usize))
} else {
WindowEvent::Navigation(servo.browser_id, TraversalDirection::Forward(delta as usize))
WindowEvent::Navigation(
servo.browser_id,
TraversalDirection::Forward(delta as usize),
)
};
servo.servo.handle_events(vec![window_event]);
}
@ -284,11 +305,13 @@ pub unsafe extern "C" fn traverse_servo(servo: *mut ServoInstance, delta: i32) {
#[no_mangle]
pub unsafe extern "C" fn navigate_servo(servo: *mut ServoInstance, text: *const c_char) {
if let Some(servo) = servo.as_mut() {
let text = CStr::from_ptr(text).to_str().expect("Failed to convert text to UTF-8");
let text = CStr::from_ptr(text)
.to_str()
.expect("Failed to convert text to UTF-8");
let url = ServoUrl::parse(text).unwrap_or_else(|_| {
let mut search = ServoUrl::parse("http://google.com/search")
.expect("Failed to parse search URL")
.into_url();
.expect("Failed to parse search URL")
.into_url();
search.query_pairs_mut().append_pair("q", text);
ServoUrl::from_url(search)
});
@ -314,8 +337,8 @@ pub unsafe extern "C" fn discard_servo(servo: *mut ServoInstance) {
}
}
if Instant::now() > finish {
warn!("Incomplete shutdown.");
break 'outer;
warn!("Incomplete shutdown.");
break 'outer;
}
thread::sleep(SHUTDOWN_POLL_INTERVAL);
servo.servo.handle_events(vec![]);
@ -345,9 +368,9 @@ struct WindowInstance {
#[derive(Clone, Copy)]
enum ScrollState {
TriggerUp,
TriggerDown(DevicePoint),
TriggerDragging(DevicePoint, DevicePoint),
TriggerUp,
TriggerDown(DevicePoint),
TriggerDragging(DevicePoint, DevicePoint),
}
impl WindowMethods for WindowInstance {
@ -357,7 +380,8 @@ impl WindowMethods for WindowInstance {
fn prepare_for_composite(&self) -> bool {
MakeCurrent(self.disp, self.surf, self.surf, self.ctxt);
self.gl.viewport(0, 0, self.width as i32, self.height as i32);
self.gl
.viewport(0, 0, self.width as i32, self.height as i32);
true
}
@ -374,14 +398,19 @@ impl WindowMethods for WindowInstance {
hidpi_factor: TypedScale::new(self.hidpi),
screen: TypedSize2D::new(self.width, self.height),
screen_avail: TypedSize2D::new(self.width, self.height),
window: (TypedSize2D::new(self.width, self.height), TypedPoint2D::new(0, 0)),
window: (
TypedSize2D::new(self.width, self.height),
TypedPoint2D::new(0, 0),
),
framebuffer: TypedSize2D::new(self.width, self.height),
viewport: TypedRect::new(TypedPoint2D::new(0, 0), TypedSize2D::new(self.width, self.height)),
viewport: TypedRect::new(
TypedPoint2D::new(0, 0),
TypedSize2D::new(self.width, self.height),
),
}
}
fn set_animation_state(&self, _state: AnimationState) {
}
fn set_animation_state(&self, _state: AnimationState) {}
}
struct EventLoopWakerInstance;
@ -397,8 +426,7 @@ impl EventLoopWaker for EventLoopWakerInstance {
Box::new(EventLoopWakerInstance)
}
fn wake(&self) {
}
fn wake(&self) {}
}
struct ResourceReaderInstance;
@ -413,17 +441,23 @@ impl ResourceReaderMethods for ResourceReaderInstance {
fn read(&self, res: Resource) -> Vec<u8> {
Vec::from(match res {
Resource::Preferences => &include_bytes!("../../../resources/prefs.json")[..],
Resource::HstsPreloadList => &include_bytes!("../../../resources/hsts_preload.json")[..],
Resource::HstsPreloadList => {
&include_bytes!("../../../resources/hsts_preload.json")[..]
},
Resource::SSLCertificates => &include_bytes!("../../../resources/certs")[..],
Resource::BadCertHTML => &include_bytes!("../../../resources/badcert.html")[..],
Resource::NetErrorHTML => &include_bytes!("../../../resources/neterror.html")[..],
Resource::UserAgentCSS => &include_bytes!("../../../resources/user-agent.css")[..],
Resource::ServoCSS => &include_bytes!("../../../resources/servo.css")[..],
Resource::PresentationalHintsCSS => &include_bytes!("../../../resources/presentational-hints.css")[..],
Resource::PresentationalHintsCSS => {
&include_bytes!("../../../resources/presentational-hints.css")[..]
},
Resource::QuirksModeCSS => &include_bytes!("../../../resources/quirks-mode.css")[..],
Resource::RippyPNG => &include_bytes!("../../../resources/rippy.png")[..],
Resource::DomainList => &include_bytes!("../../../resources/public_domains.txt")[..],
Resource::BluetoothBlocklist => &include_bytes!("../../../resources/gatt_blocklist.txt")[..],
Resource::BluetoothBlocklist => {
&include_bytes!("../../../resources/gatt_blocklist.txt")[..]
},
})
}

View file

@ -112,9 +112,8 @@ pub fn init(
resources::set(Box::new(ResourceReader(readfile)));
if let Some(args) = init_opts.args {
let mut args: Vec<String> = serde_json::from_str(&args).map_err(|_| {
"Invalid arguments. Servo arguments must be formatted as a JSON array"
})?;
let mut args: Vec<String> = serde_json::from_str(&args)
.map_err(|_| "Invalid arguments. Servo arguments must be formatted as a JSON array")?;
// opts::from_cmdline_args expects the first argument to be the binary name.
args.insert(0, "servo".to_string());
@ -123,19 +122,19 @@ pub fn init(
opts::from_cmdline_args(&args);
}
let embedder_url = init_opts.url.as_ref().and_then(|s| {
ServoUrl::parse(s).ok()
});
let embedder_url = init_opts.url.as_ref().and_then(|s| ServoUrl::parse(s).ok());
let cmdline_url = opts::get().url.clone();
let pref_url = PREFS.get("shell.homepage").as_string().and_then(|s| {
ServoUrl::parse(s).ok()
});
let pref_url = PREFS
.get("shell.homepage")
.as_string()
.and_then(|s| ServoUrl::parse(s).ok());
let blank_url = ServoUrl::parse("about:blank").ok();
let url = embedder_url
.or(cmdline_url)
.or(pref_url)
.or(blank_url).unwrap();
.or(blank_url)
.unwrap();
gl.clear_color(1.0, 1.0, 1.0, 1.0);
gl.clear(gl::COLOR_BUFFER_BIT);
@ -171,16 +170,14 @@ pub fn init(
}
pub fn deinit() {
SERVO.with(|s| {
s.replace(None).unwrap().deinit()
});
SERVO.with(|s| s.replace(None).unwrap().deinit());
}
impl ServoGlue {
fn get_browser_id(&self) -> Result<BrowserId, &'static str> {
let browser_id = match self.browser_id {
Some(id) => id,
None => return Err("No BrowserId set yet.")
None => return Err("No BrowserId set yet."),
};
Ok(browser_id)
}
@ -417,7 +414,8 @@ impl ServoGlue {
let _ = self.browsers.pop();
if let Some(prev_browser_id) = self.browsers.last() {
self.browser_id = Some(*prev_browser_id);
self.events.push(WindowEvent::SelectBrowser(*prev_browser_id));
self.events
.push(WindowEvent::SelectBrowser(*prev_browser_id));
} else {
self.events.push(WindowEvent::Quit);
}
@ -476,7 +474,8 @@ impl WindowMethods for ServoCallbacks {
fn set_animation_state(&self, state: AnimationState) {
debug!("WindowMethods::set_animation_state");
self.host_callbacks.on_animating_changed(state == AnimationState::Animating);
self.host_callbacks
.on_animating_changed(state == AnimationState::Animating);
}
fn get_coordinates(&self) -> EmbedderCoordinates {

View file

@ -10,7 +10,10 @@ use std::mem;
use std::os::raw::c_char;
use std::rc::Rc;
fn call<F>(f: F) where F: Fn(&mut ServoGlue) -> Result<(), &'static str> {
fn call<F>(f: F)
where
F: Fn(&mut ServoGlue) -> Result<(), &'static str>,
{
SERVO.with(|s| {
if let Err(error) = match s.borrow_mut().as_mut() {
Some(ref mut s) => (f)(s),
@ -27,15 +30,15 @@ fn call<F>(f: F) where F: Fn(&mut ServoGlue) -> Result<(), &'static str> {
/// Callback used by Servo internals
#[repr(C)]
pub struct CHostCallbacks {
pub flush: extern fn(),
pub make_current: extern fn(),
pub on_load_started: extern fn(),
pub on_load_ended: extern fn(),
pub on_title_changed: extern fn(title: *const c_char),
pub on_url_changed: extern fn(url: *const c_char),
pub on_history_changed: extern fn(can_go_back: bool, can_go_forward: bool),
pub on_animating_changed: extern fn(animating: bool),
pub on_shutdown_complete: extern fn(),
pub flush: extern "C" fn(),
pub make_current: extern "C" fn(),
pub on_load_started: extern "C" fn(),
pub on_load_ended: extern "C" fn(),
pub on_title_changed: extern "C" fn(title: *const c_char),
pub on_url_changed: extern "C" fn(url: *const c_char),
pub on_history_changed: extern "C" fn(can_go_back: bool, can_go_forward: bool),
pub on_animating_changed: extern "C" fn(animating: bool),
pub on_shutdown_complete: extern "C" fn(),
}
/// Servo options
@ -62,9 +65,10 @@ pub extern "C" fn servo_version() -> *const c_char {
fn init(
opts: CInitOptions,
gl: Rc<gl::Gl>,
wakeup: extern fn(),
readfile: extern fn(*const c_char) -> *const c_char,
callbacks: CHostCallbacks) {
wakeup: extern "C" fn(),
readfile: extern "C" fn(*const c_char) -> *const c_char,
callbacks: CHostCallbacks,
) {
let args = unsafe { CStr::from_ptr(opts.args) };
let args = args.to_str().map(|s| s.to_string()).ok();
@ -91,20 +95,26 @@ fn init(
#[no_mangle]
pub extern "C" fn init_with_egl(
opts: CInitOptions,
wakeup: extern fn(),
readfile: extern fn(*const c_char) -> *const c_char,
callbacks: CHostCallbacks) {
wakeup: extern "C" fn(),
readfile: extern "C" fn(*const c_char) -> *const c_char,
callbacks: CHostCallbacks,
) {
let gl = gl_glue::egl::init().unwrap();
init(opts, gl, wakeup, readfile, callbacks)
}
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
#[cfg(any(
target_os = "linux",
target_os = "windows",
target_os = "macos"
))]
#[no_mangle]
pub extern "C" fn init_with_gl(
opts: CInitOptions,
wakeup: extern fn(),
readfile: extern fn(*const c_char) -> *const c_char,
callbacks: CHostCallbacks) {
wakeup: extern "C" fn(),
readfile: extern "C" fn(*const c_char) -> *const c_char,
callbacks: CHostCallbacks,
) {
let gl = gl_glue::gl::init().unwrap();
init(opts, gl, wakeup, readfile, callbacks)
}
@ -219,10 +229,10 @@ pub extern "C" fn click(x: i32, y: i32) {
call(|s| s.click(x as u32, y as u32));
}
pub struct WakeupCallback(extern fn());
pub struct WakeupCallback(extern "C" fn());
impl WakeupCallback {
fn new(callback: extern fn()) -> WakeupCallback {
fn new(callback: extern "C" fn()) -> WakeupCallback {
WakeupCallback(callback)
}
}
@ -236,10 +246,10 @@ impl EventLoopWaker for WakeupCallback {
}
}
pub struct ReadFileCallback(extern fn(*const c_char) -> *const c_char);
pub struct ReadFileCallback(extern "C" fn(*const c_char) -> *const c_char);
impl ReadFileCallback {
fn new(callback: extern fn(*const c_char) -> *const c_char) -> ReadFileCallback {
fn new(callback: extern "C" fn(*const c_char) -> *const c_char) -> ReadFileCallback {
ReadFileCallback(callback)
}
}

View file

@ -22,7 +22,11 @@ pub mod egl {
pub type EGLNativeWindowType = *const libc::c_void;
#[cfg(target_os = "android")]
pub type EGLNativeWindowType = *const libc::c_void;
#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))]
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "openbsd"
))]
pub type EGLNativeWindowType = *const libc::c_void;
pub type khronos_utime_nanoseconds_t = khronos_uint64_t;
@ -77,7 +81,11 @@ pub mod egl {
}
}
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
#[cfg(any(
target_os = "windows",
target_os = "linux",
target_os = "macos"
))]
pub mod gl {
use servo::gl::Gl;
use std::rc::Rc;

View file

@ -55,7 +55,7 @@ pub fn Java_org_mozilla_servoview_JNIServo_init(
Err(err) => {
throw(&env, &err);
return;
}
},
};
if log {
@ -95,7 +95,7 @@ pub fn Java_org_mozilla_servoview_JNIServo_init(
Err(_) => {
throw(&env, "Failed to get global reference of callback argument");
return;
}
},
};
let wakeup = Box::new(WakeupCallback::new(callbacks_ref.clone(), &env));
@ -110,11 +110,7 @@ pub fn Java_org_mozilla_servoview_JNIServo_init(
}
#[no_mangle]
pub fn Java_org_mozilla_servoview_JNIServo_setBatchMode(
env: JNIEnv,
_: JClass,
batch: jboolean,
) {
pub fn Java_org_mozilla_servoview_JNIServo_setBatchMode(env: JNIEnv, _: JClass, batch: jboolean) {
debug!("setBatchMode");
call(&env, |s| s.set_batch_mode(batch == JNI_TRUE));
}
@ -158,7 +154,7 @@ pub fn Java_org_mozilla_servoview_JNIServo_loadUri(env: JNIEnv, _class: JClass,
},
Err(_) => {
throw(&env, "Failed to convert Java string");
}
},
};
}
@ -202,7 +198,9 @@ pub fn Java_org_mozilla_servoview_JNIServo_scrollStart(
y: jint,
) {
debug!("scrollStart");
call(&env, |s| s.scroll_start(dx as i32, dy as i32, x as u32, y as u32));
call(&env, |s| {
s.scroll_start(dx as i32, dy as i32, x as u32, y as u32)
});
}
#[no_mangle]
@ -215,10 +213,11 @@ pub fn Java_org_mozilla_servoview_JNIServo_scrollEnd(
y: jint,
) {
debug!("scrollEnd");
call(&env, |s| s.scroll_end(dx as i32, dy as i32, x as u32, y as u32));
call(&env, |s| {
s.scroll_end(dx as i32, dy as i32, x as u32, y as u32)
});
}
#[no_mangle]
pub fn Java_org_mozilla_servoview_JNIServo_scroll(
env: JNIEnv,
@ -241,7 +240,9 @@ pub fn Java_org_mozilla_servoview_JNIServo_pinchZoomStart(
y: jint,
) {
debug!("pinchZoomStart");
call(&env, |s| s.pinchzoom_start(factor as f32, x as u32, y as u32));
call(&env, |s| {
s.pinchzoom_start(factor as f32, x as u32, y as u32)
});
}
#[no_mangle]
@ -268,7 +269,6 @@ pub fn Java_org_mozilla_servoview_JNIServo_pinchZoomEnd(
call(&env, |s| s.pinchzoom_end(factor as f32, x as u32, y as u32));
}
#[no_mangle]
pub fn Java_org_mozilla_servoview_JNIServo_click(env: JNIEnv, _: JClass, x: jint, y: jint) {
debug!("click");
@ -391,7 +391,8 @@ impl HostTrait for HostCallbacks {
"onTitleChanged",
"(Ljava/lang/String;)V",
&[s],
).unwrap();
)
.unwrap();
}
fn on_url_changed(&self, url: String) {
@ -407,7 +408,8 @@ impl HostTrait for HostCallbacks {
"onUrlChanged",
"(Ljava/lang/String;)V",
&[s],
).unwrap();
)
.unwrap();
}
fn on_history_changed(&self, can_go_back: bool, can_go_forward: bool) {
@ -420,7 +422,8 @@ impl HostTrait for HostCallbacks {
"onHistoryChanged",
"(ZZ)V",
&[can_go_back, can_go_forward],
).unwrap();
)
.unwrap();
}
fn on_animating_changed(&self, animating: bool) {
@ -432,7 +435,8 @@ impl HostTrait for HostCallbacks {
"onAnimatingChanged",
"(Z)V",
&[animating],
).unwrap();
)
.unwrap();
}
}
@ -441,17 +445,11 @@ fn initialize_android_glue(env: &JNIEnv, activity: JObject) {
// From jni-rs to android_injected_glue
let mut app: ffi::android_app = unsafe {
std::mem::zeroed()
};
let mut native_activity: ffi::ANativeActivity = unsafe {
std::mem::zeroed()
};
let mut app: ffi::android_app = unsafe { std::mem::zeroed() };
let mut native_activity: ffi::ANativeActivity = unsafe { std::mem::zeroed() };
let clazz = Box::into_raw(Box::new(env.new_global_ref(activity).unwrap()));
native_activity.clazz = unsafe {
(*clazz).as_obj().into_inner() as *mut c_void
};
native_activity.clazz = unsafe { (*clazz).as_obj().into_inner() as *mut c_void };
let vm = env.get_java_vm().unwrap().get_java_vm_pointer();
native_activity.vm = vm as *mut ffi::_JavaVM;
@ -463,7 +461,7 @@ fn initialize_android_glue(env: &JNIEnv, activity: JObject) {
}
}
extern {
extern "C" {
pub fn __android_log_write(prio: c_int, tag: *const c_char, text: *const c_char) -> c_int;
}
@ -497,7 +495,11 @@ fn redirect_stdout_to_logcat() {
let result = {
let read_into = &mut buf[cursor..];
unsafe {
read(descriptor, read_into.as_mut_ptr() as *mut _, read_into.len())
read(
descriptor,
read_into.as_mut_ptr() as *mut _,
read_into.len(),
)
}
};
@ -505,7 +507,11 @@ fn redirect_stdout_to_logcat() {
return;
} else if result < 0 {
unsafe {
__android_log_write(3, tag, b"error in log thread; closing\0".as_ptr() as *const _);
__android_log_write(
3,
tag,
b"error in log thread; closing\0".as_ptr() as *const _,
);
}
return;
} else {
@ -546,7 +552,10 @@ fn redirect_stdout_to_logcat() {
fn throw(env: &JNIEnv, err: &str) {
if let Err(e) = env.throw(("java/lang/Exception", err)) {
warn!("Failed to throw Java exception: `{}`. Exception was: `{}`", e, err);
warn!(
"Failed to throw Java exception: `{}`. Exception was: `{}`",
e, err
);
}
}