From 0e4b20ff049073588819a141ff416692aa92eb10 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Tue, 9 Jan 2007 01:59:02 +0000 Subject: [PATCH] fix misleading warning (SF#1631064: http://sourceforge.net/tracker/index.php?func=detail&aid=1631064&group_id=13478&atid=113478) --- src/flac/main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/flac/main.c b/src/flac/main.c index 62fc963..99c596f 100644 --- a/src/flac/main.c +++ b/src/flac/main.c @@ -73,7 +73,7 @@ static void short_usage(); static void show_version(); static void show_help(); static void show_explain(); -static void format_mistake(const char *infilename, const char *wrong, const char *right); +static void format_mistake(const char *infilename, FileFormat wrong, FileFormat right); static int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_last_file); static int decode_file(const char *infilename); @@ -1499,9 +1499,11 @@ void show_explain() printf(" --no-verify\n"); } -void format_mistake(const char *infilename, const char *wrong, const char *right) +void format_mistake(const char *infilename, FileFormat wrong, FileFormat right) { - flac__utils_printf(stderr, 1, "WARNING: %s is not a %s file; treating as a %s file\n", infilename, wrong, right); + /* WATCHOUT: indexed by FileFormat */ + static const char * const ff[] = { "raw", "WAVE", "AIFF", "FLAC", "Ogg FLAC" }; + flac__utils_printf(stderr, 1, "WARNING: %s is not a %s file%s; treating as a %s file\n", infilename, ff[wrong], wrong==FLAC||wrong==OGGFLAC? " (or may have an ID3v2 tag which is not allowed)":"", ff[right]); } int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_last_file) @@ -1551,7 +1553,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ /* attempt to guess the file type based on the first 12 bytes */ if((lookahead_length = fread(lookahead, 1, 12, encode_infile)) < 12) { if(fmt != RAW) - format_mistake(infilename, fmt == AIF ? "AIFF" : "WAVE", "raw"); + format_mistake(infilename, fmt, RAW); fmt= RAW; } else { @@ -1570,7 +1572,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ fmt= OGGFLAC; else { if(fmt != RAW) - format_mistake(infilename, fmt == AIF ? "AIFF" : "WAVE", "raw"); + format_mistake(infilename, fmt, RAW); fmt= RAW; } } -- 2.7.4