From cc70aadc03999159c5f4cff693d5df453ef9d66f Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 26 Dec 2024 21:09:41 -0600 Subject: [PATCH] refactor --- .../include/file_manager/open_file.hpp | 16 ++++++++-------- .../file_manager/ring_buffer_open_file.hpp | 2 +- .../librepertory/src/file_manager/open_file.cpp | 10 +++++----- .../src/file_manager/ring_buffer_open_file.cpp | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/repertory/librepertory/include/file_manager/open_file.hpp b/repertory/librepertory/include/file_manager/open_file.hpp index b24558a4..502f734d 100644 --- a/repertory/librepertory/include/file_manager/open_file.hpp +++ b/repertory/librepertory/include/file_manager/open_file.hpp @@ -77,10 +77,10 @@ private: stop_type stop_requested_{false}; private: - [[nodiscard]] auto adjust_cache_size(std::uint64_t file_size, bool shrink) - -> api_error; + [[nodiscard]] auto adjust_cache_size(std::uint64_t file_size, + bool shrink) -> api_error; - [[nodiscard]] auto check_allocation() -> api_error; + [[nodiscard]] auto check_start() -> api_error; void download_chunk(std::size_t chunk, bool skip_active, bool should_reset); @@ -110,12 +110,12 @@ public: return true; } - [[nodiscard]] auto native_operation(native_operation_callback callback) - -> api_error override; + [[nodiscard]] auto + native_operation(native_operation_callback callback) -> api_error override; - [[nodiscard]] auto native_operation(std::uint64_t new_file_size, - native_operation_callback callback) - -> api_error override; + [[nodiscard]] auto + native_operation(std::uint64_t new_file_size, + native_operation_callback callback) -> api_error override; void remove(std::uint64_t handle) override; diff --git a/repertory/librepertory/include/file_manager/ring_buffer_open_file.hpp b/repertory/librepertory/include/file_manager/ring_buffer_open_file.hpp index 9bcd14f0..0401e8df 100644 --- a/repertory/librepertory/include/file_manager/ring_buffer_open_file.hpp +++ b/repertory/librepertory/include/file_manager/ring_buffer_open_file.hpp @@ -63,7 +63,7 @@ private: stop_type stop_requested_{false}; private: - [[nodiscard]] auto check_allocation() -> api_error; + [[nodiscard]] auto check_start() -> api_error; auto download_chunk(std::size_t chunk, bool skip_active) -> api_error; diff --git a/repertory/librepertory/src/file_manager/open_file.cpp b/repertory/librepertory/src/file_manager/open_file.cpp index 71f42420..bd23dd4d 100644 --- a/repertory/librepertory/src/file_manager/open_file.cpp +++ b/repertory/librepertory/src/file_manager/open_file.cpp @@ -158,7 +158,7 @@ auto open_file::adjust_cache_size(std::uint64_t file_size, return set_api_error(res); } -auto open_file::check_allocation() -> api_error { +auto open_file::check_start() -> api_error { REPERTORY_USES_FUNCTION_NAME(); unique_recur_mutex_lock file_lock(file_mtx_); @@ -410,7 +410,7 @@ auto open_file::native_operation( return set_api_error(api_error::download_stopped); } - auto res = check_allocation(); + auto res = check_start(); if (res != api_error::success) { return res; } @@ -432,7 +432,7 @@ auto open_file::native_operation( return set_api_error(api_error::download_stopped); } - auto res = check_allocation(); + auto res = check_start(); if (res != api_error::success) { return res; } @@ -548,7 +548,7 @@ auto open_file::read(std::size_t read_size, std::uint64_t read_offset, return api_error::success; } - auto res = check_allocation(); + auto res = check_start(); if (res != api_error::success) { return res; } @@ -711,7 +711,7 @@ auto open_file::write(std::uint64_t write_offset, const data_buffer &data, return set_api_error(api_error::download_stopped); } - auto res = check_allocation(); + auto res = check_start(); if (res != api_error::success) { return res; } diff --git a/repertory/librepertory/src/file_manager/ring_buffer_open_file.cpp b/repertory/librepertory/src/file_manager/ring_buffer_open_file.cpp index 2595c3e2..13c24936 100644 --- a/repertory/librepertory/src/file_manager/ring_buffer_open_file.cpp +++ b/repertory/librepertory/src/file_manager/ring_buffer_open_file.cpp @@ -86,7 +86,7 @@ auto ring_buffer_open_file::can_handle_file(std::uint64_t file_size, return file_size >= (static_cast(ring_size) * chunk_size); } -auto ring_buffer_open_file::check_allocation() -> api_error { +auto ring_buffer_open_file::check_start() -> api_error { REPERTORY_USES_FUNCTION_NAME(); if (nf_) { @@ -304,7 +304,7 @@ auto ring_buffer_open_file::read(std::size_t read_size, read_offset = read_offset - (begin_chunk * chunk_size_); unique_mutex_lock read_lock(read_mtx_); - auto res = check_allocation(); + auto res = check_start(); if (res != api_error::success) { return res; }