playlist/queue: use std::unique_ptr
This commit is contained in:
parent
ea626368a0
commit
cbeb809798
@ -33,6 +33,8 @@
|
|||||||
#include "SongLoader.hxx"
|
#include "SongLoader.hxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
bool
|
bool
|
||||||
playlist_load_into_queue(const char *uri, SongEnumerator &e,
|
playlist_load_into_queue(const char *uri, SongEnumerator &e,
|
||||||
unsigned start_index, unsigned end_index,
|
unsigned start_index, unsigned end_index,
|
||||||
@ -76,21 +78,18 @@ playlist_open_into_queue(const char *uri,
|
|||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
Cond cond;
|
Cond cond;
|
||||||
|
|
||||||
auto playlist = playlist_open_any(uri,
|
std::unique_ptr<SongEnumerator> playlist(playlist_open_any(uri,
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
loader.GetStorage(),
|
loader.GetStorage(),
|
||||||
#endif
|
#endif
|
||||||
mutex, cond);
|
mutex, cond));
|
||||||
if (playlist == nullptr) {
|
if (playlist == nullptr) {
|
||||||
error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_LIST),
|
error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_LIST),
|
||||||
"No such playlist");
|
"No such playlist");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result =
|
return playlist_load_into_queue(uri, *playlist,
|
||||||
playlist_load_into_queue(uri, *playlist,
|
start_index, end_index,
|
||||||
start_index, end_index,
|
dest, pc, loader, error);
|
||||||
dest, pc, loader, error);
|
|
||||||
delete playlist;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user