Skip to content

Commit

Permalink
fix last bloc size
Browse files Browse the repository at this point in the history
  • Loading branch information
ndusart committed Oct 7, 2024
1 parent 5537653 commit f605746
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/hash_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ pub fn hash_file(
use std::io::Read;

let hash = {
let buf = &mut buffer;

let current_block_size = {
let rem = file_size - offset;
if rem < block_size {
Expand All @@ -79,7 +77,8 @@ pub fn hash_file(
block_size
}
};
let buf = &mut buf[0..current_block_size];
buffer.resize(current_block_size, 0);
let buf = &mut buffer;

if file.read_exact(buf).is_err() {
break;
Expand Down

0 comments on commit f605746

Please sign in to comment.