diff options
Diffstat (limited to '')
-rw-r--r-- | src/SongSticker.cxx (renamed from src/song_sticker.c) | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/song_sticker.c b/src/SongSticker.cxx index 78025906e..40af50b31 100644 --- a/src/song_sticker.c +++ b/src/SongSticker.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,10 +18,10 @@ */ #include "config.h" -#include "song_sticker.h" +#include "SongSticker.hxx" +#include "StickerDatabase.hxx" #include "song.h" -#include "directory.h" -#include "sticker.h" +#include "Directory.hxx" #include <glib.h> @@ -109,7 +109,7 @@ sticker_song_get(const struct song *song) } struct sticker_song_find_data { - struct directory *directory; + Directory *directory; const char *base_uri; size_t base_uri_length; @@ -121,34 +121,31 @@ struct sticker_song_find_data { static void sticker_song_find_cb(const char *uri, const char *value, gpointer user_data) { - struct sticker_song_find_data *data = user_data; - struct song *song; + struct sticker_song_find_data *data = + (struct sticker_song_find_data *)user_data; if (memcmp(uri, data->base_uri, data->base_uri_length) != 0) /* should not happen, ignore silently */ return; - song = directory_lookup_song(data->directory, - uri + data->base_uri_length); + song *song = data->directory->LookupSong(uri + data->base_uri_length); if (song != NULL) data->func(song, value, data->user_data); } bool -sticker_song_find(struct directory *directory, const char *name, +sticker_song_find(Directory *directory, const char *name, void (*func)(struct song *song, const char *value, gpointer user_data), gpointer user_data) { - struct sticker_song_find_data data = { - .directory = directory, - .func = func, - .user_data = user_data, - }; - char *allocated; - bool success; + struct sticker_song_find_data data; + data.directory = directory; + data.func = func; + data.user_data = user_data; - data.base_uri = directory_get_path(directory); + char *allocated; + data.base_uri = directory->GetPath(); if (*data.base_uri != 0) /* append slash to base_uri */ data.base_uri = allocated = @@ -159,8 +156,8 @@ sticker_song_find(struct directory *directory, const char *name, data.base_uri_length = strlen(data.base_uri); - success = sticker_find("song", data.base_uri, name, - sticker_song_find_cb, &data); + bool success = sticker_find("song", data.base_uri, name, + sticker_song_find_cb, &data); g_free(allocated); return success; |