Mercurial > audlegacy
changeset 3827:fd86a88426f4
dbus: ensure that only proper UTF8 is sent over the wire.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sun, 21 Oct 2007 07:05:38 -0500 |
parents | 67827c5ab4bd |
children | d31089ffe40a |
files | src/audacious/dbus.c |
diffstat | 1 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/dbus.c Fri Oct 19 06:27:36 2007 -0500 +++ b/src/audacious/dbus.c Sun Oct 21 07:05:38 2007 -0500 @@ -180,9 +180,13 @@ TupleValueType type; type = tuple_get_value_type(tuple, -1, key); if (type == TUPLE_STRING) { + gchar *result = str_to_utf8(tuple_get_string(tuple, -1, key)); + val = g_new0(GValue, 1); g_value_init(val, G_TYPE_STRING); - g_value_set_string(val, tuple_get_string(tuple, -1, key)); + g_value_set_string(val, result); + + g_free(result); return val; } else if (type == TUPLE_INT) { val = g_new0(GValue, 1); @@ -379,7 +383,7 @@ } gboolean mpris_emit_track_change(MprisPlayer *obj) { - GHashTable *metadata; + GHashTable *metadata; Tuple *tuple = NULL; GValue *value; Playlist *active; @@ -391,13 +395,13 @@ metadata = mpris_metadata_from_tuple(tuple); if (metadata != NULL) { - // Song URI - value = g_new0(GValue, 1); - g_value_init(value, G_TYPE_STRING); - g_value_set_string(value, playlist_get_filename(active, pos)); + // Song URI + value = g_new0(GValue, 1); + g_value_init(value, G_TYPE_STRING); + g_value_set_string(value, playlist_get_filename(active, pos)); - g_hash_table_insert(metadata, "URI", value); - } + g_hash_table_insert(metadata, "URI", value); + } g_signal_emit(obj, signals[TRACK_CHANGE_SIG], 0, metadata); return TRUE;