Skip to content

Commit f12816e

Browse files
authored
Merge pull request #584 from jf2048/no-log-escaping-2
glib: Correctly cast log messages to C char types
2 parents 55056ec + 4304fad commit f12816e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

glib/src/bridged_logging.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ impl GlibLogger {
122122
crate::ffi::g_log(
123123
domain.to_glib_none().0,
124124
GlibLogger::level_to_glib(level),
125-
b"%s\0".as_ptr() as *const i8,
126-
ToGlibPtr::<*const i8>::to_glib_none(message).0,
125+
b"%s\0".as_ptr() as *const _,
126+
ToGlibPtr::<*const std::os::raw::c_char>::to_glib_none(message).0,
127127
);
128128
}
129129
}
@@ -153,8 +153,8 @@ impl GlibLogger {
153153
file.to_glib_none().0,
154154
line_str.to_glib_none().0,
155155
func.to_glib_none().0,
156-
b"%s\0".as_ptr() as *const i8,
157-
ToGlibPtr::<*const i8>::to_glib_none(message).0,
156+
b"%s\0".as_ptr() as *const _,
157+
ToGlibPtr::<*const std::os::raw::c_char>::to_glib_none(message).0,
158158
);
159159
}
160160
}

glib/src/log.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ macro_rules! g_log_inner {
347347
$crate::ffi::g_log(
348348
$log_domain,
349349
$log_level.into_glib(),
350-
b"%s\0".as_ptr() as *const i8,
351-
ToGlibPtr::<*const i8>::to_glib_none(&w.into_string()).0,
350+
b"%s\0".as_ptr() as *const _,
351+
ToGlibPtr::<*const std::os::raw::c_char>::to_glib_none(&w.into_string()).0,
352352
);
353353
}
354354
}
@@ -647,8 +647,8 @@ macro_rules! g_print_inner {
647647
if !std::write!(&mut w, $format, $($arg),*).is_err() {
648648
unsafe {
649649
$crate::ffi::$func(
650-
b"%s\0".as_ptr() as *const i8,
651-
ToGlibPtr::<*const i8>::to_glib_none(&w.into_string()).0,
650+
b"%s\0".as_ptr() as *const _,
651+
ToGlibPtr::<*const std::os::raw::c_char>::to_glib_none(&w.into_string()).0,
652652
);
653653
}
654654
}

0 commit comments

Comments
 (0)