From 002958f0b4f6d3a585b93ef8056ce9f163a60951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 20 Dec 2020 19:21:20 +0200 Subject: [PATCH] gstreamer/sdp: Fix SDPMessage::medias_mut() iterator The raw pointer manipulation code was adding one indirection too many. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/304 --- gstreamer-sdp/src/sdp_message.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gstreamer-sdp/src/sdp_message.rs b/gstreamer-sdp/src/sdp_message.rs index cbc88472c..45728b097 100644 --- a/gstreamer-sdp/src/sdp_message.rs +++ b/gstreamer-sdp/src/sdp_message.rs @@ -1064,7 +1064,7 @@ macro_rules! define_iter_mut( // example removes the message that was returned here at an earlier time. The compiler // would be correct to complain in that case, but we don't provide such a function. let message = unsafe { - &mut *(&mut self.message as *mut &'a mut SDPMessageRef as *mut SDPMessageRef) + &mut *(self.message as *mut SDPMessageRef) }; if self.idx >= self.len { return None; @@ -1089,7 +1089,7 @@ macro_rules! define_iter_mut( impl<'a> DoubleEndedIterator for $name<'a> { fn next_back(&mut self) -> Option { let message = unsafe { - &mut *(&mut self.message as *mut &'a mut SDPMessageRef as *mut SDPMessageRef) + &mut *(self.message as *mut SDPMessageRef) }; if self.idx == self.len { return None; @@ -1133,7 +1133,7 @@ define_iter_mut!( MediasIterMut, &'a mut SDPMediaRef, |message: &'a mut SDPMessageRef, idx| message.get_media_mut(idx), - |message: &mut SDPMessageRef| message.medias_len() + |message: &SDPMessageRef| message.medias_len() ); define_iter!( PhonesIter,