aboutsummaryrefslogtreecommitdiffstats
path: root/src/mpdclient.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-07 16:14:39 +0100
committerMax Kellermann <max@duempel.org>2008-11-07 16:14:39 +0100
commitc238364f6833320fee4256226af650347d5a751b (patch)
treec04fbb8f91e34dea95410290b941bee627e66c18 /src/mpdclient.c
parent06aafa1328f50d247676c2eca488e53fa02c0dbd (diff)
downloadmpd-c238364f6833320fee4256226af650347d5a751b.tar.gz
mpd-c238364f6833320fee4256226af650347d5a751b.tar.xz
mpd-c238364f6833320fee4256226af650347d5a751b.zip
mpdclient: expect UTF-8 strings
Don't convert the character set of strings to and from the current locale. This library cannot know what the strings are going to be used for, so it should not mess with them.
Diffstat (limited to 'src/mpdclient.c')
-rw-r--r--src/mpdclient.c75
1 files changed, 9 insertions, 66 deletions
diff --git a/src/mpdclient.c b/src/mpdclient.c
index df636a566..7907eead5 100644
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
@@ -19,7 +19,6 @@
#include "mpdclient.h"
#include "screen_utils.h"
#include "config.h"
-#include "charset.h"
#include "options.h"
#include "strfsong.h"
@@ -123,7 +122,6 @@ mpdclient_finish_command(mpdclient_t *c)
if (c->connection->error) {
gint error = c->connection->error;
- gchar *msg;
if (error == MPD_ERROR_ACK &&
c->connection->errorCode == MPD_ACK_ERROR_PERMISSION &&
@@ -133,9 +131,7 @@ mpdclient_finish_command(mpdclient_t *c)
if (error == MPD_ERROR_ACK)
error = error | (c->connection->errorCode << 8);
- msg = locale_to_utf8(c->connection->errorStr);
- error_cb(c, error, msg);
- g_free(msg);
+ error_cb(c, error, c->connection->errorStr);
return error;
}
@@ -399,24 +395,13 @@ mpdclient_cmd_volume(mpdclient_t *c, gint value)
}
gint
-mpdclient_cmd_add_path_utf8(mpdclient_t *c, gchar *path_utf8)
+mpdclient_cmd_add_path(mpdclient_t *c, gchar *path_utf8)
{
mpd_sendAddCommand(c->connection, path_utf8);
return mpdclient_finish_command(c);
}
gint
-mpdclient_cmd_add_path(mpdclient_t *c, gchar *path)
-{
- gint retval;
- gchar *path_utf8 = locale_to_utf8(path);
-
- retval=mpdclient_cmd_add_path_utf8(c, path_utf8);
- g_free(path_utf8);
- return retval;
-}
-
-gint
mpdclient_cmd_add(mpdclient_t *c, struct mpd_song *song)
{
gint retval = 0;
@@ -530,7 +515,7 @@ mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index)
}
gint
-mpdclient_cmd_save_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
+mpdclient_cmd_save_playlist(mpdclient_t *c, gchar *filename_utf8)
{
gint retval = 0;
@@ -541,17 +526,6 @@ mpdclient_cmd_save_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
}
gint
-mpdclient_cmd_save_playlist(mpdclient_t *c, gchar *filename)
-{
- gint retval = 0;
- gchar *filename_utf8 = locale_to_utf8(filename);
-
- retval = mpdclient_cmd_save_playlist_utf8(c, filename);
- g_free(filename_utf8);
- return retval;
-}
-
-gint
mpdclient_cmd_load_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
{
mpd_sendLoadCommand(c->connection, filename_utf8);
@@ -560,7 +534,7 @@ mpdclient_cmd_load_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
}
gint
-mpdclient_cmd_delete_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
+mpdclient_cmd_delete_playlist(mpdclient_t *c, gchar *filename_utf8)
{
gint retval = 0;
@@ -570,17 +544,6 @@ mpdclient_cmd_delete_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
return retval;
}
-gint
-mpdclient_cmd_delete_playlist(mpdclient_t *c, gchar *filename)
-{
- gint retval = 0;
- gchar *filename_utf8 = locale_to_utf8(filename);
-
- retval = mpdclient_cmd_delete_playlist_utf8(c, filename_utf8);
- g_free(filename_utf8);
- return retval;
-}
-
/****************************************************************************/
/*** Callback managment functions *******************************************/
@@ -740,10 +703,9 @@ mpdclient_filelist_get(mpdclient_t *c, const gchar *path)
{
mpdclient_filelist_t *filelist;
mpd_InfoEntity *entity;
- gchar *path_utf8 = locale_to_utf8(path);
gboolean has_dirs_only = TRUE;
- mpd_sendLsInfoCommand(c->connection, path_utf8);
+ mpd_sendLsInfoCommand(c->connection, path);
filelist = filelist_new(path);
if (path && path[0] && strcmp(path, "/"))
/* add a dummy entry for ./.. */
@@ -760,8 +722,6 @@ mpdclient_filelist_get(mpdclient_t *c, const gchar *path)
/* If there's an error, ignore it. We'll return an empty filelist. */
mpdclient_finish_command(c);
- g_free(path_utf8);
-
// If there are only directory entities in the filelist, we sort it
if (has_dirs_only)
filelist_sort(filelist, compare_filelistentry_dir);
@@ -770,10 +730,10 @@ mpdclient_filelist_get(mpdclient_t *c, const gchar *path)
}
mpdclient_filelist_t *
-mpdclient_filelist_search_utf8(mpdclient_t *c,
- int exact_match,
- int table,
- gchar *filter_utf8)
+mpdclient_filelist_search(mpdclient_t *c,
+ int exact_match,
+ int table,
+ gchar *filter_utf8)
{
mpdclient_filelist_t *filelist;
mpd_InfoEntity *entity;
@@ -795,23 +755,6 @@ mpdclient_filelist_search_utf8(mpdclient_t *c,
return filelist;
}
-
-mpdclient_filelist_t *
-mpdclient_filelist_search(mpdclient_t *c,
- int exact_match,
- int table,
- gchar *_filter)
-{
- mpdclient_filelist_t *filelist;
- gchar *filter_utf8 = locale_to_utf8(_filter);
-
- filelist = mpdclient_filelist_search_utf8(c, exact_match, table,
- filter_utf8);
- g_free(filter_utf8);
-
- return filelist;
-}
-
mpdclient_filelist_t *
mpdclient_filelist_update(mpdclient_t *c, mpdclient_filelist_t *filelist)
{