Commit ad219dd1 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Remove PAD_PROBE_ID_INVALID and Default impls for PadProbeId and NotifyWatchId

These should never ever be 0, and passing 0 to any of the functions
using them will result in assertions.
parent fc4ad817
......@@ -65,7 +65,7 @@ pub enum ElementMessageType {
Info,
}
#[derive(Debug, Default, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq)]
pub struct NotifyWatchId(libc::c_ulong);
impl ToGlib for NotifyWatchId {
......@@ -79,6 +79,7 @@ impl ToGlib for NotifyWatchId {
impl FromGlib<libc::c_ulong> for NotifyWatchId {
fn from_glib(val: libc::c_ulong) -> NotifyWatchId {
skip_assert_initialized!();
assert_ne!(val, 0);
NotifyWatchId(val)
}
}
......
......@@ -115,7 +115,7 @@ pub use element::{ElementExtManual, ElementMessageType, NotifyWatchId};
pub use element::{ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI,
ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME};
pub use bin::BinExtManual;
pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo, PAD_PROBE_ID_INVALID};
pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo};
pub use gobject::GObjectExtManualGst;
pub use child_proxy::ChildProxyExtManual;
pub use tag_setter::TagSetterExtManual;
......
......@@ -56,9 +56,8 @@ impl Pad {
}
}
#[derive(Debug, Default, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq)]
pub struct PadProbeId(libc::c_ulong);
pub const PAD_PROBE_ID_INVALID: PadProbeId = PadProbeId(0);
impl ToGlib for PadProbeId {
type GlibType = libc::c_ulong;
......@@ -71,6 +70,7 @@ impl ToGlib for PadProbeId {
impl FromGlib<libc::c_ulong> for PadProbeId {
fn from_glib(val: libc::c_ulong) -> PadProbeId {
skip_assert_initialized!();
assert_ne!(val, 0);
PadProbeId(val)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment