diff --git a/components/core/src/clp/NetworkReader.cpp b/components/core/src/clp/NetworkReader.cpp index 706763362..cdde759c2 100644 --- a/components/core/src/clp/NetworkReader.cpp +++ b/components/core/src/clp/NetworkReader.cpp @@ -128,8 +128,7 @@ NetworkReader::NetworkReader( m_buffer_pool_size{std::max(cMinBufferPoolSize, buffer_pool_size)}, m_buffer_size{std::max(cMinBufferSize, buffer_size)} { for (size_t i = 0; i < m_buffer_pool_size; ++i) { - // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays) - m_buffer_pool.emplace_back(std::make_unique(m_buffer_size)); + m_buffer_pool.emplace_back(m_buffer_size); } m_downloader_thread = std::make_unique(*this, offset, disable_caching); m_downloader_thread->start(); @@ -248,7 +247,10 @@ auto NetworkReader::acquire_empty_buffer() -> void { return; } } - m_curr_downloader_buf.emplace(m_buffer_pool.at(m_curr_downloader_buf_idx).get(), m_buffer_size); + m_curr_downloader_buf.emplace( + m_buffer_pool.at(m_curr_downloader_buf_idx).data(), + m_buffer_size + ); } auto NetworkReader::release_empty_buffer() -> void { @@ -264,7 +266,7 @@ auto NetworkReader::enqueue_filled_buffer() -> void { } std::unique_lock const buffer_resource_lock{m_buffer_resource_mutex}; m_filled_buffer_queue.emplace( - m_buffer_pool.at(m_curr_downloader_buf_idx).get(), + m_buffer_pool.at(m_curr_downloader_buf_idx).data(), m_buffer_size - m_curr_downloader_buf.value().size() ); diff --git a/components/core/src/clp/NetworkReader.hpp b/components/core/src/clp/NetworkReader.hpp index ba581d067..7c808fd4f 100644 --- a/components/core/src/clp/NetworkReader.hpp +++ b/components/core/src/clp/NetworkReader.hpp @@ -17,6 +17,7 @@ #include +#include "Array.hpp" #include "CurlDownloadHandler.hpp" #include "CurlGlobalInstance.hpp" #include "ErrorCode.hpp" @@ -106,7 +107,7 @@ class NetworkReader : public ReaderInterface { ); // Destructor - virtual ~NetworkReader(); + ~NetworkReader() override; // Copy/Move Constructors // These are disabled since this class' synchronization primitives are non-copyable and @@ -330,8 +331,7 @@ class NetworkReader : public ReaderInterface { size_t m_buffer_size{cDefaultBufferSize}; size_t m_curr_downloader_buf_idx{0}; - // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays) - std::vector> m_buffer_pool; + std::vector> m_buffer_pool; std::queue m_filled_buffer_queue; std::optional m_curr_downloader_buf; std::optional m_curr_reader_buf; diff --git a/components/core/tests/test-NetworkReader.cpp b/components/core/tests/test-NetworkReader.cpp index 5a900ced3..cd4b90cc0 100644 --- a/components/core/tests/test-NetworkReader.cpp +++ b/components/core/tests/test-NetworkReader.cpp @@ -11,6 +11,7 @@ #include #include +#include "../src/clp/Array.hpp" #include "../src/clp/CurlDownloadHandler.hpp" #include "../src/clp/CurlGlobalInstance.hpp" #include "../src/clp/ErrorCode.hpp" @@ -65,12 +66,11 @@ auto get_test_input_path_relative_to_tests_dir() -> std::filesystem::path { auto get_content(clp::ReaderInterface& reader, size_t read_buf_size) -> std::vector { std::vector buf; - // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays) - auto const read_buf{std::make_unique(read_buf_size)}; + clp::Array read_buf{read_buf_size}; for (bool has_more_content{true}; has_more_content;) { size_t num_bytes_read{}; - has_more_content = reader.read(read_buf.get(), read_buf_size, num_bytes_read); - std::string_view const view{read_buf.get(), num_bytes_read}; + has_more_content = reader.read(read_buf.data(), read_buf_size, num_bytes_read); + std::string_view const view{read_buf.data(), num_bytes_read}; buf.insert(buf.cend(), view.cbegin(), view.cend()); } return buf;