From ee8632786980b9718dcc9c8484932c68b0bb9b5a Mon Sep 17 00:00:00 2001 From: eelke Date: Sun, 23 Feb 2025 16:52:39 +0100 Subject: [PATCH] Fix warnings and dependencies --- README.md | 3 +- pglab/ConnectionController.cpp | 2 +- pglab/catalog/models/DatabasesTableModel.cpp | 5 ++- pglab/querytool/QueryTool.cpp | 4 ++- pglablib/ASyncDBConnection.cpp | 3 +- pglablib/ParamListJson.cpp | 33 ++++++++++---------- pglablib/ParamListModel.cpp | 2 +- pglablib/codebuilder/StringEscapeRule.cpp | 8 ++--- pglablib/utils/HumanReadableBytes.cpp | 2 +- pglablib/utils/KeyStrengthener.cpp | 8 ++--- pgsql/Pgsql_Connection.h | 4 --- pgsql/Pgsql_Params.cpp | 2 +- pgsql/Pgsql_Value.cpp | 3 +- pgsql/pgsql.pro | 2 +- 14 files changed, 38 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 3e38338..bdf5ea0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -The program is build with Qt 6.3 using QtCreator and the Visual Studio 2019 C++ compiler. +The program is build with Qt 6.8 using QtCreator and the Visual Studio 2022 C++ compiler. Only 64-bits builds are actively maintained. [Documentation](https://eelke.gitlab.io/pgLab/) is generated automatically when a commit is tagged. It also includes releasenotes. @@ -8,7 +8,6 @@ The release notes use collected from git using [reno](https://docs.openstack.org - boost - botan -- fmt - googletest - libpq diff --git a/pglab/ConnectionController.cpp b/pglab/ConnectionController.cpp index d361650..642441d 100644 --- a/pglab/ConnectionController.cpp +++ b/pglab/ConnectionController.cpp @@ -207,7 +207,7 @@ bool ConnectionController::retrieveFromPasswordManager(const std::string &passwo password = m_passwordManager->decrypt(password_id, enc_password); return true; } - catch (const PasswordManagerException &ex) + catch (const PasswordManagerException &) { return false; } diff --git a/pglab/catalog/models/DatabasesTableModel.cpp b/pglab/catalog/models/DatabasesTableModel.cpp index 3ab64af..ac10ec5 100644 --- a/pglab/catalog/models/DatabasesTableModel.cpp +++ b/pglab/catalog/models/DatabasesTableModel.cpp @@ -5,7 +5,6 @@ #include "catalog/PgDatabaseCatalog.h" #include "catalog/PgDatabaseContainer.h" #include "catalog/PgAuthIdContainer.h" -#include "ResultTableModelUtil.h" #include #include "Pgsql_Connection.h" @@ -31,7 +30,7 @@ void DatabasesTableModel::setDatabaseList(std::shared_ptr(databases.size() - 1)); } StartLoadDatabaseSizes(std::move(oidIndex)); } @@ -90,7 +89,7 @@ QVariant DatabasesTableModel::headerData(int section, Qt::Orientation orientatio int DatabasesTableModel::rowCount(const QModelIndex &) const { int result = 0; - result = databases.size(); + result = static_cast(databases.size()); return result; } diff --git a/pglab/querytool/QueryTool.cpp b/pglab/querytool/QueryTool.cpp index f9addcb..eaae545 100644 --- a/pglab/querytool/QueryTool.cpp +++ b/pglab/querytool/QueryTool.cpp @@ -586,7 +586,9 @@ void QueryTool::generateCode() { QString command = getCommand(); if (resultList.empty()) { - QMessageBox::question(this, "pglab", tr("Please execute the query first"), QMessageBox::Ok); + QMessageBox::question(this, "pglab", tr("Please execute the query first"), + QMessageBox::StandardButtons(QMessageBox::Ok), + QMessageBox::Ok); } if (resultList.size() == 1) { std::shared_ptr dbres = resultList[0]->GetPgsqlResult(); diff --git a/pglablib/ASyncDBConnection.cpp b/pglablib/ASyncDBConnection.cpp index 396b345..dfe05c9 100644 --- a/pglablib/ASyncDBConnection.cpp +++ b/pglablib/ASyncDBConnection.cpp @@ -263,7 +263,7 @@ void ASyncDBConnectionThread::waitForAndSendCommand() { WaitHandleList whl; auto wait_result_new_command = whl.add(m_commandQueue.m_newEvent); - auto wait_result_stop = whl.add(m_stopEvent); + whl.add(m_stopEvent); DWORD res = MsgWaitForMultipleObjectsEx( whl.count(), // _In_ DWORD nCount, @@ -284,7 +284,6 @@ void ASyncDBConnectionThread::doNewCommand() // get command from top of queue (but leave it in the queue, we need the callback) if (! m_commandQueue.m_queue.empty()) { const Command &command = m_commandQueue.m_queue.front(); - bool query_send = false; if (command.params.empty()) m_connection.sendQuery(command.command.c_str()); else diff --git a/pglablib/ParamListJson.cpp b/pglablib/ParamListJson.cpp index afd55fb..6f96b60 100644 --- a/pglablib/ParamListJson.cpp +++ b/pglablib/ParamListJson.cpp @@ -8,12 +8,12 @@ Json::Value ParamToJson(const Param ¶m) return v; } -Param ParamFromJson(const Json::Value &json) -{ - Param p; +// Param ParamFromJson(const Json::Value &json) +// { +// Param p; - return p; -} +// return p; +// } Json::Value ParamListToJson(const t_ParamList &list) { @@ -24,14 +24,15 @@ Json::Value ParamListToJson(const t_ParamList &list) return root; } -t_ParamList ParamListFromJson(const Json::Value &json) -{ - t_ParamList result; - if (json.isArray()) { - result.reserve(json.size()); - for (auto &e : json) { - result.push_back(ParamFromJson(e)); - } - } - return result; -} +// t_ParamList ParamListFromJson(const Json::Value &json) +// { +// t_ParamList result; +// if (json.isArray()) { +// result.reserve(json.size()); +// for (auto &e : json) { +// result.push_back(ParamFromJson(e)); +// } +// } +// return result; +//} + diff --git a/pglablib/ParamListModel.cpp b/pglablib/ParamListModel.cpp index f21b4e9..655e4dd 100644 --- a/pglablib/ParamListModel.cpp +++ b/pglablib/ParamListModel.cpp @@ -41,7 +41,7 @@ QVariant ParamListModel::headerData(int section, Qt::Orientation orientation, in int ParamListModel::rowCount(const QModelIndex &) const { - return m_paramList.size(); + return static_cast(m_paramList.size()); } int ParamListModel::columnCount(const QModelIndex &) const diff --git a/pglablib/codebuilder/StringEscapeRule.cpp b/pglablib/codebuilder/StringEscapeRule.cpp index 074ca68..7018ac5 100644 --- a/pglablib/codebuilder/StringEscapeRule.cpp +++ b/pglablib/codebuilder/StringEscapeRule.cpp @@ -2,7 +2,7 @@ /** */ -QString convert(QStringView in, ConvertToNumericEscape conversion, NumericEscapeFormat format, QString prefix) -{ - return "TODO"; -} +// QString convert(QStringView in, ConvertToNumericEscape conversion, NumericEscapeFormat format, QString prefix) +// { +// return "TODO"; +// } diff --git a/pglablib/utils/HumanReadableBytes.cpp b/pglablib/utils/HumanReadableBytes.cpp index 9294d11..c9314e8 100644 --- a/pglablib/utils/HumanReadableBytes.cpp +++ b/pglablib/utils/HumanReadableBytes.cpp @@ -42,7 +42,7 @@ std::string HumanReadableBytes(uint64_t bytes) }; std::ostringstream out; - for (int i = 0; i < (sizeof(scales) / sizeof(scale)); ++i) + for (unsigned int i = 0; i < (sizeof(scales) / sizeof(scale)); ++i) { if (bytes >= scales[i].scale) { diff --git a/pglablib/utils/KeyStrengthener.cpp b/pglablib/utils/KeyStrengthener.cpp index 48d681f..29428bc 100644 --- a/pglablib/utils/KeyStrengthener.cpp +++ b/pglablib/utils/KeyStrengthener.cpp @@ -44,10 +44,10 @@ void KeyStrengthener::saveParams(SQLiteConnection &db, const QString &table_name + "VALUES(?1, ?2, ?3, ?4, ?5, ?6, ?7)"); stmt.Bind(1, 1); stmt.Bind(2, "Scrypt"); - stmt.Bind(3, i1); - stmt.Bind(4, i2); - stmt.Bind(5, i3); - stmt.Bind(6, m_keySize); + stmt.Bind(3, (int)i1); + stmt.Bind(4, (int)i2); + stmt.Bind(5, (int)i3); + stmt.Bind(6, (int)m_keySize); stmt.Bind(7, salt_str); stmt.Step(); } diff --git a/pgsql/Pgsql_Connection.h b/pgsql/Pgsql_Connection.h index 3deeef2..2b1c973 100644 --- a/pgsql/Pgsql_Connection.h +++ b/pgsql/Pgsql_Connection.h @@ -5,12 +5,8 @@ #include #include -#include -#include #include -#include - #include "Pgsql_Canceller.h" #include "Pgsql_Result.h" diff --git a/pgsql/Pgsql_Params.cpp b/pgsql/Pgsql_Params.cpp index 933d3c4..d59c55b 100644 --- a/pgsql/Pgsql_Params.cpp +++ b/pgsql/Pgsql_Params.cpp @@ -116,7 +116,7 @@ void Params::clear() void Params::appendValues(const t_paramValues &r) { const int n = static_cast(r.size()); - const int ofs = m_paramValues.size(); + const size_t ofs = m_paramValues.size(); m_paramValues.reserve(ofs + n); for (int i = 0; i < n; ++i) { if (r[i]) { diff --git a/pgsql/Pgsql_Value.cpp b/pgsql/Pgsql_Value.cpp index d0df733..79a7c25 100644 --- a/pgsql/Pgsql_Value.cpp +++ b/pgsql/Pgsql_Value.cpp @@ -128,7 +128,7 @@ Value::operator int64_t() const if (m_val == nullptr) return 0LL; - const int len = std::strlen(m_val); + const size_t len = std::strlen(m_val); if (len > 0) { char *endptr = nullptr; int64_t result = std::strtoll(m_val, &endptr, 10); @@ -136,7 +136,6 @@ Value::operator int64_t() const return result; } throw std::runtime_error("Value conversion to int64_t failed"); -// return std::strtoll(m_val, nullptr, 10); } Value::operator bool() const diff --git a/pgsql/pgsql.pro b/pgsql/pgsql.pro index 5f38ffd..02c21a5 100644 --- a/pgsql/pgsql.pro +++ b/pgsql/pgsql.pro @@ -7,7 +7,7 @@ CONFIG += staticlib QT += core -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets sql +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = pgsql TEMPLATE = lib