Skip to content

Commit

Permalink
Remove clearing of buffer
Browse files Browse the repository at this point in the history
`read_scanline` overwrites the entire buffer or returns an `Err`,
so the resetting the buffer is not needed.
  • Loading branch information
bash committed Feb 10, 2023
1 parent 60c1649 commit 7df5cb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/codecs/hdr/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,12 @@ impl<R: BufRead> HdrDecoder<R> {

let mut buf = vec![Default::default(); self.width as usize];
for chunk in chunks_iter {
// read_scanline overwrites the entire buffer or returns an Err,
// so not resetting the buffer here is ok.
read_scanline(&mut self.r, &mut buf[..])?;
for (dst, &pix) in chunk.iter_mut().zip(buf.iter()) {
*dst = f(pix);
}
buf.clear();
buf.resize(self.width as usize, Default::default());
}
Ok(())
}
Expand Down

0 comments on commit 7df5cb1

Please sign in to comment.