1
0
Fork 0

Fix buffer iterators over last refactor

This len() function returns the remaining length, which is not what we
want.
This commit is contained in:
Robbert van der Helm 2022-02-13 01:16:52 +01:00
parent 8411313270
commit 81ddb410f5

View file

@ -59,7 +59,7 @@ impl<'a> Iterator for Samples<'a> {
type Item = Channels<'a>;
fn next(&mut self) -> Option<Self::Item> {
if self.current_sample < self.len() {
if self.current_sample < unsafe { (*self.buffers)[0].len() } {
let channels = Channels {
buffers: self.buffers,
current_sample: self.current_sample,
@ -114,7 +114,7 @@ impl<'a> Iterator for ChannelsIter<'a> {
type Item = &'a mut f32;
fn next(&mut self) -> Option<Self::Item> {
if self.current_channel < self.len() {
if self.current_channel < unsafe { (*self.buffers).len() } {
// SAFETY: These bounds have already been checked
let sample = unsafe {
(*self.buffers)