diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-10-05 00:36:55 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-10-05 00:36:55 -0700 |
commit | c4802008b899cc2d272d5e9b6c7000736ed3a6df (patch) | |
tree | 5d9146af43e9999ed32e726d52de7e0d2674958c /src/player_error.c | |
parent | 9beb6b61ab28122de049da918afad424b1e92c42 (diff) | |
parent | 1533279fb18b2b0f53345f0e0727d2f0f968c00d (diff) | |
download | mpd-c4802008b899cc2d272d5e9b6c7000736ed3a6df.tar.gz mpd-c4802008b899cc2d272d5e9b6c7000736ed3a6df.tar.xz mpd-c4802008b899cc2d272d5e9b6c7000736ed3a6df.zip |
Merge commit '1533279fb18b2b0f53345f0e0727d2f0f968c00d'
* commit '1533279fb18b2b0f53345f0e0727d2f0f968c00d':
directory: reuse existing directory if found on update
song: better handling of existing songs when rereading DB
tag: merge clearMpdTag into tag_free
song: start avoiding race in updateSongInfo
command: get rid of specialized list handlers
directory: simplify list update handling logic
main_notify: define main_task so we can use it for assertions
directory: streamline deletes
song: start avoiding race in updateSongInfo
playlist: small lines of code reduction
Revert "Start using song pointers in core data structures"
Conflicts:
src/playlist.c
Diffstat (limited to 'src/player_error.c')
-rw-r--r-- | src/player_error.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/player_error.c b/src/player_error.c index 4c7f7b9de..38e76e2c4 100644 --- a/src/player_error.c +++ b/src/player_error.c @@ -4,50 +4,52 @@ #include "path.h" enum player_error player_errno; -Song *player_errsong; +static char errsong_url[MPD_PATH_MAX]; void player_clearerror(void) { player_errno = PLAYER_ERROR_NONE; - player_errsong = NULL; + *errsong_url = '\0'; } -void player_seterror(enum player_error err, Song *song) +void player_seterror(enum player_error err, const char *url) { if (player_errno) ERROR("Clobbering existing error: %s\n", player_strerror()); player_errno = err; - player_errsong = song; + pathcpy_trunc(errsong_url, url); } const char *player_strerror(void) { /* static OK here, only one user in main task */ static char error[MPD_PATH_MAX + 64]; /* still too much */ - char path_max_tmp[MPD_PATH_MAX]; - *error = '\0'; /* likely */ + const char *ret = NULL; switch (player_errno) { - case PLAYER_ERROR_NONE: break; + case PLAYER_ERROR_NONE: + ret = ""; + break; case PLAYER_ERROR_FILE: - snprintf(error, sizeof(error), "problems decoding \"%s\"", - get_song_url(path_max_tmp, player_errsong)); + snprintf(error, sizeof(error), + "problems decoding \"%s\"", errsong_url); break; case PLAYER_ERROR_AUDIO: - strcpy(error, "problems opening audio device"); + ret = "problems opening audio device"; break; case PLAYER_ERROR_SYSTEM: - strcpy(error, "system error occured"); + /* DONTFIX: misspelling "occurred" here is client-visible */ + ret = "system error occured"; break; case PLAYER_ERROR_UNKTYPE: - snprintf(error, sizeof(error), "file type of \"%s\" is unknown", - get_song_url(path_max_tmp, player_errsong)); - case PLAYER_ERROR_FILENOTFOUND: snprintf(error, sizeof(error), - "file \"%s\" does not exist or is inaccessible", - get_song_url(path_max_tmp, player_errsong)); + "file type of \"%s\" is unknown", errsong_url); break; + case PLAYER_ERROR_FILENOTFOUND: + snprintf(error, sizeof(error), + "file \"%s\" does not exist or is inaccessible", + errsong_url); } - return *error ? error : NULL; + return ret ? ret : error; } |