diff options
author | kientzle <kientzle@FreeBSD.org> | 2005-04-06 04:19:30 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2005-04-06 04:19:30 +0000 |
commit | 3e09e80261db8f758a8fd87c1ca6ec1217cf2978 (patch) | |
tree | 63fdda264f932859284aaf1f0b67a8cc43312bcd /lib/libarchive/archive_read.c | |
parent | 37b92090cfa2d45e70e9ac612529b298081d3c5a (diff) | |
download | FreeBSD-src-3e09e80261db8f758a8fd87c1ca6ec1217cf2978.zip FreeBSD-src-3e09e80261db8f758a8fd87c1ca6ec1217cf2978.tar.gz |
A number of improvements to ZIP support.
* Handles entries with compressed size >2GB (signed/unsigned cleanup)
* Handles entries with compressed size >4GB ("ZIP64" extension)
* Handles Unix extensions (ctime, atime, mtime, mode, uid, etc)
* Format-specific "skip data" override allows ZIP reader to skip
entries without decompressing them, which makes "tar -t"
a lot faster.
* Handles "length-at-end" entries generated by, e.g., "zip -r - foo"
Many thanks to: Dan Nelson, who contributed the code and test files for
the first three items above and suggested the fourth.
Diffstat (limited to 'lib/libarchive/archive_read.c')
-rw-r--r-- | lib/libarchive/archive_read.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libarchive/archive_read.c b/lib/libarchive/archive_read.c index 15fa9f7..1d01b8e 100644 --- a/lib/libarchive/archive_read.c +++ b/lib/libarchive/archive_read.c @@ -226,6 +226,8 @@ archive_read_next_header(struct archive *a, struct archive_entry **entryp) a->state = ARCHIVE_STATE_FATAL; return (ARCHIVE_FATAL); } + if (ret != ARCHIVE_OK) + return (ret); } /* Record start-of-header. */ @@ -405,9 +407,13 @@ archive_read_data_skip(struct archive *a) archive_check_magic(a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_DATA); - while ((r = archive_read_data_block(a, &buff, &size, &offset)) == - ARCHIVE_OK) - ; + if (a->format->read_data_skip != NULL) + r = (a->format->read_data_skip)(a); + else { + while ((r = archive_read_data_block(a, &buff, &size, &offset)) + == ARCHIVE_OK) + ; + } if (r == ARCHIVE_EOF) r = ARCHIVE_OK; @@ -505,6 +511,7 @@ __archive_read_register_format(struct archive *a, int (*bid)(struct archive *), int (*read_header)(struct archive *, struct archive_entry *), int (*read_data)(struct archive *, const void **, size_t *, off_t *), + int (*read_data_skip)(struct archive *), int (*cleanup)(struct archive *)) { int i, number_slots; @@ -520,6 +527,7 @@ __archive_read_register_format(struct archive *a, a->formats[i].bid = bid; a->formats[i].read_header = read_header; a->formats[i].read_data = read_data; + a->formats[i].read_data_skip = read_data_skip; a->formats[i].cleanup = cleanup; a->formats[i].format_data = format_data; return (ARCHIVE_OK); |