Commit 72512018 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

flac/main.c : Improved option validation with --force-raw-format.

Patch-from:  lvqcl <lvqcl.mail@gmail.com>
parent 879a0ce2
......@@ -399,20 +399,6 @@ int do_it(void)
if(option_values.format_sample_rate >= 0)
return usage_error("ERROR: --sample-rate not allowed with --decode\n");
}
else {
if(!option_values.force_raw_format) {
if(option_values.format_is_big_endian >= 0)
return usage_error("ERROR: --endian only allowed with --force-raw-format\n");
if(option_values.format_is_unsigned_samples >= 0)
return usage_error("ERROR: --sign only allowed with --force-raw-format\n");
if(option_values.format_channels >= 0)
return usage_error("ERROR: --channels only allowed with --force-raw-format\n");
if(option_values.format_bps >= 0)
return usage_error("ERROR: --bps only allowed with --force-raw-format\n");
if(option_values.format_sample_rate >= 0)
return usage_error("ERROR: --sample-rate only allowed with --force-raw-format\n");
}
}
if(option_values.ignore_chunk_sizes) {
if(option_values.mode_decode)
......@@ -1850,6 +1836,12 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
return usage_error("ERROR: for encoding a raw file you must specify a value for --endian, --sign, --channels, --bps, and --sample-rate\n");
}
}
else {
if(option_values.format_is_big_endian >= 0 || option_values.format_is_unsigned_samples >= 0 || option_values.format_channels >= 0 || option_values.format_bps >= 0 || option_values.format_sample_rate >= 0) {
conditional_fclose(encode_infile);
return usage_error("ERROR: raw format options (--endian, --sign, --channels, --bps, and --sample-rate) are not allowed for non-raw input\n");
}
}
if(option_values.force_to_stdout) {
if(option_values.replay_gain) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment