Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #198 from darrenldl/dev
Browse files Browse the repository at this point in the history
Added hashing code to check mode, updated decode mode to display hash time as well
  • Loading branch information
darrenldl committed May 17, 2019
2 parents 20e5a46 + 433598d commit 55df4d1
Show file tree
Hide file tree
Showing 11 changed files with 682 additions and 206 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

- Encode stdin mode now reports current rate and time used during encoding, and shows normal progress stats at the end
- The following modes now use "bytes" as units for progress reporting instead of "chunks" or "blocks"
- Check
- Decode
- Encode
- Repair
Expand All @@ -52,6 +53,16 @@

- Bumped major version as this may break backward compatibility

- Added options for hashing stored data in check mode

- This can be triggered via `--hash` or `--hash-only`

- Both are incompatible with range options, as opposed to decode mode where hashing is still done with range options

- This is to reduce complexity, especially since ranged hashing isn't very useful in general
- Time elapsed fields display update for decode mode
- Now decoding time and hashing time are displayed separately

## 6.0.1

- Minor fixes for rescue and decode mode help messages
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ If blockyarchive has been useful to you, and you would like to donate to me for

**Libcrc code**

The crcccitt code is translated from the C implementation in [libcrc](https://github.com/lammertb/libcrc) and are under the same MIT License as used by libcrc and as stated in libcrc source code, the license text of the crcccitt.c is copied over to `crc-ccitt/build.rs`, `crc-ccitt/src/lib.rs`, `build.rs` and `src/crc_ccitt.rs` as well.
The crcccitt code is translated from the C implementation in [libcrc](https://github.com/lammertb/libcrc) and is under the same MIT License as used by libcrc and as stated in libcrc source code. The license text of the crcccitt.c is copied over to `crc-ccitt/build.rs`, `crc-ccitt/src/lib.rs`, `build.rs` and `src/crc_ccitt.rs` as well.

**Official SeqBox code**

Expand Down
45 changes: 45 additions & 0 deletions src/block_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,3 +545,48 @@ pub fn guess_starting_block_index(

Ok(index_with_highest_count.unwrap_or(0))
}

pub fn get_data_par_burst_from_ref_block_and_in_file(
ref_block_pos: u64,
ref_block: &Block,
burst: Option<usize>,
from_pos: Option<u64>,
guess_burst_from_pos: Option<u64>,
force_misalign: bool,
in_file: &str,
) -> Option<(usize, usize, usize)> {
if ver_uses_rs(ref_block.get_version()) && ref_block.is_meta() {
match (ref_block.get_RSD(), ref_block.get_RSP()) {
(Ok(Some(data)), Ok(Some(parity))) => {
let data = data as usize;
let parity = parity as usize;

let guess_burst_from_pos = match guess_burst_from_pos {
Some(x) => Some(GuessBurstFromPos::NoShift(x)),
None => match from_pos {
None => None,
Some(x) => Some(GuessBurstFromPos::ShiftToStart(x)),
},
};

// try to obtain burst error resistance level
match burst {
Some(l) => Some((data, parity, l)),
None => match guess_burst_err_resistance_level(
in_file,
guess_burst_from_pos,
force_misalign,
ref_block_pos,
ref_block,
) {
Ok(Some(l)) => Some((data, parity, l)),
_ => Some((data, parity, 0)), // assume burst resistance level is 0
},
}
}
_ => None,
}
} else {
None
}
}

0 comments on commit 55df4d1

Please sign in to comment.