Skip to content

Commit

Permalink
Merge pull request #309 from burrbull/fix-read-size
Browse files Browse the repository at this point in the history
correct read len
  • Loading branch information
burrbull authored Nov 3, 2020
2 parents 06d966f + 4f73d2e commit d4e0d42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/engines/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ impl<'a, I: 'a + IoProvider> ExecutionState<'a, I> {
rhandle.try_seek(pos)
}

fn input_read(&mut self, handle: *mut InputHandle, buf: &mut [u8]) -> Result<()> {
fn input_read(&mut self, handle: *mut InputHandle, buf: &mut [u8]) -> Result<usize> {
let rhandle: &mut InputHandle = unsafe { &mut *handle };
rhandle.read_exact(buf).map_err(Error::from)
rhandle.read(buf).map_err(Error::from)
}
/*
fn input_getc(&mut self, handle: *mut InputHandle) -> Result<u8> {
Expand Down Expand Up @@ -739,7 +739,7 @@ extern "C" fn input_read<'a, I: 'a + IoProvider>(
}
} else {*/
match es.input_read(rhandle, rdata) {
Ok(_) => len as isize,
Ok(l) => l as isize,
Err(e) => {
if len != 1 {
tt_warning!(es.status, "{}-byte read failed", len; e);
Expand Down

0 comments on commit d4e0d42

Please sign in to comment.