\#10 Address compiler warnings

This commit is contained in:
2023-10-30 10:54:35 -05:00
parent b137b57dbc
commit 8cf19e0594
5 changed files with 22 additions and 31 deletions

View File

@ -103,13 +103,13 @@ void file_manager::open_file::download_chunk(std::size_t chunk,
reset_timeout();
}
unique_recur_mutex_lock file_lock(file_mtx_);
unique_recur_mutex_lock download_lock(file_mtx_);
if ((get_api_error() == api_error::success) && (chunk < read_state_.size()) &&
not read_state_[chunk]) {
if (active_downloads_.find(chunk) != active_downloads_.end()) {
if (not skip_active) {
auto active_download = active_downloads_.at(chunk);
file_lock.unlock();
download_lock.unlock();
active_download->wait();
}
@ -129,7 +129,7 @@ void file_manager::open_file::download_chunk(std::size_t chunk,
read_state_.count());
active_downloads_[chunk] = std::make_shared<download>();
file_lock.unlock();
download_lock.unlock();
if (should_reset) {
reset_timeout();
@ -486,7 +486,7 @@ auto file_manager::open_file::close() -> bool {
}
void file_manager::open_file::update_background_reader(std::size_t read_chunk) {
recur_mutex_lock file_lock(file_mtx_);
recur_mutex_lock reader_lock(file_mtx_);
read_chunk_index_ = read_chunk;
if (not reader_thread_ && not stop_requested_) {
@ -533,11 +533,11 @@ auto file_manager::open_file::write(std::uint64_t write_offset,
return api_error::success;
}
unique_recur_mutex_lock file_lock(file_mtx_);
unique_recur_mutex_lock write_lock(file_mtx_);
if (stop_requested_) {
return api_error::download_stopped;
}
file_lock.unlock();
write_lock.unlock();
const auto start_chunk_index =
static_cast<std::size_t>(write_offset / chunk_size_);
@ -552,7 +552,7 @@ auto file_manager::open_file::write(std::uint64_t write_offset,
return get_api_error();
}
file_lock.lock();
write_lock.lock();
if ((write_offset + data.size()) > fsi_.size) {
auto res = resize(write_offset + data.size());
if (res != api_error::success) {