Showing the changes to git-odb/src (1 of 1 file). Show all
Unified · Split
| @@ -347,13 +347,13 @@ impl File { · 346 unmodified lines | ||
| 347 | 347 | result_size, |
| 348 | 348 | .. |
| 349 | 349 | }, |
| 350 | − ) in chain.iter().rev().enumerate() | |
| 350 | + ) in chain.into_iter().rev().enumerate() | |
| 351 | 351 | { |
| 352 | − let data = &mut instructions[data.clone()]; | |
| 352 | + let data = &mut instructions[data]; | |
| 353 | 353 | if delta_idx + 1 == chain_len { |
| 354 | − last_result_size = Some(*result_size); | |
| 354 | + last_result_size = Some(result_size); | |
| 355 | 355 | } |
| 356 | − apply_delta(&source_buf[..*base_size], &mut target_buf[..*result_size], data); | |
| 356 | + apply_delta(&source_buf[..base_size], &mut target_buf[..result_size], data); | |
| 357 | 357 | // use the target as source for the next delta |
| 358 | 358 | std::mem::swap(&mut source_buf, &mut target_buf); |
| 359 | 359 | } |
| @@ -367,7 +367,7 @@ impl File { · 7 unmodified lines | ||
| 367 | 367 | // object, which should also be placed in the second buffer right away. You don't have that |
| 368 | 368 | // control/knowledge for out-of-pack bases, so this is a special case to deal with, too. |
| 369 | 369 | // Maybe these invariants can be represented in the type system though. |
| 370 | − if chain.len() % 2 == 1 { | |
| 370 | + if chain_len % 2 == 1 { | |
| 371 | 371 | // this seems inverted, but remember: we swapped the buffers on the last iteration |
| 372 | 372 | target_buf[..last_result_size].copy_from_slice(&source_buf[..last_result_size]); |
| 373 | 373 | } |
| @@ -381,7 +381,7 @@ impl File { · 7 unmodified lines | ||
| 381 | 381 | // technically depending on the cache, the chain size is not correct as it might |
| 382 | 382 | // have been cut short by a cache hit. The caller must deactivate the cache to get |
| 383 | 383 | // actual results |
| 384 | − num_deltas: chain.len() as u32, | |
| 384 | + num_deltas: chain_len as u32, | |
| 385 | 385 | decompressed_size: first_entry.decompressed_size as u64, |
| 386 | 386 | compressed_size: consumed_input, |
| 387 | 387 | object_size: last_result_size as u64, |
| @@ -389,7 +389,7 @@ impl File { · 1 unmodified line | ||
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | −fn apply_delta(base: &[u8], mut target: &mut [u8], data: &[u8]) { | |
| 392 | +pub(crate) fn apply_delta(base: &[u8], mut target: &mut [u8], data: &[u8]) { | |
| 393 | 393 | let mut i = 0; |
| 394 | 394 | while let Some(cmd) = data.get(i) { |
| 395 | 395 | i += 1; |