diff --git a/repertory/librepertory/src/comm/packet/client_pool.cpp b/repertory/librepertory/src/comm/packet/client_pool.cpp index 4f22f1bf..3b2b910f 100644 --- a/repertory/librepertory/src/comm/packet/client_pool.cpp +++ b/repertory/librepertory/src/comm/packet/client_pool.cpp @@ -27,8 +27,6 @@ #include "events/types/service_stop_begin.hpp" #include "events/types/service_stop_end.hpp" #include "utils/error.hpp" -#include -#include namespace repertory { client_pool::pool::work_queue::work_queue() { diff --git a/repertory/repertory_test/src/direct_open_file_test.cpp b/repertory/repertory_test/src/direct_open_file_test.cpp index 4dcdaf39..c858c8c6 100644 --- a/repertory/repertory_test/src/direct_open_file_test.cpp +++ b/repertory/repertory_test/src/direct_open_file_test.cpp @@ -493,42 +493,23 @@ TEST_F(direct_open_file_test, provider_error_is_propagated) { auto test_buffer = build_test_buffer(source_file); - bool fail_once{true}; EXPECT_CALL(provider, read_file_bytes) - .WillRepeatedly( - [test_buffer, &fail_once](std::string_view, std::size_t size, - std::uint64_t offset, data_buffer &data, + .WillRepeatedly([test_buffer](std::string_view, std::size_t /* size */, + std::uint64_t /* offset */, + data_buffer & /* data */, stop_type &stop_requested) -> api_error { - if (stop_requested) { - return api_error::download_stopped; - } - if (fail_once) { - fail_once = false; - return api_error::os_error; - } - std::size_t avail = - (offset < test_buffer.size()) - ? (test_buffer.size() - static_cast(offset)) - : 0U; - std::size_t to_copy = std::min(size, avail); - data.resize(to_copy); - if (to_copy != 0U) { - std::memcpy(data.data(), - test_buffer.data() + static_cast(offset), - to_copy); - } - return api_error::success; - }); + if (stop_requested) { + return api_error::download_stopped; + } + + return api_error::os_error; + }); { direct_open_file file(test_chunk_size, 30U, fsi, provider); data_buffer data{}; EXPECT_EQ(api_error::os_error, file.read(17U, 0U, data)); - - data_buffer data2{}; - EXPECT_EQ(api_error::success, file.read(17U, 0U, data2)); - EXPECT_EQ(std::size_t(17U), data2.size()); } source_file.close();