Skip to content

Commit

Permalink
bam/io/reader/header/sam_header: Reset EOL flag if read does not cons…
Browse files Browse the repository at this point in the history
…ume full line
  • Loading branch information
zaeleus committed Dec 19, 2024
1 parent 1b9cfe1 commit 5ba0b2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions noodles-bam/src/async/io/reader/header/sam_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ where
let amt = src.len().min(buf.remaining());
buf.put_slice(&src[..amt]);

if amt < src.len() {
self.is_eol = false;
}

self.consume(amt);

Poll::Ready(Ok(()))
Expand Down
6 changes: 6 additions & 0 deletions noodles-bam/src/io/reader/header/sam_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ where
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
let mut src = self.fill_buf()?;
let amt = src.read(buf)?;

if !src.is_empty() {
self.is_eol = false;
}

self.consume(amt);

Ok(amt)
}
}
Expand Down

0 comments on commit 5ba0b2b

Please sign in to comment.