use auto with make_unique

C arrays can be used with make_unique in C++17.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2021-11-11 00:47:45 -08:00
parent 061dd2dfef
commit 31aa6d0c4f
8 changed files with 10 additions and 11 deletions

View File

@@ -310,7 +310,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag *mpd_tag) noexcept
id3_data = stream.this_frame;
mad_stream_skip(&(stream), tagsize);
} else {
allocated.reset(new id3_byte_t[tagsize]);
allocated = std::make_unique<id3_byte_t[]>(tagsize);
memcpy(allocated.get(), stream.this_frame, count);
mad_stream_skip(&(stream), count);

View File

@@ -137,7 +137,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
const auto kernal_path = block.GetPath("kernal");
if (!kernal_path.IsNull())
{
kernal.reset(new uint8_t[rom_size]);
kernal = std::make_unique<uint8_t[]>(rom_size);
loadRom(kernal_path, kernal.get());
}
@@ -145,7 +145,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
const auto basic_path = block.GetPath("basic");
if (!basic_path.IsNull())
{
basic.reset(new uint8_t[rom_size]);
basic = std::make_unique<uint8_t[]>(rom_size);
loadRom(basic_path, basic.get());
}
#endif