Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/xz/options.c

Issue 7109015: Update XZ Utils to 5.0.3 (in deps) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/xz/message.c ('k') | src/xz/private.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /////////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////////
2 // 2 //
3 /// \file options.c 3 /// \file options.c
4 /// \brief Parser for filter-specific options 4 /// \brief Parser for filter-specific options
5 // 5 //
6 // Author: Lasse Collin 6 // Author: Lasse Collin
7 // 7 //
8 // This file has been put into the public domain. 8 // This file has been put into the public domain.
9 // You can do whatever you want with this file. 9 // You can do whatever you want with this file.
10 // 10 //
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // Delta // 143 // Delta //
144 /////////// 144 ///////////
145 145
146 enum { 146 enum {
147 OPT_DIST, 147 OPT_DIST,
148 }; 148 };
149 149
150 150
151 static void 151 static void
152 set_delta(void *options, uint32_t key, uint64_t value, 152 set_delta(void *options, uint32_t key, uint64_t value,
153 » » const char *valuestr lzma_attribute((unused))) 153 » » const char *valuestr lzma_attribute((__unused__)))
154 { 154 {
155 lzma_options_delta *opt = options; 155 lzma_options_delta *opt = options;
156 switch (key) { 156 switch (key) {
157 case OPT_DIST: 157 case OPT_DIST:
158 opt->dist = value; 158 opt->dist = value;
159 break; 159 break;
160 } 160 }
161 } 161 }
162 162
163 163
(...skipping 23 matching lines...) Expand all
187 // BCJ // 187 // BCJ //
188 ///////// 188 /////////
189 189
190 enum { 190 enum {
191 OPT_START_OFFSET, 191 OPT_START_OFFSET,
192 }; 192 };
193 193
194 194
195 static void 195 static void
196 set_bcj(void *options, uint32_t key, uint64_t value, 196 set_bcj(void *options, uint32_t key, uint64_t value,
197 » » const char *valuestr lzma_attribute((unused))) 197 » » const char *valuestr lzma_attribute((__unused__)))
198 { 198 {
199 lzma_options_bcj *opt = options; 199 lzma_options_bcj *opt = options;
200 switch (key) { 200 switch (key) {
201 case OPT_START_OFFSET: 201 case OPT_START_OFFSET:
202 opt->start_offset = value; 202 opt->start_offset = value;
203 break; 203 break;
204 } 204 }
205 } 205 }
206 206
207 207
(...skipping 26 matching lines...) Expand all
234 OPT_LC, 234 OPT_LC,
235 OPT_LP, 235 OPT_LP,
236 OPT_PB, 236 OPT_PB,
237 OPT_MODE, 237 OPT_MODE,
238 OPT_NICE, 238 OPT_NICE,
239 OPT_MF, 239 OPT_MF,
240 OPT_DEPTH, 240 OPT_DEPTH,
241 }; 241 };
242 242
243 243
244 static void lzma_attribute((noreturn)) 244 static void lzma_attribute((__noreturn__))
245 error_lzma_preset(const char *valuestr) 245 error_lzma_preset(const char *valuestr)
246 { 246 {
247 message_fatal(_("Unsupported LZMA1/LZMA2 preset: %s"), valuestr); 247 message_fatal(_("Unsupported LZMA1/LZMA2 preset: %s"), valuestr);
248 } 248 }
249 249
250 250
251 static void 251 static void
252 set_lzma(void *options, uint32_t key, uint64_t value, const char *valuestr) 252 set_lzma(void *options, uint32_t key, uint64_t value, const char *valuestr)
253 { 253 {
254 lzma_options_lzma *opt = options; 254 lzma_options_lzma *opt = options;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 { "lp", NULL, LZMA_LCLP_MIN, LZMA_LCLP_MAX }, 339 { "lp", NULL, LZMA_LCLP_MIN, LZMA_LCLP_MAX },
340 { "pb", NULL, LZMA_PB_MIN, LZMA_PB_MAX }, 340 { "pb", NULL, LZMA_PB_MIN, LZMA_PB_MAX },
341 { "mode", modes, 0, 0 }, 341 { "mode", modes, 0, 0 },
342 { "nice", NULL, 2, 273 }, 342 { "nice", NULL, 2, 273 },
343 { "mf", mfs, 0, 0 }, 343 { "mf", mfs, 0, 0 },
344 { "depth", NULL, 0, UINT32_MAX }, 344 { "depth", NULL, 0, UINT32_MAX },
345 { NULL, NULL, 0, 0 } 345 { NULL, NULL, 0, 0 }
346 }; 346 };
347 347
348 lzma_options_lzma *options = xmalloc(sizeof(lzma_options_lzma)); 348 lzma_options_lzma *options = xmalloc(sizeof(lzma_options_lzma));
349 » *options = (lzma_options_lzma){ 349 » if (lzma_lzma_preset(options, LZMA_PRESET_DEFAULT))
350 » » .dict_size = LZMA_DICT_SIZE_DEFAULT, 350 » » message_bug();
351 » » .preset_dict = NULL,
352 » » .preset_dict_size = 0,
353 » » .lc = LZMA_LC_DEFAULT,
354 » » .lp = LZMA_LP_DEFAULT,
355 » » .pb = LZMA_PB_DEFAULT,
356 » » .mode = LZMA_MODE_NORMAL,
357 » » .nice_len = 64,
358 » » .mf = LZMA_MF_BT4,
359 » » .depth = 0,
360 » };
361 351
362 parse_options(str, opts, &set_lzma, options); 352 parse_options(str, opts, &set_lzma, options);
363 353
364 if (options->lc + options->lp > LZMA_LCLP_MAX) 354 if (options->lc + options->lp > LZMA_LCLP_MAX)
365 » » message_fatal(_("The sum of lc and lp must be at " 355 » » message_fatal(_("The sum of lc and lp must not exceed 4"));
366 » » » » "maximum of 4"));
367 356
368 const uint32_t nice_len_min = options->mf & 0x0F; 357 const uint32_t nice_len_min = options->mf & 0x0F;
369 if (options->nice_len < nice_len_min) 358 if (options->nice_len < nice_len_min)
370 message_fatal(_("The selected match finder requires at " 359 message_fatal(_("The selected match finder requires at "
371 "least nice=%" PRIu32), nice_len_min); 360 "least nice=%" PRIu32), nice_len_min);
372 361
373 return options; 362 return options;
374 } 363 }
OLDNEW
« no previous file with comments | « src/xz/message.c ('k') | src/xz/private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698