From: Josh Coalson Date: Tue, 14 Nov 2006 05:02:35 +0000 (+0000) Subject: disallow multiple input FLAC files when --import-tags-from=- is used (SF#1082577... X-Git-Tag: 1.2.0~297 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16e953ffc6365bdc470c78687f5e08de345b482a;p=platform%2Fupstream%2Fflac.git disallow multiple input FLAC files when --import-tags-from=- is used (SF#1082577 sourceforge.net/tracker/index.php?func=detail&aid=1082577&group_id=13478&atid=113478) --- diff --git a/doc/html/documentation.html b/doc/html/documentation.html index f2d60a66..99952abd 100644 --- a/doc/html/documentation.html +++ b/doc/html/documentation.html @@ -1201,7 +1201,7 @@ --import-tags-from=FILE - Import tags from a file. Use - for stdin. Each line should be of the form NAME=VALUE. Multi-line comments are currently not supported. Specify --remove-all-tags and/or --no-utf8-convert before --import-tags-from if necessary. + Import tags from a file. Use - for stdin. Each line should be of the form NAME=VALUE. Multi-line comments are currently not supported. Specify --remove-all-tags and/or --no-utf8-convert before --import-tags-from if necessary. If FILE is - (stdin), only one FLAC file may be specified. diff --git a/man/metaflac.sgml b/man/metaflac.sgml index 3a80a37a..90697a9c 100644 --- a/man/metaflac.sgml +++ b/man/metaflac.sgml @@ -265,7 +265,8 @@ manpage.1: manpage.sgml Import tags from a file. Use '-' for stdin. Each line should be of the form NAME=VALUE. Multi-line comments are currently not supported. Specify --remove-all-tags and/or - --no-utf8-convert before --import-tags-from if necessary. + --no-utf8-convert before --import-tags-from if necessary. If + FILE is '-' (stdin), only one FLAC file may be specified. diff --git a/src/metaflac/options.c b/src/metaflac/options.c index be9d77cc..6e3acd53 100644 --- a/src/metaflac/options.c +++ b/src/metaflac/options.c @@ -202,16 +202,27 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options) } } - /* check for only one FLAC file used with --import-cuesheet-from/--export-cuesheet-to */ - if( - ( - 0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM) || - 0 != find_shorthand_operation(options, OP__EXPORT_CUESHEET_TO) || - 0 != find_shorthand_operation(options, OP__EXPORT_PICTURE_TO) - ) && options->num_files > 1 - ) { - fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-cuesheet-from', '--export-cuesheet-to' or '--export-picture-to'\n"); - had_error = true; + /* check for only one FLAC file used with certain options */ + if(options->num_files > 1) { + if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) { + fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-cuesheet-from'\n"); + had_error = true; + } + if(0 != find_shorthand_operation(options, OP__EXPORT_CUESHEET_TO)) { + fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-cuesheet-to'\n"); + had_error = true; + } + if(0 != find_shorthand_operation(options, OP__EXPORT_PICTURE_TO)) { + fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-picture-to'\n"); + had_error = true; + } + if( + 0 != find_shorthand_operation(options, OP__IMPORT_VC_FROM) && + 0 == strcmp(find_shorthand_operation(options, OP__IMPORT_VC_FROM)->argument.filename.value, "-") + ) { + fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-tags-from=-'\n"); + had_error = true; + } } if(options->args.checks.has_block_type && options->args.checks.has_except_block_type) {