[clang-tidy] use make_unique

Found with modernize-make-unique

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-01-31 19:52:08 -08:00
parent bc6eca2115
commit 469cd9582f
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B
3 changed files with 6 additions and 6 deletions

View File

@ -227,7 +227,7 @@ handle_list_file(Client &client, Request args, Response &r)
std::unique_ptr<SongFilter> filter;
if (!args.empty()) {
filter.reset(new SongFilter());
filter = std::make_unique<SongFilter>();
try {
filter->Parse(args, false);
} catch (...) {
@ -272,8 +272,8 @@ handle_list(Client &client, Request args, Response &r)
return CommandResult::ERROR;
}
filter.reset(new SongFilter(TAG_ARTIST,
args.shift()));
filter = std::make_unique<SongFilter>(TAG_ARTIST,
args.shift());
}
while (args.size >= 2 &&
@ -302,7 +302,7 @@ handle_list(Client &client, Request args, Response &r)
tag_types.emplace_back(tagType);
if (!args.empty()) {
filter.reset(new SongFilter());
filter = std::make_unique<SongFilter>();
try {
filter->Parse(args, false);
} catch (...) {

View File

@ -365,7 +365,7 @@ SimpleDatabase::Save()
#ifdef ENABLE_ZLIB
std::unique_ptr<GzipOutputStream> gzip;
if (compress) {
gzip.reset(new GzipOutputStream(*os));
gzip = std::make_unique<GzipOutputStream>(*os);
os = gzip.get();
}
#endif

View File

@ -544,7 +544,7 @@ wavpack_streamdecode(DecoderClient &client, InputStream &is)
open_flags |= OPEN_WVC;
can_seek &= is_wvc->IsSeekable();
wvc.reset(new WavpackInput(&client, *is_wvc));
wvc = std::make_unique<WavpackInput>(&client, *is_wvc);
}
if (!can_seek) {