From: Michihiro NAKAJIMA Date: Thu, 19 Jan 2012 04:54:43 +0000 (-0500) Subject: Delete archive_matching_path_excluded and archive_matching_path_excluded_w. X-Git-Tag: v3.0.4~2^2~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56418500132ba3a851981524211a5d93bc1d95a2;p=thirdparty%2Flibarchive.git Delete archive_matching_path_excluded and archive_matching_path_excluded_w. They were not so helpful than I though at archive_read_disk. Rename archive_matching_path_excluded_ae to archive_matching_path_excluded. Rename archive_matching_time_excluded_ae to archive_matching_time_excluded. Rename archive_matching_owner_excluded_ae to archive_matching_owner_excluded. Rename archive_matching_excluded_ae to archive_matching_excluded. SVN-Revision: 4178 --- diff --git a/cpio/cpio.c b/cpio/cpio.c index c919d380b..c0cb8a525 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -880,7 +880,7 @@ mode_in(struct cpio *cpio) lafe_errc(1, archive_errno(a), "%s", archive_error_string(a)); } - if (archive_matching_path_excluded_ae(cpio->matching, entry)) + if (archive_matching_path_excluded(cpio->matching, entry)) continue; if (cpio->option_rename) { destpath = cpio_rename(archive_entry_pathname(entry)); @@ -982,7 +982,7 @@ mode_list(struct cpio *cpio) lafe_errc(1, archive_errno(a), "%s", archive_error_string(a)); } - if (archive_matching_path_excluded_ae(cpio->matching, entry)) + if (archive_matching_path_excluded(cpio->matching, entry)) continue; if (cpio->verbose) list_item_verbose(cpio, entry); diff --git a/libarchive/archive.h b/libarchive/archive.h index 44d53c5f4..524f210c9 100644 --- a/libarchive/archive.h +++ b/libarchive/archive.h @@ -818,27 +818,23 @@ __LA_DECL int archive_matching_free(struct archive *); /* * Test if archive_entry is excluded. * This is a convenience function. This is the same as calling all - * archive_matching_path_excluded_ae, archive_matching_time_excluded_ae - * and archive_matching_owner_excluded_ae. + * archive_matching_path_excluded, archive_matching_time_excluded + * and archive_matching_owner_excluded. */ -__LA_DECL int archive_matching_excluded_ae(struct archive *, +__LA_DECL int archive_matching_excluded(struct archive *, struct archive_entry *); /* - * Test if filename is excluded. The conditions are set by following functions. + * Test if pathname is excluded. The conditions are set by following functions. */ __LA_DECL int archive_matching_path_excluded(struct archive *, - const char *_filename); -__LA_DECL int archive_matching_path_excluded_w(struct archive *, - const wchar_t *_filename); -__LA_DECL int archive_matching_path_excluded_ae(struct archive *, struct archive_entry *); -/* Add exclusion fielname pattern. */ +/* Add exclusion pathname pattern. */ __LA_DECL int archive_matching_exclude_pattern(struct archive *, const char *); __LA_DECL int archive_matching_exclude_pattern_w(struct archive *, const wchar_t *); -/* Add inclusion fielname pattern. */ +/* Add inclusion pathname pattern. */ __LA_DECL int archive_matching_include_pattern(struct archive *, const char *); __LA_DECL int archive_matching_include_pattern_w(struct archive *, @@ -860,7 +856,7 @@ __LA_DECL int archive_matching_path_unmatched_inclusions_next_w( * Test if a file is excluded by its time stamp. * The conditions are set by following functions. */ -__LA_DECL int archive_matching_time_excluded_ae(struct archive *, +__LA_DECL int archive_matching_time_excluded(struct archive *, struct archive_entry *); /* Set inclusion file times. */ __LA_DECL int archive_matching_newer_mtime(struct archive *, @@ -901,7 +897,7 @@ __LA_DECL int archive_matching_pathname_newer_mtime_ae( * Test if a file is excluded by its uid ,gid, uname or gname. * The conditions are set by following functions. */ -__LA_DECL int archive_matching_owner_excluded_ae(struct archive *, +__LA_DECL int archive_matching_owner_excluded(struct archive *, struct archive_entry *); /* Add inclusion uid, gid, uname and gname. */ __LA_DECL int archive_matching_include_uid(struct archive *, diff --git a/libarchive/archive_matching.c b/libarchive/archive_matching.c index 8d49ddab2..5893ef9e6 100644 --- a/libarchive/archive_matching.c +++ b/libarchive/archive_matching.c @@ -244,7 +244,7 @@ archive_matching_free(struct archive *_a) * Returns <0 if something error happened. */ int -archive_matching_excluded_ae(struct archive *_a, struct archive_entry *entry) +archive_matching_excluded(struct archive *_a, struct archive_entry *entry) { struct archive_matching *a; int r; @@ -368,51 +368,13 @@ archive_matching_include_pattern_w(struct archive *_a, const wchar_t *pattern) * Returns <0 if something error happened. */ int -archive_matching_path_excluded(struct archive *_a, const char *pathname) -{ - struct archive_matching *a; - - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_path_excluded"); - - if (pathname == NULL || *pathname == L'\0') - return (0); - a = (struct archive_matching *)_a; - - /* If we don't have exclusion/inclusion pattern set at all, - * the pathname is always not excluded. */ - if ((a->setflag & PATTERN_IS_SET) == 0) - return (0); - return (path_excluded(a, 1, pathname)); -} - -int -archive_matching_path_excluded_w(struct archive *_a, const wchar_t *pathname) -{ - struct archive_matching *a; - - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_path_excluded_w"); - - if (pathname == NULL || *pathname == L'\0') - return (0); - a = (struct archive_matching *)_a; - - /* If we don't have exclusion/inclusion pattern set at all, - * the pathname is always not excluded. */ - if ((a->setflag & PATTERN_IS_SET) == 0) - return (0); - return (path_excluded(a, 0, pathname)); -} - -int -archive_matching_path_excluded_ae(struct archive *_a, +archive_matching_path_excluded(struct archive *_a, struct archive_entry *entry) { struct archive_matching *a; archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_path_excluded_ae"); + ARCHIVE_STATE_NEW, "archive_matching_path_excluded"); a = (struct archive_matching *)_a; if (entry == NULL) { @@ -1051,7 +1013,7 @@ archive_matching_pathname_newer_mtime_ae(struct archive *_a, * Returns <0 if something error happened. */ int -archive_matching_time_excluded_ae(struct archive *_a, +archive_matching_time_excluded(struct archive *_a, struct archive_entry *entry) { struct archive_matching *a; @@ -1492,7 +1454,7 @@ archive_matching_include_gname_w(struct archive *_a, const wchar_t *gname) * Returns <0 if something error happened. */ int -archive_matching_owner_excluded_ae(struct archive *_a, +archive_matching_owner_excluded(struct archive *_a, struct archive_entry *entry) { struct archive_matching *a; diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 88b89b612..15c778637 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -914,8 +914,7 @@ next_entry: * Perform path matching. */ if (a->matching) { - r = archive_matching_path_excluded(a->matching, - tree_current_path(t)); + r = archive_matching_path_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); @@ -1020,7 +1019,7 @@ next_entry: * Perform time matching. */ if (a->matching) { - r = archive_matching_time_excluded_ae(a->matching, entry); + r = archive_matching_time_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); @@ -1047,7 +1046,7 @@ next_entry: * Perform owner matching. */ if (a->matching) { - r = archive_matching_owner_excluded_ae(a->matching, entry); + r = archive_matching_owner_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c index 814d4bec8..58369db56 100644 --- a/libarchive/archive_read_disk_windows.c +++ b/libarchive/archive_read_disk_windows.c @@ -795,8 +795,7 @@ next_entry: * Perform path matching. */ if (a->matching) { - r = archive_matching_path_excluded_w(a->matching, - tree_current_path(t)); + r = archive_matching_path_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); @@ -863,7 +862,7 @@ next_entry: * Perform time matching. */ if (a->matching) { - r = archive_matching_time_excluded_ae(a->matching, entry); + r = archive_matching_time_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); @@ -890,7 +889,7 @@ next_entry: * Perform owner matching. */ if (a->matching) { - r = archive_matching_owner_excluded_ae(a->matching, entry); + r = archive_matching_owner_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); diff --git a/libarchive/test/test_archive_matching_owner.c b/libarchive/test/test_archive_matching_owner.c index 50c63ec4f..7ed90e24f 100644 --- a/libarchive/test/test_archive_matching_owner.c +++ b/libarchive/test/test_archive_matching_owner.c @@ -44,24 +44,24 @@ test_uid(void) archive_entry_set_uid(ae, 0); failure("uid 0 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_uid(ae, 1000); failure("uid 1000 should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_uid(ae, 1001); failure("uid 1001 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_uid(ae, 1002); failure("uid 1002 should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_uid(ae, 1003); failure("uid 1003 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); @@ -86,24 +86,24 @@ test_gid(void) archive_entry_set_gid(ae, 0); failure("uid 0 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_gid(ae, 1000); failure("uid 1000 should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_gid(ae, 1001); failure("uid 1001 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_gid(ae, 1002); failure("uid 1002 should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_gid(ae, 1003); failure("uid 1003 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); @@ -128,24 +128,24 @@ test_uname_mbs(void) archive_entry_copy_uname(ae, "unknown"); failure("User 'unknown' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_copy_uname(ae, "foo"); failure("User 'foo' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_uname(ae, "foo1"); failure("User 'foo1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_copy_uname(ae, "bar"); failure("User 'bar' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_uname(ae, "bar1"); failure("User 'bar1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); @@ -170,24 +170,24 @@ test_uname_wcs(void) archive_entry_copy_uname_w(ae, L"unknown"); failure("User 'unknown' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_copy_uname_w(ae, L"foo"); failure("User 'foo' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_uname_w(ae, L"foo1"); failure("User 'foo1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_copy_uname_w(ae, L"bar"); failure("User 'bar' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_uname_w(ae, L"bar1"); failure("User 'bar1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); @@ -212,24 +212,24 @@ test_gname_mbs(void) archive_entry_copy_gname(ae, "unknown"); failure("Group 'unknown' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_copy_gname(ae, "foo"); failure("Group 'foo' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_gname(ae, "foo1"); failure("Group 'foo1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_copy_gname(ae, "bar"); failure("Group 'bar' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_gname(ae, "bar1"); failure("Group 'bar1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); @@ -254,24 +254,24 @@ test_gname_wcs(void) archive_entry_copy_gname_w(ae, L"unknown"); failure("Group 'unknown' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_copy_gname_w(ae, L"foo"); failure("Group 'foo' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_gname_w(ae, L"foo1"); failure("Group 'foo1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_copy_gname_w(ae, L"bar"); failure("Group 'bar' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_owner_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_gname_w(ae, L"bar1"); failure("Group 'bar1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_owner_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); diff --git a/libarchive/test/test_archive_matching_path.c b/libarchive/test/test_archive_matching_path.c index 2ac3e1ace..9ad5b8ce9 100644 --- a/libarchive/test/test_archive_matching_path.c +++ b/libarchive/test/test_archive_matching_path.c @@ -43,24 +43,26 @@ test_exclusion_mbs(void) assertEqualIntA(m, 0, archive_matching_exclude_pattern(m, "^aa*")); /* Test with 'aa1234', which should be excluded. */ - failure("'aa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, "aa1234")); - failure("'aa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_w(m, L"aa1234")); archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"aa1234"); + failure("'aa1234' should be excluded"); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Test with 'a1234', which should not be excluded. */ - failure("'a1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, "a1234")); - failure("'a1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_w(m, L"a1234")); archive_entry_copy_pathname(ae, "a1234"); failure("'a1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"a1234"); + failure("'a1234' should not be excluded"); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); @@ -84,24 +86,26 @@ test_exclusion_wcs(void) assertEqualIntA(m, 0, archive_matching_exclude_pattern_w(m, L"^aa*")); /* Test with 'aa1234', which should be excluded. */ - failure("'aa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, "aa1234")); - failure("'aa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_w(m, L"aa1234")); archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"aa1234"); + failure("'aa1234' should be excluded"); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Test with 'a1234', which should not be excluded. */ - failure("'a1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, "a1234")); - failure("'a1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_w(m, L"a1234")); archive_entry_copy_pathname(ae, "a1234"); failure("'a1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"a1234"); + failure("'a1234' should not be excluded"); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); @@ -126,24 +130,26 @@ test_inclusion_mbs(void) assertEqualIntA(m, 0, archive_matching_include_pattern(m, "^aa*")); /* Test with 'aa1234', which should not be excluded. */ - failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, "aa1234")); - failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_w(m, L"aa1234")); archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"aa1234"); + failure("'aa1234' should not be excluded"); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Test with 'a1234', which should be excluded. */ - failure("'a1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, "a1234")); - failure("'a1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_w(m, L"a1234")); archive_entry_copy_pathname(ae, "a1234"); failure("'a1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"a1234"); + failure("'a1234' should be excluded"); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify unmatched_inclusions. */ assertEqualInt(0, archive_matching_path_unmatched_inclusions(m)); @@ -173,24 +179,26 @@ test_inclusion_wcs(void) assertEqualIntA(m, 0, archive_matching_include_pattern_w(m, L"^aa*")); /* Test with 'aa1234', which should not be excluded. */ - failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, "aa1234")); - failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_w(m, L"aa1234")); archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"aa1234"); + failure("'aa1234' should not be excluded"); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Test with 'a1234', which should be excluded. */ - failure("'a1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, "a1234")); - failure("'a1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_w(m, L"a1234")); archive_entry_copy_pathname(ae, "a1234"); failure("'a1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"a1234"); + failure("'a1234' should be excluded"); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify unmatched_inclusions. */ assertEqualInt(0, archive_matching_path_unmatched_inclusions(m)); @@ -222,24 +230,26 @@ test_exclusion_and_inclusion(void) assertEqualIntA(m, 0, archive_matching_include_pattern(m, "^a1*")); /* Test with 'aa1234', which should not be excluded. */ - failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, "aa1234")); - failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_w(m, L"aa1234")); archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"aa1234"); + failure("'aa1234' should not be excluded"); + assertEqualInt(0, archive_matching_path_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Test with 'aaa1234', which should be excluded. */ - failure("'aaa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, "aaa1234")); - failure("'aaa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_w(m, L"aaa1234")); archive_entry_copy_pathname(ae, "aaa1234"); failure("'aaa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); + archive_entry_clear(ae); + archive_entry_copy_pathname_w(ae, L"aaa1234"); + failure("'aaa1234' should be excluded"); + assertEqualInt(1, archive_matching_path_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify unmatched_inclusions. */ assertEqualInt(1, archive_matching_path_unmatched_inclusions(m)); diff --git a/libarchive/test/test_archive_matching_time.c b/libarchive/test/test_archive_matching_time.c index b110e6382..667a39fe9 100644 --- a/libarchive/test/test_archive_matching_time.c +++ b/libarchive/test/test_archive_matching_time.c @@ -46,31 +46,31 @@ test_newer_time(void) archive_entry_set_mtime(ae, 7880, 0); archive_entry_set_ctime(ae, 7880, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7879, 999); archive_entry_set_ctime(ae, 7879, 999); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7881, 0); archive_entry_set_ctime(ae, 7881, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); archive_entry_set_ctime(ae, 7880, 0); failure("Its mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 0); archive_entry_set_ctime(ae, 7880, 1); failure("Its ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); @@ -115,8 +115,8 @@ test_newer_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'mid' file. */ archive_entry_clear(ae); @@ -124,8 +124,8 @@ test_newer_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'new' file. */ archive_entry_clear(ae); @@ -133,8 +133,8 @@ test_newer_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* * Test 'newer ctime than'. @@ -159,8 +159,8 @@ test_newer_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'mid' file. */ archive_entry_clear(ae); @@ -168,8 +168,8 @@ test_newer_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'new' file. */ archive_entry_clear(ae); @@ -177,8 +177,8 @@ test_newer_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); assertChdir(".."); /* Clean up. */ @@ -225,8 +225,8 @@ test_newer_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'mid' file. */ archive_entry_clear(ae); @@ -234,8 +234,8 @@ test_newer_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'new' file. */ archive_entry_clear(ae); @@ -243,8 +243,8 @@ test_newer_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* * Test 'newer ctime than'. @@ -269,8 +269,8 @@ test_newer_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'mid' file. */ archive_entry_clear(ae); @@ -278,8 +278,8 @@ test_newer_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'new' file. */ archive_entry_clear(ae); @@ -287,8 +287,8 @@ test_newer_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); assertChdir(".."); /* Clean up. */ @@ -317,31 +317,31 @@ test_older_time(void) archive_entry_set_mtime(ae, 7880, 0); archive_entry_set_ctime(ae, 7880, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7879, 999); archive_entry_set_ctime(ae, 7879, 999); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7881, 0); archive_entry_set_ctime(ae, 7881, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); archive_entry_set_ctime(ae, 7879, 0); failure("Its mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7879, 0); archive_entry_set_ctime(ae, 7880, 1); failure("Its ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); @@ -386,8 +386,8 @@ test_older_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Verify 'mid' file. */ archive_entry_clear(ae); @@ -395,8 +395,8 @@ test_older_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'new' file. */ archive_entry_clear(ae); @@ -404,8 +404,8 @@ test_older_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* * Test 'older ctime than'. @@ -430,8 +430,8 @@ test_older_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Verify 'mid' file. */ archive_entry_clear(ae); @@ -439,8 +439,8 @@ test_older_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'new' file. */ archive_entry_clear(ae); @@ -448,8 +448,8 @@ test_older_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); assertChdir(".."); /* Clean up. */ @@ -496,8 +496,8 @@ test_older_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Verify 'mid' file. */ archive_entry_clear(ae); @@ -505,8 +505,8 @@ test_older_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'new' file. */ archive_entry_clear(ae); @@ -514,8 +514,8 @@ test_older_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* * Test 'older ctime than'. @@ -540,8 +540,8 @@ test_older_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Verify 'mid' file. */ archive_entry_clear(ae); @@ -549,8 +549,8 @@ test_older_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); /* Verify 'new' file. */ archive_entry_clear(ae); @@ -558,8 +558,8 @@ test_older_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); assertChdir(".."); /* Clean up. */ @@ -579,58 +579,58 @@ excluded(struct archive *m) archive_entry_copy_pathname(ae, "file1"); archive_entry_set_mtime(ae, 7879, 999); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 0); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_pathname(ae, "file2"); archive_entry_set_mtime(ae, 7879, 999); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 0); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_copy_pathname(ae, "file3"); archive_entry_set_mtime(ae, 7879, 999); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 0); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(1, archive_matching_excluded_ae(m, ae)); + assertEqualInt(1, archive_matching_time_excluded(m, ae)); + assertEqualInt(1, archive_matching_excluded(m, ae)); archive_entry_copy_pathname(ae, "file4"); archive_entry_set_mtime(ae, 7879, 999); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 0); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded_ae(m, ae)); - assertEqualInt(0, archive_matching_excluded_ae(m, ae)); + assertEqualInt(0, archive_matching_time_excluded(m, ae)); + assertEqualInt(0, archive_matching_excluded(m, ae)); /* Clean up. */ diff --git a/tar/read.c b/tar/read.c index 90d8a8f2e..f103de53a 100644 --- a/tar/read.c +++ b/tar/read.c @@ -236,12 +236,6 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (bsdtar->gname) archive_entry_set_gname(entry, bsdtar->gname); - /* - * Exclude entries that are too old. - */ - if (archive_matching_time_excluded_ae(bsdtar->matching, entry)) - continue; /* skip it. */ - /* * Note that pattern exclusions are checked before * pathname rewrites are handled. This gives more @@ -251,8 +245,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) * rewrite, there would be no way to exclude foo1/bar * while allowing foo2/bar.) */ - if (archive_matching_path_excluded_ae(bsdtar->matching, - entry)) + if (archive_matching_excluded(bsdtar->matching, entry)) continue; /* Excluded by a pattern test. */ if (mode == 't') { diff --git a/tar/write.c b/tar/write.c index 817d5a4be..cb5e8f160 100644 --- a/tar/write.c +++ b/tar/write.c @@ -591,11 +591,7 @@ append_archive(struct bsdtar *bsdtar, struct archive *a, struct archive *ina) int e; while (ARCHIVE_OK == (e = archive_read_next_header(ina, &in_entry))) { - if (archive_matching_time_excluded_ae(bsdtar->matching, - in_entry)) - continue; - if (archive_matching_path_excluded_ae(bsdtar->matching, - in_entry)) + if (archive_matching_excluded(bsdtar->matching, in_entry)) continue; if (bsdtar->option_interactive && !yes("copy '%s'", archive_entry_pathname(in_entry)))