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.
This commit is contained in:
parent
d4b227a5fa
commit
86476a54f9
@ -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)
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user