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
This commit is contained in:
Sebastian Dröge 2020-12-20 19:21:20 +02:00
parent ae51a2f49c
commit 002958f0b4

View file

@ -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<Self::Item> {
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,