diff --git a/repertory/librepertory/include/file_manager/open_file.hpp b/repertory/librepertory/include/file_manager/open_file.hpp index 15722c6f..42a101c1 100644 --- a/repertory/librepertory/include/file_manager/open_file.hpp +++ b/repertory/librepertory/include/file_manager/open_file.hpp @@ -78,7 +78,7 @@ private: void download_chunk(std::size_t chunk, bool skip_active, bool should_reset); void download_range(std::size_t start_chunk_index, - std::size_t end_chunk_index_inclusive, bool should_reset); + std::size_t end_chunk_index, bool should_reset); void set_modified(); diff --git a/repertory/librepertory/src/file_manager/open_file.cpp b/repertory/librepertory/src/file_manager/open_file.cpp index 23866263..ae157c34 100644 --- a/repertory/librepertory/src/file_manager/open_file.cpp +++ b/repertory/librepertory/src/file_manager/open_file.cpp @@ -208,11 +208,10 @@ void open_file::download_chunk(std::size_t chunk, bool skip_active, } void open_file::download_range(std::size_t start_chunk_index, - std::size_t end_chunk_index_inclusive, - bool should_reset) { - for (std::size_t chunk = start_chunk_index; - chunk <= end_chunk_index_inclusive; chunk++) { - download_chunk(chunk, false, should_reset); + std::size_t end_chunk_index, bool should_reset) { + for (std::size_t chunk_index = start_chunk_index; + chunk_index <= end_chunk_index; ++chunk_index) { + download_chunk(chunk_index, false, should_reset); if (get_api_error() != api_error::success) { return; } @@ -571,6 +570,11 @@ auto open_file::write(std::uint64_t write_offset, const data_buffer &data, return api_error::os_error; } + for (std::size_t chunk_index = start_chunk_index; + chunk_index <= end_chunk_index; ++chunk_index) { + read_state_.set(chunk_idx); + } + reset_timeout(); return api_error::success; });