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

@@ -54,7 +54,7 @@ UCharToUTF8(std::basic_string_view<UChar> src)
/* worst-case estimate */
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;
int32_t dest_length;

View File

@@ -36,8 +36,7 @@ ScanVorbisPicture(StringView value, TagHandler &handler) noexcept
return;
size_t debase64_size = CalculateBase64OutputSize(value.size);
std::unique_ptr<uint8_t[]> debase64_buffer;
debase64_buffer.reset(new uint8_t[debase64_size]);
auto debase64_buffer = std::make_unique<uint8_t[]>(debase64_size);
try {
debase64_size =