input: wrap InputStream in std::unique_ptr

This commit is contained in:
Max Kellermann
2016-02-21 08:03:32 +01:00
parent 054e9ecaae
commit cadc67ea40
19 changed files with 107 additions and 103 deletions

View File

@@ -92,19 +92,20 @@ int main(int argc, char **argv)
/* open the stream and dump it */
Mutex mutex;
Cond cond;
{
Mutex mutex;
Cond cond;
InputStream *is = InputStream::OpenReady(argv[1], mutex, cond, error);
if (is != NULL) {
ret = dump_input_stream(*is);
delete is;
} else {
if (error.IsDefined())
LogError(error);
else
fprintf(stderr, "input_stream::Open() failed\n");
ret = EXIT_FAILURE;
auto is = InputStream::OpenReady(argv[1], mutex, cond, error);
if (is) {
ret = dump_input_stream(*is);
} else {
if (error.IsDefined())
LogError(error);
else
fprintf(stderr, "input_stream::Open() failed\n");
ret = EXIT_FAILURE;
}
}
/* deinitialize everything */