forked from mirrors/gstreamer-rs
gstreamer: Use Value::from_type_unchecked()
where applicable
Gets rid of some unnecessary assertions. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1184>
This commit is contained in:
parent
89326c7e7c
commit
84720eee66
3 changed files with 5 additions and 4 deletions
|
@ -64,7 +64,8 @@ where
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
let func_box: Box<dyn Fn(T) -> bool + Send + Sync + 'static> = Box::new(func);
|
let func_box: Box<dyn Fn(T) -> bool + Send + Sync + 'static> = Box::new(func);
|
||||||
let mut closure_value = glib::Value::from_type(from_glib(filter_boxed_get_type::<T>()));
|
let mut closure_value =
|
||||||
|
glib::Value::from_type_unchecked(from_glib(filter_boxed_get_type::<T>()));
|
||||||
glib::gobject_ffi::g_value_take_boxed(
|
glib::gobject_ffi::g_value_take_boxed(
|
||||||
closure_value.to_glib_none_mut().0,
|
closure_value.to_glib_none_mut().0,
|
||||||
Arc::into_raw(Arc::new(func_box)) as gpointer,
|
Arc::into_raw(Arc::new(func_box)) as gpointer,
|
||||||
|
@ -137,7 +138,7 @@ where
|
||||||
let func_ptr = &mut func as *mut F as gpointer;
|
let func_ptr = &mut func as *mut F as gpointer;
|
||||||
|
|
||||||
let mut accum = Some(init);
|
let mut accum = Some(init);
|
||||||
let mut ret = glib::Value::from_type(glib::Type::POINTER);
|
let mut ret = glib::Value::from_type_unchecked(glib::Type::POINTER);
|
||||||
glib::gobject_ffi::g_value_set_pointer(
|
glib::gobject_ffi::g_value_set_pointer(
|
||||||
ret.to_glib_none_mut().0,
|
ret.to_glib_none_mut().0,
|
||||||
&mut accum as *mut _ as gpointer,
|
&mut accum as *mut _ as gpointer,
|
||||||
|
|
|
@ -112,7 +112,7 @@ macro_rules! bitflags_deserialize_impl {
|
||||||
return Ok(Self::Value::empty());
|
return Ok(Self::Value::empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut gvalue = glib::Value::from_type(Self::Value::static_type());
|
let mut gvalue = unsafe { glib::Value::from_type_unchecked(Self::Value::static_type()) };
|
||||||
let tokens = value.split('+');
|
let tokens = value.split('+');
|
||||||
let class = FlagsClass::new(Self::Value::static_type()).unwrap();
|
let class = FlagsClass::new(Self::Value::static_type()).unwrap();
|
||||||
|
|
||||||
|
|
|
@ -1306,7 +1306,7 @@ impl GstValueExt for glib::Value {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut value = glib::Value::from_type(pspec.value_type());
|
let mut value = glib::Value::from_type_unchecked(pspec.value_type());
|
||||||
let ret: bool = from_glib(ffi::gst_value_deserialize_with_pspec(
|
let ret: bool = from_glib(ffi::gst_value_deserialize_with_pspec(
|
||||||
value.to_glib_none_mut().0,
|
value.to_glib_none_mut().0,
|
||||||
s.to_glib_none().0,
|
s.to_glib_none().0,
|
||||||
|
|
Loading…
Reference in a new issue