tags: Use to_glib_none() to convert &str to a C string instead of as_ptr()

The latter does not necessarily give us a NUL-terminated string.

Fixes https://github.com/sdroege/gstreamer-rs/issues/122
This commit is contained in:
Sebastian Dröge 2018-07-23 10:17:38 +03:00
parent 694bcaa697
commit 93b32882ee

View file

@ -193,8 +193,10 @@ impl TagListRef {
unsafe {
let v = value.to_send_value();
let tag_name = tag_name.to_glib_none();
let tag_type: glib::Type = from_glib(
ffi::gst_tag_get_type(tag_name.as_ptr() as *const i8)
ffi::gst_tag_get_type(tag_name.0)
);
if tag_type != v.type_() {
return Err(TagError::TypeMismatch)
@ -203,7 +205,7 @@ impl TagListRef {
ffi::gst_tag_list_add_value(
self.as_mut_ptr(),
mode.to_glib(),
tag_name.to_glib_none().0,
tag_name.0,
v.to_glib_none().0,
);
}