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 | |
parent | feat: remove spdlog and clean up log (diff) | |
download | GpgFrontend-3d84beaf22caaf299a3004032402bd94ee4ab886.tar.gz GpgFrontend-3d84beaf22caaf299a3004032402bd94ee4ab886.zip |
fix: clean up warnings
-rw-r--r-- | src/core/function/gpg/GpgContext.cpp | 9 | ||||
-rw-r--r-- | src/core/model/GFDataExchanger.cpp | 9 | ||||
-rw-r--r-- | src/sdk/GFSDKModule.cpp | 6 | ||||
-rw-r--r-- | src/ui/widgets/FileTreeView.cpp | 2 | ||||
-rw-r--r-- | src/ui/widgets/KeyTable.cpp | 2 |
5 files changed, 16 insertions, 12 deletions
diff --git a/src/core/function/gpg/GpgContext.cpp b/src/core/function/gpg/GpgContext.cpp index 16898375..e0869188 100644 --- a/src/core/function/gpg/GpgContext.cpp +++ b/src/core/function/gpg/GpgContext.cpp @@ -32,6 +32,7 @@ #include <gpgme.h> #include <cassert> +#include <cstddef> #include <mutex> #include "core/function/CoreSignalStation.h" @@ -100,7 +101,7 @@ class GpgContext::Impl { QString pass = "abcdefg\n"; #endif - auto passpahrase_size = pass.size(); + auto passphrase_size = pass.size(); size_t off = 0; do { @@ -108,13 +109,13 @@ class GpgContext::Impl { const char *p_pass = pass.data(); res = gpgme_io_write(fd, &p_pass[off], passpahrase_size - off); #else - res = gpgme_io_write(fd, &pass[off], passpahrase_size - off); + res = gpgme_io_write(fd, &pass[off], passphrase_size - off); #endif if (res > 0) off += res; - } while (res > 0 && off != passpahrase_size); + } while (res > 0 && static_cast<long long>(off) != passphrase_size); res += gpgme_io_write(fd, "\n", 1); - return res == passpahrase_size + 1 + return static_cast<long long>(res) == (passphrase_size + 1) ? 0 : gpgme_error_from_errno(GPG_ERR_CANCELED); } 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; } diff --git a/src/sdk/GFSDKModule.cpp b/src/sdk/GFSDKModule.cpp index c0215a8b..ecc4afd1 100644 --- a/src/sdk/GFSDKModule.cpp +++ b/src/sdk/GFSDKModule.cpp @@ -69,7 +69,7 @@ auto GFModuleListRTChildKeys(const char *namespace_, const char *key, *child_keys = static_cast<char **>(GFAllocateMemory(sizeof(char **) * keys.size())); - for (int i = 0; i < keys.size(); i++) { + for (decltype(keys.size()) i = 0; i < keys.size(); i++) { (*child_keys)[i] = GFStrDup(keys[i]); } @@ -92,8 +92,8 @@ void GFModuleTriggerModuleEventCallback(GFModuleEvent *module_event, } auto GFModuleRetrieveRTValueOrDefaultBool(const char *namespace_, - const char *key, int default_value) - -> const int { + const char *key, + int default_value) -> const int { return static_cast<const int>( GpgFrontend::Module::RetrieveRTValueTypedOrDefault( GFUnStrDup(namespace_), GFUnStrDup(key), diff --git a/src/ui/widgets/FileTreeView.cpp b/src/ui/widgets/FileTreeView.cpp index c40741d4..b9ffbd27 100644 --- a/src/ui/widgets/FileTreeView.cpp +++ b/src/ui/widgets/FileTreeView.cpp @@ -63,8 +63,6 @@ FileTreeView::FileTreeView(QWidget* parent, const QString& target_path) void FileTreeView::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected) { QTreeView::selectionChanged(selected, deselected); - qCDebug(ui, "file tree view selected changed, selected: {}, deselected: {}", - selected.size(), deselected.size()); if (!selected.indexes().empty()) { selected_path_ = dir_model_->filePath(selected.indexes().first()); diff --git a/src/ui/widgets/KeyTable.cpp b/src/ui/widgets/KeyTable.cpp index 76c3bc3c..0254840e 100644 --- a/src/ui/widgets/KeyTable.cpp +++ b/src/ui/widgets/KeyTable.cpp @@ -34,7 +34,7 @@ namespace GpgFrontend::UI { auto KeyTable::GetChecked() const -> KeyIdArgsListPtr { auto ret = std::make_unique<KeyIdArgsList>(); - for (size_t i = 0; i < GetRowCount(); i++) { + for (decltype(GetRowCount()) i = 0; i < GetRowCount(); i++) { if (IsRowChecked(i)) ret->push_back(GetKeyIdByRow(i)); } return ret; |