From 0f6f34ca2fca81734544b32e8dbc8ee32122bb65 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 25 Mar 2018 19:18:08 +0200 Subject: Fixed more warnings and then disabled them ..because there is a boatload more to fix. --- common/adaptorfactoryregistry.cpp | 2 +- common/commands.cpp | 2 +- common/domainadaptor.h | 2 +- common/facade.h | 2 +- common/facadefactory.cpp | 2 +- common/genericresource.h | 2 +- common/index.cpp | 2 +- common/listener.cpp | 14 +++++++------- common/listener.h | 2 +- common/resource.cpp | 2 +- common/resourceaccess.cpp | 8 ++++---- common/resourcefacade.cpp | 4 ++-- common/resultprovider.h | 2 +- common/resultset.cpp | 2 +- common/synchronizer.h | 2 +- common/test.cpp | 5 ++--- 16 files changed, 27 insertions(+), 28 deletions(-) (limited to 'common') diff --git a/common/adaptorfactoryregistry.cpp b/common/adaptorfactoryregistry.cpp index 91b5a4c..c302bca 100644 --- a/common/adaptorfactoryregistry.cpp +++ b/common/adaptorfactoryregistry.cpp @@ -34,7 +34,7 @@ using namespace Sink; AdaptorFactoryRegistry &AdaptorFactoryRegistry::instance() { // QMutexLocker locker(&sMutex); - static AdaptorFactoryRegistry *instance = 0; + static AdaptorFactoryRegistry *instance = nullptr; if (!instance) { instance = new AdaptorFactoryRegistry; } diff --git a/common/commands.cpp b/common/commands.cpp index a92b455..0ec2c7b 100644 --- a/common/commands.cpp +++ b/common/commands.cpp @@ -80,7 +80,7 @@ int headerSize() void write(QLocalSocket *device, int messageId, int commandId) { - write(device, messageId, commandId, 0, 0); + write(device, messageId, commandId, nullptr, 0); } static void write(QLocalSocket *device, const char *buffer, uint size) diff --git a/common/domainadaptor.h b/common/domainadaptor.h index f981a1f..bcfc18d 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h @@ -201,7 +201,7 @@ public: return true; } - virtual bool createBuffer(const QSharedPointer &bufferAdaptor, flatbuffers::FlatBufferBuilder &fbb, void const *metadataData = 0, size_t metadataSize = 0) Q_DECL_OVERRIDE + virtual bool createBuffer(const QSharedPointer &bufferAdaptor, flatbuffers::FlatBufferBuilder &fbb, void const *metadataData = nullptr, size_t metadataSize = 0) Q_DECL_OVERRIDE { //TODO rewrite the unterlying functions so we don't have to wrap the bufferAdaptor auto newObject = Sink::ApplicationDomain::ApplicationDomainType("", "", 0, bufferAdaptor); diff --git a/common/facade.h b/common/facade.h index 0ec2e59..33e4b57 100644 --- a/common/facade.h +++ b/common/facade.h @@ -57,7 +57,7 @@ public: * @param adaptorFactory is the adaptor factory used to generate the mappings from domain to resource types and vice versa */ GenericFacade(const ResourceContext &context); - virtual ~GenericFacade(); + virtual ~GenericFacade() Q_DECL_OVERRIDE; static QByteArray bufferTypeForDomainType(); KAsync::Job create(const DomainType &domainObject) Q_DECL_OVERRIDE; diff --git a/common/facadefactory.cpp b/common/facadefactory.cpp index c26c0a1..0657414 100644 --- a/common/facadefactory.cpp +++ b/common/facadefactory.cpp @@ -35,7 +35,7 @@ FacadeFactory::FacadeFactory() FacadeFactory &FacadeFactory::instance() { QMutexLocker locker(&sMutex); - static FacadeFactory *instance = 0; + static FacadeFactory *instance = nullptr; if (!instance) { instance = new FacadeFactory; } diff --git a/common/genericresource.h b/common/genericresource.h index 11ede0c..d34a361 100644 --- a/common/genericresource.h +++ b/common/genericresource.h @@ -37,7 +37,7 @@ class SINK_EXPORT GenericResource : public Resource { public: GenericResource(const Sink::ResourceContext &context, const QSharedPointer &pipeline = QSharedPointer()); - virtual ~GenericResource(); + virtual ~GenericResource() Q_DECL_OVERRIDE; virtual void processCommand(int commandId, const QByteArray &data) Q_DECL_OVERRIDE; virtual void setLowerBoundRevision(qint64 revision) Q_DECL_OVERRIDE; diff --git a/common/index.cpp b/common/index.cpp index 725c28b..a4641bc 100644 --- a/common/index.cpp +++ b/common/index.cpp @@ -48,6 +48,6 @@ QByteArray Index::lookup(const QByteArray &key) { QByteArray result; //We have to create a deep copy, otherwise the returned data may become invalid when the transaction ends. - lookup(key, [&](const QByteArray &value) { result = QByteArray(value.constData(), value.size()); }, [this](const Index::Error &) { }); + lookup(key, [&](const QByteArray &value) { result = QByteArray(value.constData(), value.size()); }, [](const Index::Error &) { }); return result; } diff --git a/common/listener.cpp b/common/listener.cpp index d2cab72..b9426db 100644 --- a/common/listener.cpp +++ b/common/listener.cpp @@ -109,10 +109,10 @@ void Listener::emergencyAbortAllConnections() SinkWarning() << "Sending panic"; client.socket->write("PANIC"); client.socket->waitForBytesWritten(); - disconnect(client.socket, 0, this, 0); + disconnect(client.socket, nullptr, this, nullptr); client.socket->abort(); delete client.socket; - client.socket = 0; + client.socket = nullptr; } } @@ -123,10 +123,10 @@ void Listener::closeAllConnections() { for (Client &client : m_connections) { if (client.socket) { - disconnect(client.socket, 0, this, 0); + disconnect(client.socket, nullptr, this, nullptr); client.socket->close(); delete client.socket; - client.socket = 0; + client.socket = nullptr; } } @@ -363,9 +363,9 @@ bool Listener::processClientBuffer(Client &client) return false; } - const uint messageId = *(uint *)client.commandBuffer.constData(); - const int commandId = *(int *)(client.commandBuffer.constData() + sizeof(uint)); - const uint size = *(uint *)(client.commandBuffer.constData() + sizeof(int) + sizeof(uint)); + const uint messageId = *(const uint *)client.commandBuffer.constData(); + const int commandId = *(const int *)(client.commandBuffer.constData() + sizeof(uint)); + const uint size = *(const uint *)(client.commandBuffer.constData() + sizeof(int) + sizeof(uint)); SinkTrace() << "Received message. Id:" << messageId << " CommandId: " << commandId << " Size: " << size; // TODO: reject messages above a certain size? diff --git a/common/listener.h b/common/listener.h index 38e87da..8a1de8a 100644 --- a/common/listener.h +++ b/common/listener.h @@ -56,7 +56,7 @@ class SINK_EXPORT Listener : public QObject { Q_OBJECT public: - Listener(const QByteArray &resourceName, const QByteArray &resourceType, QObject *parent = 0); + Listener(const QByteArray &resourceName, const QByteArray &resourceType, QObject *parent = nullptr); ~Listener(); void checkForUpgrade(); diff --git a/common/resource.cpp b/common/resource.cpp index 6db5510..cd0c4e0 100644 --- a/common/resource.cpp +++ b/common/resource.cpp @@ -30,7 +30,7 @@ namespace Sink { -Resource::Resource() : QObject(), d(0) +Resource::Resource() : QObject(), d(nullptr) { Q_UNUSED(d); } diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 20bb632..6863193 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp @@ -48,7 +48,7 @@ #include #include -static void queuedInvoke(const std::function &f, QObject *context = 0) +static void queuedInvoke(const std::function &f, QObject *context = nullptr) { auto timer = QSharedPointer::create(); timer->setSingleShot(true); @@ -605,8 +605,8 @@ bool ResourceAccess::processMessageBuffer() } // const uint messageId = *(int*)(d->partialMessageBuffer.constData()); - const int commandId = *(int *)(d->partialMessageBuffer.constData() + sizeof(uint)); - const uint size = *(int *)(d->partialMessageBuffer.constData() + sizeof(int) + sizeof(uint)); + const int commandId = *(const int *)(d->partialMessageBuffer.constData() + sizeof(uint)); + const uint size = *(const int *)(d->partialMessageBuffer.constData() + sizeof(int) + sizeof(uint)); if (size > (uint)(d->partialMessageBuffer.size() - headerSize)) { SinkWarning() << "command too small"; @@ -690,7 +690,7 @@ ResourceAccessFactory::ResourceAccessFactory() ResourceAccessFactory &ResourceAccessFactory::instance() { - static ResourceAccessFactory *instance = 0; + static ResourceAccessFactory *instance = nullptr; if (!instance) { instance = new ResourceAccessFactory; } diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 3dba3e5..7998692 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp @@ -110,7 +110,7 @@ LocalStorageQueryRunner::LocalStorageQueryRunner(const Query &query, }; QObject *guard = new QObject; - mResultProvider->setFetcher([this, query, guard, &configNotifier, matchesTypeAndIds]() { + mResultProvider->setFetcher([this, query, matchesTypeAndIds]() { const auto entries = mConfigStore.getEntries(); for (const auto &res : entries.keys()) { const auto type = entries.value(res); @@ -371,7 +371,7 @@ QPair, typename Sink::ResultEmitterinsert(resource.identifier()); } }; - runner->setStatusUpdater([this, runner, monitoredResources, ctx, monitorResource](ApplicationDomain::SinkAccount &account) { + runner->setStatusUpdater([runner, monitoredResources, ctx, monitorResource](ApplicationDomain::SinkAccount &account) { Query query{Query::LiveQuery}; query.filter(account.identifier()); query.request() diff --git a/common/resultprovider.h b/common/resultprovider.h index 87d650f..4655432 100644 --- a/common/resultprovider.h +++ b/common/resultprovider.h @@ -343,7 +343,7 @@ class AggregatingResultEmitter : public ResultEmitter public: typedef QSharedPointer> Ptr; - ~AggregatingResultEmitter() + ~AggregatingResultEmitter() Q_DECL_OVERRIDE { } diff --git a/common/resultset.cpp b/common/resultset.cpp index b82b14d..08954c9 100644 --- a/common/resultset.cpp +++ b/common/resultset.cpp @@ -103,7 +103,7 @@ ResultSet::ReplayResult ResultSet::replaySet(int offset, int batchSize, const Ca skip(offset); int counter = 0; while (!batchSize || (counter < batchSize)) { - const bool ret = next([this, &counter, callback](const ResultSet::Result &result) { + const bool ret = next([&counter, callback](const ResultSet::Result &result) { counter++; callback(result); }); diff --git a/common/synchronizer.h b/common/synchronizer.h index 590b939..ff25a08 100644 --- a/common/synchronizer.h +++ b/common/synchronizer.h @@ -42,7 +42,7 @@ class SINK_EXPORT Synchronizer : public ChangeReplay Q_OBJECT public: Synchronizer(const Sink::ResourceContext &resourceContext); - virtual ~Synchronizer(); + virtual ~Synchronizer() Q_DECL_OVERRIDE; void setup(const std::function &enqueueCommandCallback, MessageQueue &messageQueue); void synchronize(const Sink::QueryBase &query); diff --git a/common/test.cpp b/common/test.cpp index 52d79ca..90dc0b6 100644 --- a/common/test.cpp +++ b/common/test.cpp @@ -113,7 +113,7 @@ public: }); return facade; } - ~TestFacade(){}; + ~TestFacade() Q_DECL_OVERRIDE {}; KAsync::Job create(const T &domainObject) Q_DECL_OVERRIDE { mTestAccount->addEntity(T::Ptr::create(domainObject)); @@ -158,8 +158,7 @@ public: } resultProvider->initialResultSetComplete(true); }); - auto job = KAsync::start([query, resultProvider]() {}); - return qMakePair(job, emitter); + return qMakePair(KAsync::null(), emitter); } Test::TestAccount *mTestAccount; -- cgit v1.2.3