diff options
author | Eric Wong <normalperson@yhbt.net> | 2007-08-28 05:01:19 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2007-08-28 05:01:19 +0000 |
commit | c5c8548ba25e7cd5ad88ea3062db1a88d1faa0a2 (patch) | |
tree | 2417c06de41d5517440178cdd5dbdd5f73036543 /src/inputPlugins/flac_plugin.c | |
parent | cd6e584c35c4709b3aeef54b69e0504f2440a8c0 (diff) | |
download | mpd-c5c8548ba25e7cd5ad88ea3062db1a88d1faa0a2.tar.gz mpd-c5c8548ba25e7cd5ad88ea3062db1a88d1faa0a2.tar.xz mpd-c5c8548ba25e7cd5ad88ea3062db1a88d1faa0a2.zip |
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
Diffstat (limited to 'src/inputPlugins/flac_plugin.c')
-rw-r--r-- | src/inputPlugins/flac_plugin.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index 3f3a4b4f1..d7a981649 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -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; } |