mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-31 21:22:22 +00:00
Improve C string handling a bit
These are always going to be valid UTF-8 or things are very wrong.
This commit is contained in:
parent
e2b18a91e0
commit
7a33a4177f
3 changed files with 8 additions and 6 deletions
|
@ -108,7 +108,7 @@ impl Caps {
|
|||
|
||||
unsafe {
|
||||
let ptr = gst_caps_to_string(self.0);
|
||||
let s = CStr::from_ptr(ptr).to_string_lossy().into_owned();
|
||||
let s = CStr::from_ptr(ptr).to_str().unwrap().into();
|
||||
g_free(ptr);
|
||||
|
||||
s
|
||||
|
|
|
@ -102,8 +102,9 @@ impl Stream {
|
|||
|
||||
unsafe {
|
||||
CStr::from_ptr(gst_stream_get_stream_id(self.0))
|
||||
.to_string_lossy()
|
||||
.into_owned()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,8 +216,9 @@ impl StreamCollection {
|
|||
|
||||
unsafe {
|
||||
CStr::from_ptr(gst_stream_collection_get_upstream_id(self.0))
|
||||
.to_string_lossy()
|
||||
.into_owned()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ impl TagList {
|
|||
|
||||
unsafe {
|
||||
let ptr = gst_tag_list_to_string(self.0);
|
||||
let s = CStr::from_ptr(ptr).to_string_lossy().into_owned();
|
||||
let s = CStr::from_ptr(ptr).to_str().unwrap().into();
|
||||
g_free(ptr);
|
||||
|
||||
s
|
||||
|
|
Loading…
Reference in a new issue