Commit c5c8548b authored by Eric Wong's avatar Eric Wong

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
parent cd6e584c
...@@ -270,26 +270,27 @@ static MpdTag *flacMetadataDup(char *file, int *vorbisCommentFound) ...@@ -270,26 +270,27 @@ static MpdTag *flacMetadataDup(char *file, int *vorbisCommentFound)
it = FLAC__metadata_simple_iterator_new(); it = FLAC__metadata_simple_iterator_new();
if (!FLAC__metadata_simple_iterator_init(it, file, 1, 0)) { 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: case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT:
DEBUG err = "illegal input";
("flacMetadataDup: Reading '%s' metadata gave the following error: Illegal Input\n",
file);
break; break;
case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE: case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE:
DEBUG err = "error opening file";
("flacMetadataDup: Reading '%s' metadata gave the following error: Error Opening File\n",
file);
break; break;
case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE: case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE:
DEBUG err = "not a FLAC file";
("flacMetadataDup: Reading '%s' metadata gave the following error: Not A Flac File\n",
file);
break; break;
default: default:
DEBUG("flacMetadataDup: Reading '%s' metadata failed\n", err = FLAC__Metadata_SimpleIteratorStatusString[s];
file);
} }
DEBUG("flacMetadataDup: Reading '%s' "
"metadata gave the following error: %s\n",
file, err);
FLAC__metadata_simple_iterator_delete(it); FLAC__metadata_simple_iterator_delete(it);
return ret; return ret;
} }
......
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