diff options
author | Brad King <brad.king@kitware.com> | 2014-04-03 18:37:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-04-03 19:02:49 (GMT) |
commit | 2f1978632b709a9370b3cb1137375c05351d149c (patch) | |
tree | 85980710818211b8188709643e6714e8839feee9 /Utilities/cmlibarchive/libarchive/archive_read_set_options.c | |
parent | 23e4666cf57c31c719472debba83a43f54d351d8 (diff) | |
parent | 64713ae3ffddf6fbbfa7ea762c3d756cb245a066 (diff) | |
download | CMake-2f1978632b709a9370b3cb1137375c05351d149c.zip CMake-2f1978632b709a9370b3cb1137375c05351d149c.tar.gz CMake-2f1978632b709a9370b3cb1137375c05351d149c.tar.bz2 |
Merge branch 'libarchive-upstream' into update-libarchive
Resolve conflicts in favor of the upstream side where possible.
Resolve a logical conflict in archive_windows.h where the upstream
port to Watcom was done slightly differently from ours.
Diffstat (limited to 'Utilities/cmlibarchive/libarchive/archive_read_set_options.c')
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_read_set_options.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_set_options.c b/Utilities/cmlibarchive/libarchive/archive_read_set_options.c index 793f8f7..46678b1 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_set_options.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_set_options.c @@ -78,7 +78,7 @@ archive_set_format_option(struct archive *_a, const char *m, const char *o, struct archive_read *a = (struct archive_read *)_a; struct archive_format_descriptor *format; size_t i; - int r, rv = ARCHIVE_WARN; + int r, rv = ARCHIVE_WARN, matched_modules = 0; for (i = 0; i < sizeof(a->formats)/sizeof(a->formats[0]); i++) { format = &a->formats[i]; @@ -86,8 +86,11 @@ archive_set_format_option(struct archive *_a, const char *m, const char *o, format->name == NULL) /* This format does not support option. */ continue; - if (m != NULL && strcmp(format->name, m) != 0) - continue; + if (m != NULL) { + if (strcmp(format->name, m) != 0) + continue; + ++matched_modules; + } a->format = format; r = format->options(a, o, v); @@ -96,16 +99,13 @@ archive_set_format_option(struct archive *_a, const char *m, const char *o, if (r == ARCHIVE_FATAL) return (ARCHIVE_FATAL); - if (m != NULL) - return (r); - if (r == ARCHIVE_OK) rv = ARCHIVE_OK; } /* If the format name didn't match, return a special code for * _archive_set_option[s]. */ - if (rv == ARCHIVE_WARN && m != NULL) - rv = ARCHIVE_WARN - 1; + if (m != NULL && matched_modules == 0) + return ARCHIVE_WARN - 1; return (rv); } @@ -116,7 +116,7 @@ archive_set_filter_option(struct archive *_a, const char *m, const char *o, struct archive_read *a = (struct archive_read *)_a; struct archive_read_filter *filter; struct archive_read_filter_bidder *bidder; - int r, rv = ARCHIVE_WARN; + int r, rv = ARCHIVE_WARN, matched_modules = 0; for (filter = a->filter; filter != NULL; filter = filter->upstream) { bidder = filter->bidder; @@ -125,24 +125,24 @@ archive_set_filter_option(struct archive *_a, const char *m, const char *o, if (bidder->options == NULL) /* This bidder does not support option */ continue; - if (m != NULL && strcmp(filter->name, m) != 0) - continue; + if (m != NULL) { + if (strcmp(filter->name, m) != 0) + continue; + ++matched_modules; + } r = bidder->options(bidder, o, v); if (r == ARCHIVE_FATAL) return (ARCHIVE_FATAL); - if (m != NULL) - return (r); - if (r == ARCHIVE_OK) rv = ARCHIVE_OK; } /* If the filter name didn't match, return a special code for * _archive_set_option[s]. */ - if (rv == ARCHIVE_WARN && m != NULL) - rv = ARCHIVE_WARN - 1; + if (m != NULL && matched_modules == 0) + return ARCHIVE_WARN - 1; return (rv); } |