From 43b88c7110143422458ada1e1832de4b30fa87e1 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 28 Apr 2026 16:50:31 +0000 Subject: [PATCH] Reduce build warnings and enable Qt build --- build-aux/m4/ax_boost_base.m4 | 12 ++++++------ depends/config.site.in | 2 +- src/agrarian-cli.cpp | 4 ++-- src/amount.h | 1 + src/base58.cpp | 5 +++-- src/compressor.cpp | 6 ++++-- src/crypto/scrypt.cpp | 3 ++- src/leveldb/port/port_posix.cc | 6 ++++-- src/leveldb/util/logging.cc | 2 +- src/lightzagrthread.cpp | 2 +- src/masternode.h | 1 + src/primitives/transaction.cpp | 2 ++ src/primitives/transaction.h | 1 + src/protocol.cpp | 2 +- src/qt/addresstablemodel.cpp | 16 +++++++++------- src/qt/agrarian.cpp | 4 ++-- src/qt/bantablemodel.cpp | 6 ++++-- src/qt/bitcoinamountfield.cpp | 6 +++++- src/qt/bitcoingui.cpp | 4 ++++ src/qt/guiutil.cpp | 7 +++++++ src/qt/optionsmodel.cpp | 8 ++++---- src/qt/paymentserver.cpp | 13 ++++++++----- src/qt/peertablemodel.cpp | 6 ++++-- src/qt/privacydialog.cpp | 4 ---- src/qt/receivecoinsdialog.cpp | 3 +-- src/qt/receiverequestdialog.cpp | 29 ++++++++++++++++++++++++++++- src/qt/recentrequeststablemodel.cpp | 3 ++- src/qt/splashscreen.cpp | 16 ++++++++++++++++ src/qt/trafficgraphwidget.cpp | 1 + src/qt/transactiondesc.cpp | 4 ++-- src/qt/transactionrecord.cpp | 2 +- src/qt/transactiontablemodel.cpp | 6 ++++-- src/qt/transactionview.cpp | 19 ++++++++++--------- src/qt/utilitydialog.h | 2 +- src/qt/walletmodel.cpp | 4 ++-- src/script/script.h | 1 + src/script/standard.cpp | 2 +- src/txmempool.h | 1 + src/util.cpp | 2 +- src/wallet/rpcdump.cpp | 2 -- src/wallet/rpcwallet.cpp | 10 +++++----- src/wallet/wallet.cpp | 5 ++--- src/zagr/accumulators.cpp | 16 ++++++++-------- 43 files changed, 164 insertions(+), 87 deletions(-) diff --git a/build-aux/m4/ax_boost_base.m4 b/build-aux/m4/ax_boost_base.m4 index 650c94fa..5e68ee45 100644 --- a/build-aux/m4/ax_boost_base.m4 +++ b/build-aux/m4/ax_boost_base.m4 @@ -122,7 +122,7 @@ if test "x$want_boost" = "xyes"; then dnl this location ist chosen if boost libraries are installed with the --layout=system option dnl or if you install boost with RPM if test "$ac_boost_path" != ""; then - BOOST_CPPFLAGS="-I$ac_boost_path/include" + BOOST_CPPFLAGS="-isystem $ac_boost_path/include" for ac_boost_path_tmp in $libsubdirs; do if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp" @@ -136,7 +136,7 @@ if test "x$want_boost" = "xyes"; then if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir" - BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" + BOOST_CPPFLAGS="-isystem $ac_boost_path_tmp/include" break; fi done @@ -193,12 +193,12 @@ if test "x$want_boost" = "xyes"; then _version=$_version_tmp fi VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" + BOOST_CPPFLAGS="-isystem $ac_boost_path/include/boost-$VERSION_UNDERSCORE" done dnl if nothing found search for layout used in Windows distributions if test -z "$BOOST_CPPFLAGS"; then if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then - BOOST_CPPFLAGS="-I$ac_boost_path" + BOOST_CPPFLAGS="-isystem $ac_boost_path" fi fi fi @@ -218,7 +218,7 @@ if test "x$want_boost" = "xyes"; then done VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" + BOOST_CPPFLAGS="-isystem $best_path/include/boost-$VERSION_UNDERSCORE" if test "$ac_boost_lib_path" = ""; then for libsubdir in $libsubdirs ; do if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi @@ -238,7 +238,7 @@ if test "x$want_boost" = "xyes"; then V_CHECK=`expr $stage_version_shorten \>\= $_version` if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) - BOOST_CPPFLAGS="-I$BOOST_ROOT" + BOOST_CPPFLAGS="-isystem $BOOST_ROOT" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" fi fi diff --git a/depends/config.site.in b/depends/config.site.in index e6337520..4aafba7f 100644 --- a/depends/config.site.in +++ b/depends/config.site.in @@ -62,7 +62,7 @@ if test -z "@allow_host_packages@"; then export PKGCONFIG_LIBDIR= fi -CPPFLAGS="-I$depends_prefix/include/ $CPPFLAGS" +CPPFLAGS="-isystem $depends_prefix/include/ $CPPFLAGS" LDFLAGS="-L$depends_prefix/lib $LDFLAGS" if test -n "@CC@" -a -z "${CC}"; then diff --git a/src/agrarian-cli.cpp b/src/agrarian-cli.cpp index 3ab90bfd..7626b356 100644 --- a/src/agrarian-cli.cpp +++ b/src/agrarian-cli.cpp @@ -246,8 +246,8 @@ int CommandLineRPC(int argc, char* argv[]) const UniValue reply = CallRPC(strMethod, params); // Parse reply - const UniValue& result = find_value(reply, "result"); - const UniValue& error = find_value(reply, "error"); + const UniValue result = find_value(reply, "result"); + const UniValue error = find_value(reply, "error"); if (!error.isNull()) { // Error diff --git a/src/amount.h b/src/amount.h index 6922e858..1cbf993f 100644 --- a/src/amount.h +++ b/src/amount.h @@ -29,6 +29,7 @@ public: explicit CFeeRate(const CAmount& _nSatoshisPerK) : nSatoshisPerK(_nSatoshisPerK) {} CFeeRate(const CAmount& nFeePaid, size_t nSize); CFeeRate(const CFeeRate& other) { nSatoshisPerK = other.nSatoshisPerK; } + CFeeRate& operator=(const CFeeRate& other) = default; CAmount GetFee(size_t size) const; // unit returned is satoshis CAmount GetFeePerK() const { return GetFee(1000); } // satoshis-per-1000-bytes diff --git a/src/base58.cpp b/src/base58.cpp index 996baf40..ca81bdbd 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -8,6 +8,7 @@ #include "hash.h" #include "uint256.h" +#include #include #include #include @@ -270,7 +271,7 @@ CTxDestination CBitcoinAddress::Get() const if (!IsValid()) return CNoDestination(); uint160 id; - memcpy(&id, &vchData[0], 20); + std::copy(vchData.begin(), vchData.end(), id.begin()); if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)) return CKeyID(id); else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS)) @@ -284,7 +285,7 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)) return false; uint160 id; - memcpy(&id, &vchData[0], 20); + std::copy(vchData.begin(), vchData.end(), id.begin()); keyID = CKeyID(id); return true; } diff --git a/src/compressor.cpp b/src/compressor.cpp index 903a0074..8d4baf9b 100644 --- a/src/compressor.cpp +++ b/src/compressor.cpp @@ -10,10 +10,12 @@ #include "pubkey.h" #include "script/standard.h" +#include + bool CScriptCompressor::IsToKeyID(CKeyID& hash) const { if (script.size() == 25 && script[0] == OP_DUP && script[1] == OP_HASH160 && script[2] == 20 && script[23] == OP_EQUALVERIFY && script[24] == OP_CHECKSIG) { - memcpy(&hash, &script[3], 20); + std::copy(script.begin() + 3, script.begin() + 23, hash.begin()); return true; } return false; @@ -22,7 +24,7 @@ bool CScriptCompressor::IsToKeyID(CKeyID& hash) const bool CScriptCompressor::IsToScriptID(CScriptID& hash) const { if (script.size() == 23 && script[0] == OP_HASH160 && script[1] == 20 && script[22] == OP_EQUAL) { - memcpy(&hash, &script[2], 20); + std::copy(script.begin() + 2, script.begin() + 22, hash.begin()); return true; } return false; diff --git a/src/crypto/scrypt.cpp b/src/crypto/scrypt.cpp index 67552b7a..dbdbb27f 100644 --- a/src/crypto/scrypt.cpp +++ b/src/crypto/scrypt.cpp @@ -167,7 +167,8 @@ PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt, } /* Clean PShctx, since we never called _Final on it. */ - memset(&PShctx, 0, sizeof(HMAC_SHA256_CTX)); + PShctx.ictx.Reset(); + PShctx.octx.Reset(); } static inline uint32_t diff --git a/src/leveldb/port/port_posix.cc b/src/leveldb/port/port_posix.cc index ec39e921..897fc961 100644 --- a/src/leveldb/port/port_posix.cc +++ b/src/leveldb/port/port_posix.cc @@ -55,8 +55,10 @@ void InitOnce(OnceType* once, void (*initializer)()) { bool HasAcceleratedCRC32C() { #if (defined(__x86_64__) || defined(__i386__)) && defined(__GNUC__) - unsigned int eax, ebx, ecx, edx; - __get_cpuid(1, &eax, &ebx, &ecx, &edx); + unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0; + if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) == 0) { + return false; + } return (ecx & (1 << 20)) != 0; #else return false; diff --git a/src/leveldb/util/logging.cc b/src/leveldb/util/logging.cc index db6160c8..40c9058e 100644 --- a/src/leveldb/util/logging.cc +++ b/src/leveldb/util/logging.cc @@ -55,7 +55,7 @@ bool ConsumeDecimalNumber(Slice* in, uint64_t* val) { const int delta = (c - '0'); static const uint64_t kMaxUint64 = ~static_cast(0); if (v > kMaxUint64/10 || - (v == kMaxUint64/10 && delta > kMaxUint64%10)) { + (v == kMaxUint64/10 && static_cast(delta) > kMaxUint64%10)) { // Overflow return false; } diff --git a/src/lightzagrthread.cpp b/src/lightzagrthread.cpp index f8c78cf8..0ba95402 100644 --- a/src/lightzagrthread.cpp +++ b/src/lightzagrthread.cpp @@ -59,7 +59,7 @@ void CLightWorker::ThreadLightZAGRSimplified() { heightStop ); - } catch (NotEnoughMintsException e) { + } catch (const NotEnoughMintsException& e) { LogPrintStr(std::string("ThreadLightZAGRSimplified: ") + e.message + "\n"); rejectWork(genWit, blockHeight, NOT_ENOUGH_MINTS); continue; diff --git a/src/masternode.h b/src/masternode.h index d033fa09..48373c26 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -47,6 +47,7 @@ public: CMasternodePing(); CMasternodePing(CTxIn& newVin); + CMasternodePing(const CMasternodePing& other) = default; ADD_SERIALIZE_METHODS; diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index 14f4e890..fc37470b 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -159,6 +159,8 @@ CTransaction::CTransaction(const CMutableTransaction &tx) : nVersion(tx.nVersion UpdateHash(); } +CTransaction::CTransaction(const CTransaction &tx) : hash(tx.hash), nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime) { } + CTransaction& CTransaction::operator=(const CTransaction &tx) { *const_cast(&nVersion) = tx.nVersion; *const_cast*>(&vin) = tx.vin; diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 7e6b0a26..b6e350e0 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -226,6 +226,7 @@ public: /** Convert a CMutableTransaction into a CTransaction. */ CTransaction(const CMutableTransaction &tx); + CTransaction(const CTransaction& tx); CTransaction& operator=(const CTransaction& tx); ADD_SERIALIZE_METHODS; diff --git a/src/protocol.cpp b/src/protocol.cpp index 3b81a519..bd8e1c44 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -51,7 +51,7 @@ CMessageHeader::CMessageHeader(const char* pszCommand, unsigned int nMessageSize { memcpy(pchMessageStart, Params().MessageStart(), MESSAGE_START_SIZE); memset(pchCommand, 0, sizeof(pchCommand)); - strncpy(pchCommand, pszCommand, COMMAND_SIZE); + memcpy(pchCommand, pszCommand, strnlen(pszCommand, COMMAND_SIZE)); nMessageSize = nMessageSizeIn; nChecksum = 0; } diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 6b3e7a0d..f1ca7f77 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -13,6 +13,8 @@ #include "wallet/wallet.h" #include "askpassphrasedialog.h" +#include + #include #include @@ -82,7 +84,7 @@ public: cachedAddressTable.clear(); { LOCK(wallet->cs_wallet); - for (const PAIRTYPE(CTxDestination, CAddressBookData) & item : wallet->mapAddressBook) { + for (const auto& item : wallet->mapAddressBook) { const CBitcoinAddress& address = item.first; bool fMine = IsMine(*wallet, address.Get()); AddressTableEntry::Type addressType = translateTransactionType( @@ -96,15 +98,15 @@ public: // qLowerBound() and qUpperBound() require our cachedAddressTable list to be sorted in asc order // Even though the map is already sorted this re-sorting step is needed because the originating map // is sorted by binary address, not by base58() address. - qSort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan()); + std::sort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan()); } void updateEntry(const QString& address, const QString& label, bool isMine, const QString& purpose, int status) { // Find address / label in model - QList::iterator lower = qLowerBound( + QList::iterator lower = std::lower_bound( cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan()); - QList::iterator upper = qUpperBound( + QList::iterator upper = std::upper_bound( cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan()); int lowerIndex = (lower - cachedAddressTable.begin()); int upperIndex = (upper - cachedAddressTable.begin()); @@ -145,9 +147,9 @@ public: void updateEntry(const QString &pubCoin, const QString &isUsed, int status) { // Find address / label in model - QList::iterator lower = qLowerBound( + QList::iterator lower = std::lower_bound( cachedAddressTable.begin(), cachedAddressTable.end(), pubCoin, AddressTableEntryLessThan()); - QList::iterator upper = qUpperBound( + QList::iterator upper = std::upper_bound( cachedAddressTable.begin(), cachedAddressTable.end(), pubCoin, AddressTableEntryLessThan()); int lowerIndex = (lower - cachedAddressTable.begin()); bool inModel = (lower != upper); @@ -317,7 +319,7 @@ QVariant AddressTableModel::headerData(int section, Qt::Orientation orientation, Qt::ItemFlags AddressTableModel::flags(const QModelIndex& index) const { if (!index.isValid()) - return 0; + return Qt::ItemFlags(); AddressTableEntry* rec = static_cast(index.internalPointer()); Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; diff --git a/src/qt/agrarian.cpp b/src/qt/agrarian.cpp index 0bd243c2..37ddce40 100644 --- a/src/qt/agrarian.cpp +++ b/src/qt/agrarian.cpp @@ -357,7 +357,7 @@ void BitcoinApplication::createWindow(const NetworkStyle* networkStyle) void BitcoinApplication::createSplashScreen(const NetworkStyle* networkStyle) { - SplashScreen* splash = new SplashScreen(0, networkStyle); + SplashScreen* splash = new SplashScreen(Qt::WindowFlags(), networkStyle); // We don't hold a direct pointer to the splash screen after creation, so use // Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually. splash->setAttribute(Qt::WA_DeleteOnClose); @@ -502,7 +502,6 @@ int main(int argc, char* argv[]) Q_INIT_RESOURCE(agrarian_locale); Q_INIT_RESOURCE(agrarian); - BitcoinApplication app(argc, argv); #if QT_VERSION > 0x050100 // Generate high-dpi pixmaps QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); @@ -513,6 +512,7 @@ int main(int argc, char* argv[]) #ifdef Q_OS_MAC QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif + BitcoinApplication app(argc, argv); // Register meta types used for QMetaObject::invokeMethod qRegisterMetaType(); diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp index 5bc703d0..fd48522a 100644 --- a/src/qt/bantablemodel.cpp +++ b/src/qt/bantablemodel.cpp @@ -12,6 +12,8 @@ #include "sync.h" #include "utiltime.h" +#include + #include #include @@ -63,7 +65,7 @@ public: if (sortColumn >= 0) // sort cachedBanlist (use stable sort to prevent rows jumping around unneceesarily) - qStableSort(cachedBanlist.begin(), cachedBanlist.end(), BannedNodeLessThan(sortColumn, sortOrder)); + std::stable_sort(cachedBanlist.begin(), cachedBanlist.end(), BannedNodeLessThan(sortColumn, sortOrder)); } int size() const @@ -147,7 +149,7 @@ QVariant BanTableModel::headerData(int section, Qt::Orientation orientation, int Qt::ItemFlags BanTableModel::flags(const QModelIndex &index) const { if(!index.isValid()) - return 0; + return Qt::ItemFlags(); Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; return retval; diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index c9dd9fe9..b49b59d2 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -98,7 +98,11 @@ public: const QFontMetrics fm(fontMetrics()); int h = lineEdit()->minimumSizeHint().height(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + int w = fm.horizontalAdvance(BitcoinUnits::format(BitcoinUnits::AGR, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways)); +#else int w = fm.width(BitcoinUnits::format(BitcoinUnits::AGR, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways)); +#endif w += 2; // cursor blinking space QStyleOptionSpinBox opt; @@ -159,7 +163,7 @@ protected: StepEnabled stepEnabled() const { - StepEnabled rv = 0; + StepEnabled rv = StepEnabled(); if (isReadOnly()) // Disable steps when AmountSpinBox is read-only return StepNone; if (text().isEmpty()) // Allow step-up with empty field diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 6a38ffb5..b42219dd 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1283,7 +1283,11 @@ void BitcoinGUI::updateTorIcon() bool tor_enabled = clientModel->getTorInfo(ip_port); if (tor_enabled) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + if (labelTorIcon->pixmap(Qt::ReturnByValue).isNull()) { +#else if (labelTorIcon->pixmap() == 0) { +#endif QString ip_port_q = QString::fromStdString(ip_port); labelTorIcon->setPixmap(QIcon(":/icons/onion").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); labelTorIcon->setToolTip(tr("Tor is enabled: %1").arg(ip_port_q)); diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 0989f2fd..5c38c0e8 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -52,7 +52,9 @@ #include #include #include +#include #include +#include #include #include // for Qt::mightBeRichText #include @@ -787,7 +789,12 @@ void restoreWindowGeometry(const QString& strSetting, const QSize& defaultSize, QSize size = settings.value(strSetting + "Size", defaultSize).toSize(); if (!pos.x() && !pos.y()) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QScreen* screenHandle = QGuiApplication::primaryScreen(); + QRect screen = screenHandle ? screenHandle->geometry() : QRect(QPoint(), size); +#else QRect screen = QApplication::desktop()->screenGeometry(); +#endif pos.setX((screen.width() - size.width()) / 2); pos.setY((screen.height() - size.height()) / 2); } diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 56a76606..46cb7e22 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -219,12 +219,12 @@ QVariant OptionsModel::data(const QModelIndex& index, int role) const return settings.value("fUseProxy", false); case ProxyIP: { // contains IP at index 0 and port at index 1 - QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); + QStringList strlIpPort = settings.value("addrProxy").toString().split(":", Qt::SkipEmptyParts); return strlIpPort.at(0); } case ProxyPort: { // contains IP at index 0 and port at index 1 - QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); + QStringList strlIpPort = settings.value("addrProxy").toString().split(":", Qt::SkipEmptyParts); return strlIpPort.at(1); } @@ -308,7 +308,7 @@ bool OptionsModel::setData(const QModelIndex& index, const QVariant& value, int break; case ProxyIP: { // contains current IP at index 0 and current port at index 1 - QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); + QStringList strlIpPort = settings.value("addrProxy").toString().split(":", Qt::SkipEmptyParts); // if that key doesn't exist or has a changed IP if (!settings.contains("addrProxy") || strlIpPort.at(0) != value.toString()) { // construct new value from new IP and current port @@ -319,7 +319,7 @@ bool OptionsModel::setData(const QModelIndex& index, const QVariant& value, int } break; case ProxyPort: { // contains current IP at index 0 and current port at index 1 - QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); + QStringList strlIpPort = settings.value("addrProxy").toString().split(":", Qt::SkipEmptyParts); // if that key doesn't exist or has a changed port if (!settings.contains("addrProxy") || strlIpPort.at(1) != value.toString()) { // construct new value from current IP and new port diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 627c7cb6..2c84e07f 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -129,9 +130,11 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store) if (certFile != "-system-") { certList = QSslCertificate::fromPath(certFile); // Use those certificates when fetching payment requests, too: - QSslSocket::setDefaultCaCertificates(certList); + QSslConfiguration sslConfiguration = QSslConfiguration::defaultConfiguration(); + sslConfiguration.setCaCertificates(certList); + QSslConfiguration::setDefaultConfiguration(sslConfiguration); } else - certList = QSslSocket::systemCaCertificates(); + certList = QSslConfiguration::systemCaCertificates(); int nRootCerts = 0; const QDateTime currentTime = QDateTime::currentDateTime(); @@ -372,7 +375,7 @@ void PaymentServer::handleURIOrFile(const QString& s) if (uri.hasQueryItem("r")) // payment request URI { QByteArray temp; - temp.append(uri.queryItemValue("r")); + temp.append(uri.queryItemValue("r").toUtf8()); QString decoded = QUrl::fromPercentEncoding(temp); QUrl fetchUrl(decoded, QUrl::StrictMode); @@ -507,7 +510,7 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins QList > sendingTos = request.getPayTo(); QStringList addresses; - foreach (const PAIRTYPE(CScript, CAmount) & sendingTo, sendingTos) { + for (const auto& sendingTo : sendingTos) { // Extract and check destination addresses CTxDestination dest; if (ExtractDestination(sendingTo.first, dest)) { @@ -597,7 +600,7 @@ void PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipien } } - int length = payment.ByteSize(); + int length = static_cast(payment.ByteSizeLong()); netRequest.setHeader(QNetworkRequest::ContentLengthHeader, length); QByteArray serData(length, '\0'); if (payment.SerializeToArray(serData.data(), length)) { diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index aa97dc89..1378e9db 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -12,6 +12,8 @@ #include "net.h" #include "sync.h" +#include + #include #include #include @@ -83,7 +85,7 @@ public: if (sortColumn >= 0) // sort cacheNodeStats (use stable sort to prevent rows jumping around unneceesarily) - qStableSort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder)); + std::stable_sort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder)); // build index map mapNodeRows.clear(); @@ -185,7 +187,7 @@ QVariant PeerTableModel::headerData(int section, Qt::Orientation orientation, in Qt::ItemFlags PeerTableModel::flags(const QModelIndex& index) const { if (!index.isValid()) - return 0; + return Qt::ItemFlags(); Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; return retval; diff --git a/src/qt/privacydialog.cpp b/src/qt/privacydialog.cpp index 50da8060..8436b61a 100644 --- a/src/qt/privacydialog.cpp +++ b/src/qt/privacydialog.cpp @@ -706,10 +706,6 @@ void PrivacyDialog::setBalance(const CAmount& balance, const CAmount& unconfirme } } CAmount matureZerocoinBalance = zerocoinBalance - unconfirmedZerocoinBalance - immatureZerocoinBalance; - CAmount nLockedBalance = 0; - if (walletModel) { - nLockedBalance = walletModel->getLockedBalance(); - } ui->labelzAvailableAmount->setText(QString::number(zerocoinBalance/COIN) + QString(" zAGR ")); ui->labelzAvailableAmount_2->setText(QString::number(matureZerocoinBalance/COIN) + QString(" zAGR ")); diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 6e03738c..9daca9bf 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -255,7 +255,7 @@ void ReceiveCoinsDialog::copyColumnToClipboard(int column) return; // correct for selection mode ContiguousSelection QModelIndex firstIndex = selection.at(0); - GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString()); + GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.sibling(firstIndex.row(), column), Qt::EditRole).toString()); } // context menu @@ -300,4 +300,3 @@ void ReceiveCoinsDialog::receiveAddressUsed() clear(); } } - diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index bcaab800..46035ee9 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -40,14 +40,26 @@ QRImageWidget::QRImageWidget(QWidget* parent) : QLabel(parent), contextMenu(0) QImage QRImageWidget::exportImage() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + const QPixmap pixmapValue = pixmap(Qt::ReturnByValue); + if (pixmapValue.isNull()) + return QImage(); + return pixmapValue.toImage().scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE); +#else if (!pixmap()) return QImage(); return pixmap()->toImage().scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE); +#endif } void QRImageWidget::mousePressEvent(QMouseEvent* event) { - if (event->button() == Qt::LeftButton && pixmap()) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + const bool hasPixmap = !pixmap(Qt::ReturnByValue).isNull(); +#else + const bool hasPixmap = pixmap(); +#endif + if (event->button() == Qt::LeftButton && hasPixmap) { event->accept(); QMimeData* mimeData = new QMimeData; mimeData->setImageData(exportImage()); @@ -62,8 +74,13 @@ void QRImageWidget::mousePressEvent(QMouseEvent* event) void QRImageWidget::saveImage() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + if (pixmap(Qt::ReturnByValue).isNull()) + return; +#else if (!pixmap()) return; +#endif QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Image (*.png)"), NULL); if (!fn.isEmpty()) { exportImage().save(fn); @@ -72,15 +89,25 @@ void QRImageWidget::saveImage() void QRImageWidget::copyImage() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + if (pixmap(Qt::ReturnByValue).isNull()) + return; +#else if (!pixmap()) return; +#endif QApplication::clipboard()->setImage(exportImage()); } void QRImageWidget::contextMenuEvent(QContextMenuEvent* event) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + if (pixmap(Qt::ReturnByValue).isNull()) + return; +#else if (!pixmap()) return; +#endif contextMenu->exec(event->globalPos()); } diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index c5fdc66f..78f65135 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -11,6 +11,7 @@ #include "optionsmodel.h" #include "streams.h" +#include RecentRequestsTableModel::RecentRequestsTableModel(CWallet* wallet, WalletModel* parent) : walletModel(parent) { @@ -198,7 +199,7 @@ void RecentRequestsTableModel::addNewRequest(RecentRequestEntry& recipient) void RecentRequestsTableModel::sort(int column, Qt::SortOrder order) { - qSort(list.begin(), list.end(), RecentRequestEntryLessThan(column, order)); + std::sort(list.begin(), list.end(), RecentRequestEntryLessThan(column, order)); emit dataChanged(index(0, 0, QModelIndex()), index(list.size() - 1, NUMBER_OF_COLUMNS - 1, QModelIndex())); } diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index e6ca9025..d6453846 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -20,7 +20,9 @@ #include #include #include +#include #include +#include SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle) : QWidget(0, f), curAlignment(0) { @@ -52,7 +54,11 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle) // check font size and drawing with pixPaint.setFont(QFont(font, 28 * fontFactor)); QFontMetrics fm = pixPaint.fontMetrics(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + int titleTextWidth = fm.horizontalAdvance(titleText); +#else int titleTextWidth = fm.width(titleText); +#endif if (titleTextWidth > 160) { // strange font rendering, Arial probably not found fontFactor = 0.75; @@ -79,7 +85,11 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle) boldFont.setWeight(QFont::Bold); pixPaint.setFont(boldFont); fm = pixPaint.fontMetrics(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + int titleAddTextWidth = fm.horizontalAdvance(titleAddText); +#else int titleAddTextWidth = fm.width(titleAddText); +#endif pixPaint.drawText(pixmap.width() - titleAddTextWidth - 10, pixmap.height() - 25, titleAddText); } @@ -92,7 +102,13 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle) QRect r(QPoint(), pixmap.size()); resize(r.size()); setFixedSize(r.size()); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QScreen* screenHandle = QGuiApplication::primaryScreen(); + QRect screen = screenHandle ? screenHandle->geometry() : QRect(QPoint(), r.size()); + move(screen.center() - r.center()); +#else move(QApplication::desktop()->screenGeometry().center() - r.center()); +#endif subscribeToCoreSignals(); } diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index 29757c11..099cccdc 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index a6f2cb53..49e0573e 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -254,14 +254,14 @@ QString TransactionDesc::toHTML(CWallet* wallet, CWalletTx& wtx, TransactionReco strHTML += "" + tr("Output index") + ": " + QString::number(rec->getOutputIndex()) + "
"; // Message from normal agrarian:URI (agrarian:XyZ...?message=example) - foreach (const PAIRTYPE(string, string) & r, wtx.vOrderForm) + for (const auto& r : wtx.vOrderForm) if (r.first == "Message") strHTML += "
" + tr("Message") + ":
" + GUIUtil::HtmlEscape(r.second, true) + "
"; // // PaymentRequest info: // - foreach (const PAIRTYPE(string, string) & r, wtx.vOrderForm) { + for (const auto& r : wtx.vOrderForm) { if (r.first == "PaymentRequest") { PaymentRequestPlus req; req.parse(QByteArray::fromRawData(r.second.data(), r.second.size())); diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 6624f082..d17d93d7 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -217,7 +217,7 @@ QList TransactionRecord::decomposeTransaction(const CWallet* if (fAllToMe > mine) fAllToMe = mine; } - if (fAllFromMeDenom && fAllToMeDenom && nFromMe * nToMe) { + if (fAllFromMeDenom && fAllToMeDenom && nFromMe && nToMe) { parts.append(TransactionRecord(hash, nTime, TransactionRecord::ObfuscationDenominate, "", -nDebit, nCredit)); parts.last().involvesWatchAddress = false; // maybe pass to TransactionRecord as constructor argument } else if (fAllFromMe && fAllToMe) { diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index de375492..885bcc46 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -20,6 +20,8 @@ #include "util.h" #include "wallet/wallet.h" +#include + #include #include #include @@ -95,9 +97,9 @@ public: qDebug() << "TransactionTablePriv::updateWallet : " + QString::fromStdString(hash.ToString()) + " " + QString::number(status); // Find bounds of this transaction in model - QList::iterator lower = qLowerBound( + QList::iterator lower = std::lower_bound( cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan()); - QList::iterator upper = qUpperBound( + QList::iterator upper = std::upper_bound( cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan()); int lowerIndex = (lower - cachedWallet.begin()); int upperIndex = (upper - cachedWallet.begin()); diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index a12c765d..21c98555 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -230,7 +231,7 @@ void TransactionView::setModel(WalletModel* model) if (model->getOptionsModel()) { // Add third party transaction URLs to context menu - QStringList listUrls = model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts); + QStringList listUrls = model->getOptionsModel()->getThirdPartyTxUrls().split("|", Qt::SkipEmptyParts); for (int i = 0; i < listUrls.size(); ++i) { QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); if (!host.isEmpty()) { @@ -275,30 +276,30 @@ void TransactionView::chooseDate(int idx) break; case Today: transactionProxyModel->setDateRange( - QDateTime(current), + QDateTime(current, QTime(0, 0)), TransactionFilterProxy::MAX_DATE); break; case ThisWeek: { // Find last Monday QDate startOfWeek = current.addDays(-(current.dayOfWeek() - 1)); transactionProxyModel->setDateRange( - QDateTime(startOfWeek), + QDateTime(startOfWeek, QTime(0, 0)), TransactionFilterProxy::MAX_DATE); } break; case ThisMonth: transactionProxyModel->setDateRange( - QDateTime(QDate(current.year(), current.month(), 1)), + QDateTime(QDate(current.year(), current.month(), 1), QTime(0, 0)), TransactionFilterProxy::MAX_DATE); break; case LastMonth: transactionProxyModel->setDateRange( - QDateTime(QDate(current.year(), current.month() - 1, 1)), - QDateTime(QDate(current.year(), current.month(), 1))); + QDateTime(QDate(current.year(), current.month() - 1, 1), QTime(0, 0)), + QDateTime(QDate(current.year(), current.month(), 1), QTime(0, 0))); break; case ThisYear: transactionProxyModel->setDateRange( - QDateTime(QDate(current.year(), 1, 1)), + QDateTime(QDate(current.year(), 1, 1), QTime(0, 0)), TransactionFilterProxy::MAX_DATE); break; case Range: @@ -565,8 +566,8 @@ void TransactionView::dateRangeChanged() if (!transactionProxyModel) return; transactionProxyModel->setDateRange( - QDateTime(dateFrom->date()), - QDateTime(dateTo->date()).addDays(1)); + QDateTime(dateFrom->date(), QTime(0, 0)), + QDateTime(dateTo->date(), QTime(0, 0)).addDays(1)); } void TransactionView::focusTransaction(const QModelIndex& idx) diff --git a/src/qt/utilitydialog.h b/src/qt/utilitydialog.h index 2e0d7f50..ad85d2ab 100644 --- a/src/qt/utilitydialog.h +++ b/src/qt/utilitydialog.h @@ -44,7 +44,7 @@ class ShutdownWindow : public QWidget Q_OBJECT public: - ShutdownWindow(QWidget* parent = 0, Qt::WindowFlags f = 0); + ShutdownWindow(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags()); static void showShutdownWindow(BitcoinGUI* window); protected: diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 0a8cddfd..5a97e974 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -769,8 +769,8 @@ void WalletModel::listZerocoinMints(std::set& setMints, bool fUnusedO void WalletModel::loadReceiveRequests(std::vector& vReceiveRequests) { LOCK(wallet->cs_wallet); - for (const PAIRTYPE(CTxDestination, CAddressBookData) & item : wallet->mapAddressBook) - for (const PAIRTYPE(std::string, std::string) & item2 : item.second.destdata) + for (const auto& item : wallet->mapAddressBook) + for (const auto& item2 : item.second.destdata) if (item2.first.size() > 2 && item2.first.substr(0, 2) == "rr") // receive request vReceiveRequests.push_back(item2.second); } diff --git a/src/script/script.h b/src/script/script.h index c5b623bf..81b02bf3 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -377,6 +377,7 @@ protected: public: CScript() { } CScript(const CScript& b) : std::vector(b.begin(), b.end()) { } + CScript& operator=(const CScript& b) = default; CScript(const_iterator pbegin, const_iterator pend) : std::vector(pbegin, pend) { } CScript(const unsigned char* pbegin, const unsigned char* pend) : std::vector(pbegin, pend) { } diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 06f757e6..34bbbdfc 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -85,7 +85,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vectortx; } double GetPriority(unsigned int currentHeight) const; diff --git a/src/util.cpp b/src/util.cpp index d5391dba..5ea37ffb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -557,7 +557,7 @@ bool TryCreateDirectory(const boost::filesystem::path& p) { try { return boost::filesystem::create_directory(p); - } catch (boost::filesystem::filesystem_error) { + } catch (const boost::filesystem::filesystem_error&) { if (!boost::filesystem::exists(p) || !boost::filesystem::is_directory(p)) throw; } diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 93751fe6..1f4872c8 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -29,8 +29,6 @@ using namespace std; -void EnsureWalletIsUnlocked(bool fAllowAnonOnly); - std::string static EncodeDumpTime(int64_t nTime) { return DateTimeStrFormat("%Y-%m-%dT%H:%M:%SZ", nTime); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 257d95ad..de3cf0c1 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -68,7 +68,7 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) entry.push_back(Pair("walletconflicts", conflicts)); entry.push_back(Pair("time", wtx.GetTxTime())); entry.push_back(Pair("timereceived", (int64_t)wtx.nTimeReceived)); - for (const PAIRTYPE(string, string) & item : wtx.mapValue) + for (const auto& item : wtx.mapValue) entry.push_back(Pair(item.first, item.second)); } @@ -312,7 +312,7 @@ UniValue getaddressesbyaccount(const UniValue& params, bool fHelp) // Find all addresses that have the given account UniValue ret(UniValue::VARR); - for (const PAIRTYPE(CBitcoinAddress, CAddressBookData) & item : pwalletMain->mapAddressBook) { + for (const auto& item : pwalletMain->mapAddressBook) { const CBitcoinAddress& address = item.first; const string& strName = item.second.name; if (strName == strAccount) @@ -1109,7 +1109,7 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts) // Reply UniValue ret(UniValue::VARR); map mapAccountTally; - for (const PAIRTYPE(CBitcoinAddress, CAddressBookData) & item : pwalletMain->mapAddressBook) { + for (const auto& item : pwalletMain->mapAddressBook) { const CBitcoinAddress& address = item.first; const string& strAccount = item.second.name; map::iterator it = mapTally.find(address); @@ -1483,7 +1483,7 @@ UniValue listaccounts(const UniValue& params, bool fHelp) includeWatchonly = includeWatchonly | ISMINE_WATCH_ONLY; map mapAccountBalances; - for (const PAIRTYPE(CTxDestination, CAddressBookData) & entry : pwalletMain->mapAddressBook) { + for (const auto& entry : pwalletMain->mapAddressBook) { if (IsMine(*pwalletMain, entry.first) & includeWatchonly) // This address belongs to me mapAccountBalances[entry.second.name] = 0; } @@ -1515,7 +1515,7 @@ UniValue listaccounts(const UniValue& params, bool fHelp) mapAccountBalances[entry.strAccount] += entry.nCreditDebit; UniValue ret(UniValue::VOBJ); - for (const PAIRTYPE(string, CAmount) & accountBalance : mapAccountBalances) { + for (const auto& accountBalance : mapAccountBalances) { ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second))); } return ret; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 74d9dab5..5a6d83d4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2673,7 +2673,7 @@ bool CWallet::DelAddressBook(const CTxDestination& address) if (fFileBacked) { // Delete destdata tuples associated with address std::string strAddress = CBitcoinAddress(address).ToString(); - for (const PAIRTYPE(string, string) & item : mapAddressBook[address].destdata) { + for (const auto& item : mapAddressBook[address].destdata) { CWalletDB(strWalletFile).EraseDestData(strAddress, item.first); } } @@ -2959,7 +2959,7 @@ set CWallet::GetAccountAddresses(string strAccount) const { LOCK(cs_wallet); set result; - for (const PAIRTYPE(CTxDestination, CAddressBookData) & item : mapAddressBook) { + for (const auto& item : mapAddressBook) { const CTxDestination& address = item.first; const string& strName = item.second.name; if (strName == strAccount) @@ -5075,4 +5075,3 @@ void CWallet::PrecomputeSpends() MilliSleep(5000); } } - diff --git a/src/zagr/accumulators.cpp b/src/zagr/accumulators.cpp index bb6e9323..359736e6 100644 --- a/src/zagr/accumulators.cpp +++ b/src/zagr/accumulators.cpp @@ -592,11 +592,11 @@ bool GenerateAccumulatorWitness(CoinWitnessData* coinWitness, AccumulatorMap& ma return true; // TODO: I know that could merge all of this exception but maybe it's not really good.. think if we should have a different treatment for each one - } catch (searchMintHeightException e) { + } catch (const searchMintHeightException& e) { return error("%s: searchMintHeightException: %s", __func__, e.message); - } catch (ChecksumInDbNotFoundException e) { + } catch (const ChecksumInDbNotFoundException& e) { return error("%s: ChecksumInDbNotFoundException: %s", __func__, e.message); - } catch (GetPubcoinException e) { + } catch (const GetPubcoinException& e) { return error("%s: GetPubcoinException: %s", __func__, e.message); } } @@ -790,9 +790,9 @@ bool CalculateAccumulatorWitnessFor( return true; - } catch (ChecksumInDbNotFoundException e) { + } catch (const ChecksumInDbNotFoundException& e) { return error("%s: ChecksumInDbNotFoundException: %s", __func__, e.message); - } catch (GetPubcoinException e) { + } catch (const GetPubcoinException& e) { return error("%s: GetPubcoinException: %s", __func__, e.message); } } @@ -877,11 +877,11 @@ bool GenerateAccumulatorWitness( return true; // TODO: I know that could merge all of this exception but maybe it's not really good.. think if we should have a different treatment for each one - } catch (searchMintHeightException e) { + } catch (const searchMintHeightException& e) { return error("%s: searchMintHeightException: %s", __func__, e.message); - } catch (ChecksumInDbNotFoundException e) { + } catch (const ChecksumInDbNotFoundException& e) { return error("%s: ChecksumInDbNotFoundException: %s", __func__, e.message); - } catch (GetPubcoinException e) { + } catch (const GetPubcoinException& e) { return error("%s: GetPubcoinException: %s", __func__, e.message); } }