archive_read_set_options.c (231200) | archive_read_set_options.c (232153) |
---|---|
1/*- 2 * Copyright (c) 2011 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 64 unchanged lines hidden (view full) --- 73 74static int 75archive_set_format_option(struct archive *_a, const char *m, const char *o, 76 const char *v) 77{ 78 struct archive_read *a = (struct archive_read *)_a; 79 struct archive_format_descriptor *format; 80 size_t i; | 1/*- 2 * Copyright (c) 2011 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 64 unchanged lines hidden (view full) --- 73 74static int 75archive_set_format_option(struct archive *_a, const char *m, const char *o, 76 const char *v) 77{ 78 struct archive_read *a = (struct archive_read *)_a; 79 struct archive_format_descriptor *format; 80 size_t i; |
81 int r, rv = ARCHIVE_FAILED; | 81 int r, rv = ARCHIVE_WARN; |
82 83 for (i = 0; i < sizeof(a->formats)/sizeof(a->formats[0]); i++) { 84 format = &a->formats[i]; 85 if (format == NULL || format->options == NULL || 86 format->name == NULL) 87 /* This format does not support option. */ 88 continue; 89 if (m != NULL && strcmp(format->name, m) != 0) --- 7 unchanged lines hidden (view full) --- 97 return (ARCHIVE_FATAL); 98 99 if (m != NULL) 100 return (r); 101 102 if (r == ARCHIVE_OK) 103 rv = ARCHIVE_OK; 104 } | 82 83 for (i = 0; i < sizeof(a->formats)/sizeof(a->formats[0]); i++) { 84 format = &a->formats[i]; 85 if (format == NULL || format->options == NULL || 86 format->name == NULL) 87 /* This format does not support option. */ 88 continue; 89 if (m != NULL && strcmp(format->name, m) != 0) --- 7 unchanged lines hidden (view full) --- 97 return (ARCHIVE_FATAL); 98 99 if (m != NULL) 100 return (r); 101 102 if (r == ARCHIVE_OK) 103 rv = ARCHIVE_OK; 104 } |
105 /* If the format name didn't match, return a special code for 106 * _archive_set_option[s]. */ 107 if (rv == ARCHIVE_WARN && m != NULL) 108 rv = ARCHIVE_WARN - 1; |
|
105 return (rv); 106} 107 108static int 109archive_set_filter_option(struct archive *_a, const char *m, const char *o, 110 const char *v) 111{ 112 struct archive_read *a = (struct archive_read *)_a; 113 struct archive_read_filter *filter; 114 struct archive_read_filter_bidder *bidder; | 109 return (rv); 110} 111 112static int 113archive_set_filter_option(struct archive *_a, const char *m, const char *o, 114 const char *v) 115{ 116 struct archive_read *a = (struct archive_read *)_a; 117 struct archive_read_filter *filter; 118 struct archive_read_filter_bidder *bidder; |
115 int r, rv = ARCHIVE_FAILED; | 119 int r, rv = ARCHIVE_WARN; |
116 117 for (filter = a->filter; filter != NULL; filter = filter->upstream) { 118 bidder = filter->bidder; 119 if (bidder == NULL) 120 continue; 121 if (bidder->options == NULL) 122 /* This bidder does not support option */ 123 continue; --- 6 unchanged lines hidden (view full) --- 130 return (ARCHIVE_FATAL); 131 132 if (m != NULL) 133 return (r); 134 135 if (r == ARCHIVE_OK) 136 rv = ARCHIVE_OK; 137 } | 120 121 for (filter = a->filter; filter != NULL; filter = filter->upstream) { 122 bidder = filter->bidder; 123 if (bidder == NULL) 124 continue; 125 if (bidder->options == NULL) 126 /* This bidder does not support option */ 127 continue; --- 6 unchanged lines hidden (view full) --- 134 return (ARCHIVE_FATAL); 135 136 if (m != NULL) 137 return (r); 138 139 if (r == ARCHIVE_OK) 140 rv = ARCHIVE_OK; 141 } |
142 /* If the filter name didn't match, return a special code for 143 * _archive_set_option[s]. */ 144 if (rv == ARCHIVE_WARN && m != NULL) 145 rv = ARCHIVE_WARN - 1; |
|
138 return (rv); 139} 140 141static int 142archive_set_option(struct archive *a, const char *m, const char *o, 143 const char *v) 144{ 145 return _archive_set_either_option(a, m, o, v, 146 archive_set_format_option, 147 archive_set_filter_option); 148} | 146 return (rv); 147} 148 149static int 150archive_set_option(struct archive *a, const char *m, const char *o, 151 const char *v) 152{ 153 return _archive_set_either_option(a, m, o, v, 154 archive_set_format_option, 155 archive_set_filter_option); 156} |