aboutsummaryrefslogtreecommitdiff
path: root/src/PlaylistPrint.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-09-27 23:48:29 +0200
committerMax Kellermann <max@duempel.org>2012-09-28 00:10:02 +0200
commit609f6ce66de4d100388531db5a420f155b7bf64d (patch)
treeb2d4810436036634cbef7fe1fe30f1e41c832467 /src/PlaylistPrint.cxx
parent7298b6c84652a98140805f3d4c85c3d5263c407a (diff)
PlaylistFile: use std::list instead of GPtrArray
Diffstat (limited to 'src/PlaylistPrint.cxx')
-rw-r--r--src/PlaylistPrint.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/PlaylistPrint.cxx b/src/PlaylistPrint.cxx
index 832f49cf..4f50825b 100644
--- a/src/PlaylistPrint.cxx
+++ b/src/PlaylistPrint.cxx
@@ -116,18 +116,18 @@ bool
spl_print(struct client *client, const char *name_utf8, bool detail,
GError **error_r)
{
- GPtrArray *list;
-
- list = spl_load(name_utf8, error_r);
- if (list == NULL)
+ GError *error = NULL;
+ PlaylistFileContents contents = LoadPlaylistFile(name_utf8, &error);
+ if (contents.empty() && error != nullptr) {
+ g_propagate_error(error_r, error);
return false;
+ }
- for (unsigned i = 0; i < list->len; ++i) {
- const char *temp = (const char *)g_ptr_array_index(list, i);
+ for (const auto &uri_utf8 : contents) {
bool wrote = false;
if (detail) {
- struct song *song = db_get_song(temp);
+ struct song *song = db_get_song(uri_utf8.c_str());
if (song) {
song_print_info(client, song);
db_return_song(song);
@@ -136,11 +136,11 @@ spl_print(struct client *client, const char *name_utf8, bool detail,
}
if (!wrote) {
- client_printf(client, SONG_FILE "%s\n", temp);
+ client_printf(client, SONG_FILE "%s\n",
+ uri_utf8.c_str());
}
}
- spl_free(list);
return true;
}