• Home
  • Raw
  • Download

Lines Matching refs:options

104 …LAC__bool parse_option(int option_index, const char *option_argument, CommandLineOptions *options);
105 static void append_new_operation(CommandLineOptions *options, Operation operation);
106 static void append_new_argument(CommandLineOptions *options, Argument argument);
107 static Operation *append_major_operation(CommandLineOptions *options, OperationType type);
108 static Operation *append_shorthand_operation(CommandLineOptions *options, OperationType type);
109 static Argument *find_argument(CommandLineOptions *options, ArgumentType type);
110 static Operation *find_shorthand_operation(CommandLineOptions *options, OperationType type);
111 static Argument *append_argument(CommandLineOptions *options, ArgumentType type);
126 void init_options(CommandLineOptions *options) in init_options() argument
128 options->preserve_modtime = false; in init_options()
132 options->prefix_with_filename = 2; in init_options()
134 options->utf8_convert = true; in init_options()
135 options->use_padding = true; in init_options()
136 options->cued_seekpoints = true; in init_options()
137 options->show_long_help = false; in init_options()
138 options->show_version = false; in init_options()
139 options->application_data_format_is_hexdump = false; in init_options()
141 options->ops.operations = 0; in init_options()
142 options->ops.num_operations = 0; in init_options()
143 options->ops.capacity = 0; in init_options()
145 options->args.arguments = 0; in init_options()
146 options->args.num_arguments = 0; in init_options()
147 options->args.capacity = 0; in init_options()
149 options->args.checks.num_shorthand_ops = 0; in init_options()
150 options->args.checks.num_major_ops = 0; in init_options()
151 options->args.checks.has_block_type = false; in init_options()
152 options->args.checks.has_except_block_type = false; in init_options()
154 options->num_files = 0; in init_options()
155 options->filenames = 0; in init_options()
158 FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options) in parse_options() argument
167 had_error |= !parse_option(option_index, share__optarg, options); in parse_options()
179 if(options->prefix_with_filename == 2) in parse_options()
180 options->prefix_with_filename = (argc - share__optind > 1); in parse_options()
182 if(share__optind >= argc && !options->show_long_help && !options->show_version) { in parse_options()
188 options->num_files = argc - share__optind; in parse_options()
190 if(options->num_files > 0) { in parse_options()
192 if(0 == (options->filenames = safe_malloc_mul_2op_(sizeof(char*), /*times*/options->num_files))) in parse_options()
195 options->filenames[i++] = local_strdup(argv[share__optind++]); in parse_options()
198 if(options->args.checks.num_major_ops > 0) { in parse_options()
199 if(options->args.checks.num_major_ops > 1) { in parse_options()
203 else if(options->args.checks.num_shorthand_ops > 0) { in parse_options()
210 if(options->num_files > 1) { in parse_options()
211 if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) { in parse_options()
215 if(0 != find_shorthand_operation(options, OP__EXPORT_CUESHEET_TO)) { in parse_options()
219 if(0 != find_shorthand_operation(options, OP__EXPORT_PICTURE_TO)) { in parse_options()
224 0 != find_shorthand_operation(options, OP__IMPORT_VC_FROM) && in parse_options()
225 0 == strcmp(find_shorthand_operation(options, OP__IMPORT_VC_FROM)->argument.filename.value, "-") in parse_options()
232 if(options->args.checks.has_block_type && options->args.checks.has_except_block_type) { in parse_options()
245 if(options->cued_seekpoints) { in parse_options()
246 Operation *op = find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM); in parse_options()
248 Operation *op2 = find_shorthand_operation(options, OP__ADD_SEEKPOINT); in parse_options()
250 op2 = append_shorthand_operation(options, OP__ADD_SEEKPOINT); in parse_options()
258 void free_options(CommandLineOptions *options) in free_options() argument
264 FLAC__ASSERT(0 == options->ops.operations || options->ops.num_operations > 0); in free_options()
265 FLAC__ASSERT(0 == options->args.arguments || options->args.num_arguments > 0); in free_options()
267 for(i = 0, op = options->ops.operations; i < options->ops.num_operations; i++, op++) { in free_options()
310 for(i = 0, arg = options->args.arguments; i < options->args.num_arguments; i++, arg++) { in free_options()
330 if(0 != options->ops.operations) in free_options()
331 free(options->ops.operations); in free_options()
333 if(0 != options->args.arguments) in free_options()
334 free(options->args.arguments); in free_options()
336 if(0 != options->filenames) { in free_options()
337 for(i = 0; i < options->num_files; i++) { in free_options()
338 if(0 != options->filenames[i]) in free_options()
339 free(options->filenames[i]); in free_options()
341 free(options->filenames); in free_options()
349 FLAC__bool parse_option(int option_index, const char *option_argument, CommandLineOptions *options) in parse_option() argument
357 options->preserve_modtime = true; in parse_option()
360 options->prefix_with_filename = true; in parse_option()
363 options->prefix_with_filename = false; in parse_option()
366 options->utf8_convert = false; in parse_option()
369 options->use_padding = false; in parse_option()
372 options->cued_seekpoints = false; in parse_option()
375 (void) append_shorthand_operation(options, OP__SHOW_MD5SUM); in parse_option()
378 (void) append_shorthand_operation(options, OP__SHOW_MIN_BLOCKSIZE); in parse_option()
381 (void) append_shorthand_operation(options, OP__SHOW_MAX_BLOCKSIZE); in parse_option()
384 (void) append_shorthand_operation(options, OP__SHOW_MIN_FRAMESIZE); in parse_option()
387 (void) append_shorthand_operation(options, OP__SHOW_MAX_FRAMESIZE); in parse_option()
390 (void) append_shorthand_operation(options, OP__SHOW_SAMPLE_RATE); in parse_option()
393 (void) append_shorthand_operation(options, OP__SHOW_CHANNELS); in parse_option()
396 (void) append_shorthand_operation(options, OP__SHOW_BPS); in parse_option()
399 (void) append_shorthand_operation(options, OP__SHOW_TOTAL_SAMPLES); in parse_option()
402 op = append_shorthand_operation(options, OP__SET_MD5SUM); in parse_option()
412 op = append_shorthand_operation(options, OP__SET_MIN_BLOCKSIZE); in parse_option()
421 op = append_shorthand_operation(options, OP__SET_MAX_BLOCKSIZE); in parse_option()
430 op = append_shorthand_operation(options, OP__SET_MIN_FRAMESIZE); in parse_option()
439 op = append_shorthand_operation(options, OP__SET_MAX_FRAMESIZE); in parse_option()
448 op = append_shorthand_operation(options, OP__SET_SAMPLE_RATE); in parse_option()
457 op = append_shorthand_operation(options, OP__SET_CHANNELS); in parse_option()
466 op = append_shorthand_operation(options, OP__SET_BPS); in parse_option()
475 op = append_shorthand_operation(options, OP__SET_TOTAL_SAMPLES); in parse_option()
484 (void) append_shorthand_operation(options, OP__SHOW_VC_VENDOR); in parse_option()
488 op = append_shorthand_operation(options, OP__SHOW_VC_FIELD); in parse_option()
497 (void) append_shorthand_operation(options, OP__REMOVE_VC_ALL); in parse_option()
501 op = append_shorthand_operation(options, OP__REMOVE_VC_FIELD); in parse_option()
511 op = append_shorthand_operation(options, OP__REMOVE_VC_FIRSTFIELD); in parse_option()
521 op = append_shorthand_operation(options, OP__SET_VC_FIELD); in parse_option()
532 op = append_shorthand_operation(options, OP__SET_VC_FIELD); in parse_option()
542 op = append_shorthand_operation(options, OP__IMPORT_VC_FROM); in parse_option()
550 op = append_shorthand_operation(options, OP__EXPORT_VC_TO); in parse_option()
558 if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) { in parse_option()
562 op = append_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM); in parse_option()
570 op = append_shorthand_operation(options, OP__EXPORT_CUESHEET_TO); in parse_option()
578 op = append_shorthand_operation(options, OP__IMPORT_PICTURE_FROM); in parse_option()
586 arg = find_argument(options, ARG__BLOCK_NUMBER); in parse_option()
587 op = append_shorthand_operation(options, OP__EXPORT_PICTURE_TO); in parse_option()
605 op = find_shorthand_operation(options, OP__ADD_SEEKPOINT); in parse_option()
607 op = append_shorthand_operation(options, OP__ADD_SEEKPOINT); in parse_option()
614 (void) append_shorthand_operation(options, OP__ADD_REPLAY_GAIN); in parse_option()
617 (void) append_shorthand_operation(options, OP__SCAN_REPLAY_GAIN); in parse_option()
629 op = append_shorthand_operation(options, OP__REMOVE_VC_FIELD); in parse_option()
634 op = append_shorthand_operation(options, OP__ADD_PADDING); in parse_option()
642 options->show_long_help = true; in parse_option()
645 options->show_version = true; in parse_option()
648 (void) append_major_operation(options, OP__LIST); in parse_option()
651 (void) append_major_operation(options, OP__APPEND); in parse_option()
654 (void) append_major_operation(options, OP__REMOVE); in parse_option()
657 (void) append_major_operation(options, OP__REMOVE_ALL); in parse_option()
660 (void) append_major_operation(options, OP__MERGE_PADDING); in parse_option()
663 (void) append_major_operation(options, OP__SORT_PADDING); in parse_option()
666 arg = append_argument(options, ARG__BLOCK_NUMBER); in parse_option()
674 arg = append_argument(options, ARG__BLOCK_TYPE); in parse_option()
680 options->args.checks.has_block_type = true; in parse_option()
683 arg = append_argument(options, ARG__EXCEPT_BLOCK_TYPE); in parse_option()
689 options->args.checks.has_except_block_type = true; in parse_option()
692 arg = append_argument(options, ARG__DATA_FORMAT); in parse_option()
701 …if(!parse_application_data_format(option_argument, &(options->application_data_format_is_hexdump))… in parse_option()
707 arg = append_argument(options, ARG__FROM_FILE); in parse_option()
718 void append_new_operation(CommandLineOptions *options, Operation operation) in append_new_operation() argument
720 if(options->ops.capacity == 0) { in append_new_operation()
721 options->ops.capacity = 50; in append_new_operation()
722 if(0 == (options->ops.operations = malloc(sizeof(Operation) * options->ops.capacity))) in append_new_operation()
724 memset(options->ops.operations, 0, sizeof(Operation) * options->ops.capacity); in append_new_operation()
726 if(options->ops.capacity <= options->ops.num_operations) { in append_new_operation()
727 unsigned original_capacity = options->ops.capacity; in append_new_operation()
728 if(options->ops.capacity > UINT32_MAX / 2) /* overflow check */ in append_new_operation()
730 options->ops.capacity *= 2; in append_new_operation()
731 …if(0 == (options->ops.operations = safe_realloc_mul_2op_(options->ops.operations, sizeof(Operation… in append_new_operation()
733 …memset(options->ops.operations + original_capacity, 0, sizeof(Operation) * (options->ops.capacity … in append_new_operation()
736 options->ops.operations[options->ops.num_operations++] = operation; in append_new_operation()
739 void append_new_argument(CommandLineOptions *options, Argument argument) in append_new_argument() argument
741 if(options->args.capacity == 0) { in append_new_argument()
742 options->args.capacity = 50; in append_new_argument()
743 if(0 == (options->args.arguments = malloc(sizeof(Argument) * options->args.capacity))) in append_new_argument()
745 memset(options->args.arguments, 0, sizeof(Argument) * options->args.capacity); in append_new_argument()
747 if(options->args.capacity <= options->args.num_arguments) { in append_new_argument()
748 unsigned original_capacity = options->args.capacity; in append_new_argument()
749 if(options->args.capacity > UINT32_MAX / 2) /* overflow check */ in append_new_argument()
751 options->args.capacity *= 2; in append_new_argument()
752 …if(0 == (options->args.arguments = safe_realloc_mul_2op_(options->args.arguments, sizeof(Argument)… in append_new_argument()
754 …memset(options->args.arguments + original_capacity, 0, sizeof(Argument) * (options->args.capacity … in append_new_argument()
757 options->args.arguments[options->args.num_arguments++] = argument; in append_new_argument()
760 Operation *append_major_operation(CommandLineOptions *options, OperationType type) in append_major_operation() argument
765 append_new_operation(options, op); in append_major_operation()
766 options->args.checks.num_major_ops++; in append_major_operation()
767 return options->ops.operations + (options->ops.num_operations - 1); in append_major_operation()
770 Operation *append_shorthand_operation(CommandLineOptions *options, OperationType type) in append_shorthand_operation() argument
775 append_new_operation(options, op); in append_shorthand_operation()
776 options->args.checks.num_shorthand_ops++; in append_shorthand_operation()
777 return options->ops.operations + (options->ops.num_operations - 1); in append_shorthand_operation()
780 Argument *find_argument(CommandLineOptions *options, ArgumentType type) in find_argument() argument
783 for(i = 0; i < options->args.num_arguments; i++) in find_argument()
784 if(options->args.arguments[i].type == type) in find_argument()
785 return &options->args.arguments[i]; in find_argument()
789 Operation *find_shorthand_operation(CommandLineOptions *options, OperationType type) in find_shorthand_operation() argument
792 for(i = 0; i < options->ops.num_operations; i++) in find_shorthand_operation()
793 if(options->ops.operations[i].type == type) in find_shorthand_operation()
794 return &options->ops.operations[i]; in find_shorthand_operation()
798 Argument *append_argument(CommandLineOptions *options, ArgumentType type) in append_argument() argument
803 append_new_argument(options, arg); in append_argument()
804 return options->args.arguments + (options->args.num_arguments - 1); in append_argument()