Add a delegating read_exact() on Reader so we can use the same Reader for more things
This commit is contained in:
parent
81112fcd51
commit
a7ce73ee98
@ -105,9 +105,9 @@ impl File {
|
||||
continue;
|
||||
}
|
||||
|
||||
io_file.seek(io::SeekFrom::Start(section.shdr.sh_offset))?;
|
||||
reader.seek(io::SeekFrom::Start(section.shdr.sh_offset))?;
|
||||
section.data.resize(section.shdr.sh_size as usize, 0u8);
|
||||
io_file.read_exact(&mut section.data)?;
|
||||
reader.read_exact(&mut section.data)?;
|
||||
}
|
||||
|
||||
// Parse the section names from the section header string table
|
||||
|
@ -35,6 +35,10 @@ impl<'data, D: Read + Seek> Reader<'data, D> {
|
||||
Reader{delegate: delegate, endian: endian}
|
||||
}
|
||||
|
||||
pub fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), std::io::Error> {
|
||||
self.delegate.read_exact(buf)
|
||||
}
|
||||
|
||||
pub fn seek(&mut self, pos: std::io::SeekFrom) -> Result<u64, std::io::Error> {
|
||||
self.delegate.seek(pos)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user