summaryrefslogtreecommitdiff
path: root/test/dump_playlist.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2016-02-21 08:03:32 +0100
committerMax Kellermann <max@duempel.org>2016-02-21 08:03:32 +0100
commitcadc67ea40d761281d768256514d6660d820500f (patch)
treea94b048981d852aa9f1141103554eba4c5e601fb /test/dump_playlist.cxx
parent054e9ecaaebe6a8536c894c5093bdce99577e51f (diff)
input: wrap InputStream in std::unique_ptr
Diffstat (limited to 'test/dump_playlist.cxx')
-rw-r--r--test/dump_playlist.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx
index 7ae06eacf..0da744528 100644
--- a/test/dump_playlist.cxx
+++ b/test/dump_playlist.cxx
@@ -50,7 +50,6 @@ tag_save(FILE *file, const Tag &tag)
int main(int argc, char **argv)
try {
const char *uri;
- InputStream *is = NULL;
if (argc != 3) {
fprintf(stderr, "Usage: dump_playlist CONFIG URI\n");
@@ -82,12 +81,13 @@ try {
Mutex mutex;
Cond cond;
+ InputStreamPtr is;
auto playlist = playlist_list_open_uri(uri, mutex, cond);
if (playlist == NULL) {
/* open the stream and wait until it becomes ready */
is = InputStream::OpenReady(uri, mutex, cond, error);
- if (is == NULL) {
+ if (!is) {
if (error.IsDefined())
LogError(error);
else
@@ -100,7 +100,6 @@ try {
playlist = playlist_list_open_stream(*is, uri);
if (playlist == NULL) {
- delete is;
fprintf(stderr, "Failed to open playlist\n");
return 2;
}
@@ -132,7 +131,7 @@ try {
/* deinitialize everything */
delete playlist;
- delete is;
+ is.reset();
decoder_plugin_deinit_all();
playlist_list_global_finish();