diff options
author | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-02-08 05:09:25 +0900 |
---|---|---|
committer | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-02-08 05:09:25 +0900 |
commit | b4d25a741c58200e1b48c5108140aedf8c1acccc (patch) | |
tree | 5b6cd2b0853bf904d91040bbc6976d1ef315da14 | |
parent | c5356170ba6ae487ea7a1c80bb6d433eaf7715ec (diff) | |
download | libarchive-b4d25a741c58200e1b48c5108140aedf8c1acccc.tar.gz |
Rename archive_matching to archive_match.
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | cpio/cpio.c | 12 | ||||
-rw-r--r-- | libarchive/CMakeLists.txt | 2 | ||||
-rw-r--r-- | libarchive/archive.h | 79 | ||||
-rw-r--r-- | libarchive/archive_check_magic.c | 2 | ||||
-rw-r--r-- | libarchive/archive_match.c (renamed from libarchive/archive_matching.c) | 375 | ||||
-rw-r--r-- | libarchive/archive_private.h | 2 | ||||
-rw-r--r-- | libarchive/archive_read_disk_posix.c | 6 | ||||
-rw-r--r-- | libarchive/archive_read_disk_private.h | 6 | ||||
-rw-r--r-- | libarchive/archive_read_disk_windows.c | 6 | ||||
-rw-r--r-- | libarchive/test/CMakeLists.txt | 6 | ||||
-rw-r--r-- | libarchive/test/test_archive_match_owner.c (renamed from libarchive/test/test_archive_matching_owner.c) | 182 | ||||
-rw-r--r-- | libarchive/test/test_archive_match_path.c (renamed from libarchive/test/test_archive_matching_path.c) | 144 | ||||
-rw-r--r-- | libarchive/test/test_archive_match_time.c (renamed from libarchive/test/test_archive_matching_time.c) | 642 | ||||
-rw-r--r-- | libarchive/test/test_read_disk_directory_traversals.c | 6 | ||||
-rw-r--r-- | libarchive_fe/matching.c | 4 | ||||
-rw-r--r-- | tar/bsdtar.c | 26 | ||||
-rw-r--r-- | tar/read.c | 10 | ||||
-rw-r--r-- | tar/write.c | 8 |
19 files changed, 757 insertions, 769 deletions
diff --git a/Makefile.am b/Makefile.am index c917d1e8..5a30316c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -103,7 +103,7 @@ libarchive_la_SOURCES= \ libarchive/archive_entry_strmode.c \ libarchive/archive_entry_xattr.c \ libarchive/archive_getdate.c \ - libarchive/archive_matching.c \ + libarchive/archive_match.c \ libarchive/archive_options.c \ libarchive/archive_options_private.h \ libarchive/archive_pathmatch.c \ @@ -260,9 +260,9 @@ libarchive_test_SOURCES= \ libarchive/test/test_archive_clear_error.c \ libarchive/test/test_archive_crypto.c \ libarchive/test/test_archive_getdate.c \ - libarchive/test/test_archive_matching_owner.c \ - libarchive/test/test_archive_matching_path.c \ - libarchive/test/test_archive_matching_time.c \ + libarchive/test/test_archive_match_owner.c \ + libarchive/test/test_archive_match_path.c \ + libarchive/test/test_archive_match_time.c \ libarchive/test/test_archive_pathmatch.c \ libarchive/test/test_archive_read_close_twice.c \ libarchive/test/test_archive_read_close_twice_open_fd.c \ diff --git a/cpio/cpio.c b/cpio/cpio.c index c0cb8a52..8acfae22 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -189,7 +189,7 @@ main(int argc, char *argv[]) cpio->bytes_per_block = 512; cpio->filename = NULL; - cpio->matching = archive_matching_new(); + cpio->matching = archive_match_new(); if (cpio->matching == NULL) lafe_errc(1, 0, "Out of memory"); @@ -226,7 +226,7 @@ main(int argc, char *argv[]) cpio->filename = cpio->argument; break; case 'f': /* POSIX 1997 */ - if (archive_matching_exclude_pattern(cpio->matching, + if (archive_match_exclude_pattern(cpio->matching, cpio->argument) != ARCHIVE_OK) lafe_errc(1, 0, "Error : %s", archive_error_string(cpio->matching)); @@ -391,7 +391,7 @@ main(int argc, char *argv[]) break; case 'i': while (*cpio->argv != NULL) { - if (archive_matching_include_pattern(cpio->matching, + if (archive_match_include_pattern(cpio->matching, *cpio->argv) != ARCHIVE_OK) lafe_errc(1, 0, "Error : %s", archive_error_string(cpio->matching)); @@ -414,7 +414,7 @@ main(int argc, char *argv[]) "Must specify at least one of -i, -o, or -p"); } - archive_matching_free(cpio->matching); + archive_match_free(cpio->matching); free_cache(cpio->gname_cache); free_cache(cpio->uname_cache); return (cpio->return_value); @@ -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(cpio->matching, entry)) + if (archive_match_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(cpio->matching, entry)) + if (archive_match_path_excluded(cpio->matching, entry)) continue; if (cpio->verbose) list_item_verbose(cpio, entry); diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt index a4b18714..a506908e 100644 --- a/libarchive/CMakeLists.txt +++ b/libarchive/CMakeLists.txt @@ -29,7 +29,7 @@ SET(libarchive_SOURCES archive_entry_strmode.c archive_entry_xattr.c archive_getdate.c - archive_matching.c + archive_match.c archive_options.c archive_options_private.h archive_pathmatch.c diff --git a/libarchive/archive.h b/libarchive/archive.h index 5c90b5fd..d141f4ae 100644 --- a/libarchive/archive.h +++ b/libarchive/archive.h @@ -773,10 +773,10 @@ __LA_DECL int archive_read_disk_set_behavior(struct archive *, int flags); /* - * Set archive_matching object that will be used in archive_read_disk to + * Set archive_match object that will be used in archive_read_disk to * know whether an entry should be skipped. The callback function * _excluded_func will be invoked when an entry is skipped by the result - * of archive_matching. + * of archive_match. */ __LA_DECL int archive_read_disk_set_matching(struct archive *, struct archive *_matching, void (*_excluded_func) @@ -825,104 +825,97 @@ __LA_DECL void archive_copy_error(struct archive *dest, __LA_DECL int archive_file_count(struct archive *); /* - * ARCHIVE_MATCHING API + * ARCHIVE_MATCH API */ -__LA_DECL struct archive *archive_matching_new(void); -__LA_DECL int archive_matching_free(struct archive *); +__LA_DECL struct archive *archive_match_new(void); +__LA_DECL int archive_match_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, archive_matching_time_excluded - * and archive_matching_owner_excluded. + * archive_match_path_excluded, archive_match_time_excluded + * and archive_match_owner_excluded. */ -__LA_DECL int archive_matching_excluded(struct archive *, +__LA_DECL int archive_match_excluded(struct archive *, struct archive_entry *); /* * Test if pathname is excluded. The conditions are set by following functions. */ -__LA_DECL int archive_matching_path_excluded(struct archive *, +__LA_DECL int archive_match_path_excluded(struct archive *, struct archive_entry *); /* 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 *, +__LA_DECL int archive_match_exclude_pattern(struct archive *, const char *); +__LA_DECL int archive_match_exclude_pattern_w(struct archive *, const wchar_t *); /* 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 *, +__LA_DECL int archive_match_include_pattern(struct archive *, const char *); +__LA_DECL int archive_match_include_pattern_w(struct archive *, const wchar_t *); /* * How to get statistic information for inclusion patterns. */ /* Return the amount number of unmatched inclusion patterns. */ -__LA_DECL int archive_matching_path_unmatched_inclusions( - struct archive *); +__LA_DECL int archive_match_path_unmatched_inclusions(struct archive *); /* Return the pattern of unmatched inclusion with ARCHIVE_OK. * Return ARCHIVE_EOF if there is no inclusion pattern. */ -__LA_DECL int archive_matching_path_unmatched_inclusions_next( +__LA_DECL int archive_match_path_unmatched_inclusions_next( struct archive *, const char **); -__LA_DECL int archive_matching_path_unmatched_inclusions_next_w( +__LA_DECL int archive_match_path_unmatched_inclusions_next_w( struct archive *, const wchar_t **); /* * Test if a file is excluded by its time stamp. * The conditions are set by following functions. */ -__LA_DECL int archive_matching_time_excluded(struct archive *, +__LA_DECL int archive_match_time_excluded(struct archive *, struct archive_entry *); /* * Flags to tell a matching type of time stamps. These are used for - * following functinos archive_matching_time*(). + * following functinos. */ /* Time flag: mtime to be tested. */ -#define ARCHIVE_MATCHING_MTIME (0x0100) +#define ARCHIVE_MATCH_MTIME (0x0100) /* Time flag: ctime to be tested. */ -#define ARCHIVE_MATCHING_CTIME (0x0200) +#define ARCHIVE_MATCH_CTIME (0x0200) /* Comparison flag: Match the time if it is newer than. */ -#define ARCHIVE_MATCHING_NEWER (0x0001) +#define ARCHIVE_MATCH_NEWER (0x0001) /* Comparison flag: Match the time if it is older than. */ -#define ARCHIVE_MATCHING_OLDER (0x0002) +#define ARCHIVE_MATCH_OLDER (0x0002) /* Comparison flag: Match the time if it is equal to. */ -#define ARCHIVE_MATCHING_EQUAL (0x0010) +#define ARCHIVE_MATCH_EQUAL (0x0010) /* Set inclusion time. */ -__LA_DECL int archive_matching_include_time(struct archive *, int _flag, +__LA_DECL int archive_match_include_time(struct archive *, int _flag, time_t _sec, long _nsec); /* Set inclusion time by a date string. */ -__LA_DECL int archive_matching_include_date(struct archive *, int _flag, +__LA_DECL int archive_match_include_date(struct archive *, int _flag, const char *_datestr); -__LA_DECL int archive_matching_include_date_w(struct archive *, int _flag, +__LA_DECL int archive_match_include_date_w(struct archive *, int _flag, const wchar_t *_datestr); /* Set inclusion time by a particluar file. */ -__LA_DECL int archive_matching_include_time_pathname(struct archive *, +__LA_DECL int archive_match_include_file_time(struct archive *, int _flag, const char *_pathname); -__LA_DECL int archive_matching_include_time_pathname_w(struct archive *, +__LA_DECL int archive_match_include_file_time_w(struct archive *, int _flag, const wchar_t *_pathname); /* Add exclusion entry. */ -__LA_DECL int archive_matching_exclude_entry(struct archive *, +__LA_DECL int archive_match_exclude_entry(struct archive *, int _flag, struct archive_entry *); /* * 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(struct archive *, +__LA_DECL int archive_match_owner_excluded(struct archive *, struct archive_entry *); /* Add inclusion uid, gid, uname and gname. */ -__LA_DECL int archive_matching_include_uid(struct archive *, - int64_t); -__LA_DECL int archive_matching_include_gid(struct archive *, - int64_t); -__LA_DECL int archive_matching_include_uname(struct archive *, - const char *); -__LA_DECL int archive_matching_include_uname_w(struct archive *, +__LA_DECL int archive_match_include_uid(struct archive *, int64_t); +__LA_DECL int archive_match_include_gid(struct archive *, int64_t); +__LA_DECL int archive_match_include_uname(struct archive *, const char *); +__LA_DECL int archive_match_include_uname_w(struct archive *, const wchar_t *); -__LA_DECL int archive_matching_include_gname(struct archive *, - const char *); -__LA_DECL int archive_matching_include_gname_w(struct archive *, +__LA_DECL int archive_match_include_gname(struct archive *, const char *); +__LA_DECL int archive_match_include_gname_w(struct archive *, const wchar_t *); #ifdef __cplusplus diff --git a/libarchive/archive_check_magic.c b/libarchive/archive_check_magic.c index f6f1a185..c695e582 100644 --- a/libarchive/archive_check_magic.c +++ b/libarchive/archive_check_magic.c @@ -94,7 +94,7 @@ archive_handle_type_name(unsigned m) case ARCHIVE_READ_MAGIC: return ("archive_read"); case ARCHIVE_WRITE_DISK_MAGIC: return ("archive_write_disk"); case ARCHIVE_READ_DISK_MAGIC: return ("archive_read_disk"); - case ARCHIVE_MATCHING_MAGIC: return ("archive_matching"); + case ARCHIVE_MATCH_MAGIC: return ("archive_match"); default: return NULL; } } diff --git a/libarchive/archive_matching.c b/libarchive/archive_match.c index a28fdd55..e6d97153 100644 --- a/libarchive/archive_matching.c +++ b/libarchive/archive_match.c @@ -86,7 +86,7 @@ struct id_array { #define TIME_IS_SET 2 #define ID_IS_SET 4 -struct archive_matching { +struct archive_match { struct archive archive; /* exclusion/inclusion set flag. */ @@ -129,15 +129,15 @@ struct archive_matching { struct match_list inclusion_gnames; }; -static int add_entry(struct archive_matching *, int, +static int add_entry(struct archive_match *, int, struct archive_entry *); -static int add_owner_id(struct archive_matching *, struct id_array *, +static int add_owner_id(struct archive_match *, struct id_array *, int64_t); -static int add_owner_name(struct archive_matching *, struct match_list *, +static int add_owner_name(struct archive_match *, struct match_list *, int, const void *); -static int add_pattern_mbs(struct archive_matching *, struct match_list *, +static int add_pattern_mbs(struct archive_match *, struct match_list *, const char *); -static int add_pattern_wcs(struct archive_matching *, struct match_list *, +static int add_pattern_wcs(struct archive_match *, struct match_list *, const wchar_t *); static int cmp_key_mbs(const struct archive_rb_node *, const void *); static int cmp_key_wcs(const struct archive_rb_node *, const void *); @@ -148,36 +148,36 @@ static int cmp_node_wcs(const struct archive_rb_node *, static void entry_list_add(struct entry_list *, struct match_file *); static void entry_list_free(struct entry_list *); static void entry_list_init(struct entry_list *); -static int error_nomem(struct archive_matching *); +static int error_nomem(struct archive_match *); static void match_list_add(struct match_list *, struct match *); static void match_list_free(struct match_list *); static void match_list_init(struct match_list *); -static int match_list_unmatched_inclusions_next(struct archive_matching *, +static int match_list_unmatched_inclusions_next(struct archive_match *, struct match_list *, int, const void **); static int match_owner_id(struct id_array *, int64_t); #if !defined(_WIN32) || defined(__CYGWIN__) -static int match_owner_name_mbs(struct archive_matching *, +static int match_owner_name_mbs(struct archive_match *, struct match_list *, const char *); #else -static int match_owner_name_wcs(struct archive_matching *, +static int match_owner_name_wcs(struct archive_match *, struct match_list *, const wchar_t *); #endif -static int match_path_exclusion(struct archive_matching *, +static int match_path_exclusion(struct archive_match *, struct match *, int, const void *); -static int match_path_inclusion(struct archive_matching *, +static int match_path_inclusion(struct archive_match *, struct match *, int, const void *); -static int owner_excluded(struct archive_matching *, +static int owner_excluded(struct archive_match *, struct archive_entry *); -static int path_excluded(struct archive_matching *, int, const void *); -static int set_timefilter(struct archive_matching *, int, time_t, long, +static int path_excluded(struct archive_match *, int, const void *); +static int set_timefilter(struct archive_match *, int, time_t, long, time_t, long); -static int set_timefilter_pathname_mbs(struct archive_matching *, +static int set_timefilter_pathname_mbs(struct archive_match *, int, const char *); -static int set_timefilter_pathname_wcs(struct archive_matching *, +static int set_timefilter_pathname_wcs(struct archive_match *, int, const wchar_t *); -static int set_time_str(struct archive_matching *, int, const char *); -static int set_time_str_w(struct archive_matching *, int, const wchar_t *); -static int time_excluded(struct archive_matching *, +static int set_time_str(struct archive_match *, int, const char *); +static int set_time_str_w(struct archive_match *, int, const wchar_t *); +static int time_excluded(struct archive_match *, struct archive_entry *); static int validate_time_flag(struct archive *, int, const char *); @@ -200,7 +200,7 @@ static const struct archive_rb_tree_ops rb_ops_wcs = { */ static int -error_nomem(struct archive_matching *a) +error_nomem(struct archive_match *a) { archive_set_error(&(a->archive), ENOMEM, "No memory"); a->archive.state = ARCHIVE_STATE_FATAL; @@ -208,14 +208,14 @@ error_nomem(struct archive_matching *a) } struct archive * -archive_matching_new(void) +archive_match_new(void) { - struct archive_matching *a; + struct archive_match *a; - a = (struct archive_matching *)calloc(1, sizeof(*a)); + a = (struct archive_match *)calloc(1, sizeof(*a)); if (a == NULL) return (NULL); - a->archive.magic = ARCHIVE_MATCHING_MAGIC; + a->archive.magic = ARCHIVE_MATCH_MAGIC; a->archive.state = ARCHIVE_STATE_NEW; match_list_init(&(a->inclusions)); match_list_init(&(a->exclusions)); @@ -228,15 +228,15 @@ archive_matching_new(void) } int -archive_matching_free(struct archive *_a) +archive_match_free(struct archive *_a) { - struct archive_matching *a; + struct archive_match *a; if (_a == NULL) return (ARCHIVE_OK); - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_matching_free"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_match_free"); + a = (struct archive_match *)_a; match_list_free(&(a->inclusions)); match_list_free(&(a->exclusions)); entry_list_free(&(a->entry_list)); @@ -256,15 +256,15 @@ archive_matching_free(struct archive *_a) * Returns <0 if something error happened. */ int -archive_matching_excluded(struct archive *_a, struct archive_entry *entry) +archive_match_excluded(struct archive *_a, struct archive_entry *entry) { - struct archive_matching *a; + struct archive_match *a; int r; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_excluded_ae"); + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_excluded_ae"); - a = (struct archive_matching *)_a; + a = (struct archive_match *)_a; if (entry == NULL) { archive_set_error(&(a->archive), EINVAL, "entry is NULL"); return (ARCHIVE_FAILED); @@ -297,14 +297,14 @@ archive_matching_excluded(struct archive *_a, struct archive_entry *entry) */ int -archive_matching_exclude_pattern(struct archive *_a, const char *pattern) +archive_match_exclude_pattern(struct archive *_a, const char *pattern) { - struct archive_matching *a; + struct archive_match *a; int r; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_exclude_pattern"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_exclude_pattern"); + a = (struct archive_match *)_a; if (pattern == NULL || *pattern == '\0') { archive_set_error(&(a->archive), EINVAL, "pattern is empty"); @@ -316,14 +316,14 @@ archive_matching_exclude_pattern(struct archive *_a, const char *pattern) } int -archive_matching_exclude_pattern_w(struct archive *_a, const wchar_t *pattern) +archive_match_exclude_pattern_w(struct archive *_a, const wchar_t *pattern) { - struct archive_matching *a; + struct archive_match *a; int r; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_exclude_pattern_w"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_exclude_pattern_w"); + a = (struct archive_match *)_a; if (pattern == NULL || *pattern == L'\0') { archive_set_error(&(a->archive), EINVAL, "pattern is empty"); @@ -335,14 +335,14 @@ archive_matching_exclude_pattern_w(struct archive *_a, const wchar_t *pattern) } int -archive_matching_include_pattern(struct archive *_a, const char *pattern) +archive_match_include_pattern(struct archive *_a, const char *pattern) { - struct archive_matching *a; + struct archive_match *a; int r; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_include_pattern"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_include_pattern"); + a = (struct archive_match *)_a; if (pattern == NULL || *pattern == '\0') { archive_set_error(&(a->archive), EINVAL, "pattern is empty"); @@ -354,14 +354,14 @@ archive_matching_include_pattern(struct archive *_a, const char *pattern) } int -archive_matching_include_pattern_w(struct archive *_a, const wchar_t *pattern) +archive_match_include_pattern_w(struct archive *_a, const wchar_t *pattern) { - struct archive_matching *a; + struct archive_match *a; int r; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_include_pattern_w"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_include_pattern_w"); + a = (struct archive_match *)_a; if (pattern == NULL || *pattern == L'\0') { archive_set_error(&(a->archive), EINVAL, "pattern is empty"); @@ -380,15 +380,15 @@ 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, +archive_match_path_excluded(struct archive *_a, struct archive_entry *entry) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_path_excluded"); + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_path_excluded"); - a = (struct archive_matching *)_a; + a = (struct archive_match *)_a; if (entry == NULL) { archive_set_error(&(a->archive), EINVAL, "entry is NULL"); return (ARCHIVE_FAILED); @@ -409,28 +409,28 @@ archive_matching_path_excluded(struct archive *_a, * Utilty functions to get statistic information for inclusion patterns. */ int -archive_matching_path_unmatched_inclusions(struct archive *_a) +archive_match_path_unmatched_inclusions(struct archive *_a) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_unmatched_inclusions"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_unmatched_inclusions"); + a = (struct archive_match *)_a; return (a->inclusions.unmatched_count); } int -archive_matching_path_unmatched_inclusions_next(struct archive *_a, +archive_match_path_unmatched_inclusions_next(struct archive *_a, const char **_p) { - struct archive_matching *a; + struct archive_match *a; const void *v; int r; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_unmatched_inclusions_next"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_unmatched_inclusions_next"); + a = (struct archive_match *)_a; r = match_list_unmatched_inclusions_next(a, &(a->inclusions), 1, &v); *_p = (const char *)v; @@ -438,16 +438,16 @@ archive_matching_path_unmatched_inclusions_next(struct archive *_a, } int -archive_matching_path_unmatched_inclusions_next_w(struct archive *_a, +archive_match_path_unmatched_inclusions_next_w(struct archive *_a, const wchar_t **_p) { - struct archive_matching *a; + struct archive_match *a; const void *v; int r; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_unmatched_inclusions_next_w"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_unmatched_inclusions_next_w"); + a = (struct archive_match *)_a; r = match_list_unmatched_inclusions_next(a, &(a->inclusions), 0, &v); *_p = (const wchar_t *)v; @@ -455,7 +455,7 @@ archive_matching_path_unmatched_inclusions_next_w(struct archive *_a, } static int -add_pattern_mbs(struct archive_matching *a, struct match_list *list, +add_pattern_mbs(struct archive_match *a, struct match_list *list, const char *pattern) { struct match *match; @@ -475,7 +475,7 @@ add_pattern_mbs(struct archive_matching *a, struct match_list *list, } static int -add_pattern_wcs(struct archive_matching *a, struct match_list *list, +add_pattern_wcs(struct archive_match *a, struct match_list *list, const wchar_t *pattern) { struct match *match; @@ -495,7 +495,7 @@ add_pattern_wcs(struct archive_matching *a, struct match_list *list, } static int -path_excluded(struct archive_matching *a, int mbs, const void *pathname) +path_excluded(struct archive_match *a, int mbs, const void *pathname) { struct match *match; struct match *matched; @@ -563,7 +563,7 @@ path_excluded(struct archive_matching *a, int mbs, const void *pathname) * */ static int -match_path_exclusion(struct archive_matching *a, struct match *m, +match_path_exclusion(struct archive_match *a, struct match *m, int mbs, const void *pn) { int flag = PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END; @@ -591,7 +591,7 @@ match_path_exclusion(struct archive_matching *a, struct match *m, * the beginning of the path) even though exclusions are not anchored. */ static int -match_path_inclusion(struct archive_matching *a, struct match *m, +match_path_inclusion(struct archive_match *a, struct match *m, int mbs, const void *pn) { int flag = PATHMATCH_NO_ANCHOR_END; @@ -645,7 +645,7 @@ match_list_add(struct match_list *list, struct match *m) } static int -match_list_unmatched_inclusions_next(struct archive_matching *a, +match_list_unmatched_inclusions_next(struct archive_match *a, struct match_list *list, int mbs, const void **vp) { struct match *m; @@ -699,80 +699,78 @@ match_list_unmatched_inclusions_next(struct archive_matching *a, * Utility functions to manage inclusion timestamps. */ int -archive_matching_include_time(struct archive *_a, int flag, time_t sec, +archive_match_include_time(struct archive *_a, int flag, time_t sec, long nsec) { int r; - r = validate_time_flag(_a, flag, "archive_matching_include_time"); + r = validate_time_flag(_a, flag, "archive_match_include_time"); if (r != ARCHIVE_OK) return (r); - return set_timefilter((struct archive_matching *)_a, flag, + return set_timefilter((struct archive_match *)_a, flag, sec, nsec, sec, nsec); } int -archive_matching_include_date(struct archive *_a, int flag, +archive_match_include_date(struct archive *_a, int flag, const char *datestr) { int r; - r = validate_time_flag(_a, flag, "archive_matching_include_date"); + r = validate_time_flag(_a, flag, "archive_match_include_date"); if (r != ARCHIVE_OK) return (r); - return set_time_str((struct archive_matching *)_a, flag, datestr); + return set_time_str((struct archive_match *)_a, flag, datestr); } int -archive_matching_include_date_w(struct archive *_a, int flag, +archive_match_include_date_w(struct archive *_a, int flag, const wchar_t *datestr) { int r; - r = validate_time_flag(_a, flag, "archive_matching_include_date_w"); + r = validate_time_flag(_a, flag, "archive_match_include_date_w"); if (r != ARCHIVE_OK) return (r); - return set_time_str_w((struct archive_matching *)_a, flag, datestr); + return set_time_str_w((struct archive_match *)_a, flag, datestr); } int -archive_matching_include_time_pathname(struct archive *_a, int flag, +archive_match_include_file_time(struct archive *_a, int flag, const char *pathname) { int r; - r = validate_time_flag(_a, flag, - "archive_matching_include_time_pathname"); + r = validate_time_flag(_a, flag, "archive_match_include_file_time"); if (r != ARCHIVE_OK) return (r); - return set_timefilter_pathname_mbs((struct archive_matching *)_a, + return set_timefilter_pathname_mbs((struct archive_match *)_a, flag, pathname); } int -archive_matching_include_time_pathname_w(struct archive *_a, int flag, +archive_match_include_file_time_w(struct archive *_a, int flag, const wchar_t *pathname) { int r; - r = validate_time_flag(_a, flag, - "archive_matching_include_time_pathname_w"); + r = validate_time_flag(_a, flag, "archive_match_include_file_time_w"); if (r != ARCHIVE_OK) return (r); - return set_timefilter_pathname_wcs((struct archive_matching *)_a, + return set_timefilter_pathname_wcs((struct archive_match *)_a, flag, pathname); } int -archive_matching_exclude_entry(struct archive *_a, int flag, +archive_match_exclude_entry(struct archive *_a, int flag, struct archive_entry *entry) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_time_include_entry"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_time_include_entry"); + a = (struct archive_match *)_a; if (entry == NULL) { archive_set_error(&(a->archive), EINVAL, "entry is NULL"); @@ -789,15 +787,15 @@ archive_matching_exclude_entry(struct archive *_a, int flag, * Returns <0 if something error happened. */ int -archive_matching_time_excluded(struct archive *_a, +archive_match_time_excluded(struct archive *_a, struct archive_entry *entry) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_time_excluded_ae"); + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_time_excluded_ae"); - a = (struct archive_matching *)_a; + a = (struct archive_match *)_a; if (entry == NULL) { archive_set_error(&(a->archive), EINVAL, "entry is NULL"); return (ARCHIVE_FAILED); @@ -813,29 +811,29 @@ archive_matching_time_excluded(struct archive *_a, static int validate_time_flag(struct archive *_a, int flag, const char *_fn) { - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, ARCHIVE_STATE_NEW, _fn); /* Check a type of time. */ if (flag & - ((~(ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME)) & 0xff00)) { + ((~(ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME)) & 0xff00)) { archive_set_error(_a, EINVAL, "Invalid time flag"); return (ARCHIVE_FAILED); } - if ((flag & (ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME)) == 0) { + if ((flag & (ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME)) == 0) { archive_set_error(_a, EINVAL, "No time flag"); return (ARCHIVE_FAILED); } /* Check a type of comparison. */ if (flag & - ((~(ARCHIVE_MATCHING_NEWER | ARCHIVE_MATCHING_OLDER - | ARCHIVE_MATCHING_EQUAL)) & 0x00ff)) { + ((~(ARCHIVE_MATCH_NEWER | ARCHIVE_MATCH_OLDER + | ARCHIVE_MATCH_EQUAL)) & 0x00ff)) { archive_set_error(_a, EINVAL, "Invalid comparison flag"); return (ARCHIVE_FAILED); } - if ((flag & (ARCHIVE_MATCHING_NEWER | ARCHIVE_MATCHING_OLDER - | ARCHIVE_MATCHING_EQUAL)) == 0) { + if ((flag & (ARCHIVE_MATCH_NEWER | ARCHIVE_MATCH_OLDER + | ARCHIVE_MATCH_EQUAL)) == 0) { archive_set_error(_a, EINVAL, "No comparison flag"); return (ARCHIVE_FAILED); } @@ -843,37 +841,36 @@ validate_time_flag(struct archive *_a, int flag, const char *_fn) return (ARCHIVE_OK); } -#define JUST_EQUAL(t) (((t) & (ARCHIVE_MATCHING_EQUAL |\ - ARCHIVE_MATCHING_NEWER | ARCHIVE_MATCHING_OLDER))\ - == ARCHIVE_MATCHING_EQUAL) +#define JUST_EQUAL(t) (((t) & (ARCHIVE_MATCH_EQUAL |\ + ARCHIVE_MATCH_NEWER | ARCHIVE_MATCH_OLDER)) == ARCHIVE_MATCH_EQUAL) static int -set_timefilter(struct archive_matching *a, int timetype, +set_timefilter(struct archive_match *a, int timetype, time_t mtime_sec, long mtime_nsec, time_t ctime_sec, long ctime_nsec) { - if (timetype & ARCHIVE_MATCHING_MTIME) { - if ((timetype & ARCHIVE_MATCHING_NEWER) || + if (timetype & ARCHIVE_MATCH_MTIME) { + if ((timetype & ARCHIVE_MATCH_NEWER) || JUST_EQUAL(timetype)) { a->newer_mtime_filter = timetype; a->newer_mtime_sec = mtime_sec; a->newer_mtime_nsec = mtime_nsec; a->setflag |= TIME_IS_SET; } - if (timetype & ARCHIVE_MATCHING_OLDER) { + if (timetype & ARCHIVE_MATCH_OLDER) { a->older_mtime_filter = timetype; a->older_mtime_sec = mtime_sec; a->older_mtime_nsec = mtime_nsec; a->setflag |= TIME_IS_SET; } } - if (timetype & ARCHIVE_MATCHING_CTIME) { - if ((timetype & ARCHIVE_MATCHING_NEWER) || + if (timetype & ARCHIVE_MATCH_CTIME) { + if ((timetype & ARCHIVE_MATCH_NEWER) || JUST_EQUAL(timetype)) { a->newer_ctime_filter = timetype; a->newer_ctime_sec = ctime_sec; a->newer_ctime_nsec = ctime_nsec; a->setflag |= TIME_IS_SET; } - if (timetype & ARCHIVE_MATCHING_OLDER) { + if (timetype & ARCHIVE_MATCH_OLDER) { a->older_ctime_filter = timetype; a->older_ctime_sec = ctime_sec; a->older_ctime_nsec = ctime_nsec; @@ -884,7 +881,7 @@ set_timefilter(struct archive_matching *a, int timetype, } static int -set_time_str(struct archive_matching *a, int timetype, const char *datestr) +set_time_str(struct archive_match *a, int timetype, const char *datestr) { time_t time; @@ -901,7 +898,7 @@ set_time_str(struct archive_matching *a, int timetype, const char *datestr) } static int -set_time_str_w(struct archive_matching *a, int timetype, const wchar_t *datestr) +set_time_str_w(struct archive_match *a, int timetype, const wchar_t *datestr) { struct archive_string as; time_t time; @@ -932,7 +929,7 @@ set_time_str_w(struct archive_matching *a, int timetype, const wchar_t *datestr) #if defined(_WIN32) && !defined(__CYGWIN__) #define EPOC_TIME (116444736000000000ui64) static int -set_timefilter_find_data(struct archive_matching *a, int timetype, +set_timefilter_find_data(struct archive_match *a, int timetype, DWORD ftLastWriteTime_dwHighDateTime, DWORD ftLastWriteTime_dwLowDateTime, DWORD ftCreationTime_dwHighDateTime, DWORD ftCreationTime_dwLowDateTime) { @@ -964,7 +961,7 @@ set_timefilter_find_data(struct archive_matching *a, int timetype, } #else static int -set_timefilter_stat(struct archive_matching *a, int timetype, struct stat *st) +set_timefilter_stat(struct archive_match *a, int timetype, struct stat *st) { struct archive_entry *ae; time_t ctime, mtime; @@ -984,7 +981,7 @@ set_timefilter_stat(struct archive_matching *a, int timetype, struct stat *st) #endif static int -set_timefilter_pathname_mbs(struct archive_matching *a, int timetype, +set_timefilter_pathname_mbs(struct archive_match *a, int timetype, const char *path) { #if defined(_WIN32) && !defined(__CYGWIN__) @@ -1023,7 +1020,7 @@ set_timefilter_pathname_mbs(struct archive_matching *a, int timetype, } static int -set_timefilter_pathname_wcs(struct archive_matching *a, int timetype, +set_timefilter_pathname_wcs(struct archive_match *a, int timetype, const wchar_t *path) { #if defined(_WIN32) && !defined(__CYGWIN__) @@ -1160,7 +1157,7 @@ entry_list_add(struct entry_list *list, struct match_file *file) } static int -add_entry(struct archive_matching *a, int flag, +add_entry(struct archive_match *a, int flag, struct archive_entry *entry) { struct match_file *f; @@ -1230,7 +1227,7 @@ add_entry(struct archive_matching *a, int flag, } static int -time_excluded(struct archive_matching *a, struct archive_entry *entry) +time_excluded(struct archive_match *a, struct archive_entry *entry) { struct match_file *f; const void *pathname; @@ -1256,7 +1253,7 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry) if (nsec < a->newer_ctime_nsec) return (1); /* Too old, skip it. */ if (nsec == a->newer_ctime_nsec && - (a->newer_ctime_filter & ARCHIVE_MATCHING_EQUAL) + (a->newer_ctime_filter & ARCHIVE_MATCH_EQUAL) == 0) return (1); /* Equal, skip it. */ } else if (JUST_EQUAL(a->newer_ctime_filter)) @@ -1278,7 +1275,7 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry) if (nsec > a->older_ctime_nsec) return (1); /* Too new, skip it. */ if (nsec == a->older_ctime_nsec && - (a->older_ctime_filter & ARCHIVE_MATCHING_EQUAL) + (a->older_ctime_filter & ARCHIVE_MATCH_EQUAL) == 0) return (1); /* Eeual, skip it. */ } @@ -1292,7 +1289,7 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry) if (nsec < a->newer_mtime_nsec) return (1); /* Too old, skip it. */ if (nsec == a->newer_mtime_nsec && - (a->newer_mtime_filter & ARCHIVE_MATCHING_EQUAL) + (a->newer_mtime_filter & ARCHIVE_MATCH_EQUAL) == 0) return (1); /* Equal, skip it. */ } else if (JUST_EQUAL(a->newer_mtime_filter)) @@ -1307,7 +1304,7 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry) if (nsec > a->older_mtime_nsec) return (1); /* Too new, skip it. */ if (nsec == a->older_mtime_nsec && - (a->older_mtime_filter & ARCHIVE_MATCHING_EQUAL) + (a->older_mtime_filter & ARCHIVE_MATCH_EQUAL) == 0) return (1); /* Equal, skip it. */ } @@ -1333,43 +1330,43 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry) if (f == NULL) return (0); - if (f->flag & ARCHIVE_MATCHING_CTIME) { + if (f->flag & ARCHIVE_MATCH_CTIME) { sec = archive_entry_ctime(entry); if (f->ctime_sec > sec) { - if (f->flag & ARCHIVE_MATCHING_OLDER) + if (f->flag & ARCHIVE_MATCH_OLDER) return (1); } else if (f->ctime_sec < sec) { - if (f->flag & ARCHIVE_MATCHING_NEWER) + if (f->flag & ARCHIVE_MATCH_NEWER) return (1); } else { nsec = archive_entry_ctime_nsec(entry); if (f->ctime_nsec > nsec) { - if (f->flag & ARCHIVE_MATCHING_OLDER) + if (f->flag & ARCHIVE_MATCH_OLDER) return (1); } else if (f->ctime_nsec < nsec) { - if (f->flag & ARCHIVE_MATCHING_NEWER) + if (f->flag & ARCHIVE_MATCH_NEWER) return (1); - } else if (f->flag & ARCHIVE_MATCHING_EQUAL) + } else if (f->flag & ARCHIVE_MATCH_EQUAL) return (1); } } - if (f->flag & ARCHIVE_MATCHING_MTIME) { + if (f->flag & ARCHIVE_MATCH_MTIME) { sec = archive_entry_mtime(entry); if (f->mtime_sec > sec) { - if (f->flag & ARCHIVE_MATCHING_OLDER) + if (f->flag & ARCHIVE_MATCH_OLDER) return (1); } else if (f->mtime_sec < sec) { - if (f->flag & ARCHIVE_MATCHING_NEWER) + if (f->flag & ARCHIVE_MATCH_NEWER) return (1); } else { nsec = archive_entry_mtime_nsec(entry); if (f->mtime_nsec > nsec) { - if (f->flag & ARCHIVE_MATCHING_OLDER) + if (f->flag & ARCHIVE_MATCH_OLDER) return (1); } else if (f->mtime_nsec < nsec) { - if (f->flag & ARCHIVE_MATCHING_NEWER) + if (f->flag & ARCHIVE_MATCH_NEWER) return (1); - } else if (f->flag & ARCHIVE_MATCHING_EQUAL) + } else if (f->flag & ARCHIVE_MATCH_EQUAL) return (1); } } @@ -1381,68 +1378,68 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry) */ int -archive_matching_include_uid(struct archive *_a, int64_t uid) +archive_match_include_uid(struct archive *_a, int64_t uid) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_include_uid"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_include_uid"); + a = (struct archive_match *)_a; return (add_owner_id(a, &(a->inclusion_uids), uid)); } int -archive_matching_include_gid(struct archive *_a, int64_t gid) +archive_match_include_gid(struct archive *_a, int64_t gid) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_include_gid"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_include_gid"); + a = (struct archive_match *)_a; return (add_owner_id(a, &(a->inclusion_gids), gid)); } int -archive_matching_include_uname(struct archive *_a, const char *uname) +archive_match_include_uname(struct archive *_a, const char *uname) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_include_uname"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_include_uname"); + a = (struct archive_match *)_a; return (add_owner_name(a, &(a->inclusion_unames), 1, uname)); } int -archive_matching_include_uname_w(struct archive *_a, const wchar_t *uname) +archive_match_include_uname_w(struct archive *_a, const wchar_t *uname) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_include_uname_w"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_include_uname_w"); + a = (struct archive_match *)_a; return (add_owner_name(a, &(a->inclusion_unames), 0, uname)); } int -archive_matching_include_gname(struct archive *_a, const char *gname) +archive_match_include_gname(struct archive *_a, const char *gname) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_include_gname"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_include_gname"); + a = (struct archive_match *)_a; return (add_owner_name(a, &(a->inclusion_gnames), 1, gname)); } int -archive_matching_include_gname_w(struct archive *_a, const wchar_t *gname) +archive_match_include_gname_w(struct archive *_a, const wchar_t *gname) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_include_gname_w"); - a = (struct archive_matching *)_a; + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_include_gname_w"); + a = (struct archive_match *)_a; return (add_owner_name(a, &(a->inclusion_gnames), 0, gname)); } @@ -1454,15 +1451,15 @@ archive_matching_include_gname_w(struct archive *_a, const wchar_t *gname) * Returns <0 if something error happened. */ int -archive_matching_owner_excluded(struct archive *_a, +archive_match_owner_excluded(struct archive *_a, struct archive_entry *entry) { - struct archive_matching *a; + struct archive_match *a; - archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC, - ARCHIVE_STATE_NEW, "archive_matching_id_excluded_ae"); + archive_check_magic(_a, ARCHIVE_MATCH_MAGIC, + ARCHIVE_STATE_NEW, "archive_match_id_excluded_ae"); - a = (struct archive_matching *)_a; + a = (struct archive_match *)_a; if (entry == NULL) { archive_set_error(&(a->archive), EINVAL, "entry is NULL"); return (ARCHIVE_FAILED); @@ -1476,7 +1473,7 @@ archive_matching_owner_excluded(struct archive *_a, } static int -add_owner_id(struct archive_matching *a, struct id_array *ids, int64_t id) +add_owner_id(struct archive_match *a, struct id_array *ids, int64_t id) { if (ids->count + 1 >= ids->size) { if (ids->size == 0) @@ -1508,7 +1505,7 @@ match_owner_id(struct id_array *ids, int64_t id) } static int -add_owner_name(struct archive_matching *a, struct match_list *list, +add_owner_name(struct archive_match *a, struct match_list *list, int mbs, const void *name) { struct match *match; @@ -1527,7 +1524,7 @@ add_owner_name(struct archive_matching *a, struct match_list *list, #if !defined(_WIN32) || defined(__CYGWIN__) static int -match_owner_name_mbs(struct archive_matching *a, struct match_list *list, +match_owner_name_mbs(struct archive_match *a, struct match_list *list, const char *name) { struct match *m; @@ -1548,7 +1545,7 @@ match_owner_name_mbs(struct archive_matching *a, struct match_list *list, } #else static int -match_owner_name_wcs(struct archive_matching *a, struct match_list *list, +match_owner_name_wcs(struct archive_match *a, struct match_list *list, const wchar_t *name) { struct match *m; @@ -1570,7 +1567,7 @@ match_owner_name_wcs(struct archive_matching *a, struct match_list *list, #endif static int -owner_excluded(struct archive_matching *a, struct archive_entry *entry) +owner_excluded(struct archive_match *a, struct archive_entry *entry) { int r; diff --git a/libarchive/archive_private.h b/libarchive/archive_private.h index 937bba6e..470f5005 100644 --- a/libarchive/archive_private.h +++ b/libarchive/archive_private.h @@ -50,7 +50,7 @@ #define ARCHIVE_READ_MAGIC (0xdeb0c5U) #define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U) #define ARCHIVE_READ_DISK_MAGIC (0xbadb0c5U) -#define ARCHIVE_MATCHING_MAGIC (0xcad11c9U) +#define ARCHIVE_MATCH_MAGIC (0xcad11c9U) #define ARCHIVE_STATE_NEW 1U #define ARCHIVE_STATE_HEADER 2U diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index daa49539..3599dfd6 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -930,7 +930,7 @@ next_entry: * Perform path matching. */ if (a->matching) { - r = archive_matching_path_excluded(a->matching, entry); + r = archive_match_path_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); @@ -1043,7 +1043,7 @@ next_entry: * Perform time matching. */ if (a->matching) { - r = archive_matching_time_excluded(a->matching, entry); + r = archive_match_time_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); @@ -1070,7 +1070,7 @@ next_entry: * Perform owner matching. */ if (a->matching) { - r = archive_matching_owner_excluded(a->matching, entry); + r = archive_match_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_private.h b/libarchive/archive_read_disk_private.h index 59b0fe22..fa73a241 100644 --- a/libarchive/archive_read_disk_private.h +++ b/libarchive/archive_read_disk_private.h @@ -79,10 +79,10 @@ struct archive_read_disk { struct archive_entry *); void *metadata_filter_data; - /* ARCHIVE_MATCHING object. */ + /* ARCHIVE_MATCH object. */ struct archive *matching; - /* Callback function, this will be invoked when ARCHIVE_MATCHING - * archive_matching_*_excluded_ae return true. */ + /* Callback function, this will be invoked when ARCHIVE_MATCH + * archive_match_*_excluded_ae return true. */ void (*excluded_cb_func)(struct archive *, void *, struct archive_entry *); void *excluded_cb_data; diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c index 0a373ba0..aeffbe82 100644 --- a/libarchive/archive_read_disk_windows.c +++ b/libarchive/archive_read_disk_windows.c @@ -809,7 +809,7 @@ next_entry: * Perform path matching. */ if (a->matching) { - r = archive_matching_path_excluded(a->matching, entry); + r = archive_match_path_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); @@ -884,7 +884,7 @@ next_entry: * Perform time matching. */ if (a->matching) { - r = archive_matching_time_excluded(a->matching, entry); + r = archive_match_time_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, "Faild : %s", archive_error_string(a->matching)); @@ -911,7 +911,7 @@ next_entry: * Perform owner matching. */ if (a->matching) { - r = archive_matching_owner_excluded(a->matching, entry); + r = archive_match_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/CMakeLists.txt b/libarchive/test/CMakeLists.txt index 7f0bfff5..06bbf9af 100644 --- a/libarchive/test/CMakeLists.txt +++ b/libarchive/test/CMakeLists.txt @@ -16,9 +16,9 @@ IF(ENABLE_TEST) test_archive_clear_error.c test_archive_crypto.c test_archive_getdate.c - test_archive_matching_owner.c - test_archive_matching_path.c - test_archive_matching_time.c + test_archive_match_owner.c + test_archive_match_path.c + test_archive_match_time.c test_archive_pathmatch.c test_archive_read_close_twice.c test_archive_read_close_twice_open_fd.c diff --git a/libarchive/test/test_archive_matching_owner.c b/libarchive/test/test_archive_match_owner.c index 7ed90e24..6bf9c6f0 100644 --- a/libarchive/test/test_archive_matching_owner.c +++ b/libarchive/test/test_archive_match_owner.c @@ -32,40 +32,40 @@ test_uid(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } - assertEqualIntA(m, 0, archive_matching_include_uid(m, 1000)); - assertEqualIntA(m, 0, archive_matching_include_uid(m, 1002)); + assertEqualIntA(m, 0, archive_match_include_uid(m, 1000)); + assertEqualIntA(m, 0, archive_match_include_uid(m, 1002)); archive_entry_set_uid(ae, 0); failure("uid 0 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_uid(ae, 1000); failure("uid 1000 should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_set_uid(ae, 1001); failure("uid 1001 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_uid(ae, 1002); failure("uid 1002 should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_set_uid(ae, 1003); failure("uid 1003 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -74,40 +74,40 @@ test_gid(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } - assertEqualIntA(m, 0, archive_matching_include_gid(m, 1000)); - assertEqualIntA(m, 0, archive_matching_include_gid(m, 1002)); + assertEqualIntA(m, 0, archive_match_include_gid(m, 1000)); + assertEqualIntA(m, 0, archive_match_include_gid(m, 1002)); archive_entry_set_gid(ae, 0); failure("uid 0 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_gid(ae, 1000); failure("uid 1000 should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_set_gid(ae, 1001); failure("uid 1001 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_gid(ae, 1002); failure("uid 1002 should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_set_gid(ae, 1003); failure("uid 1003 should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -116,40 +116,40 @@ test_uname_mbs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } - assertEqualIntA(m, 0, archive_matching_include_uname(m, "foo")); - assertEqualIntA(m, 0, archive_matching_include_uname(m, "bar")); + assertEqualIntA(m, 0, archive_match_include_uname(m, "foo")); + assertEqualIntA(m, 0, archive_match_include_uname(m, "bar")); archive_entry_copy_uname(ae, "unknown"); failure("User 'unknown' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_copy_uname(ae, "foo"); failure("User 'foo' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_copy_uname(ae, "foo1"); failure("User 'foo1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_copy_uname(ae, "bar"); failure("User 'bar' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_copy_uname(ae, "bar1"); failure("User 'bar1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -158,40 +158,40 @@ test_uname_wcs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } - assertEqualIntA(m, 0, archive_matching_include_uname_w(m, L"foo")); - assertEqualIntA(m, 0, archive_matching_include_uname_w(m, L"bar")); + assertEqualIntA(m, 0, archive_match_include_uname_w(m, L"foo")); + assertEqualIntA(m, 0, archive_match_include_uname_w(m, L"bar")); archive_entry_copy_uname_w(ae, L"unknown"); failure("User 'unknown' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_copy_uname_w(ae, L"foo"); failure("User 'foo' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_copy_uname_w(ae, L"foo1"); failure("User 'foo1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_copy_uname_w(ae, L"bar"); failure("User 'bar' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_copy_uname_w(ae, L"bar1"); failure("User 'bar1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -200,40 +200,40 @@ test_gname_mbs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } - assertEqualIntA(m, 0, archive_matching_include_gname(m, "foo")); - assertEqualIntA(m, 0, archive_matching_include_gname(m, "bar")); + assertEqualIntA(m, 0, archive_match_include_gname(m, "foo")); + assertEqualIntA(m, 0, archive_match_include_gname(m, "bar")); archive_entry_copy_gname(ae, "unknown"); failure("Group 'unknown' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_copy_gname(ae, "foo"); failure("Group 'foo' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_copy_gname(ae, "foo1"); failure("Group 'foo1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_copy_gname(ae, "bar"); failure("Group 'bar' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_copy_gname(ae, "bar1"); failure("Group 'bar1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -242,43 +242,43 @@ test_gname_wcs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } - assertEqualIntA(m, 0, archive_matching_include_gname_w(m, L"foo")); - assertEqualIntA(m, 0, archive_matching_include_gname_w(m, L"bar")); + assertEqualIntA(m, 0, archive_match_include_gname_w(m, L"foo")); + assertEqualIntA(m, 0, archive_match_include_gname_w(m, L"bar")); archive_entry_copy_gname_w(ae, L"unknown"); failure("Group 'unknown' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_copy_gname_w(ae, L"foo"); failure("Group 'foo' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_copy_gname_w(ae, L"foo1"); failure("Group 'foo1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_copy_gname_w(ae, L"bar"); failure("Group 'bar' should not be excluded"); - assertEqualInt(0, archive_matching_owner_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_owner_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_copy_gname_w(ae, L"bar1"); failure("Group 'bar1' should be excluded"); - assertEqualInt(1, archive_matching_owner_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_owner_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } -DEFINE_TEST(test_archive_matching_owner) +DEFINE_TEST(test_archive_match_owner) { test_uid(); test_gid(); diff --git a/libarchive/test/test_archive_matching_path.c b/libarchive/test/test_archive_match_path.c index 9ad5b8ce..8fcf512b 100644 --- a/libarchive/test/test_archive_matching_path.c +++ b/libarchive/test/test_archive_match_path.c @@ -32,41 +32,41 @@ test_exclusion_mbs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } /* Test for pattern "^aa*" */ - assertEqualIntA(m, 0, archive_matching_exclude_pattern(m, "^aa*")); + assertEqualIntA(m, 0, archive_match_exclude_pattern(m, "^aa*")); /* Test with 'aa1234', which should be excluded. */ archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_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)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Test with 'a1234', which should not be excluded. */ archive_entry_copy_pathname(ae, "a1234"); failure("'a1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_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)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -75,41 +75,41 @@ test_exclusion_wcs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } /* Test for pattern "^aa*" */ - assertEqualIntA(m, 0, archive_matching_exclude_pattern_w(m, L"^aa*")); + assertEqualIntA(m, 0, archive_match_exclude_pattern_w(m, L"^aa*")); /* Test with 'aa1234', which should be excluded. */ archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_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)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Test with 'a1234', which should not be excluded. */ archive_entry_copy_pathname(ae, "a1234"); failure("'a1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_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)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -119,46 +119,46 @@ test_inclusion_mbs(void) struct archive *m; const char *mp; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } /* Test for pattern "^aa*" */ - assertEqualIntA(m, 0, archive_matching_include_pattern(m, "^aa*")); + assertEqualIntA(m, 0, archive_match_include_pattern(m, "^aa*")); /* Test with 'aa1234', which should not be excluded. */ archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_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)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Test with 'a1234', which should be excluded. */ archive_entry_copy_pathname(ae, "a1234"); failure("'a1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_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)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify unmatched_inclusions. */ - assertEqualInt(0, archive_matching_path_unmatched_inclusions(m)); + assertEqualInt(0, archive_match_path_unmatched_inclusions(m)); assertEqualIntA(m, ARCHIVE_EOF, - archive_matching_path_unmatched_inclusions_next(m, &mp)); + archive_match_path_unmatched_inclusions_next(m, &mp)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -168,46 +168,46 @@ test_inclusion_wcs(void) struct archive *m; const char *mp; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } /* Test for pattern "^aa*" */ - assertEqualIntA(m, 0, archive_matching_include_pattern_w(m, L"^aa*")); + assertEqualIntA(m, 0, archive_match_include_pattern_w(m, L"^aa*")); /* Test with 'aa1234', which should not be excluded. */ archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_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)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Test with 'a1234', which should be excluded. */ archive_entry_copy_pathname(ae, "a1234"); failure("'a1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_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)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify unmatched_inclusions. */ - assertEqualInt(0, archive_matching_path_unmatched_inclusions(m)); + assertEqualInt(0, archive_match_path_unmatched_inclusions(m)); assertEqualIntA(m, ARCHIVE_EOF, - archive_matching_path_unmatched_inclusions_next(m, &mp)); + archive_match_path_unmatched_inclusions_next(m, &mp)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -218,60 +218,60 @@ test_exclusion_and_inclusion(void) const char *mp; const wchar_t *wp; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } - assertEqualIntA(m, 0, archive_matching_exclude_pattern(m, "^aaa*")); - assertEqualIntA(m, 0, archive_matching_include_pattern_w(m, L"^aa*")); - assertEqualIntA(m, 0, archive_matching_include_pattern(m, "^a1*")); + assertEqualIntA(m, 0, archive_match_exclude_pattern(m, "^aaa*")); + assertEqualIntA(m, 0, archive_match_include_pattern_w(m, L"^aa*")); + assertEqualIntA(m, 0, archive_match_include_pattern(m, "^a1*")); /* Test with 'aa1234', which should not be excluded. */ archive_entry_copy_pathname(ae, "aa1234"); failure("'aa1234' should not be excluded"); - assertEqualInt(0, archive_matching_path_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_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)); + assertEqualInt(0, archive_match_path_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Test with 'aaa1234', which should be excluded. */ archive_entry_copy_pathname(ae, "aaa1234"); failure("'aaa1234' should be excluded"); - assertEqualInt(1, archive_matching_path_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_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)); + assertEqualInt(1, archive_match_path_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify unmatched_inclusions. */ - assertEqualInt(1, archive_matching_path_unmatched_inclusions(m)); + assertEqualInt(1, archive_match_path_unmatched_inclusions(m)); /* Verify unmatched inclusion patterns. */ assertEqualIntA(m, ARCHIVE_OK, - archive_matching_path_unmatched_inclusions_next(m, &mp)); + archive_match_path_unmatched_inclusions_next(m, &mp)); assertEqualString("^a1*", mp); assertEqualIntA(m, ARCHIVE_EOF, - archive_matching_path_unmatched_inclusions_next(m, &mp)); + archive_match_path_unmatched_inclusions_next(m, &mp)); /* Verify unmatched inclusion patterns again in Wide-Char. */ assertEqualIntA(m, ARCHIVE_OK, - archive_matching_path_unmatched_inclusions_next_w(m, &wp)); + archive_match_path_unmatched_inclusions_next_w(m, &wp)); assertEqualWString(L"^a1*", wp); assertEqualIntA(m, ARCHIVE_EOF, - archive_matching_path_unmatched_inclusions_next_w(m, &wp)); + archive_match_path_unmatched_inclusions_next_w(m, &wp)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } -DEFINE_TEST(test_archive_matching_path) +DEFINE_TEST(test_archive_match_path) { test_exclusion_mbs(); test_exclusion_wcs(); diff --git a/libarchive/test/test_archive_matching_time.c b/libarchive/test/test_archive_match_time.c index 1cb2c59d..c951e0db 100644 --- a/libarchive/test/test_archive_matching_time.c +++ b/libarchive/test/test_archive_match_time.c @@ -34,50 +34,50 @@ test_newer_time(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } - assertEqualIntA(m, 0, archive_matching_include_time(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_NEWER, 7880, 0)); + assertEqualIntA(m, 0, archive_match_include_time(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_NEWER, 7880, 0)); archive_entry_copy_pathname(ae, "file1"); 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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_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(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -87,18 +87,18 @@ test_newer_time_str(void) struct archive *m; time_t now, t; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } time(&now); - assertEqualIntA(m, 0, archive_matching_include_date(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_NEWER, "1980/2/1 0:0:0 UTC")); + assertEqualIntA(m, 0, archive_match_include_date(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_NEWER, "1980/2/1 0:0:0 UTC")); /* Test1: Allow newer time. */ archive_entry_copy_pathname(ae, "file1"); @@ -106,40 +106,40 @@ test_newer_time_str(void) archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/2/1 0:0:1 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/2/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 1); archive_entry_set_ctime(ae, t, 0); failure("Its mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 1); failure("Its ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Test2: Allow equal or newer time. */ - assertEqualIntA(m, 0, archive_matching_include_date(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_NEWER | ARCHIVE_MATCHING_EQUAL, + assertEqualIntA(m, 0, archive_match_include_date(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_NEWER | ARCHIVE_MATCH_EQUAL, "1980/2/1 0:0:0 UTC")); archive_entry_copy_pathname(ae, "file1"); @@ -147,25 +147,25 @@ test_newer_time_str(void) archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/2/1 0:0:1 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -175,18 +175,18 @@ test_newer_time_str_w(void) struct archive *m; time_t now, t; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } time(&now); - assertEqualIntA(m, 0, archive_matching_include_date_w(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_NEWER, L"1980/2/1 0:0:0 UTC")); + assertEqualIntA(m, 0, archive_match_include_date_w(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_NEWER, L"1980/2/1 0:0:0 UTC")); /* Test1: Allow newer time. */ archive_entry_copy_pathname(ae, "file1"); @@ -194,40 +194,40 @@ test_newer_time_str_w(void) archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/2/1 0:0:1 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/2/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 1); archive_entry_set_ctime(ae, t, 0); failure("Its mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 1); failure("Its ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Test2: Allow equal or newer time. */ - assertEqualIntA(m, 0, archive_matching_include_date_w(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_NEWER | ARCHIVE_MATCHING_EQUAL, + assertEqualIntA(m, 0, archive_match_include_date_w(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_NEWER | ARCHIVE_MATCH_EQUAL, L"1980/2/1 0:0:0 UTC")); archive_entry_copy_pathname(ae, "file1"); @@ -235,25 +235,25 @@ test_newer_time_str_w(void) archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/2/1 0:0:1 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -263,14 +263,14 @@ test_newer_mtime_than_file_mbs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -278,16 +278,16 @@ test_newer_mtime_than_file_mbs(void) /* * Test: newer mtime than a file specified in MBS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_NEWER, "mid_mtime")); + assertEqualIntA(m, 0, archive_match_include_file_time(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_NEWER, "mid_mtime")); /* Verify 'old_mtime' file. */ archive_entry_copy_pathname(ae, "old_mtime"); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'mid_mtime' file. */ archive_entry_clear(ae); @@ -295,8 +295,8 @@ test_newer_mtime_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'new_mtime' file. */ archive_entry_clear(ae); @@ -304,13 +304,13 @@ test_newer_mtime_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_mtime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -320,14 +320,14 @@ test_newer_ctime_than_file_mbs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -335,16 +335,16 @@ test_newer_ctime_than_file_mbs(void) /* * Test: newer ctime than a file specified in MBS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname(m, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_NEWER, "mid_ctime")); + assertEqualIntA(m, 0, archive_match_include_file_time(m, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_NEWER, "mid_ctime")); /* Verify 'old_ctime' file. */ archive_entry_copy_pathname(ae, "old_ctime"); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'mid_ctime' file. */ archive_entry_clear(ae); @@ -352,8 +352,8 @@ test_newer_ctime_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'new_ctime' file. */ archive_entry_clear(ae); @@ -361,13 +361,13 @@ test_newer_ctime_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -377,14 +377,14 @@ test_newer_mtime_than_file_wcs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -392,16 +392,16 @@ test_newer_mtime_than_file_wcs(void) /* * Test: newer mtime than a file specified in WCS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname_w(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_NEWER, L"mid_mtime")); + assertEqualIntA(m, 0, archive_match_include_file_time_w(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_NEWER, L"mid_mtime")); /* Verify 'old_mtime' file. */ archive_entry_copy_pathname(ae, "old_mtime"); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'mid_mtime' file. */ archive_entry_clear(ae); @@ -409,8 +409,8 @@ test_newer_mtime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'new_mtime' file. */ archive_entry_clear(ae); @@ -418,13 +418,13 @@ test_newer_mtime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_mtime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -434,14 +434,14 @@ test_newer_ctime_than_file_wcs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -449,8 +449,8 @@ test_newer_ctime_than_file_wcs(void) /* * Test: newer ctime than a file specified in WCS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname_w(m, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_NEWER, L"mid_ctime")); + assertEqualIntA(m, 0, archive_match_include_file_time_w(m, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_NEWER, L"mid_ctime")); /* Verify 'old_ctime' file. */ archive_entry_clear(ae); @@ -458,8 +458,8 @@ test_newer_ctime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'mid_ctime' file. */ archive_entry_clear(ae); @@ -467,8 +467,8 @@ test_newer_ctime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'new_ctime' file. */ archive_entry_clear(ae); @@ -476,13 +476,13 @@ test_newer_ctime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -491,50 +491,50 @@ test_older_time(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } - assertEqualIntA(m, 0, archive_matching_include_time(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_OLDER, 7880, 0)); + assertEqualIntA(m, 0, archive_match_include_time(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_OLDER, 7880, 0)); archive_entry_copy_pathname(ae, "file1"); 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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_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(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -544,61 +544,61 @@ test_older_time_str(void) struct archive *m; time_t now, t; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } time(&now); /* Test1: Allow newer time. */ - assertEqualIntA(m, 0, archive_matching_include_date(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_OLDER, "1980/2/1 0:0:0 UTC")); + assertEqualIntA(m, 0, archive_match_include_date(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_OLDER, "1980/2/1 0:0:0 UTC")); archive_entry_copy_pathname(ae, "file1"); t = __archive_get_date(now, "1980/2/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/3/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/3/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_ctime(ae, t, 0); failure("Its mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); t = __archive_get_date(now, "1980/3/1 0:0:0 UTC"); archive_entry_set_ctime(ae, t, 0); failure("Its ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Test2: Allow equal or newer time. */ - assertEqualIntA(m, 0, archive_matching_include_date(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_OLDER | ARCHIVE_MATCHING_EQUAL, + assertEqualIntA(m, 0, archive_match_include_date(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_OLDER | ARCHIVE_MATCH_EQUAL, "1980/2/1 0:0:0 UTC")); archive_entry_copy_pathname(ae, "file1"); @@ -606,25 +606,25 @@ test_older_time_str(void) archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/3/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -634,61 +634,61 @@ test_older_time_str_w(void) struct archive *m; time_t now, t; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } time(&now); /* Test1: Allow newer time. */ - assertEqualIntA(m, 0, archive_matching_include_date_w(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_OLDER, L"1980/2/1 0:0:0 UTC")); + assertEqualIntA(m, 0, archive_match_include_date_w(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_OLDER, L"1980/2/1 0:0:0 UTC")); archive_entry_copy_pathname(ae, "file1"); t = __archive_get_date(now, "1980/2/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/3/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/3/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_ctime(ae, t, 0); failure("Its mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); t = __archive_get_date(now, "1980/3/1 0:0:0 UTC"); archive_entry_set_ctime(ae, t, 0); failure("Its ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Test2: Allow equal or newer time. */ - assertEqualIntA(m, 0, archive_matching_include_date_w(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME | - ARCHIVE_MATCHING_OLDER | ARCHIVE_MATCHING_EQUAL, + assertEqualIntA(m, 0, archive_match_include_date_w(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME | + ARCHIVE_MATCH_OLDER | ARCHIVE_MATCH_EQUAL, L"1980/2/1 0:0:0 UTC")); archive_entry_copy_pathname(ae, "file1"); @@ -696,25 +696,25 @@ test_older_time_str_w(void) archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/1/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); t = __archive_get_date(now, "1980/3/1 0:0:0 UTC"); archive_entry_set_mtime(ae, t, 0); archive_entry_set_ctime(ae, t, 0); failure("Both Its mtime and ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -724,14 +724,14 @@ test_older_mtime_than_file_mbs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -739,16 +739,16 @@ test_older_mtime_than_file_mbs(void) /* * Test: older mtime than a file specified in MBS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER, "mid_mtime")); + assertEqualIntA(m, 0, archive_match_include_file_time(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_OLDER, "mid_mtime")); /* Verify 'old_mtime' file. */ archive_entry_copy_pathname(ae, "old_mtime"); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_mtime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Verify 'mid_mtime' file. */ archive_entry_clear(ae); @@ -756,8 +756,8 @@ test_older_mtime_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'new_mtime' file. */ archive_entry_clear(ae); @@ -765,13 +765,13 @@ test_older_mtime_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -781,14 +781,14 @@ test_older_ctime_than_file_mbs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -796,8 +796,8 @@ test_older_ctime_than_file_mbs(void) /* * Test: older ctime than a file specified in MBS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname(m, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_OLDER, "mid_ctime")); + assertEqualIntA(m, 0, archive_match_include_file_time(m, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_OLDER, "mid_ctime")); /* Verify 'old_ctime' file. */ archive_entry_clear(ae); @@ -805,8 +805,8 @@ test_older_ctime_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Verify 'mid_ctime' file. */ archive_entry_clear(ae); @@ -814,8 +814,8 @@ test_older_ctime_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'new_ctime' file. */ archive_entry_clear(ae); @@ -823,13 +823,13 @@ test_older_ctime_than_file_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -839,14 +839,14 @@ test_older_mtime_than_file_wcs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -854,16 +854,16 @@ test_older_mtime_than_file_wcs(void) /* * Test: older mtime than a file specified in WCS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname_w(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER, L"mid_mtime")); + assertEqualIntA(m, 0, archive_match_include_file_time_w(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_OLDER, L"mid_mtime")); /* Verify 'old_mtime' file. */ archive_entry_copy_pathname(ae, "old_mtime"); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_mtime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Verify 'mid_mtime' file. */ archive_entry_clear(ae); @@ -871,8 +871,8 @@ test_older_mtime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'new_mtime' file. */ archive_entry_clear(ae); @@ -880,13 +880,13 @@ test_older_mtime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -896,14 +896,14 @@ test_older_ctime_than_file_wcs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -911,8 +911,8 @@ test_older_ctime_than_file_wcs(void) /* * Test: older ctime than a file specified in WCS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname_w(m, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_OLDER, L"mid_ctime")); + assertEqualIntA(m, 0, archive_match_include_file_time_w(m, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_OLDER, L"mid_ctime")); /* Verify 'old_ctime' file. */ archive_entry_clear(ae); @@ -920,8 +920,8 @@ test_older_ctime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Verify 'mid_ctime' file. */ archive_entry_clear(ae); @@ -929,8 +929,8 @@ test_older_ctime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'new_ctime' file. */ archive_entry_clear(ae); @@ -938,13 +938,13 @@ test_older_ctime_than_file_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -954,14 +954,14 @@ test_mtime_between_files_mbs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -969,18 +969,18 @@ test_mtime_between_files_mbs(void) /* * Test: mtime between file specified in MBS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_NEWER, "old_mtime")); - assertEqualIntA(m, 0, archive_matching_include_time_pathname(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER, "new_mtime")); + assertEqualIntA(m, 0, archive_match_include_file_time(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_NEWER, "old_mtime")); + assertEqualIntA(m, 0, archive_match_include_file_time(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_OLDER, "new_mtime")); /* Verify 'old_mtime' file. */ archive_entry_copy_pathname(ae, "old_mtime"); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'mid_mtime' file. */ archive_entry_clear(ae); @@ -988,8 +988,8 @@ test_mtime_between_files_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_mtime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Verify 'new_mtime' file. */ archive_entry_clear(ae); @@ -997,13 +997,13 @@ test_mtime_between_files_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -1013,14 +1013,14 @@ test_mtime_between_files_wcs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -1028,18 +1028,18 @@ test_mtime_between_files_wcs(void) /* * Test: mtime between file specified in WCS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname_w(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_NEWER, L"old_mtime")); - assertEqualIntA(m, 0, archive_matching_include_time_pathname_w(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER, L"new_mtime")); + assertEqualIntA(m, 0, archive_match_include_file_time_w(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_NEWER, L"old_mtime")); + assertEqualIntA(m, 0, archive_match_include_file_time_w(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_OLDER, L"new_mtime")); /* Verify 'old_mtime' file. */ archive_entry_copy_pathname(ae, "old_mtime"); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'mid_mtime' file. */ archive_entry_clear(ae); @@ -1047,8 +1047,8 @@ test_mtime_between_files_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_mtime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Verify 'new_mtime' file. */ archive_entry_clear(ae); @@ -1056,13 +1056,13 @@ test_mtime_between_files_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_mtime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -1072,14 +1072,14 @@ test_ctime_between_files_mbs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -1087,18 +1087,18 @@ test_ctime_between_files_mbs(void) /* * Test: ctime between files specified in MBS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname(m, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_NEWER, "old_ctime")); - assertEqualIntA(m, 0, archive_matching_include_time_pathname(m, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_OLDER, "new_ctime")); + assertEqualIntA(m, 0, archive_match_include_file_time(m, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_NEWER, "old_ctime")); + assertEqualIntA(m, 0, archive_match_include_file_time(m, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_OLDER, "new_ctime")); /* Verify 'old_ctime' file. */ archive_entry_copy_pathname(ae, "old_ctime"); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'mid_ctime' file. */ archive_entry_clear(ae); @@ -1106,8 +1106,8 @@ test_ctime_between_files_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Verify 'new_ctime' file. */ archive_entry_clear(ae); @@ -1115,13 +1115,13 @@ test_ctime_between_files_mbs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -1131,14 +1131,14 @@ test_ctime_between_files_wcs(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } if (!assert((a = archive_read_disk_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); archive_entry_free(ae); return; } @@ -1146,18 +1146,18 @@ test_ctime_between_files_wcs(void) /* * Test: ctime between files specified in WCS file name. */ - assertEqualIntA(m, 0, archive_matching_include_time_pathname_w(m, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_NEWER, L"old_ctime")); - assertEqualIntA(m, 0, archive_matching_include_time_pathname_w(m, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_OLDER, L"new_ctime")); + assertEqualIntA(m, 0, archive_match_include_file_time_w(m, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_NEWER, L"old_ctime")); + assertEqualIntA(m, 0, archive_match_include_file_time_w(m, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_OLDER, L"new_ctime")); /* Verify 'old_ctime' file. */ archive_entry_copy_pathname(ae, "old_ctime"); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("old_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Verify 'mid_ctime' file. */ archive_entry_clear(ae); @@ -1165,8 +1165,8 @@ test_ctime_between_files_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("mid_ctime should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Verify 'new_ctime' file. */ archive_entry_clear(ae); @@ -1174,13 +1174,13 @@ test_ctime_between_files_wcs(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_entry_from_file(a, ae, -1, NULL)); failure("new_ctime should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* Clean up. */ archive_read_free(a); archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } static void @@ -1194,44 +1194,44 @@ 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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 0); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_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(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 0); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_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(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 0); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); failure("It should be excluded"); - assertEqualInt(1, archive_matching_time_excluded(m, ae)); - assertEqualInt(1, archive_matching_excluded(m, ae)); + assertEqualInt(1, archive_match_time_excluded(m, ae)); + assertEqualInt(1, archive_match_excluded(m, ae)); /* * "file4" is not registered, that sort of a file should not be @@ -1240,16 +1240,16 @@ excluded(struct archive *m) 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(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 0); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); archive_entry_set_mtime(ae, 7880, 1); failure("It should not be excluded"); - assertEqualInt(0, archive_matching_time_excluded(m, ae)); - assertEqualInt(0, archive_matching_excluded(m, ae)); + assertEqualInt(0, archive_match_time_excluded(m, ae)); + assertEqualInt(0, archive_match_excluded(m, ae)); /* Clean up. */ @@ -1262,37 +1262,37 @@ test_pathname_newer_mtime(void) struct archive_entry *ae; struct archive *m; - if (!assert((m = archive_matching_new()) != NULL)) + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { - archive_matching_free(m); + archive_match_free(m); return; } archive_entry_copy_pathname(ae, "file1"); archive_entry_set_mtime(ae, 7880, 0); - assertEqualIntA(m, 0, archive_matching_exclude_entry(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER | - ARCHIVE_MATCHING_EQUAL, ae)); + assertEqualIntA(m, 0, archive_match_exclude_entry(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_OLDER | + ARCHIVE_MATCH_EQUAL, ae)); archive_entry_copy_pathname(ae, "file2"); archive_entry_set_mtime(ae, 1, 0); - assertEqualIntA(m, 0, archive_matching_exclude_entry(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER | - ARCHIVE_MATCHING_EQUAL, ae)); + assertEqualIntA(m, 0, archive_match_exclude_entry(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_OLDER | + ARCHIVE_MATCH_EQUAL, ae)); archive_entry_copy_pathname(ae, "file3"); archive_entry_set_mtime(ae, 99999, 0); - assertEqualIntA(m, 0, archive_matching_exclude_entry(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER | - ARCHIVE_MATCHING_EQUAL, ae)); + assertEqualIntA(m, 0, archive_match_exclude_entry(m, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_OLDER | + ARCHIVE_MATCH_EQUAL, ae)); excluded(m); /* Clean up. */ archive_entry_free(ae); - archive_matching_free(m); + archive_match_free(m); } -DEFINE_TEST(test_archive_matching_time) +DEFINE_TEST(test_archive_match_time) { struct stat st; diff --git a/libarchive/test/test_read_disk_directory_traversals.c b/libarchive/test/test_read_disk_directory_traversals.c index be77304f..0477b2cd 100644 --- a/libarchive/test/test_read_disk_directory_traversals.c +++ b/libarchive/test/test_read_disk_directory_traversals.c @@ -1320,7 +1320,7 @@ test_callbacks(void) archive_entry_free(ae); return; } - if (assert((m = archive_matching_new()) != NULL)) { + if (assert((m = archive_match_new()) != NULL)) { archive_entry_free(ae); archive_read_free(a); return; @@ -1331,7 +1331,7 @@ test_callbacks(void) */ file_count = 3; assertEqualIntA(m, ARCHIVE_OK, - archive_matching_exclude_pattern(m, "cb/f2")); + archive_match_exclude_pattern(m, "cb/f2")); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_set_matching(a, m, NULL, NULL)); failure("Directory traversals should work as well"); @@ -1416,7 +1416,7 @@ test_callbacks(void) /* Destroy the disk object. */ assertEqualInt(ARCHIVE_OK, archive_read_free(a)); - assertEqualInt(ARCHIVE_OK, archive_matching_free(m)); + assertEqualInt(ARCHIVE_OK, archive_match_free(m)); archive_entry_free(ae); } diff --git a/libarchive_fe/matching.c b/libarchive_fe/matching.c index 3af5e658..f416eae7 100644 --- a/libarchive_fe/matching.c +++ b/libarchive_fe/matching.c @@ -48,7 +48,7 @@ lafe_exclude_from_file(struct archive *matching, const char *pathname) lr = lafe_line_reader(pathname, 0); while ((p = lafe_line_reader_next(lr)) != NULL) { - ret = archive_matching_exclude_pattern(matching, p); + ret = archive_match_exclude_pattern(matching, p); if (ret == ARCHIVE_FATAL) lafe_errc(1, errno, "Out of memory"); } @@ -66,7 +66,7 @@ lafe_include_from_file(struct archive *matching, const char *pathname, lr = lafe_line_reader(pathname, nullSeparator); while ((p = lafe_line_reader_next(lr)) != NULL) { - ret = archive_matching_include_pattern(matching, p); + ret = archive_match_include_pattern(matching, p); if (ret == ARCHIVE_FATAL) lafe_errc(1, errno, "Out of memory"); } diff --git a/tar/bsdtar.c b/tar/bsdtar.c index 9993ff31..0d723f3a 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -240,7 +240,7 @@ main(int argc, char **argv) if (getenv(COPYFILE_DISABLE_VAR)) bsdtar->readdisk_flags &= ~ARCHIVE_READDISK_MAC_COPYFILE; #endif - bsdtar->matching = archive_matching_new(); + bsdtar->matching = archive_match_new(); if (bsdtar->matching == NULL) lafe_errc(1, errno, "Out of memory"); @@ -287,7 +287,7 @@ main(int argc, char **argv) bsdtar->readdisk_flags &= ~ARCHIVE_READDISK_MAC_COPYFILE; break; case OPTION_EXCLUDE: /* GNU tar */ - if (archive_matching_exclude_pattern( + if (archive_match_exclude_pattern( bsdtar->matching, bsdtar->argument) != ARCHIVE_OK) lafe_errc(1, 0, "Couldn't exclude %s\n", bsdtar->argument); @@ -339,7 +339,7 @@ main(int argc, char **argv) * no one else needs this to filter entries * when transforming archives. */ - if (archive_matching_include_pattern(bsdtar->matching, + if (archive_match_include_pattern(bsdtar->matching, bsdtar->argument) != ARCHIVE_OK) lafe_errc(1, 0, "Failed to add %s to inclusion list", @@ -394,31 +394,29 @@ main(int argc, char **argv) * TODO: Add corresponding "older" options to reverse these. */ case OPTION_NEWER_CTIME: /* GNU tar */ - if (archive_matching_include_date(bsdtar->matching, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_NEWER, + if (archive_match_include_date(bsdtar->matching, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_NEWER, bsdtar->argument) != ARCHIVE_OK) lafe_errc(1, 0, "Error : %s", archive_error_string(bsdtar->matching)); break; case OPTION_NEWER_CTIME_THAN: - if (archive_matching_include_time_pathname( - bsdtar->matching, - ARCHIVE_MATCHING_CTIME | ARCHIVE_MATCHING_NEWER, + if (archive_match_include_file_time(bsdtar->matching, + ARCHIVE_MATCH_CTIME | ARCHIVE_MATCH_NEWER, bsdtar->argument) != ARCHIVE_OK) lafe_errc(1, 0, "Error : %s", archive_error_string(bsdtar->matching)); break; case OPTION_NEWER_MTIME: /* GNU tar */ - if (archive_matching_include_date(bsdtar->matching, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_NEWER, + if (archive_match_include_date(bsdtar->matching, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_NEWER, bsdtar->argument) != ARCHIVE_OK) lafe_errc(1, 0, "Error : %s", archive_error_string(bsdtar->matching)); break; case OPTION_NEWER_MTIME_THAN: - if (archive_matching_include_time_pathname( - bsdtar->matching, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_NEWER, + if (archive_match_include_file_time(bsdtar->matching, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_NEWER, bsdtar->argument) != ARCHIVE_OK) lafe_errc(1, 0, "Error : %s", archive_error_string(bsdtar->matching)); @@ -683,7 +681,7 @@ main(int argc, char **argv) break; } - archive_matching_free(bsdtar->matching); + archive_match_free(bsdtar->matching); #if HAVE_REGEX_H cleanup_substitution(bsdtar); #endif @@ -158,7 +158,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) int r; while (*bsdtar->argv) { - if (archive_matching_include_pattern(bsdtar->matching, + if (archive_match_include_pattern(bsdtar->matching, *bsdtar->argv) != ARCHIVE_OK) lafe_errc(1, 0, "Error inclusion pattern: %s", archive_error_string(bsdtar->matching)); @@ -204,7 +204,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) for (;;) { /* Support --fast-read option */ if (bsdtar->option_fast_read && - archive_matching_path_unmatched_inclusions(bsdtar->matching) == 0) + archive_match_path_unmatched_inclusions(bsdtar->matching) == 0) break; r = archive_read_next_header(a, &entry); @@ -245,7 +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_excluded(bsdtar->matching, entry)) + if (archive_match_excluded(bsdtar->matching, entry)) continue; /* Excluded by a pattern test. */ if (mode == 't') { @@ -450,11 +450,11 @@ unmatched_inclusions_warn(struct archive *matching, const char *msg) if (matching == NULL) return (0); - while ((r = archive_matching_path_unmatched_inclusions_next( + while ((r = archive_match_path_unmatched_inclusions_next( matching, &p)) == ARCHIVE_OK) lafe_warnc(0, "%s: %s", p, msg); if (r == ARCHIVE_FATAL) lafe_errc(1, errno, "Out of memory"); - return (archive_matching_path_unmatched_inclusions(matching)); + return (archive_match_path_unmatched_inclusions(matching)); } diff --git a/tar/write.c b/tar/write.c index 93c12592..1c0f5ccc 100644 --- a/tar/write.c +++ b/tar/write.c @@ -342,9 +342,9 @@ tar_mode_u(struct bsdtar *bsdtar) lafe_errc(1, 0, "Cannot append to compressed archive."); } - if (archive_matching_exclude_entry(bsdtar->matching, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER | - ARCHIVE_MATCHING_EQUAL, entry) != ARCHIVE_OK) + if (archive_match_exclude_entry(bsdtar->matching, + ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_OLDER | + ARCHIVE_MATCH_EQUAL, entry) != ARCHIVE_OK) lafe_errc(1, 0, "Error : %s", archive_error_string(bsdtar->matching)); /* Record the last format determination we see */ @@ -590,7 +590,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_excluded(bsdtar->matching, in_entry)) + if (archive_match_excluded(bsdtar->matching, in_entry)) continue; if (bsdtar->option_interactive && !yes("copy '%s'", archive_entry_pathname(in_entry))) |