[clang-tidy] use make_unique

Found with modernize-make-unique Signed-off-by: 's avatarRosen Penev <rosenp@gmail.com>
parent bc6eca21
...@@ -227,7 +227,7 @@ handle_list_file(Client &client, Request args, Response &r) ...@@ -227,7 +227,7 @@ handle_list_file(Client &client, Request args, Response &r)
std::unique_ptr<SongFilter> filter; std::unique_ptr<SongFilter> filter;
if (!args.empty()) { if (!args.empty()) {
filter.reset(new SongFilter()); filter = std::make_unique<SongFilter>();
try { try {
filter->Parse(args, false); filter->Parse(args, false);
} catch (...) { } catch (...) {
...@@ -272,8 +272,8 @@ handle_list(Client &client, Request args, Response &r) ...@@ -272,8 +272,8 @@ handle_list(Client &client, Request args, Response &r)
return CommandResult::ERROR; return CommandResult::ERROR;
} }
filter.reset(new SongFilter(TAG_ARTIST, filter = std::make_unique<SongFilter>(TAG_ARTIST,
args.shift())); args.shift());
} }
while (args.size >= 2 && while (args.size >= 2 &&
...@@ -302,7 +302,7 @@ handle_list(Client &client, Request args, Response &r) ...@@ -302,7 +302,7 @@ handle_list(Client &client, Request args, Response &r)
tag_types.emplace_back(tagType); tag_types.emplace_back(tagType);
if (!args.empty()) { if (!args.empty()) {
filter.reset(new SongFilter()); filter = std::make_unique<SongFilter>();
try { try {
filter->Parse(args, false); filter->Parse(args, false);
} catch (...) { } catch (...) {
......
...@@ -365,7 +365,7 @@ SimpleDatabase::Save() ...@@ -365,7 +365,7 @@ SimpleDatabase::Save()
#ifdef ENABLE_ZLIB #ifdef ENABLE_ZLIB
std::unique_ptr<GzipOutputStream> gzip; std::unique_ptr<GzipOutputStream> gzip;
if (compress) { if (compress) {
gzip.reset(new GzipOutputStream(*os)); gzip = std::make_unique<GzipOutputStream>(*os);
os = gzip.get(); os = gzip.get();
} }
#endif #endif
......
...@@ -544,7 +544,7 @@ wavpack_streamdecode(DecoderClient &client, InputStream &is) ...@@ -544,7 +544,7 @@ wavpack_streamdecode(DecoderClient &client, InputStream &is)
open_flags |= OPEN_WVC; open_flags |= OPEN_WVC;
can_seek &= is_wvc->IsSeekable(); can_seek &= is_wvc->IsSeekable();
wvc.reset(new WavpackInput(&client, *is_wvc)); wvc = std::make_unique<WavpackInput>(&client, *is_wvc);
} }
if (!can_seek) { if (!can_seek) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment