inputPlugins/flac: improve error messages

For the default: case, just use the error message that libFLAC
provides instead of using something ambiguous.  Also, this gets
rid of long lines in the code, making it easier to digest.

Of course, we save ~100 bytes of text space in the process :)

git-svn-id: https://svn.musicpd.org/mpd/trunk@6830 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Eric Wong 2007-08-28 05:01:19 +00:00
parent cd6e584c35
commit c5c8548ba2

View File

@ -270,26 +270,27 @@ static MpdTag *flacMetadataDup(char *file, int *vorbisCommentFound)
it = FLAC__metadata_simple_iterator_new();
if (!FLAC__metadata_simple_iterator_init(it, file, 1, 0)) {
switch (FLAC__metadata_simple_iterator_status(it)) {
const char *err;
FLAC_API FLAC__Metadata_SimpleIteratorStatus s;
s = FLAC__metadata_simple_iterator_status(it);
switch (s) { /* slightly more human-friendly messages: */
case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT:
DEBUG
("flacMetadataDup: Reading '%s' metadata gave the following error: Illegal Input\n",
file);
err = "illegal input";
break;
case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE:
DEBUG
("flacMetadataDup: Reading '%s' metadata gave the following error: Error Opening File\n",
file);
err = "error opening file";
break;
case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE:
DEBUG
("flacMetadataDup: Reading '%s' metadata gave the following error: Not A Flac File\n",
file);
err = "not a FLAC file";
break;
default:
DEBUG("flacMetadataDup: Reading '%s' metadata failed\n",
file);
err = FLAC__Metadata_SimpleIteratorStatusString[s];
}
DEBUG("flacMetadataDup: Reading '%s' "
"metadata gave the following error: %s\n",
file, err);
FLAC__metadata_simple_iterator_delete(it);
return ret;
}