summaryrefslogtreecommitdiff
path: root/src/playlist/PlaylistMapper.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-07 20:27:24 +0100
committerMax Kellermann <max@duempel.org>2014-02-07 20:27:24 +0100
commit8549ccfd8c24c5666435ac4dd00ba3c7d14e0351 (patch)
tree3b7820e956b3b494dff1a21be97baa311f1ff1cb /src/playlist/PlaylistMapper.cxx
parentffd16b55a69a01b906805752acc11e26491138bc (diff)
playlist/CloseSongEnumerator: new wrapper class
Simplifies a lot of code, because we don't need to return both the SongEnumerator and the InputStream.
Diffstat (limited to 'src/playlist/PlaylistMapper.cxx')
-rw-r--r--src/playlist/PlaylistMapper.cxx29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/playlist/PlaylistMapper.cxx b/src/playlist/PlaylistMapper.cxx
index ec32abd32..1211e892c 100644
--- a/src/playlist/PlaylistMapper.cxx
+++ b/src/playlist/PlaylistMapper.cxx
@@ -28,14 +28,11 @@
#include <assert.h>
static SongEnumerator *
-playlist_open_path(const char *path_fs, Mutex &mutex, Cond &cond,
- InputStream **is_r)
+playlist_open_path(const char *path_fs, Mutex &mutex, Cond &cond)
{
auto playlist = playlist_list_open_uri(path_fs, mutex, cond);
- if (playlist != nullptr)
- *is_r = nullptr;
- else
- playlist = playlist_list_open_path(path_fs, mutex, cond, is_r);
+ if (playlist == nullptr)
+ playlist = playlist_list_open_path(path_fs, mutex, cond);
return playlist;
}
@@ -44,8 +41,7 @@ playlist_open_path(const char *path_fs, Mutex &mutex, Cond &cond,
* Load a playlist from the configured playlist directory.
*/
static SongEnumerator *
-playlist_open_in_playlist_dir(const char *uri, Mutex &mutex, Cond &cond,
- InputStream **is_r)
+playlist_open_in_playlist_dir(const char *uri, Mutex &mutex, Cond &cond)
{
assert(spl_valid_name(uri));
@@ -61,7 +57,7 @@ playlist_open_in_playlist_dir(const char *uri, Mutex &mutex, Cond &cond,
AllocatedPath::Build(playlist_directory_fs, uri_fs);
assert(!path_fs.IsNull());
- return playlist_open_path(path_fs.c_str(), mutex, cond, is_r);
+ return playlist_open_path(path_fs.c_str(), mutex, cond);
}
#ifdef ENABLE_DATABASE
@@ -70,8 +66,7 @@ playlist_open_in_playlist_dir(const char *uri, Mutex &mutex, Cond &cond,
* Load a playlist from the configured music directory.
*/
static SongEnumerator *
-playlist_open_in_music_dir(const char *uri, Mutex &mutex, Cond &cond,
- InputStream **is_r)
+playlist_open_in_music_dir(const char *uri, Mutex &mutex, Cond &cond)
{
assert(uri_safe_local(uri));
@@ -79,26 +74,24 @@ playlist_open_in_music_dir(const char *uri, Mutex &mutex, Cond &cond,
if (path.IsNull())
return nullptr;
- return playlist_open_path(path.c_str(), mutex, cond, is_r);
+ return playlist_open_path(path.c_str(), mutex, cond);
}
#endif
SongEnumerator *
-playlist_mapper_open(const char *uri, Mutex &mutex, Cond &cond,
- InputStream **is_r)
+playlist_mapper_open(const char *uri, Mutex &mutex, Cond &cond)
{
if (spl_valid_name(uri)) {
- auto playlist = playlist_open_in_playlist_dir(uri, mutex, cond,
- is_r);
+ auto playlist = playlist_open_in_playlist_dir(uri,
+ mutex, cond);
if (playlist != nullptr)
return playlist;
}
#ifdef ENABLE_DATABASE
if (uri_safe_local(uri)) {
- auto playlist = playlist_open_in_music_dir(uri, mutex, cond,
- is_r);
+ auto playlist = playlist_open_in_music_dir(uri, mutex, cond);
if (playlist != nullptr)
return playlist;
}