options->prefix_with_filename = (argc - share__optind > 1);
if(share__optind >= argc && !options->show_long_help && !options->show_version) {
- fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n");
- fprintf(stderr," metaflac cannot be used as a pipe\n");
+ flac_fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n");
+ flac_fprintf(stderr," metaflac cannot be used as a pipe\n");
had_error = true;
}
if(options->args.checks.num_major_ops > 0) {
if(options->args.checks.num_major_ops > 1) {
- fprintf(stderr, "ERROR: you may only specify one major operation at a time\n");
+ flac_fprintf(stderr, "ERROR: you may only specify one major operation at a time\n");
had_error = true;
}
else if(options->args.checks.num_shorthand_ops > 0) {
- fprintf(stderr, "ERROR: you may not mix shorthand and major operations\n");
+ flac_fprintf(stderr, "ERROR: you may not mix shorthand and major operations\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");
+ flac_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");
+ flac_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");
+ flac_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");
+ flac_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) {
- fprintf(stderr, "ERROR: you may not specify both '--block-type' and '--except-block-type'\n");
+ flac_fprintf(stderr, "ERROR: you may not specify both '--block-type' and '--except-block-type'\n");
had_error = true;
}
op = append_shorthand_operation(options, OP__SET_MD5SUM);
FLAC__ASSERT(0 != option_argument);
if(!parse_md5(option_argument, op->argument.streaminfo_md5.value)) {
- fprintf(stderr, "ERROR (--%s): bad MD5 sum\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): bad MD5 sum\n", opt);
ok = false;
}
else
else if(0 == strcmp(opt, "set-min-blocksize")) {
op = append_shorthand_operation(options, OP__SET_MIN_BLOCKSIZE);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BLOCK_SIZE || op->argument.streaminfo_uint32.value > FLAC__MAX_BLOCK_SIZE) {
- fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);
+ flac_fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);
ok = false;
}
else
else if(0 == strcmp(opt, "set-max-blocksize")) {
op = append_shorthand_operation(options, OP__SET_MAX_BLOCKSIZE);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BLOCK_SIZE || op->argument.streaminfo_uint32.value > FLAC__MAX_BLOCK_SIZE) {
- fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);
+ flac_fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);
ok = false;
}
else
else if(0 == strcmp(opt, "set-min-framesize")) {
op = append_shorthand_operation(options, OP__SET_MIN_FRAMESIZE);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value >= (1u<<FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN)) {
- fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN);
+ flac_fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN);
ok = false;
}
else
else if(0 == strcmp(opt, "set-max-framesize")) {
op = append_shorthand_operation(options, OP__SET_MAX_FRAMESIZE);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value >= (1u<<FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN)) {
- fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN);
+ flac_fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN);
ok = false;
}
else
else if(0 == strcmp(opt, "set-sample-rate")) {
op = append_shorthand_operation(options, OP__SET_SAMPLE_RATE);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || !FLAC__format_sample_rate_is_valid(op->argument.streaminfo_uint32.value)) {
- fprintf(stderr, "ERROR (--%s): invalid sample rate\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): invalid sample rate\n", opt);
ok = false;
}
else
else if(0 == strcmp(opt, "set-channels")) {
op = append_shorthand_operation(options, OP__SET_CHANNELS);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value > FLAC__MAX_CHANNELS) {
- fprintf(stderr, "ERROR (--%s): value must be > 0 and <= %u\n", opt, FLAC__MAX_CHANNELS);
+ flac_fprintf(stderr, "ERROR (--%s): value must be > 0 and <= %u\n", opt, FLAC__MAX_CHANNELS);
ok = false;
}
else
else if(0 == strcmp(opt, "set-bps")) {
op = append_shorthand_operation(options, OP__SET_BPS);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BITS_PER_SAMPLE || op->argument.streaminfo_uint32.value > FLAC__MAX_BITS_PER_SAMPLE) {
- fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BITS_PER_SAMPLE, FLAC__MAX_BITS_PER_SAMPLE);
+ flac_fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BITS_PER_SAMPLE, FLAC__MAX_BITS_PER_SAMPLE);
ok = false;
}
else
else if(0 == strcmp(opt, "set-total-samples")) {
op = append_shorthand_operation(options, OP__SET_TOTAL_SAMPLES);
if(!parse_uint64(option_argument, &(op->argument.streaminfo_uint64.value)) || op->argument.streaminfo_uint64.value >= (((FLAC__uint64)1)<<FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) {
- fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN);
+ flac_fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN);
ok = false;
}
else
FLAC__ASSERT(0 != option_argument);
if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
FLAC__ASSERT(0 != option_argument);
if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
FLAC__ASSERT(0 != option_argument);
if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
op->argument.vc_field.field_value_from_file = false;
if(!parse_vorbis_comment_field(option_argument, &(op->argument.vc_field.field), &(op->argument.vc_field.field_name), &(op->argument.vc_field.field_value), &(op->argument.vc_field.field_value_length), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
op->argument.vc_field.field_value_from_file = true;
if(!parse_vorbis_comment_field(option_argument, &(op->argument.vc_field.field), &(op->argument.vc_field.field_name), &(op->argument.vc_field.field_value), &(op->argument.vc_field.field_value_length), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
op = append_shorthand_operation(options, OP__IMPORT_VC_FROM);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.filename.value))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
}
op = append_shorthand_operation(options, OP__EXPORT_VC_TO);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.filename.value))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
}
else if(0 == strcmp(opt, "import-cuesheet-from")) {
if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) {
- fprintf(stderr, "ERROR (--%s): may be specified only once\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): may be specified only once\n", opt);
ok = false;
}
op = append_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.import_cuesheet_from.filename))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
}
op = append_shorthand_operation(options, OP__EXPORT_CUESHEET_TO);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.filename.value))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
}
op = append_shorthand_operation(options, OP__IMPORT_PICTURE_FROM);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.specification.value))) {
- fprintf(stderr, "ERROR (--%s): missing specification\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing specification\n", opt);
ok = false;
}
}
op = append_shorthand_operation(options, OP__EXPORT_PICTURE_TO);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.export_picture_to.filename))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
op->argument.export_picture_to.block_number_link = arg? &(arg->value.block_number) : 0;
FLAC__ASSERT(0 != option_argument);
if(!parse_add_seekpoint(option_argument, &spec, &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed seekpoint specification \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed seekpoint specification \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
else {
op = append_shorthand_operation(options, OP__ADD_PADDING);
FLAC__ASSERT(0 != option_argument);
if(!parse_add_padding(option_argument, &(op->argument.add_padding.length))) {
- fprintf(stderr, "ERROR (--%s): illegal length \"%s\", length must be >= 0 and < 2^%u\n", opt, option_argument, FLAC__STREAM_METADATA_LENGTH_LEN);
+ flac_fprintf(stderr, "ERROR (--%s): illegal length \"%s\", length must be >= 0 and < 2^%u\n", opt, option_argument, FLAC__STREAM_METADATA_LENGTH_LEN);
ok = false;
}
}
arg = append_argument(options, ARG__BLOCK_NUMBER);
FLAC__ASSERT(0 != option_argument);
if(!parse_block_number(option_argument, &(arg->value.block_number))) {
- fprintf(stderr, "ERROR: malformed block number specification \"%s\"\n", option_argument);
+ flac_fprintf(stderr, "ERROR: malformed block number specification \"%s\"\n", option_argument);
ok = false;
}
}
arg = append_argument(options, ARG__BLOCK_TYPE);
FLAC__ASSERT(0 != option_argument);
if(!parse_block_type(option_argument, &(arg->value.block_type))) {
- fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument);
+ flac_fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument);
ok = false;
}
options->args.checks.has_block_type = true;
arg = append_argument(options, ARG__EXCEPT_BLOCK_TYPE);
FLAC__ASSERT(0 != option_argument);
if(!parse_block_type(option_argument, &(arg->value.block_type))) {
- fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument);
+ flac_fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument);
ok = false;
}
options->args.checks.has_except_block_type = true;
arg = append_argument(options, ARG__DATA_FORMAT);
FLAC__ASSERT(0 != option_argument);
if(!parse_data_format(option_argument, &(arg->value.data_format))) {
- fprintf(stderr, "ERROR (--%s): illegal data format \"%s\"\n", opt, option_argument);
+ flac_fprintf(stderr, "ERROR (--%s): illegal data format \"%s\"\n", opt, option_argument);
ok = false;
}
}
else if(0 == strcmp(opt, "application-data-format")) {
FLAC__ASSERT(0 != option_argument);
if(!parse_application_data_format(option_argument, &(options->application_data_format_is_hexdump))) {
- fprintf(stderr, "ERROR (--%s): illegal application data format \"%s\"\n", opt, option_argument);
+ flac_fprintf(stderr, "ERROR (--%s): illegal application data format \"%s\"\n", opt, option_argument);
ok = false;
}
}
void undocumented_warning(const char *opt)
{
- fprintf(stderr, "WARNING: undocmented option --%s should be used with caution,\n only for repairing a damaged STREAMINFO block\n", opt);
+ flac_fprintf(stderr, "WARNING: undocmented option --%s should be used with caution,\n only for repairing a damaged STREAMINFO block\n", opt);
}