From 4ae2b684caeec013fe7bec155ca01a4523b59166 Mon Sep 17 00:00:00 2001 From: Calin Culianu Date: Tue, 31 Dec 2019 19:29:48 +0200 Subject: [PATCH] Linux compile fixups and Qt 5.11 fixups --- App.cpp | 15 +++++++++++++-- Controller.cpp | 4 ++-- Storage.cpp | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/App.cpp b/App.cpp index a6b0507..962cb50 100644 --- a/App.cpp +++ b/App.cpp @@ -359,17 +359,28 @@ void App::parseArgs() if (options->sslCert.isNull()) throw BadArgs(QString("Unable to read ssl certificate from %1. Please make sure the file is readable and " "contains a valid certificate in PEM format.").arg(cert)); - else - Log() << "Loaded SSL certificate: " << options->sslCert.subjectDisplayName() << " " + else { + QString name; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) + // Was added Qt 5.12+ + name = options->sslCert.subjectDisplayName(); +#else + name = options->sslCert.subjectInfo(QSslCertificate::Organization).join(", "); +#endif + Log() << "Loaded SSL certificate: " << name << " " << options->sslCert.subjectInfo(QSslCertificate::SubjectInfo::EmailAddress).join(",") //<< " self-signed: " << (options->sslCert.isSelfSigned() ? "YES" : "NO") << " expires: " << (options->sslCert.expiryDate().toString("ddd MMMM d yyyy hh:mm:ss")); + } if (options->sslKey.isNull()) throw BadArgs(QString("Unable to read private key from %1. Please make sure the file is readable and " "contains a single RSA private key in PEM format.").arg(key)); constexpr auto KeyAlgoStr = [](QSsl::KeyAlgorithm a) { switch (a) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) + // This was added in Qt 5.12+ case QSsl::KeyAlgorithm::Dh: return "DH"; +#endif case QSsl::KeyAlgorithm::Ec: return "EC"; case QSsl::KeyAlgorithm::Dsa: return "DSA"; case QSsl::KeyAlgorithm::Rsa: return "RSA"; diff --git a/Controller.cpp b/Controller.cpp index 0160ca1..ad50506 100644 --- a/Controller.cpp +++ b/Controller.cpp @@ -1318,7 +1318,7 @@ auto Controller::debug(const StatsParams &p) const -> Stats // from StatsMixin m["tx_hash"] = Util::ToHexFast(item.hash); m["height"] = item.height; if (item.fee.has_value()) - m["fee"] = item.fee.value() / item.fee.value().satoshi(); + m["fee"] = qlonglong(item.fee.value() / item.fee.value().satoshi()); l.push_back(m); } ret["sh_debug"] = l; @@ -1332,7 +1332,7 @@ auto Controller::debug(const StatsParams &p) const -> Stats // from StatsMixin m["tx_hash"] = Util::ToHexFast(item.hash); m["height"] = item.height; m["tx_pos"] = item.tx_pos; - m["value"] = item.value / item.value.satoshi(); + m["value"] = qlonglong(item.value / item.value.satoshi()); l.push_back(m); } ret["unspent_debug"] = l; diff --git a/Storage.cpp b/Storage.cpp index 27d1815..cc1ee3b 100644 --- a/Storage.cpp +++ b/Storage.cpp @@ -1714,7 +1714,7 @@ auto Storage::listUnspent(const HashX & hashX) const -> UnspentItems rocksdb::Slice key; bool didReserveIota = false; TxNum maxTxNumSeen = 0; - std::list ctxoList; + std::list ctxoList; size_t ctxoListSize = 0; // we do it this way as two separate loops in order to avoid the expensive heightForTxNum lookups below in // the case where the history is huge.