diff options
author | saturneric <[email protected]> | 2024-07-26 16:33:09 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-07-26 16:33:09 +0000 |
commit | 3d84beaf22caaf299a3004032402bd94ee4ab886 (patch) | |
tree | a8acaf7c1781641f8254ff9fe3dc3d3d07499868 /src/core/model/GFDataExchanger.cpp | |
parent | feat: remove spdlog and clean up log (diff) | |
download | GpgFrontend-3d84beaf22caaf299a3004032402bd94ee4ab886.tar.gz GpgFrontend-3d84beaf22caaf299a3004032402bd94ee4ab886.zip |
fix: clean up warnings
Diffstat (limited to 'src/core/model/GFDataExchanger.cpp')
-rw-r--r-- | src/core/model/GFDataExchanger.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/model/GFDataExchanger.cpp b/src/core/model/GFDataExchanger.cpp index 1ce03352..d847b65d 100644 --- a/src/core/model/GFDataExchanger.cpp +++ b/src/core/model/GFDataExchanger.cpp @@ -38,7 +38,10 @@ auto GFDataExchanger::Write(const std::byte* buffer, size_t size) -> ssize_t { std::unique_lock<std::mutex> lock(mutex_); try { for (size_t i = 0; i < size; i++) { - if (queue_.size() == queue_max_size_) not_empty_.notify_all(); + if (queue_.size() == static_cast<unsigned long>(queue_max_size_)) { + not_empty_.notify_all(); + } + not_full_.wait(lock, [=] { return queue_.size() < queue_max_size_ || close_; }); if (close_) return -1; @@ -71,7 +74,9 @@ auto GFDataExchanger::Read(std::byte* buffer, size_t size) -> ssize_t { read_bytes++; } - if (queue_.size() < queue_max_size_) not_full_.notify_all(); + if (queue_.size() < static_cast<unsigned long>(queue_max_size_)) { + not_full_.notify_all(); + } return read_bytes; } |