diff options
author | kientzle <kientzle@FreeBSD.org> | 2009-03-07 00:25:33 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2009-03-07 00:25:33 +0000 |
commit | 86476a54f9bd352811dbacd9857efd23edeb25e3 (patch) | |
tree | 944520e8706c5f2380abb7a2f5dd55ca9d455bca /lib | |
parent | d4b227a5faae1597130a598fc7382df6374cda3f (diff) | |
download | FreeBSD-src-86476a54f9bd352811dbacd9857efd23edeb25e3.zip FreeBSD-src-86476a54f9bd352811dbacd9857efd23edeb25e3.tar.gz |
Merge r659 from libarchive.googlecode.com: Correctly report "none"
as the compression name when no other read filter bid. Add some
assertions to various tests to verify that read filters are properly
setting the textual name as well as the compression code.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libarchive/archive_read.c | 6 | ||||
-rw-r--r-- | lib/libarchive/test/test_compat_bzip2.c | 1 | ||||
-rw-r--r-- | lib/libarchive/test/test_compat_gzip.c | 1 | ||||
-rw-r--r-- | lib/libarchive/test/test_read_format_cpio_bin_Z.c | 1 | ||||
-rw-r--r-- | lib/libarchive/test/test_read_format_tar.c | 1 |
5 files changed, 6 insertions, 4 deletions
diff --git a/lib/libarchive/archive_read.c b/lib/libarchive/archive_read.c index 8346f6a..0cd8054 100644 --- a/lib/libarchive/archive_read.c +++ b/lib/libarchive/archive_read.c @@ -289,12 +289,10 @@ archive_read_open2(struct archive *_a, void *client_data, filter->read = client_read_proxy; filter->skip = client_skip_proxy; filter->close = client_close_proxy; + filter->name = "none"; + filter->code = ARCHIVE_COMPRESSION_NONE; a->filter = filter; - /* In case there's no filter. */ - a->archive.compression_code = ARCHIVE_COMPRESSION_NONE; - a->archive.compression_name = "none"; - /* Build out the input pipeline. */ e = build_stream(a); if (e == ARCHIVE_OK) diff --git a/lib/libarchive/test/test_compat_bzip2.c b/lib/libarchive/test/test_compat_bzip2.c index 143d923..f9d4029 100644 --- a/lib/libarchive/test/test_compat_bzip2.c +++ b/lib/libarchive/test/test_compat_bzip2.c @@ -69,6 +69,7 @@ compat_bzip2(const char *name) /* Verify that the format detection worked. */ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2); + assertEqualString(archive_compression_name(a), "bzip2"); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); diff --git a/lib/libarchive/test/test_compat_gzip.c b/lib/libarchive/test/test_compat_gzip.c index b1d9be3..87dd23b 100644 --- a/lib/libarchive/test/test_compat_gzip.c +++ b/lib/libarchive/test/test_compat_gzip.c @@ -69,6 +69,7 @@ verify(const char *name) /* Verify that the format detection worked. */ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_GZIP); + assertEqualString(archive_compression_name(a), "gzip"); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); diff --git a/lib/libarchive/test/test_read_format_cpio_bin_Z.c b/lib/libarchive/test/test_read_format_cpio_bin_Z.c index 749ff94..0972925 100644 --- a/lib/libarchive/test/test_read_format_cpio_bin_Z.c +++ b/lib/libarchive/test/test_read_format_cpio_bin_Z.c @@ -46,6 +46,7 @@ DEFINE_TEST(test_read_format_cpio_bin_Z) failure("archive_compression_name(a)=\"%s\"", archive_compression_name(a)); assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + assertEqualString(archive_compression_name(a), "compress (.Z)"); failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); diff --git a/lib/libarchive/test/test_read_format_tar.c b/lib/libarchive/test/test_read_format_tar.c index 812f90e..e34da1b 100644 --- a/lib/libarchive/test/test_read_format_tar.c +++ b/lib/libarchive/test/test_read_format_tar.c @@ -71,6 +71,7 @@ static void verifyEmpty(void) assertA(0 == archive_read_open_memory(a, archiveEmpty, 512)); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE); + assertEqualString(archive_compression_name(a), "none"); failure("512 zero bytes should be recognized as a tar archive."); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR); |