aboutsummaryrefslogtreecommitdiffstats
path: root/mpc.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-03-19 19:15:43 +0000
committerKalle Wallin <kaw@linux.se>2004-03-19 19:15:43 +0000
commita48c2fe2c2d13fbc879a6b5111fc9f3c866ac5b3 (patch)
tree8a5ff0674412243fd2610f0c0b3f21cd6e176506 /mpc.c
parent526b460e750f52f5b9b04df72b6601fe4c1fd5f7 (diff)
downloadmpd-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 'mpc.c')
-rw-r--r--mpc.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/mpc.c b/mpc.c
index ccb083590..f62d9789c 100644
--- a/mpc.c
+++ b/mpc.c
@@ -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