diff options
author | Max Kellermann <max@duempel.org> | 2013-01-27 17:38:09 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-27 17:38:09 +0100 |
commit | 257a0dee758049586efbf0dc3f0339b0cef03456 (patch) | |
tree | 843392ee65fb2e1abb9dad3386ec806eb23975fd /src/playlist/pls_playlist_plugin.c | |
parent | e995cd928c40ecea22fd4d1e3716bb9a656a5430 (diff) | |
download | mpd-257a0dee758049586efbf0dc3f0339b0cef03456.tar.gz mpd-257a0dee758049586efbf0dc3f0339b0cef03456.tar.xz mpd-257a0dee758049586efbf0dc3f0339b0cef03456.zip |
playlist/*: convert to C++
Diffstat (limited to '')
-rw-r--r-- | src/playlist/PlsPlaylistPlugin.cxx (renamed from src/playlist/pls_playlist_plugin.c) | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/playlist/pls_playlist_plugin.c b/src/playlist/PlsPlaylistPlugin.cxx index c4e5492af..8cb8b4f1d 100644 --- a/src/playlist/pls_playlist_plugin.c +++ b/src/playlist/PlsPlaylistPlugin.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,21 +18,22 @@ */ #include "config.h" -#include "playlist/pls_playlist_plugin.h" -#include "playlist_plugin.h" +#include "PlsPlaylistPlugin.hxx" +#include "PlaylistPlugin.hxx" #include "input_stream.h" #include "uri.h" #include "song.h" #include "tag.h" + #include <glib.h> -struct pls_playlist { +struct PlsPlaylist { struct playlist_provider base; GSList *songs; }; -static void pls_parser(GKeyFile *keyfile, struct pls_playlist *playlist) +static void pls_parser(GKeyFile *keyfile, PlsPlaylist *playlist) { gchar *key; gchar *value; @@ -111,7 +112,7 @@ pls_open_stream(struct input_stream *is) char buffer[1024]; bool success; GKeyFile *keyfile; - struct pls_playlist *playlist; + PlsPlaylist *playlist; GString *kf_data = g_string_new(""); do { @@ -152,7 +153,7 @@ pls_open_stream(struct input_stream *is) return NULL; } - playlist = g_new(struct pls_playlist, 1); + playlist = g_new(PlsPlaylist, 1); playlist_provider_init(&playlist->base, &pls_playlist_plugin); playlist->songs = NULL; @@ -166,7 +167,7 @@ pls_open_stream(struct input_stream *is) static void song_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data) { - struct song *song = data; + struct song *song = (struct song *)data; song_free(song); } @@ -174,7 +175,7 @@ song_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data) static void pls_close(struct playlist_provider *_playlist) { - struct pls_playlist *playlist = (struct pls_playlist *)_playlist; + PlsPlaylist *playlist = (PlsPlaylist *)_playlist; g_slist_foreach(playlist->songs, song_free_callback, NULL); g_slist_free(playlist->songs); @@ -186,13 +187,12 @@ pls_close(struct playlist_provider *_playlist) static struct song * pls_read(struct playlist_provider *_playlist) { - struct pls_playlist *playlist = (struct pls_playlist *)_playlist; - struct song *song; + PlsPlaylist *playlist = (PlsPlaylist *)_playlist; if (playlist->songs == NULL) return NULL; - song = playlist->songs->data; + struct song *song = (struct song *)playlist->songs->data; playlist->songs = g_slist_remove(playlist->songs, song); return song; @@ -209,12 +209,16 @@ static const char *const pls_mime_types[] = { }; const struct playlist_plugin pls_playlist_plugin = { - .name = "pls", + "pls", - .open_stream = pls_open_stream, - .close = pls_close, - .read = pls_read, + nullptr, + nullptr, + nullptr, + pls_open_stream, + pls_close, + pls_read, - .suffixes = pls_suffixes, - .mime_types = pls_mime_types, + nullptr, + pls_suffixes, + pls_mime_types, }; |