Fix various other compiler/clippy warnings

This commit is contained in:
Sebastian Dröge 2017-08-02 20:09:00 +03:00
parent 32c5218e7d
commit d7baadee22
4 changed files with 21 additions and 12 deletions

View file

@ -11,7 +11,6 @@ use ffi;
use gst_ffi;
use glib::translate::*;
use gst;
use std::mem::transmute;
use glib::source::CallbackGuard;
use glib_ffi::gpointer;
use std::ptr;
@ -51,7 +50,7 @@ impl AppSinkCallbacks {
unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gpointer) {
let _guard = CallbackGuard::new();
let callbacks: &AppSinkCallbacks = transmute(callbacks);
let callbacks = &*(callbacks as *const AppSinkCallbacks);
(callbacks.eos)(&from_glib_none(appsink));
}
@ -61,7 +60,7 @@ unsafe extern "C" fn trampoline_new_preroll(
callbacks: gpointer,
) -> gst_ffi::GstFlowReturn {
let _guard = CallbackGuard::new();
let callbacks: &AppSinkCallbacks = transmute(callbacks);
let callbacks = &*(callbacks as *const AppSinkCallbacks);
(callbacks.new_preroll)(&from_glib_none(appsink)).to_glib()
}
@ -71,7 +70,7 @@ unsafe extern "C" fn trampoline_new_sample(
callbacks: gpointer,
) -> gst_ffi::GstFlowReturn {
let _guard = CallbackGuard::new();
let callbacks: &AppSinkCallbacks = transmute(callbacks);
let callbacks = &*(callbacks as *const AppSinkCallbacks);
(callbacks.new_sample)(&from_glib_none(appsink)).to_glib()
}

View file

@ -10,7 +10,6 @@ use AppSrc;
use ffi;
use glib::translate::*;
use gst;
use std::mem::transmute;
use glib::source::CallbackGuard;
use glib_ffi::{gboolean, gpointer};
use std::ptr;
@ -54,14 +53,14 @@ unsafe extern "C" fn trampoline_need_data(
callbacks: gpointer,
) {
let _guard = CallbackGuard::new();
let callbacks: &AppSrcCallbacks = transmute(callbacks);
let callbacks = &*(callbacks as *const AppSrcCallbacks);
(callbacks.need_data)(&from_glib_none(appsrc), length);
}
unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbacks: gpointer) {
let _guard = CallbackGuard::new();
let callbacks: &AppSrcCallbacks = transmute(callbacks);
let callbacks = &*(callbacks as *const AppSrcCallbacks);
(callbacks.enough_data)(&from_glib_none(appsrc));
}
@ -72,7 +71,7 @@ unsafe extern "C" fn trampoline_seek_data(
callbacks: gpointer,
) -> gboolean {
let _guard = CallbackGuard::new();
let callbacks: &AppSrcCallbacks = transmute(callbacks);
let callbacks = &*(callbacks as *const AppSrcCallbacks);
(callbacks.seek_data)(&from_glib_none(appsrc), offset).to_glib()
}

View file

@ -15,8 +15,10 @@ use std::mem;
use std::ffi::CStr;
use glib;
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, ToGlib,
ToGlibPtr};
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr};
#[cfg(feature = "v1_10")]
use glib::translate::FromGlibPtrContainer;
#[repr(C)]
pub struct EventRef(ffi::GstEvent);
@ -930,9 +932,11 @@ impl EosBuilder {
event_builder_generic_impl!(|_| ffi::gst_event_new_eos());
}
// TODO Toc
pub struct TocBuilder {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
#[allow(unused)]
toc: (),
updated: bool,
}

View file

@ -1122,6 +1122,7 @@ pub struct ErrorBuilder<'a> {
seqnum: Option<u32>,
error: &'a glib::Error,
debug: Option<&'a str>,
#[allow(unused)]
details: Option<Structure>,
}
impl<'a> ErrorBuilder<'a> {
@ -1181,6 +1182,7 @@ pub struct WarningBuilder<'a> {
seqnum: Option<u32>,
error: &'a glib::Error,
debug: Option<&'a str>,
#[allow(unused)]
details: Option<Structure>,
}
impl<'a> WarningBuilder<'a> {
@ -1240,6 +1242,7 @@ pub struct InfoBuilder<'a> {
seqnum: Option<u32>,
error: &'a glib::Error,
debug: Option<&'a str>,
#[allow(unused)]
details: Option<Structure>,
}
impl<'a> InfoBuilder<'a> {
@ -1890,6 +1893,7 @@ impl<'a> ProgressBuilder<'a> {
pub struct TocBuilder {
src: Option<Object>,
seqnum: Option<u32>,
#[allow(unused)]
toc: (),
updated: bool,
}
@ -1984,6 +1988,7 @@ impl<'a> NeedContextBuilder<'a> {
pub struct HaveContextBuilder {
src: Option<Object>,
seqnum: Option<u32>,
#[allow(unused)]
context: (),
}
impl HaveContextBuilder {
@ -1991,11 +1996,11 @@ impl HaveContextBuilder {
Self {
src: None,
seqnum: None,
context: (),
context: context,
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
message_builder_generic_impl!(|_, src| {
ffi::gst_message_new_have_context(src, ptr::null_mut() /*s.context.to_glib_full().0*/)
});
}
@ -2038,6 +2043,7 @@ impl<'a> DeviceRemovedBuilder<'a> {
});
}
#[cfg(feature = "v1_10")]
pub struct PropertyNotifyBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
@ -2123,6 +2129,7 @@ impl<'a> StreamsSelectedBuilder<'a> {
});
}
#[cfg(feature = "v1_10")]
pub struct RedirectBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,