File tree Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -332,7 +332,7 @@ impl<'data> ChunkedDifMatch<'data> {
332
332
/// Slices the DIF into chunks of `chunk_size` bytes each, and computes SHA1
333
333
/// checksums for every chunk as well as the entire DIF.
334
334
pub fn from ( inner : DifMatch < ' data > , chunk_size : u64 ) -> Result < Self > {
335
- let ( checksum, chunks) = get_sha1_checksums ( inner. data ( ) , chunk_size) ?;
335
+ let ( checksum, chunks) = get_sha1_checksums ( inner. data ( ) , chunk_size as usize ) ?;
336
336
Ok ( ChunkedDifMatch {
337
337
inner : HashedDifMatch { inner, checksum } ,
338
338
chunks,
Original file line number Diff line number Diff line change @@ -412,7 +412,7 @@ fn upload_files_chunked(
412
412
pb. set_style ( progress_style) ;
413
413
414
414
let view = ByteView :: open ( archive. path ( ) ) ?;
415
- let ( checksum, checksums) = get_sha1_checksums ( & view, options. chunk_size ) ?;
415
+ let ( checksum, checksums) = get_sha1_checksums ( & view, options. chunk_size as usize ) ?;
416
416
let mut chunks = view
417
417
. chunks ( options. chunk_size as usize )
418
418
. zip ( checksums. iter ( ) )
Original file line number Diff line number Diff line change @@ -171,15 +171,15 @@ pub fn get_sha1_checksum<R: Read>(rdr: R) -> Result<Digest> {
171
171
172
172
/// Returns the SHA1 hash for the entire input, as well as each chunk of it. The
173
173
/// `chunk_size` must be a power of two.
174
- pub fn get_sha1_checksums ( data : & [ u8 ] , chunk_size : u64 ) -> Result < ( Digest , Vec < Digest > ) > {
174
+ pub fn get_sha1_checksums ( data : & [ u8 ] , chunk_size : usize ) -> Result < ( Digest , Vec < Digest > ) > {
175
175
if !chunk_size. is_power_of_two ( ) {
176
176
bail ! ( "Chunk size must be a power of two" ) ;
177
177
}
178
178
179
179
let mut total_sha = Sha1 :: new ( ) ;
180
180
let mut chunks = Vec :: new ( ) ;
181
181
182
- for chunk in data. chunks ( chunk_size as usize ) {
182
+ for chunk in data. chunks ( chunk_size) {
183
183
let mut chunk_sha = Sha1 :: new ( ) ;
184
184
chunk_sha. update ( chunk) ;
185
185
total_sha. update ( chunk) ;
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ impl ChunkedMapping {
38
38
let raw_data = fs:: read ( mapping) ?;
39
39
let file_name = format ! ( "/proguard/{}.txt" , mapping. uuid) ;
40
40
41
- let ( hash, chunk_hashes) = get_sha1_checksums ( & raw_data, chunk_size) ?;
41
+ let ( hash, chunk_hashes) = get_sha1_checksums ( & raw_data, chunk_size as usize ) ?;
42
42
Ok ( Self {
43
43
raw_data,
44
44
hash,
You can’t perform that action at this time.
0 commit comments