From 8abd12f1f32854dc0db1090ca23b77c5a5efeecf Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Thu, 17 Oct 2019 17:12:22 +0200 Subject: [PATCH] pxar: decoder: cleanup un-needed Decoder::get_dir() Signed-off-by: Christian Ebner --- src/pxar/decoder.rs | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/src/pxar/decoder.rs b/src/pxar/decoder.rs index e21f3bf2..e38b8afb 100644 --- a/src/pxar/decoder.rs +++ b/src/pxar/decoder.rs @@ -248,38 +248,6 @@ impl Result<(), Error>> Decoder { Ok(()) } - /// Get the `DirectoryEntry` located at `offset`. - /// - /// `offset` is expected to point to the directories `PXAR_GOODBYE_TAIL_MARKER`. - pub fn get_dir(&mut self, offset: u64) -> Result { - self.seek(SeekFrom::Start(offset))?; - - let gb: PxarGoodbyeItem = self.inner.read_item()?; - if gb.hash != PXAR_GOODBYE_TAIL_MARKER { - bail!("Expected goodbye tail marker, encountered 0x{:x?}", gb.hash); - } - - let distance = i64::try_from(gb.offset + gb.size)?; - let start = self.seek(SeekFrom::Current(0 - distance))?; - let mut header: PxarHeader = self.inner.read_item()?; - let filename = if header.htype == PXAR_FILENAME { - let name = self.inner.read_filename(header.size)?; - header = self.inner.read_item()?; - name - } else { - OsString::new() - }; - check_ca_header::(&header, PXAR_ENTRY)?; - let entry: PxarEntry = self.inner.read_item()?; - - Ok(DirectoryEntry { - start, - end: offset + GOODBYE_ITEM_SIZE, - filename, - entry, - }) - } - /// Get attributes for the archive item located at `offset`. /// /// Returns the entry, attributes and the payload size for the item.