diff options
author | Kalle Wallin <kaw@linux.se> | 2004-03-19 19:15:43 +0000 |
---|---|---|
committer | Kalle Wallin <kaw@linux.se> | 2004-03-19 19:15:43 +0000 |
commit | a48c2fe2c2d13fbc879a6b5111fc9f3c866ac5b3 (patch) | |
tree | 8a5ff0674412243fd2610f0c0b3f21cd6e176506 /mpc.c | |
parent | 526b460e750f52f5b9b04df72b6601fe4c1fd5f7 (diff) | |
download | mpd-a48c2fe2c2d13fbc879a6b5111fc9f3c866ac5b3.tar.gz mpd-a48c2fe2c2d13fbc879a6b5111fc9f3c866ac5b3.tar.xz mpd-a48c2fe2c2d13fbc879a6b5111fc9f3c866ac5b3.zip |
Added iconv support
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@308 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | mpc.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -16,6 +16,8 @@ #include "mpc.h" #include "options.h" +#define MAX_SONG_LENGTH 1024 + void mpc_update_song(mpd_client_t *c) { @@ -186,21 +188,31 @@ mpc_playlist_get_song(mpd_client_t *c, int n) char * mpc_get_song_name(mpd_Song *song) { + static char buf[MAX_SONG_LENGTH]; + char *name; + if( song->title ) { if( song->artist ) { - static char buf[512]; - - snprintf(buf, 512, "%s - %s", song->artist, song->title); - return utf8(buf); + snprintf(buf, MAX_SONG_LENGTH, "%s - %s", song->artist, song->title); + name = utf8_to_locale(buf); + strncpy(buf, name, MAX_SONG_LENGTH); + free(name); + return buf; } else { - return utf8(song->title); + name = utf8_to_locale(song->title); + strncpy(buf, name, MAX_SONG_LENGTH); + free(name); + return buf; } } - return utf8(basename(song->file)); + name = utf8_to_locale(song->file); + strncpy(buf, name, MAX_SONG_LENGTH); + free(name); + return buf; } int |