From 51d63f0e8377026210b9085d176d7dd5d2193381 Mon Sep 17 00:00:00 2001 From: Christian Kieschnick Date: Fri, 4 Jan 2019 12:28:36 +0100 Subject: [PATCH] Fixed GCC issues for const initialization Fixed issues reported by GCC for initialization of const variables --- src/keeshare/ShareObserver.cpp | 6 +++--- tests/TestSharing.cpp | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/keeshare/ShareObserver.cpp b/src/keeshare/ShareObserver.cpp index edebd3062..e30fd0966 100644 --- a/src/keeshare/ShareObserver.cpp +++ b/src/keeshare/ShareObserver.cpp @@ -80,7 +80,7 @@ QPair check(QByteArray& data, certificate = sign.certificate; auto key = sign.certificate.sshKey(); key.openKey(QString()); - const auto signer = Signature{}; + const auto signer = Signature{}; if (!signer.verify(data, sign.signature, key)) { qCritical("Invalid signature for sharing container %s.", qPrintable(reference.path)); return {Invalid, KeeShareSettings::Certificate()}; @@ -428,8 +428,8 @@ ShareObserver::Result ShareObserver::importInsecureContainerInto(const KeeShareS } auto foreign = KeeShare::foreign(); - auto own = KeeShare::own(); - static KeeShareSettings::Sign sign; // invalid sign + const auto own = KeeShare::own(); + const auto sign = KeeShareSettings::Sign{}; // invalid sign auto trust = check(payload, reference, own.certificate, foreign.certificates, sign); switch(trust.first) { case UntrustedForever: diff --git a/tests/TestSharing.cpp b/tests/TestSharing.cpp index ecbb30311..78f37f15f 100644 --- a/tests/TestSharing.cpp +++ b/tests/TestSharing.cpp @@ -108,34 +108,34 @@ void TestSharing::testNullObjects() const QString empty; QXmlStreamReader reader(empty); - const KeeShareSettings::Key nullKey = {}; + const auto nullKey = KeeShareSettings::Key{}; QVERIFY(nullKey.isNull()); - const KeeShareSettings::Key xmlKey = KeeShareSettings::Key::deserialize(reader); + const auto xmlKey = KeeShareSettings::Key::deserialize(reader); QVERIFY(xmlKey.isNull()); - const KeeShareSettings::Certificate certificate = {}; + const auto certificate = KeeShareSettings::Certificate{}; QVERIFY(certificate.isNull()); - const KeeShareSettings::Certificate xmlCertificate = KeeShareSettings::Certificate::deserialize(reader); + const auto xmlCertificate = KeeShareSettings::Certificate::deserialize(reader); QVERIFY(xmlCertificate.isNull()); - const KeeShareSettings::Own own = {}; + const auto own = KeeShareSettings::Own{}; QVERIFY(own.isNull()); - const KeeShareSettings::Own xmlOwn = KeeShareSettings::Own::deserialize(empty); + const auto xmlOwn = KeeShareSettings::Own::deserialize(empty); QVERIFY(xmlOwn.isNull()); - const KeeShareSettings::Active active = {}; + const auto active = KeeShareSettings::Active{}; QVERIFY(active.isNull()); - const KeeShareSettings::Active xmlActive = KeeShareSettings::Active::deserialize(empty); + const auto xmlActive = KeeShareSettings::Active::deserialize(empty); QVERIFY(xmlActive.isNull()); - const KeeShareSettings::Foreign foreign = {}; + const auto foreign = KeeShareSettings::Foreign{}; QVERIFY(foreign.certificates.isEmpty()); - const KeeShareSettings::Foreign xmlForeign = KeeShareSettings::Foreign::deserialize(empty); + const auto xmlForeign = KeeShareSettings::Foreign::deserialize(empty); QVERIFY(xmlForeign.certificates.isEmpty()); - const KeeShareSettings::Reference reference = {}; + const auto reference = KeeShareSettings::Reference{}; QVERIFY(reference.isNull()); - const KeeShareSettings::Reference xmlReference = KeeShareSettings::Reference::deserialize(empty); + const auto xmlReference = KeeShareSettings::Reference::deserialize(empty); QVERIFY(xmlReference.isNull()); }