diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index 9b9ed90fd..96ad2087a 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -191,7 +191,7 @@ read_stream_art(Response &r, const std::string_view art_directory, std::min(art_file_size - offset, r.GetClient().binary_limit); - auto buffer = std::make_unique(buffer_size); + auto buffer = std::make_unique_for_overwrite(buffer_size); std::size_t read_size = 0; if (buffer_size > 0) { diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx index 9da1eaff5..67fd413a3 100644 --- a/src/decoder/plugins/MadDecoderPlugin.cxx +++ b/src/decoder/plugins/MadDecoderPlugin.cxx @@ -266,7 +266,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag *mpd_tag) noexcept id3_data = stream.this_frame; mad_stream_skip(&(stream), tagsize); } else { - allocated = std::make_unique(tagsize); + allocated = std::make_unique_for_overwrite(tagsize); memcpy(allocated.get(), stream.this_frame, count); mad_stream_skip(&(stream), count); diff --git a/src/decoder/plugins/SidplayDecoderPlugin.cxx b/src/decoder/plugins/SidplayDecoderPlugin.cxx index 2e58cc84b..5a193116a 100644 --- a/src/decoder/plugins/SidplayDecoderPlugin.cxx +++ b/src/decoder/plugins/SidplayDecoderPlugin.cxx @@ -101,7 +101,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block) const auto kernal_path = block.GetPath("kernal"); if (!kernal_path.IsNull()) { - kernal = std::make_unique(rom_size); + kernal = std::make_unique_for_overwrite(rom_size); loadRom(kernal_path, kernal.get()); } @@ -109,7 +109,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block) const auto basic_path = block.GetPath("basic"); if (!basic_path.IsNull()) { - basic = std::make_unique(rom_size); + basic = std::make_unique_for_overwrite(rom_size); loadRom(basic_path, basic.get()); } } diff --git a/src/io/uring/ReadOperation.cxx b/src/io/uring/ReadOperation.cxx index f53f3fab3..6dfdc9882 100644 --- a/src/io/uring/ReadOperation.cxx +++ b/src/io/uring/ReadOperation.cxx @@ -17,7 +17,7 @@ ReadOperation::Start(Queue &queue, FileDescriptor fd, off_t offset, handler = &_handler; - buffer = std::make_unique(size); + buffer = std::make_unique_for_overwrite(size); auto &s = queue.RequireSubmitEntry(); diff --git a/src/lib/icu/Util.cxx b/src/lib/icu/Util.cxx index 81567698b..2c070453c 100644 --- a/src/lib/icu/Util.cxx +++ b/src/lib/icu/Util.cxx @@ -38,7 +38,7 @@ UCharToUTF8(std::basic_string_view src) /* worst-case estimate */ size_t dest_capacity = 4 * src.size(); - auto dest = std::make_unique(dest_capacity + 1); + auto dest = std::make_unique_for_overwrite(dest_capacity + 1); UErrorCode error_code = U_ZERO_ERROR; int32_t dest_length; diff --git a/src/lib/icu/Win32.cxx b/src/lib/icu/Win32.cxx index 2a0abb857..13fdb88a1 100644 --- a/src/lib/icu/Win32.cxx +++ b/src/lib/icu/Win32.cxx @@ -18,7 +18,7 @@ WideCharToMultiByte(unsigned code_page, std::wstring_view src) if (length <= 0) throw MakeLastError("Failed to convert from Unicode"); - auto buffer = std::make_unique(length + 1); + auto buffer = std::make_unique_for_overwrite(length + 1); length = WideCharToMultiByte(code_page, 0, src.data(), src.size(), buffer.get(), length, nullptr, nullptr); @@ -37,7 +37,7 @@ MultiByteToWideChar(unsigned code_page, std::string_view src) if (length <= 0) throw MakeLastError("Failed to convert to Unicode"); - auto buffer = std::make_unique(length + 1); + auto buffer = std::make_unique_for_overwrite(length + 1); length = MultiByteToWideChar(code_page, 0, src.data(), src.size(), buffer.get(), length); if (length <= 0) diff --git a/src/lib/nfs/FileReader.cxx b/src/lib/nfs/FileReader.cxx index ae8c75fed..20b79ce3c 100644 --- a/src/lib/nfs/FileReader.cxx +++ b/src/lib/nfs/FileReader.cxx @@ -148,7 +148,7 @@ NfsFileReader::Read(uint64_t offset, size_t size) #ifdef LIBNFS_API_2 assert(!read_buffer); // TOOD read into caller-provided buffer - read_buffer = std::make_unique(size); + read_buffer = std::make_unique_for_overwrite(size); connection->Read(fh, offset, {read_buffer.get(), size}, *this); #else connection->Read(fh, offset, size, *this); diff --git a/src/queue/Queue.cxx b/src/queue/Queue.cxx index c496f6e1e..d14c039a0 100644 --- a/src/queue/Queue.cxx +++ b/src/queue/Queue.cxx @@ -147,7 +147,7 @@ Queue::MovePostion(unsigned from, unsigned to) noexcept void Queue::MoveRange(unsigned start, unsigned end, unsigned to) noexcept { - const auto tmp = std::make_unique(end - start); + const auto tmp = std::make_unique_for_overwrite(end - start); // Copy the original block [start,end-1] for (unsigned i = start; i < end; i++) diff --git a/src/tag/ApeLoader.cxx b/src/tag/ApeLoader.cxx index 4bfede2bc..24c330b99 100644 --- a/src/tag/ApeLoader.cxx +++ b/src/tag/ApeLoader.cxx @@ -50,7 +50,7 @@ try { remaining -= sizeof(footer); assert(remaining > 10); - auto buffer = std::make_unique(remaining); + auto buffer = std::make_unique_for_overwrite(remaining); is.ReadFull(lock, {buffer.get(), remaining}); /* read tags */ diff --git a/src/tag/Id3Load.cxx b/src/tag/Id3Load.cxx index 85dc1cf43..277a799a1 100644 --- a/src/tag/Id3Load.cxx +++ b/src/tag/Id3Load.cxx @@ -47,7 +47,7 @@ try { /* we have enough data already */ return UniqueId3Tag(id3_tag_parse(query_buffer, tag_size)); - auto tag_buffer = std::make_unique(tag_size); + auto tag_buffer = std::make_unique_for_overwrite(tag_size); /* copy the start of the tag we already have to the allocated buffer */ @@ -182,7 +182,7 @@ try { /* too large, don't allocate so much memory */ return nullptr; - auto buffer = std::make_unique(size); + auto buffer = std::make_unique_for_overwrite(size); is.ReadFull(lock, std::as_writable_bytes(std::span{buffer.get(), size})); return UniqueId3Tag(id3_tag_parse(buffer.get(), size));