format/context: fix the packets iterator

This commit is contained in:
meh 2015-06-24 13:34:52 +02:00
parent 1e5d77816a
commit b712412e77

View File

@ -195,15 +195,19 @@ impl<'a> Iterator for PacketIter<'a> {
fn next(&mut self) -> Option<<Self as Iterator>::Item> { fn next(&mut self) -> Option<<Self as Iterator>::Item> {
let mut packet = Packet::empty(); let mut packet = Packet::empty();
match packet.read(self.context) { loop {
Ok(..) => unsafe { match packet.read(self.context) {
let stream = Stream::wrap(*(*self.context.as_ptr()).streams.offset(packet.stream() as isize)); Ok(..) =>
return Some((unsafe {
Stream::wrap(*(*self.context.as_ptr()).streams.offset(packet.stream() as isize))
}, packet)),
Some((stream, packet)) Err(Error::Eof) =>
}, return None,
_ => Err(..) =>
None ()
}
} }
} }
} }