Skip to content

Commit fab9c8e

Browse files
committed
glib: only support converting GString to c_char pointer
1 parent dc3630a commit fab9c8e

File tree

1 file changed

+10
-41
lines changed

1 file changed

+10
-41
lines changed

glib/src/gstring.rs

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -894,63 +894,32 @@ impl FromGlibPtrBorrow<*mut i8> for GString {
894894
}
895895
}
896896

897-
#[doc(hidden)]
898-
impl<'a> ToGlibPtr<'a, *const u8> for GString {
897+
impl<'a> ToGlibPtr<'a, *const c_char> for GString {
899898
type Storage = &'a Self;
900899

901900
#[inline]
902-
fn to_glib_none(&'a self) -> Stash<'a, *const u8, Self> {
903-
Stash(self.as_ptr() as *const u8, self)
904-
}
905-
906-
#[inline]
907-
fn to_glib_full(&self) -> *const u8 {
908-
unsafe { self.clone().into_glib_ptr() as *const u8 }
909-
}
910-
}
911-
912-
#[doc(hidden)]
913-
impl<'a> ToGlibPtr<'a, *const i8> for GString {
914-
type Storage = &'a Self;
915-
916-
#[inline]
917-
fn to_glib_none(&'a self) -> Stash<'a, *const i8, Self> {
918-
Stash(self.as_ptr() as *const i8, self)
919-
}
920-
921-
#[inline]
922-
fn to_glib_full(&self) -> *const i8 {
923-
unsafe { self.clone().into_glib_ptr() as *const i8 }
924-
}
925-
}
926-
927-
#[doc(hidden)]
928-
impl<'a> ToGlibPtr<'a, *mut u8> for GString {
929-
type Storage = &'a Self;
930-
931-
#[inline]
932-
fn to_glib_none(&'a self) -> Stash<'a, *mut u8, Self> {
933-
Stash(self.as_ptr() as *mut u8, self)
901+
fn to_glib_none(&'a self) -> Stash<'a, *const c_char, Self> {
902+
Stash(self.as_ptr() as *const c_char, self)
934903
}
935904

936905
#[inline]
937-
fn to_glib_full(&self) -> *mut u8 {
938-
unsafe { self.clone().into_glib_ptr() as *mut u8 }
906+
fn to_glib_full(&self) -> *const c_char {
907+
unsafe { self.clone().into_glib_ptr() as *const _ }
939908
}
940909
}
941910

942911
#[doc(hidden)]
943-
impl<'a> ToGlibPtr<'a, *mut i8> for GString {
912+
impl<'a> ToGlibPtr<'a, *mut c_char> for GString {
944913
type Storage = &'a Self;
945914

946915
#[inline]
947-
fn to_glib_none(&'a self) -> Stash<'a, *mut i8, Self> {
948-
Stash(self.as_ptr() as *mut i8, self)
916+
fn to_glib_none(&'a self) -> Stash<'a, *mut c_char, Self> {
917+
Stash(self.as_ptr() as *mut c_char, self)
949918
}
950919

951920
#[inline]
952-
fn to_glib_full(&self) -> *mut i8 {
953-
unsafe { self.clone().into_glib_ptr() as *mut i8 }
921+
fn to_glib_full(&self) -> *mut c_char {
922+
unsafe { self.clone().into_glib_ptr() }
954923
}
955924
}
956925

0 commit comments

Comments
 (0)