Style: Use ARCHIVE_VERSION_NUMBER to conditionalize tests on

the particular libarchive version being tested instead of the
deprecated ARCHIVE_API_VERSION and ARCHIVE_VERSION_STAMP macros.
This commit is contained in:
kientzle 2008-09-01 05:38:33 +00:00
parent 4f7f14505a
commit da7b4a0824
53 changed files with 309 additions and 311 deletions

View File

@ -48,7 +48,7 @@ struct read_memory_data {
static int memory_read_close(struct archive *, void *);
static int memory_read_open(struct archive *, void *);
#if ARCHIVE_API_VERSION < 2
#if ARCHIVE_VERSION_NUMBER < 2000000
static ssize_t memory_read_skip(struct archive *, void *, size_t request);
#else
static off_t memory_read_skip(struct archive *, void *, off_t request);
@ -113,7 +113,7 @@ memory_read(struct archive *a, void *client_data, const void **buff)
/*
* How mean can a skip() routine be? Let's try to find out.
*/
#if ARCHIVE_API_VERSION < 2
#if ARCHIVE_VERSION_NUMBER < 2000000
static ssize_t
memory_read_skip(struct archive *a, void *client_data, size_t skip)
#else

View File

@ -165,7 +165,7 @@ compare_acls(struct archive_entry *ae, struct acl_t *acls, int n, int mode)
assert(matched == 1);
}
}
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
/* Known broken before 1.9.0. */
skipping("archive_entry_acl_next() exits with ARCHIVE_EOF");
#else

View File

@ -386,7 +386,7 @@ compare_acls(struct archive_entry *ae, struct acl_t *acls, int n, int mode)
assert(matched == 1);
}
}
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
/* Known broken before 1.9.0. */
skipping("archive_entry_acl_next() exits with ARCHIVE_EOF");
#else
@ -446,10 +446,10 @@ DEFINE_TEST(test_acl_pax)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/* Write out the data we generated to a file for manual inspection. */
@ -509,9 +509,9 @@ DEFINE_TEST(test_acl_pax)
/* Close the archive. */
assertA(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertA(0 == archive_read_finish(a));
#endif
}

View File

@ -33,9 +33,9 @@ DEFINE_TEST(test_bad_fd)
assertA(0 == archive_read_support_compression_all(a));
assertA(ARCHIVE_FATAL == archive_read_open_fd(a, -1, 1024));
assertA(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertA(0 == archive_read_finish(a));
#endif
}

View File

@ -94,10 +94,10 @@ test_compat_gtar_1(void)
assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR);
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
#endif
}

View File

@ -53,10 +53,10 @@ test_compat_zip_1(void)
assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ZIP);
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
#endif
}

View File

@ -55,13 +55,12 @@ DEFINE_TEST(test_empty_write)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/*
* Again, with bzip2 compression.
*/
@ -84,10 +83,10 @@ DEFINE_TEST(test_empty_write)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
@ -113,9 +112,9 @@ DEFINE_TEST(test_empty_write)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
}

View File

@ -88,7 +88,7 @@ DEFINE_TEST(test_entry)
assertEqualInt(archive_entry_ctime_nsec(e), 0);
assert(!archive_entry_ctime_is_set(e));
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
/* dev */
archive_entry_set_dev(e, 235);
assertEqualInt(archive_entry_dev(e), 235);
@ -97,7 +97,7 @@ DEFINE_TEST(test_entry)
#endif
/* devmajor/devminor are tested specially below. */
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
/* filetype */
archive_entry_set_filetype(e, AE_IFREG);
assertEqualInt(archive_entry_filetype(e), AE_IFREG);
@ -133,7 +133,7 @@ DEFINE_TEST(test_entry)
assertEqualWString(archive_entry_hardlink_w(e), L"whardlink");
memset(wbuff, 0, sizeof(wbuff));
assertEqualWString(archive_entry_hardlink_w(e), L"whardlink");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
/* ino */
archive_entry_set_ino(e, 8593);
assertEqualInt(archive_entry_ino(e), 8593);
@ -184,7 +184,7 @@ DEFINE_TEST(test_entry)
assertEqualInt(archive_entry_mtime_nsec(e), 0);
assert(!archive_entry_mtime_is_set(e));
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
/* nlink */
archive_entry_set_nlink(e, 736);
assertEqualInt(archive_entry_nlink(e), 736);
@ -208,7 +208,7 @@ DEFINE_TEST(test_entry)
memset(wbuff, 0, sizeof(wbuff));
assertEqualWString(archive_entry_pathname_w(e), L"wpath");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
/* rdev */
archive_entry_set_rdev(e, 532);
assertEqualInt(archive_entry_rdev(e), 532);
@ -227,7 +227,7 @@ DEFINE_TEST(test_entry)
/* symlink */
archive_entry_set_symlink(e, "symlinkname");
assertEqualString(archive_entry_symlink(e), "symlinkname");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
strcpy(buff, "symlinkname2");
archive_entry_copy_symlink(e, buff);
assertEqualString(archive_entry_symlink(e), "symlinkname2");
@ -313,23 +313,23 @@ DEFINE_TEST(test_entry)
archive_entry_clear(e);
archive_entry_set_atime(e, 13579, 24680);
archive_entry_set_ctime(e, 13580, 24681);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_dev(e, 235);
#endif
archive_entry_set_fflags(e, 0x55, 0xAA);
archive_entry_set_gid(e, 204);
archive_entry_set_gname(e, "group");
archive_entry_set_hardlink(e, "hardlinkname");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_ino(e, 8593);
#endif
archive_entry_set_mode(e, 0123456);
archive_entry_set_mtime(e, 13581, 24682);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_nlink(e, 736);
#endif
archive_entry_set_pathname(e, "path");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_rdev(e, 532);
#endif
archive_entry_set_size(e, 987654321);
@ -350,7 +350,7 @@ DEFINE_TEST(test_entry)
assertEqualInt(archive_entry_atime_nsec(e2), 24680);
assertEqualInt(archive_entry_ctime(e2), 13580);
assertEqualInt(archive_entry_ctime_nsec(e2), 24681);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_dev(e2), 235);
#endif
archive_entry_fflags(e, &set, &clear);
@ -359,24 +359,24 @@ DEFINE_TEST(test_entry)
assertEqualInt(archive_entry_gid(e2), 204);
assertEqualString(archive_entry_gname(e2), "group");
assertEqualString(archive_entry_hardlink(e2), "hardlinkname");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_ino(e2), 8593);
#endif
assertEqualInt(archive_entry_mode(e2), 0123456);
assertEqualInt(archive_entry_mtime(e2), 13581);
assertEqualInt(archive_entry_mtime_nsec(e2), 24682);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_nlink(e2), 736);
#endif
assertEqualString(archive_entry_pathname(e2), "path");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_rdev(e2), 532);
#endif
assertEqualInt(archive_entry_size(e2), 987654321);
assertEqualString(archive_entry_symlink(e2), "symlinkname");
assertEqualInt(archive_entry_uid(e2), 83);
assertEqualString(archive_entry_uname(e2), "user");
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("ACL preserved by archive_entry_clone()");
#else
/* Verify ACL was copied. */
@ -417,7 +417,7 @@ DEFINE_TEST(test_entry)
assertEqualInt(qual, 77);
assertEqualString(name, "user77");
#endif
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("xattr data preserved by archive_entry_clone");
#else
/* Verify xattr was copied. */
@ -436,26 +436,26 @@ DEFINE_TEST(test_entry)
/* Change the original */
archive_entry_set_atime(e, 13580, 24690);
archive_entry_set_ctime(e, 13590, 24691);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_dev(e, 245);
#endif
archive_entry_set_fflags(e, 0x85, 0xDA);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_filetype(e, AE_IFLNK);
#endif
archive_entry_set_gid(e, 214);
archive_entry_set_gname(e, "grouper");
archive_entry_set_hardlink(e, "hardlinkpath");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_ino(e, 8763);
#endif
archive_entry_set_mode(e, 0123654);
archive_entry_set_mtime(e, 18351, 28642);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_nlink(e, 73);
#endif
archive_entry_set_pathname(e, "pathest");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_rdev(e, 132);
#endif
archive_entry_set_size(e, 987456321);
@ -470,7 +470,7 @@ DEFINE_TEST(test_entry)
assertEqualInt(archive_entry_atime_nsec(e2), 24680);
assertEqualInt(archive_entry_ctime(e2), 13580);
assertEqualInt(archive_entry_ctime_nsec(e2), 24681);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_dev(e2), 235);
#endif
archive_entry_fflags(e2, &set, &clear);
@ -479,24 +479,24 @@ DEFINE_TEST(test_entry)
assertEqualInt(archive_entry_gid(e2), 204);
assertEqualString(archive_entry_gname(e2), "group");
assertEqualString(archive_entry_hardlink(e2), "hardlinkname");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_ino(e2), 8593);
#endif
assertEqualInt(archive_entry_mode(e2), 0123456);
assertEqualInt(archive_entry_mtime(e2), 13581);
assertEqualInt(archive_entry_mtime_nsec(e2), 24682);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_nlink(e2), 736);
#endif
assertEqualString(archive_entry_pathname(e2), "path");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_rdev(e2), 532);
#endif
assertEqualInt(archive_entry_size(e2), 987654321);
assertEqualString(archive_entry_symlink(e2), "symlinkname");
assertEqualInt(archive_entry_uid(e2), 83);
assertEqualString(archive_entry_uname(e2), "user");
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("ACL held by clone of archive_entry");
#else
/* Verify ACL was unchanged. */
@ -545,7 +545,7 @@ DEFINE_TEST(test_entry)
assertEqualInt(qual, -1);
assertEqualString(name, NULL);
#endif
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("xattr preserved in archive_entry copy");
#else
/* Verify xattr was unchanged. */
@ -567,7 +567,7 @@ DEFINE_TEST(test_entry)
archive_entry_fflags(e, &set, &clear);
assertEqualInt(clear, 0);
assertEqualInt(set, 0);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_filetype(e), 0);
#endif
assertEqualInt(archive_entry_gid(e), 0);
@ -577,7 +577,7 @@ DEFINE_TEST(test_entry)
assertEqualInt(archive_entry_mode(e), 0);
assertEqualInt(archive_entry_mtime(e), 0);
assertEqualInt(archive_entry_mtime_nsec(e), 0);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_nlink(e), 0);
#endif
assertEqualString(archive_entry_pathname(e), NULL);
@ -623,7 +623,7 @@ DEFINE_TEST(test_entry)
assertEqualInt(archive_entry_ino(e), 234);
assertEqualInt(archive_entry_mode(e), 077777);
assertEqualInt(archive_entry_mtime(e), 234567);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(archive_entry_nlink(e), 345);
#endif
assertEqualInt(archive_entry_size(e), 123456789);
@ -644,17 +644,17 @@ DEFINE_TEST(test_entry)
/* Set a bunch of fields individually. */
archive_entry_set_atime(e, 456789, 321);
archive_entry_set_ctime(e, 345678, 432);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_dev(e, 123);
#endif
archive_entry_set_gid(e, 34);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_ino(e, 234);
#endif
archive_entry_set_mode(e, 012345);
archive_entry_set_mode(e, 012345);
archive_entry_set_mtime(e, 234567, 543);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_nlink(e, 345);
#endif
archive_entry_set_size(e, 123456789);
@ -664,16 +664,16 @@ DEFINE_TEST(test_entry)
/* Check that the values match. */
assertEqualInt(pst->st_atime, 456789);
assertEqualInt(pst->st_ctime, 345678);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(pst->st_dev, 123);
#endif
assertEqualInt(pst->st_gid, 34);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(pst->st_ino, 234);
#endif
assertEqualInt(pst->st_mode, 012345);
assertEqualInt(pst->st_mtime, 234567);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
assertEqualInt(pst->st_nlink, 345);
#endif
assertEqualInt(pst->st_size, 123456789);
@ -692,7 +692,7 @@ DEFINE_TEST(test_entry)
archive_entry_set_ctime(e, 345677, 431);
assert((pst = archive_entry_stat(e)) != NULL);
assertEqualInt(pst->st_ctime, 345677);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_dev(e, 122);
assert((pst = archive_entry_stat(e)) != NULL);
assertEqualInt(pst->st_dev, 122);
@ -700,7 +700,7 @@ DEFINE_TEST(test_entry)
archive_entry_set_gid(e, 33);
assert((pst = archive_entry_stat(e)) != NULL);
assertEqualInt(pst->st_gid, 33);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_ino(e, 233);
assert((pst = archive_entry_stat(e)) != NULL);
assertEqualInt(pst->st_ino, 233);
@ -711,7 +711,7 @@ DEFINE_TEST(test_entry)
archive_entry_set_mtime(e, 234566, 542);
assert((pst = archive_entry_stat(e)) != NULL);
assertEqualInt(pst->st_mtime, 234566);
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_nlink(e, 344);
assert((pst = archive_entry_stat(e)) != NULL);
assertEqualInt(pst->st_nlink, 344);
@ -739,7 +739,7 @@ DEFINE_TEST(test_entry)
* the necessary definitions on every platform.
*/
#if __FreeBSD__
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
archive_entry_set_dev(e, 0x12345678);
assertEqualInt(archive_entry_devmajor(e), major(0x12345678));
assertEqualInt(archive_entry_devminor(e), minor(0x12345678));

View File

@ -34,7 +34,7 @@ static unsigned char archive[] = {
DEFINE_TEST(test_read_compress_program)
{
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("archive_read_support_compression_program()");
#else
struct archive_entry *ae;
@ -48,10 +48,10 @@ DEFINE_TEST(test_read_compress_program)
assert(archive_compression(a) == ARCHIVE_COMPRESSION_PROGRAM);
assert(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
#endif
}

View File

@ -67,10 +67,10 @@ DEFINE_TEST(test_read_data_large)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/* Check that archive_read_data can handle 10*10^6 at a pop. */
@ -84,10 +84,10 @@ DEFINE_TEST(test_read_data_large)
failure("Read expected 10MB, but data read didn't match what was written");
assert(0 == memcmp(buff2, buff3, sizeof(buff3)));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/* Check archive_read_data_into_fd */
@ -100,10 +100,10 @@ DEFINE_TEST(test_read_data_large)
assert(tmpfilefd != 0);
assertEqualIntA(a, 0, archive_read_data_into_fd(a, tmpfilefd));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
close(tmpfilefd);

View File

@ -105,10 +105,10 @@ DEFINE_TEST(test_read_extract)
archive_entry_free(ae);
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/* Extract the entries to disk. */
@ -128,10 +128,10 @@ DEFINE_TEST(test_read_extract)
}
assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/* Test the entries on disk. */

View File

@ -28,7 +28,7 @@
#include "test.h"
__FBSDID("$FreeBSD$");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
/*
* This "archive" is created by "GNU ar". Here we try to verify
* our GNU format handling functionality.
@ -59,7 +59,7 @@ char buff[64];
DEFINE_TEST(test_read_format_ar)
{
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("test_read_support_format_ar()");
#else
struct archive_entry *ae;
@ -110,10 +110,10 @@ DEFINE_TEST(test_read_format_ar)
/* Test EOF */
assertA(1 == archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
#endif
}

View File

@ -54,10 +54,10 @@ DEFINE_TEST(test_read_format_cpio_bin)
assertA(archive_compression(a) == ARCHIVE_COMPRESSION_NONE);
assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -43,10 +43,10 @@ DEFINE_TEST(test_read_format_cpio_bin_Z)
assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS);
assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -44,10 +44,10 @@ DEFINE_TEST(test_read_format_cpio_bin_bz2)
assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2);
assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -43,10 +43,10 @@ DEFINE_TEST(test_read_format_cpio_bin_gz)
assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP);
assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -58,10 +58,10 @@ DEFINE_TEST(test_read_format_cpio_odc)
assertA(archive_compression(a) == ARCHIVE_COMPRESSION_NONE);
assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_POSIX);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -44,10 +44,10 @@ DEFINE_TEST(test_read_format_cpio_svr4_gzip)
assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP);
assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_SVR4_NOCRC);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -46,10 +46,10 @@ DEFINE_TEST(test_read_format_cpio_svr4c_Z)
assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS);
assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_SVR4_CRC);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -39,10 +39,10 @@ DEFINE_TEST(test_read_format_empty)
assertA(archive_compression(a) == ARCHIVE_COMPRESSION_NONE);
assertA(archive_format(a) == ARCHIVE_FORMAT_EMPTY);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -44,10 +44,10 @@ DEFINE_TEST(test_read_format_gtar_gz)
assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP);
assert(archive_format(a) == ARCHIVE_FORMAT_TAR_GNUTAR);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -248,7 +248,7 @@ verify_archive_file(const char *name, struct archive_contents *ac)
assertEqualIntA(a, err, ARCHIVE_EOF);
failure("%s: Size returned at EOF must be zero", name);
assertEqualInt(actual.s, 0);
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
/* libarchive < 1.9 doesn't get this right */
skipping("offset of final sparse chunk");
#else
@ -263,10 +263,10 @@ verify_archive_file(const char *name, struct archive_contents *ac)
assertEqualIntA(a, ARCHIVE_EOF, err);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}
@ -281,7 +281,7 @@ DEFINE_TEST(test_read_format_gtar_sparse)
* libarchive < 1.9 doesn't support the newer --posix sparse formats
* from GNU tar 1.15 and later.
*/
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("read support for GNUtar --posix sparse formats");
#else
/*

View File

@ -63,10 +63,10 @@ DEFINE_TEST(test_read_format_iso_gz)
assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP);
assert(archive_format(a) == ARCHIVE_FORMAT_ISO9660);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -131,10 +131,10 @@ DEFINE_TEST(test_read_format_isorr_bz2)
/* Close the archive. */
assertEqualInt(0, archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assertEqualInt(0, archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertEqualInt(0, archive_read_finish(a));
#endif
}

View File

@ -103,10 +103,10 @@ DEFINE_TEST(test_read_format_mtree)
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
#endif
}

View File

@ -52,10 +52,10 @@ DEFINE_TEST(test_read_format_pax_bz2)
assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2);
assert(archive_format(a) == ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -75,10 +75,10 @@ static void verifyEmpty(void)
assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}
@ -447,10 +447,10 @@ static void verify(unsigned char *d, size_t s,
f(ae);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
free(buff);
}

View File

@ -58,9 +58,9 @@ DEFINE_TEST(test_read_format_tar_empty_filename)
assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
#endif
}

View File

@ -45,10 +45,10 @@ DEFINE_TEST(test_read_format_tbz)
assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2);
assert(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -44,10 +44,10 @@ DEFINE_TEST(test_read_format_tgz)
assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP);
assert(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -46,10 +46,10 @@ DEFINE_TEST(test_read_format_tz)
assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS);
assertA(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -65,10 +65,10 @@ DEFINE_TEST(test_read_format_zip)
assertA(archive_format(a) == ARCHIVE_FORMAT_ZIP);
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -52,10 +52,10 @@ DEFINE_TEST(test_read_large)
assertA(0 == archive_write_header(a, entry));
archive_entry_free(entry);
assertA(sizeof(testdata) == archive_write_data(a, testdata, sizeof(testdata)));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
assert(NULL != (a = archive_read_new()));
@ -64,10 +64,10 @@ DEFINE_TEST(test_read_large)
assertA(0 == archive_read_open_memory(a, buff, sizeof(buff)));
assertA(0 == archive_read_next_header(a, &entry));
assertA(0 == archive_read_data_into_buffer(a, testdatacopy, sizeof(testdatacopy)));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertA(0 == archive_read_finish(a));
#endif
assert(0 == memcmp(testdata, testdatacopy, sizeof(testdata)));
@ -80,10 +80,10 @@ DEFINE_TEST(test_read_large)
assert(0 < (tmpfilefd = mkstemp(tmpfilename)));
assertA(0 == archive_read_data_into_fd(a, tmpfilefd));
close(tmpfilefd);
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertA(0 == archive_read_finish(a));
#endif
tmpfilefd = open(tmpfilename, O_RDONLY);
read(tmpfilefd, testdatacopy, sizeof(testdatacopy));

View File

@ -60,10 +60,10 @@ DEFINE_TEST(test_read_pax_truncated)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/* Now, read back a truncated version of the archive and
@ -104,10 +104,10 @@ DEFINE_TEST(test_read_pax_truncated)
}
wrap_up:
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}
@ -147,10 +147,10 @@ DEFINE_TEST(test_read_pax_truncated)
}
wrap_up2:
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}
@ -167,10 +167,10 @@ DEFINE_TEST(test_read_pax_truncated)
assertA(0 == archive_read_open_memory(a, buff2, used));
assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/* Damage the size field in the pax attributes. */
@ -182,10 +182,10 @@ DEFINE_TEST(test_read_pax_truncated)
assertA(0 == archive_read_open_memory(a, buff2, used));
assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/* Damage the size field in the pax attributes. */
@ -199,10 +199,10 @@ DEFINE_TEST(test_read_pax_truncated)
assertA(0 == archive_read_open_memory(a, buff2, used));
assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/* Damage the size field in the pax attributes. */
@ -217,10 +217,10 @@ DEFINE_TEST(test_read_pax_truncated)
assertA(0 == archive_read_open_memory(a, buff2, used));
assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/* Damage the size field in the pax attributes. */
@ -233,10 +233,10 @@ DEFINE_TEST(test_read_pax_truncated)
assertA(0 == archive_read_open_memory(a, buff2, used));
assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/* Damage the size field in the pax attributes. */
@ -248,10 +248,10 @@ DEFINE_TEST(test_read_pax_truncated)
assertA(0 == archive_read_open_memory(a, buff2, used));
assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/* Damage the ustar header. */
@ -263,10 +263,10 @@ DEFINE_TEST(test_read_pax_truncated)
assertA(0 == archive_read_open_memory(a, buff2, used));
assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/*

View File

@ -49,11 +49,11 @@ DEFINE_TEST(test_read_position)
assertA(0 == archive_write_header(a, ae));
archive_entry_free(ae);
assertA(data_size == (size_t)archive_write_data(a, nulls, sizeof(nulls)));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
assertA(0 == archive_write_close(a));
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/* 512-byte header + data_size (rounded up) + 1024 end-of-archive */
assert(write_pos == ((512 + data_size + 1024 + 511)/512)*512);

View File

@ -56,10 +56,10 @@ DEFINE_TEST(test_read_truncated)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/* Now, read back a truncated version of the archive and
@ -97,10 +97,10 @@ DEFINE_TEST(test_read_truncated)
}
wrap_up:
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}
@ -140,10 +140,10 @@ DEFINE_TEST(test_read_truncated)
}
wrap_up2:
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}
}

View File

@ -101,10 +101,10 @@ test_filename(const char *prefix, int dlen, int flen)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/*
@ -117,7 +117,7 @@ test_filename(const char *prefix, int dlen, int flen)
/* Read the file and check the filename. */
assertA(0 == archive_read_next_header(a, &ae));
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("Leading '/' preserved on long filenames");
#else
assertEqualString(filename, archive_entry_pathname(ae));
@ -133,7 +133,7 @@ test_filename(const char *prefix, int dlen, int flen)
* here.
*/
assertA(0 == archive_read_next_header(a, &ae));
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("Trailing '/' preserved on dirnames");
#else
assertEqualString(dirname, archive_entry_pathname(ae));
@ -141,7 +141,7 @@ test_filename(const char *prefix, int dlen, int flen)
assert((S_IFDIR | 0755) == archive_entry_mode(ae));
assertA(0 == archive_read_next_header(a, &ae));
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("Trailing '/' added to dir names");
#else
assertEqualString(dirname, archive_entry_pathname(ae));
@ -151,10 +151,10 @@ test_filename(const char *prefix, int dlen, int flen)
/* Verify the end of the archive. */
assert(1 == archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}

View File

@ -73,7 +73,7 @@ struct memdata {
#define GB ((off_t)1024 * MB)
#define TB ((off_t)1024 * GB)
#if ARCHIVE_API_VERSION < 2
#if ARCHIVE_VERSION_NUMBER < 2000000
static ssize_t memory_read_skip(struct archive *, void *, size_t request);
#else
static off_t memory_read_skip(struct archive *, void *, off_t request);
@ -167,7 +167,7 @@ memory_read(struct archive *a, void *_private, const void **buff)
}
#if ARCHIVE_API_VERSION < 2
#if ARCHIVE_VERSION_NUMBER < 2000000
static ssize_t
memory_read_skip(struct archive *a, void *private, size_t skip)
{
@ -273,10 +273,10 @@ DEFINE_TEST(test_tar_large)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/*
@ -303,10 +303,10 @@ DEFINE_TEST(test_tar_large)
/* Close out the archive. */
assertA(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assertA(0 == archive_read_finish(a));
#endif
free(memdata.buff);

View File

@ -68,10 +68,10 @@ DEFINE_TEST(test_write_compress)
archive_write_close(a);
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assert(0 == archive_write_finish(a));
#endif
/*
@ -91,10 +91,10 @@ DEFINE_TEST(test_write_compress)
}
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
free(data);

View File

@ -30,7 +30,7 @@ char buff2[64];
DEFINE_TEST(test_write_compress_program)
{
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("archive_write_set_compress_program()");
#else
struct archive_entry *ae;
@ -64,10 +64,10 @@ DEFINE_TEST(test_write_compress_program)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/*
@ -92,10 +92,10 @@ DEFINE_TEST(test_write_compress_program)
/* Verify the end of the archive. */
assert(1 == archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
#endif
}

View File

@ -25,7 +25,7 @@
#include "test.h"
__FBSDID("$FreeBSD$");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
#define UMASK 022
@ -39,10 +39,10 @@ static void create(struct archive_entry *ae, const char *msg)
failure("%s", msg);
assertEqualIntA(ad, 0, archive_write_header(ad, ae));
assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
#if ARCHIVE_API_VERSION > 1
assertEqualInt(0, archive_write_finish(ad));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(ad);
#else
assertEqualInt(0, archive_write_finish(ad));
#endif
/* Test the entries on disk. */
assert(0 == stat(archive_entry_pathname(ae), &st));
@ -88,10 +88,10 @@ static void create_reg_file(struct archive_entry *ae, const char *msg)
assertEqualIntA(ad, 0, archive_write_header(ad, ae));
assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
#if ARCHIVE_API_VERSION > 1
assertEqualInt(0, archive_write_finish(ad));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(ad);
#else
assertEqualInt(0, archive_write_finish(ad));
#endif
/* Test the entries on disk. */
assert(0 == stat(archive_entry_pathname(ae), &st));
@ -132,10 +132,10 @@ static void create_reg_file2(struct archive_entry *ae, const char *msg)
archive_write_data_block(ad, data + i, 1000, i));
}
assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
#if ARCHIVE_API_VERSION > 1
assertEqualInt(0, archive_write_finish(ad));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(ad);
#else
assertEqualInt(0, archive_write_finish(ad));
#endif
/* Test the entries on disk. */
assert(0 == stat(archive_entry_pathname(ae), &st));
@ -156,7 +156,7 @@ static void create_reg_file2(struct archive_entry *ae, const char *msg)
DEFINE_TEST(test_write_disk)
{
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("archive_write_disk interface");
#else
struct archive_entry *ae;

View File

@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
*/
DEFINE_TEST(test_write_disk_hardlink)
{
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("archive_write_disk_hardlink tests");
#else
static const char data[]="abcdefghijklmnopqrstuvwxyz";

View File

@ -25,7 +25,7 @@
#include "test.h"
__FBSDID("$FreeBSD$");
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
#define UMASK 022
@ -125,7 +125,7 @@ defaultgid(void)
DEFINE_TEST(test_write_disk_perms)
{
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("archive_write_disk interface");
#else
struct archive *a;
@ -363,10 +363,10 @@ DEFINE_TEST(test_write_disk_perms)
assertEqualIntA(a,ARCHIVE_WARN,archive_write_finish_entry(a));
}
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assert(0 == archive_write_finish(a));
#endif
archive_entry_free(ae);

View File

@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
DEFINE_TEST(test_write_disk_secure)
{
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("archive_write_disk interface");
#else
struct archive *a;
@ -105,11 +105,10 @@ DEFINE_TEST(test_write_disk_secure)
archive_entry_free(ae);
assert(0 == archive_write_finish_entry(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assert(0 == archive_write_finish(a));
#endif
/* Test the entries on disk. */

View File

@ -34,7 +34,7 @@ static char strtab[] = "abcdefghijklmn.o/\nggghhhjjjrrrttt.o/\niiijjjdddsssppp.o
DEFINE_TEST(test_write_format_ar)
{
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
skipping("ar write support");
#else
struct archive_entry *ae;
@ -102,10 +102,10 @@ DEFINE_TEST(test_write_format_ar)
archive_entry_free(ae);
archive_write_close(a);
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assert(0 == archive_write_finish(a));
#endif
/*
@ -141,10 +141,10 @@ DEFINE_TEST(test_write_format_ar)
assert(0 == memcmp(buff2, "88877766", 8));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
/*
@ -175,10 +175,10 @@ DEFINE_TEST(test_write_format_ar)
assertA(6 == archive_write_data(a, "555555", 7));
archive_entry_free(ae);
archive_write_close(a);
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assert(0 == archive_write_finish(a));
#endif
/* Now, Read the data back */
@ -202,10 +202,10 @@ DEFINE_TEST(test_write_format_ar)
/* Test EOF */
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
#endif
}

View File

@ -26,7 +26,7 @@
__FBSDID("$FreeBSD$");
/* The version stamp macro was introduced after cpio write support. */
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
static void
test_format(int (*set_format)(struct archive *))
{
@ -104,10 +104,10 @@ test_format(int (*set_format)(struct archive *))
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/*
@ -182,10 +182,10 @@ test_format(int (*set_format)(struct archive *))
/* Verify the end of the archive. */
assertEqualIntA(a, 1, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
free(buff);
@ -194,7 +194,7 @@ test_format(int (*set_format)(struct archive *))
DEFINE_TEST(test_write_format_cpio)
{
#if ARCHIVE_VERSION_STAMP >= 1009000
#if ARCHIVE_VERSION_NUMBER >= 1009000
test_format(archive_write_set_format_cpio);
test_format(archive_write_set_format_cpio_newc);
#else

View File

@ -62,10 +62,10 @@ DEFINE_TEST(test_write_format_cpio_empty)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
failure("Empty cpio archive should be exactly 87 bytes, was %d.", used);

View File

@ -111,10 +111,10 @@ DEFINE_TEST(test_write_format_cpio_newc)
archive_entry_free(entry);
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assert(0 == archive_write_finish(a));
#endif
/*

View File

@ -122,10 +122,10 @@ DEFINE_TEST(test_write_format_cpio_odc)
/* Write of data to symlink should fail == zero bytes get written. */
assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assert(0 == archive_write_finish(a));
#endif
/*

View File

@ -47,10 +47,10 @@ DEFINE_TEST(test_write_format_shar_empty)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
failure("Empty shar archive should be exactly 0 bytes, was %d.", used);

View File

@ -72,10 +72,10 @@ DEFINE_TEST(test_write_format_tar)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
/* This calculation gives "the smallest multiple of
* the block size that is at least 2048 bytes". */
@ -105,10 +105,10 @@ DEFINE_TEST(test_write_format_tar)
/* Verify the end of the archive. */
assert(1 == archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_read_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
}
}

View File

@ -46,13 +46,13 @@ DEFINE_TEST(test_write_format_tar_empty)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
/* Earlier versions wrote 0-length files for empty tar archives. */
skipping("empty tar archive size");
#else
@ -73,13 +73,13 @@ DEFINE_TEST(test_write_format_tar_empty)
/* Close out the archive. */
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assertA(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assertA(0 == archive_write_finish(a));
#endif
#if ARCHIVE_VERSION_STAMP < 1009000
#if ARCHIVE_VERSION_NUMBER < 1009000
/* Earlier versions wrote 0-length files for empty tar archives. */
skipping("empty tar archive size");
#else

View File

@ -64,10 +64,10 @@ DEFINE_TEST(test_write_open_memory)
assertA(ARCHIVE_FATAL == archive_write_close(a));
else
assertA(0 == archive_write_close(a));
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_write_finish(a));
#else
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
assert(0 == archive_write_finish(a));
#endif
assert(buff[i] == 0xAE);
assert(s <= i);