src/catar/encoder.rs: correctly sort goodbye items by hash key
This commit is contained in:
parent
c60d34bdbf
commit
1b0dc9f680
|
@ -122,7 +122,9 @@ impl <W: Write> CaTarEncoder<W> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_goodbye_table(&mut self, goodbye_offset: usize, goodbye_items: &[CaFormatGoodbyeItem]) -> Result<(), Error> {
|
fn write_goodbye_table(&mut self, goodbye_offset: usize, goodbye_items: &mut [CaFormatGoodbyeItem]) -> Result<(), Error> {
|
||||||
|
|
||||||
|
goodbye_items.sort_unstable_by(|a, b| a.hash.cmp(&b.hash));
|
||||||
|
|
||||||
let item_count = goodbye_items.len();
|
let item_count = goodbye_items.len();
|
||||||
|
|
||||||
|
@ -278,7 +280,7 @@ impl <W: Write> CaTarEncoder<W> {
|
||||||
|
|
||||||
let goodbye_offset = self.writer_pos - dir_start_pos;
|
let goodbye_offset = self.writer_pos - dir_start_pos;
|
||||||
|
|
||||||
self.write_goodbye_table(goodbye_offset, &goodbye_items)?;
|
self.write_goodbye_table(goodbye_offset, &mut goodbye_items)?;
|
||||||
|
|
||||||
println!("encode_dir: {:?} end1 {}", self.current_path, self.writer_pos);
|
println!("encode_dir: {:?} end1 {}", self.current_path, self.writer_pos);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in New Issue