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 8549046994
commit 08c54145d3

View file

@ -1029,7 +1029,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;
@ -1054,7 +1054,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;
@ -1098,7 +1098,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,