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

View file

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

View file

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

View file

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