Commit a8c77a6f authored by Max Kellermann's avatar Max Kellermann

Merge branch '1' of git://github.com/neheb/MPD

parents d051c493 31aa6d0c
...@@ -213,7 +213,7 @@ read_stream_art(Response &r, const std::string_view art_directory, ...@@ -213,7 +213,7 @@ read_stream_art(Response &r, const std::string_view art_directory,
std::min<offset_type>(art_file_size - offset, std::min<offset_type>(art_file_size - offset,
r.GetClient().binary_limit); r.GetClient().binary_limit);
std::unique_ptr<std::byte[]> buffer(new std::byte[buffer_size]); auto buffer = std::make_unique<std::byte[]>(buffer_size);
std::size_t read_size = 0; std::size_t read_size = 0;
if (buffer_size > 0) { if (buffer_size > 0) {
......
...@@ -310,7 +310,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag *mpd_tag) noexcept ...@@ -310,7 +310,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag *mpd_tag) noexcept
id3_data = stream.this_frame; id3_data = stream.this_frame;
mad_stream_skip(&(stream), tagsize); mad_stream_skip(&(stream), tagsize);
} else { } else {
allocated.reset(new id3_byte_t[tagsize]); allocated = std::make_unique<id3_byte_t[]>(tagsize);
memcpy(allocated.get(), stream.this_frame, count); memcpy(allocated.get(), stream.this_frame, count);
mad_stream_skip(&(stream), count); mad_stream_skip(&(stream), count);
......
...@@ -137,7 +137,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block) ...@@ -137,7 +137,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
const auto kernal_path = block.GetPath("kernal"); const auto kernal_path = block.GetPath("kernal");
if (!kernal_path.IsNull()) if (!kernal_path.IsNull())
{ {
kernal.reset(new uint8_t[rom_size]); kernal = std::make_unique<uint8_t[]>(rom_size);
loadRom(kernal_path, kernal.get()); loadRom(kernal_path, kernal.get());
} }
...@@ -145,7 +145,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block) ...@@ -145,7 +145,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
const auto basic_path = block.GetPath("basic"); const auto basic_path = block.GetPath("basic");
if (!basic_path.IsNull()) if (!basic_path.IsNull())
{ {
basic.reset(new uint8_t[rom_size]); basic = std::make_unique<uint8_t[]>(rom_size);
loadRom(basic_path, basic.get()); loadRom(basic_path, basic.get());
} }
#endif #endif
......
...@@ -54,7 +54,7 @@ UCharToUTF8(std::basic_string_view<UChar> src) ...@@ -54,7 +54,7 @@ UCharToUTF8(std::basic_string_view<UChar> src)
/* worst-case estimate */ /* worst-case estimate */
size_t dest_capacity = 4 * src.size(); size_t dest_capacity = 4 * src.size();
std::unique_ptr<char[]> dest(new char[dest_capacity + 1]); auto dest = std::make_unique<char[]>(dest_capacity + 1);
UErrorCode error_code = U_ZERO_ERROR; UErrorCode error_code = U_ZERO_ERROR;
int32_t dest_length; int32_t dest_length;
......
...@@ -36,8 +36,7 @@ ScanVorbisPicture(StringView value, TagHandler &handler) noexcept ...@@ -36,8 +36,7 @@ ScanVorbisPicture(StringView value, TagHandler &handler) noexcept
return; return;
size_t debase64_size = CalculateBase64OutputSize(value.size); size_t debase64_size = CalculateBase64OutputSize(value.size);
std::unique_ptr<uint8_t[]> debase64_buffer; auto debase64_buffer = std::make_unique<uint8_t[]>(debase64_size);
debase64_buffer.reset(new uint8_t[debase64_size]);
try { try {
debase64_size = debase64_size =
......
...@@ -291,7 +291,7 @@ osx_output_set_channel_map(OSXOutput *oo) ...@@ -291,7 +291,7 @@ osx_output_set_channel_map(OSXOutput *oo)
OSStatus status; OSStatus status;
const UInt32 num_channels = AudioUnitGetChannelsPerFrame(oo->au); const UInt32 num_channels = AudioUnitGetChannelsPerFrame(oo->au);
std::unique_ptr<SInt32[]> channel_map(new SInt32[num_channels]); auto channel_map = std::make_unique<SInt32[]>(num_channels);
osx_output_parse_channel_map(oo->device_name, osx_output_parse_channel_map(oo->device_name,
oo->channel_map, oo->channel_map,
channel_map.get(), channel_map.get(),
......
...@@ -66,7 +66,7 @@ try { ...@@ -66,7 +66,7 @@ try {
remaining -= sizeof(footer); remaining -= sizeof(footer);
assert(remaining > 10); assert(remaining > 10);
std::unique_ptr<char[]> buffer(new char[remaining]); auto buffer = std::make_unique<char[]>(remaining);
is.ReadFull(lock, buffer.get(), remaining); is.ReadFull(lock, buffer.get(), remaining);
/* read tags */ /* read tags */
......
...@@ -63,7 +63,7 @@ try { ...@@ -63,7 +63,7 @@ try {
/* we have enough data already */ /* we have enough data already */
return UniqueId3Tag(id3_tag_parse(query_buffer, tag_size)); return UniqueId3Tag(id3_tag_parse(query_buffer, tag_size));
std::unique_ptr<id3_byte_t[]> tag_buffer(new id3_byte_t[tag_size]); auto tag_buffer = std::make_unique<id3_byte_t[]>(tag_size);
/* copy the start of the tag we already have to the allocated /* copy the start of the tag we already have to the allocated
buffer */ buffer */
...@@ -198,7 +198,7 @@ try { ...@@ -198,7 +198,7 @@ try {
/* too large, don't allocate so much memory */ /* too large, don't allocate so much memory */
return nullptr; return nullptr;
std::unique_ptr<id3_byte_t[]> buffer(new id3_byte_t[size]); auto buffer = std::make_unique<id3_byte_t[]>(size);
is.ReadFull(lock, buffer.get(), size); is.ReadFull(lock, buffer.get(), size);
return UniqueId3Tag(id3_tag_parse(buffer.get(), size)); return UniqueId3Tag(id3_tag_parse(buffer.get(), size));
......
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