aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-06-20 20:02:33 +0000
committerKalle Wallin <kaw@linux.se>2004-06-20 20:02:33 +0000
commitc168e8f26c021b6d869e3afa9b4589a638ba5909 (patch)
treec030e2160e24269f7417896a0b18c8b4227e45d4
parentb64e284f82a247898be963d6df94ad128b52f3e4 (diff)
downloadmpd-c168e8f26c021b6d869e3afa9b4589a638ba5909.tar.gz
mpd-c168e8f26c021b6d869e3afa9b4589a638ba5909.tar.xz
mpd-c168e8f26c021b6d869e3afa9b4589a638ba5909.zip
Added _utf8 suffix to all functions that take utf8 arguments.
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1587 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/mpdclient.c40
-rw-r--r--src/mpdclient.h8
-rw-r--r--src/screen.c2
-rw-r--r--src/screen_file.c10
-rw-r--r--src/screen_play.c6
5 files changed, 45 insertions, 21 deletions
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 1069f8ef5..3f1fb4416 100644
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
@@ -316,7 +316,7 @@ mpdclient_cmd_crossfade(mpdclient_t *c, gint value)
}
gint
-mpdclient_cmd_db_update(mpdclient_t *c, gchar *path)
+mpdclient_cmd_db_update_utf8(mpdclient_t *c, gchar *path)
{
mpd_sendUpdateCommand(c->connection, path ? path : "");
return mpdclient_finish_command(c);
@@ -330,13 +330,19 @@ mpdclient_cmd_volume(mpdclient_t *c, gint value)
}
gint
+mpdclient_cmd_add_path_utf8(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);
- mpd_sendAddCommand(c->connection, path_utf8);
- retval=mpdclient_finish_command(c);
+ retval=mpdclient_cmd_add_path_utf8(c, path_utf8);
g_free(path_utf8);
return retval;
}
@@ -483,20 +489,29 @@ mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index)
}
gint
-mpdclient_cmd_save_playlist(mpdclient_t *c, gchar *filename)
+mpdclient_cmd_save_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
{
gint retval = 0;
- gchar *filename_utf8 = locale_to_utf8(filename);
mpd_sendSaveCommand(c->connection, filename_utf8);
if( (retval=mpdclient_finish_command(c)) == 0 )
mpdclient_browse_callback(c, BROWSE_PLAYLIST_SAVED, NULL);
+ return retval;
+}
+
+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(mpdclient_t *c, gchar *filename_utf8)
+mpdclient_cmd_load_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
{
mpd_sendLoadCommand(c->connection, filename_utf8);
c->need_update = TRUE;
@@ -504,7 +519,7 @@ mpdclient_cmd_load_playlist(mpdclient_t *c, gchar *filename_utf8)
}
gint
-mpdclient_cmd_delete_playlist(mpdclient_t *c, gchar *filename_utf8)
+mpdclient_cmd_delete_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
{
gint retval = 0;
@@ -514,6 +529,17 @@ mpdclient_cmd_delete_playlist(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 *******************************************/
diff --git a/src/mpdclient.h b/src/mpdclient.h
index c5df09ed8..c0d897d80 100644
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
@@ -81,17 +81,19 @@ gint mpdclient_cmd_clear(mpdclient_t *c);
gint mpdclient_cmd_repeat(mpdclient_t *c, gint value);
gint mpdclient_cmd_random(mpdclient_t *c, gint value);
gint mpdclient_cmd_crossfade(mpdclient_t *c, gint value);
-gint mpdclient_cmd_db_update(mpdclient_t *c, gchar *path);
+gint mpdclient_cmd_db_update_utf8(mpdclient_t *c, gchar *path);
gint mpdclient_cmd_volume(mpdclient_t *c, gint value);
gint mpdclient_cmd_add_path(mpdclient_t *c, gchar *path);
+gint mpdclient_cmd_add_path_utf8(mpdclient_t *c, gchar *path);
gint mpdclient_cmd_add(mpdclient_t *c, mpd_Song *song);
gint mpdclient_cmd_delete(mpdclient_t *c, gint index);
gint mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index);
gint mpdclient_cmd_save_playlist(mpdclient_t *c, gchar *filename);
-gint mpdclient_cmd_load_playlist(mpdclient_t *c, gchar *filename_utf8);
-gint mpdclient_cmd_delete_playlist(mpdclient_t *c, gchar *filename_utf8);
+gint mpdclient_cmd_save_playlist_utf8(mpdclient_t *c, gchar *filename);
+gint mpdclient_cmd_load_playlist_utf8(mpdclient_t *c, gchar *filename_utf8);
+gint mpdclient_cmd_delete_playlist_utf8(mpdclient_t *c, gchar *filename_utf8);
/*** error callbacks *****************************************************/
diff --git a/src/screen.c b/src/screen.c
index 43383d93c..8d517c950 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -782,7 +782,7 @@ screen_cmd(mpdclient_t *c, command_t cmd)
case CMD_DB_UPDATE:
if( !c->status->updatingDb )
{
- if( mpdclient_cmd_db_update(c,NULL)==0 )
+ if( mpdclient_cmd_db_update_utf8(c,NULL)==0 )
screen_status_printf(_("Database update started!"));
}
else
diff --git a/src/screen_file.c b/src/screen_file.c
index ebde97096..9f1d0b209 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -277,7 +277,7 @@ load_playlist(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry)
mpd_PlaylistFile *plf = entity->info.playlistFile;
char *filename = utf8_to_locale(plf->path);
- if( mpdclient_cmd_load_playlist(c, plf->path) == 0 )
+ if( mpdclient_cmd_load_playlist_utf8(c, plf->path) == 0 )
screen_status_printf(_("Loading playlist %s..."), basename(filename));
g_free(filename);
return 0;
@@ -318,7 +318,7 @@ handle_delete(screen_t *screen, mpdclient_t *c)
return 0;
}
- if( mpdclient_cmd_delete_playlist(c, plf->path) )
+ if( mpdclient_cmd_delete_playlist_utf8(c, plf->path) )
{
return -1;
}
@@ -418,9 +418,9 @@ handle_select(screen_t *screen, mpdclient_t *c)
{
mpd_Directory *dir = entry->entity->info.directory;
#ifdef USE_OLD_ADD
- add_directory(c, dir->path);
+ add_directory(c, tmp);
#else
- if( mpdclient_cmd_add_path(c, dir->path) == 0 )
+ if( mpdclient_cmd_add_path_utf8(c, dir->path) == 0 )
{
char *tmp = utf8_to_locale(dir->path);
@@ -579,7 +579,7 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
case CMD_DB_UPDATE:
if( !c->status->updatingDb )
{
- if( mpdclient_cmd_db_update(c,filelist->path)==0 )
+ if( mpdclient_cmd_db_update_utf8(c,filelist->path)==0 )
{
screen_status_printf(_("Database update of %s started!"),
filelist->path);
diff --git a/src/screen_play.c b/src/screen_play.c
index 60d0e2586..b11229841 100644
--- a/src/screen_play.c
+++ b/src/screen_play.c
@@ -183,15 +183,11 @@ handle_save_playlist(screen_t *screen, mpdclient_t *c, char *name)
key = tolower(screen_getch(screen->status_window.w, buf));
if( key == YES[0] )
{
- char *filename_utf8 = locale_to_utf8(filename);
-
- if( mpdclient_cmd_delete_playlist(c, filename_utf8) )
+ if( mpdclient_cmd_delete_playlist(c, filename) )
{
g_free(filename);
- g_free(filename_utf8);
return -1;
}
- g_free(filename_utf8);
error = handle_save_playlist(screen, c, filename);
g_free(filename);
return error;