diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2021-02-16 15:18:07 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2021-02-22 20:53:31 +0100 |
commit | f050979e3d71cbb72a3b4d75f5e9898d81806487 (patch) | |
tree | 4e1498751ed9f3e7b404263cb511ff0cfda0a86a | |
parent | 98b3171bbee84323640be24da230cf1c9b7d5cce (diff) |
Clean-up warnings
Fixed the following warnings:
- empty expression statement has no effect; remove unnecessary ';'
- use of old-style cast
- zero as null pointer constant
- other minor things
Change-Id: Ia672f48d2aa87c59354fc93fd19862f1875e13db
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
20 files changed, 100 insertions, 100 deletions
diff --git a/examples/remoteobjects/plugins/plugin.cpp b/examples/remoteobjects/plugins/plugin.cpp index 5ee35af..bddab06 100644 --- a/examples/remoteobjects/plugins/plugin.cpp +++ b/examples/remoteobjects/plugins/plugin.cpp @@ -63,7 +63,7 @@ // that change on-the-minute yet efficiently sleep the rest // of the time. -QRemoteObjectNode m_client; +static QRemoteObjectNode m_client; class TimeModel : public QObject { @@ -122,8 +122,8 @@ class QExampleQmlPlugin : public QQmlExtensionPlugin public: void initializeEngine(QQmlEngine *engine, const char *uri) override { - Q_UNUSED(engine); - Q_UNUSED(uri); + Q_UNUSED(engine) + Q_UNUSED(uri) Q_ASSERT(uri == QLatin1String("TimeExample")); engine->addImportPath(QStringLiteral("qrc:/qml")); m_client.setRegistryUrl(QUrl(QStringLiteral("local:registry"))); diff --git a/examples/remoteobjects/server/main.cpp b/examples/remoteobjects/server/main.cpp index 10816aa..7eaab06 100644 --- a/examples/remoteobjects/server/main.cpp +++ b/examples/remoteobjects/server/main.cpp @@ -99,6 +99,6 @@ int main(int argc, char *argv[]) MinuteTimer timer; node2.enableRemoting(&timer); - Q_UNUSED(timer); + Q_UNUSED(timer) return app.exec(); } diff --git a/examples/remoteobjects/ssl/sslserver/main.cpp b/examples/remoteobjects/ssl/sslserver/main.cpp index 6c7b8d6..73ec70e 100644 --- a/examples/remoteobjects/ssl/sslserver/main.cpp +++ b/examples/remoteobjects/ssl/sslserver/main.cpp @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) MinuteTimer timer; host.enableRemoting(&timer); - Q_UNUSED(timer); + Q_UNUSED(timer) return app.exec(); } diff --git a/src/remoteobjects/qconnection_qnx_qiodevices.cpp b/src/remoteobjects/qconnection_qnx_qiodevices.cpp index 5e2997c..7dd26bc 100644 --- a/src/remoteobjects/qconnection_qnx_qiodevices.cpp +++ b/src/remoteobjects/qconnection_qnx_qiodevices.cpp @@ -314,7 +314,7 @@ QQnxNativeIo::~QQnxNativeIo() bool QQnxNativeIo::connectToServer(QIODevice::OpenMode openMode) { Q_D(QQnxNativeIo); - Q_UNUSED(openMode); + Q_UNUSED(openMode) if (state() == QAbstractSocket::ConnectedState || state() == QAbstractSocket::ConnectingState) { @@ -455,7 +455,7 @@ bool QQnxNativeIo::waitForBytesWritten(int msecs) //TODO - This method isn't used by Qt Remote Objects, but would //need to be implemented before this class could be used as a //generic QIODevice. - Q_UNUSED(msecs); + Q_UNUSED(msecs) Q_ASSERT(false); return false; } @@ -465,7 +465,7 @@ bool QQnxNativeIo::waitForReadyRead(int msecs) //TODO - This method isn't used by Qt Remote Objects, but would //need to be implemented before this class could be used as a //generic QIODevice. - Q_UNUSED(msecs); + Q_UNUSED(msecs) Q_ASSERT(false); return false; } @@ -557,7 +557,7 @@ qint64 QIOQnxSource::bytesToWrite() const bool QIOQnxSource::open(QIODevice::OpenMode openMode) { - Q_UNUSED(openMode); + Q_UNUSED(openMode) return false; } @@ -596,7 +596,7 @@ bool QIOQnxSource::waitForBytesWritten(int msecs) //TODO - This method isn't used by Qt Remote Objects, but would //need to be implemented before this class could be used as a //generic QIODevice. - Q_UNUSED(msecs); + Q_UNUSED(msecs) Q_ASSERT(false); return false; } @@ -606,7 +606,7 @@ bool QIOQnxSource::waitForReadyRead(int msecs) //TODO - This method isn't used by Qt Remote Objects, but would //need to be implemented before this class could be used as a //generic QIODevice. - Q_UNUSED(msecs); + Q_UNUSED(msecs) Q_ASSERT(false); return false; } diff --git a/src/remoteobjects/qconnection_qnx_server.cpp b/src/remoteobjects/qconnection_qnx_server.cpp index eb4e75f..22e1796 100644 --- a/src/remoteobjects/qconnection_qnx_server.cpp +++ b/src/remoteobjects/qconnection_qnx_server.cpp @@ -118,8 +118,8 @@ bool QQnxNativeServer::waitForNewConnection(int msec, bool *timedOut) //TODO - This method isn't used by Qt Remote Objects, but would //need to be implemented before this class could be used as a //connection server (like QTcpServer or QLocalServer). - Q_UNUSED(msec); - Q_UNUSED(timedOut); + Q_UNUSED(msec) + Q_UNUSED(timedOut) Q_ASSERT(false); return false; } @@ -459,7 +459,7 @@ void QQnxNativeServerPrivate::createSource(int rcvid, uint64_t uid, pid_t toPid) { Q_Q(QQnxNativeServer); #ifndef USE_HAM - Q_UNUSED(toPid); + Q_UNUSED(toPid) #endif auto io = QSharedPointer<QIOQnxSource>(new QIOQnxSource(rcvid)); io->moveToThread(q->thread()); diff --git a/src/remoteobjects/qremoteobjectabstractitemmodeladapter.cpp b/src/remoteobjects/qremoteobjectabstractitemmodeladapter.cpp index a615216..169f180 100644 --- a/src/remoteobjects/qremoteobjectabstractitemmodeladapter.cpp +++ b/src/remoteobjects/qremoteobjectabstractitemmodeladapter.cpp @@ -123,7 +123,7 @@ void QAbstractItemModelSourceAdapter::replicaSetData(const IndexList &index, con Q_ASSERT(modelIndex.isValid()); const bool result = m_model->setData(modelIndex, value, role); Q_ASSERT(result); - Q_UNUSED(result); + Q_UNUSED(result) } DataEntries QAbstractItemModelSourceAdapter::replicaRowRequest(IndexList start, IndexList end, QList<int> roles) diff --git a/src/remoteobjects/qremoteobjectabstractitemmodeladapter_p.h b/src/remoteobjects/qremoteobjectabstractitemmodeladapter_p.h index d789b36..9fc4a60 100644 --- a/src/remoteobjects/qremoteobjectabstractitemmodeladapter_p.h +++ b/src/remoteobjects/qremoteobjectabstractitemmodeladapter_p.h @@ -126,25 +126,25 @@ struct QAbstractItemAdapterSourceAPI : public SourceApiMap , m_name(name) { m_properties[0] = 2; - m_properties[1] = QtPrivate::qtro_property_index<AdapterType>(&AdapterType::availableRoles, static_cast<QList<int> (QObject::*)()>(0),"availableRoles"); - m_properties[2] = QtPrivate::qtro_property_index<AdapterType>(&AdapterType::roleNames, static_cast<QIntHash (QObject::*)()>(0),"roleNames"); + m_properties[1] = QtPrivate::qtro_property_index<AdapterType>(&AdapterType::availableRoles, static_cast<QList<int> (QObject::*)()>(nullptr),"availableRoles"); + m_properties[2] = QtPrivate::qtro_property_index<AdapterType>(&AdapterType::roleNames, static_cast<QIntHash (QObject::*)()>(nullptr),"roleNames"); m_signals[0] = 9; - m_signals[1] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::availableRolesChanged, static_cast<void (QObject::*)()>(0),m_signalArgCount+0,&m_signalArgTypes[0]); - m_signals[2] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::dataChanged, static_cast<void (QObject::*)(IndexList,IndexList,QList<int>)>(0),m_signalArgCount+1,&m_signalArgTypes[1]); - m_signals[3] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::rowsInserted, static_cast<void (QObject::*)(IndexList,int,int)>(0),m_signalArgCount+2,&m_signalArgTypes[2]); - m_signals[4] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::rowsRemoved, static_cast<void (QObject::*)(IndexList,int,int)>(0),m_signalArgCount+3,&m_signalArgTypes[3]); - m_signals[5] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::rowsMoved, static_cast<void (QObject::*)(IndexList,int,int,IndexList,int)>(0),m_signalArgCount+4,&m_signalArgTypes[4]); - m_signals[6] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::currentChanged, static_cast<void (QObject::*)(IndexList,IndexList)>(0),m_signalArgCount+5,&m_signalArgTypes[5]); - m_signals[7] = QtPrivate::qtro_signal_index<ObjectType>(&ObjectType::modelReset, static_cast<void (QObject::*)()>(0),m_signalArgCount+6,&m_signalArgTypes[6]); - m_signals[8] = QtPrivate::qtro_signal_index<ObjectType>(&ObjectType::headerDataChanged, static_cast<void (QObject::*)(Qt::Orientation,int,int)>(0),m_signalArgCount+7,&m_signalArgTypes[7]); - m_signals[9] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::columnsInserted, static_cast<void (QObject::*)(IndexList,int,int)>(0),m_signalArgCount+8,&m_signalArgTypes[8]); + m_signals[1] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::availableRolesChanged, static_cast<void (QObject::*)()>(nullptr),m_signalArgCount+0,&m_signalArgTypes[0]); + m_signals[2] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::dataChanged, static_cast<void (QObject::*)(IndexList,IndexList,QList<int>)>(nullptr),m_signalArgCount+1,&m_signalArgTypes[1]); + m_signals[3] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::rowsInserted, static_cast<void (QObject::*)(IndexList,int,int)>(nullptr),m_signalArgCount+2,&m_signalArgTypes[2]); + m_signals[4] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::rowsRemoved, static_cast<void (QObject::*)(IndexList,int,int)>(nullptr),m_signalArgCount+3,&m_signalArgTypes[3]); + m_signals[5] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::rowsMoved, static_cast<void (QObject::*)(IndexList,int,int,IndexList,int)>(nullptr),m_signalArgCount+4,&m_signalArgTypes[4]); + m_signals[6] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::currentChanged, static_cast<void (QObject::*)(IndexList,IndexList)>(nullptr),m_signalArgCount+5,&m_signalArgTypes[5]); + m_signals[7] = QtPrivate::qtro_signal_index<ObjectType>(&ObjectType::modelReset, static_cast<void (QObject::*)()>(nullptr),m_signalArgCount+6,&m_signalArgTypes[6]); + m_signals[8] = QtPrivate::qtro_signal_index<ObjectType>(&ObjectType::headerDataChanged, static_cast<void (QObject::*)(Qt::Orientation,int,int)>(nullptr),m_signalArgCount+7,&m_signalArgTypes[7]); + m_signals[9] = QtPrivate::qtro_signal_index<AdapterType>(&AdapterType::columnsInserted, static_cast<void (QObject::*)(IndexList,int,int)>(nullptr),m_signalArgCount+8,&m_signalArgTypes[8]); m_methods[0] = 6; - m_methods[1] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaSizeRequest, static_cast<void (QObject::*)(IndexList)>(0),"replicaSizeRequest(IndexList)",m_methodArgCount+0,&m_methodArgTypes[0]); - m_methods[2] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaRowRequest, static_cast<void (QObject::*)(IndexList,IndexList,QList<int>)>(0),"replicaRowRequest(IndexList,IndexList,QList<int>)",m_methodArgCount+1,&m_methodArgTypes[1]); - m_methods[3] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaHeaderRequest, static_cast<void (QObject::*)(QList<Qt::Orientation>,QList<int>,QList<int>)>(0),"replicaHeaderRequest(QList<Qt::Orientation>,QList<int>,QList<int>)",m_methodArgCount+2,&m_methodArgTypes[2]); - m_methods[4] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaSetCurrentIndex, static_cast<void (QObject::*)(IndexList,QItemSelectionModel::SelectionFlags)>(0),"replicaSetCurrentIndex(IndexList,QItemSelectionModel::SelectionFlags)",m_methodArgCount+3,&m_methodArgTypes[3]); - m_methods[5] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaSetData, static_cast<void (QObject::*)(IndexList,QVariant,int)>(0),"replicaSetData(IndexList,QVariant,int)",m_methodArgCount+4,&m_methodArgTypes[4]); - m_methods[6] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaCacheRequest, static_cast<void (QObject::*)(size_t,QList<int>)>(0),"replicaCacheRequest(size_t,QList<int>)",m_methodArgCount+5,&m_methodArgTypes[5]); + m_methods[1] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaSizeRequest, static_cast<void (QObject::*)(IndexList)>(nullptr),"replicaSizeRequest(IndexList)",m_methodArgCount+0,&m_methodArgTypes[0]); + m_methods[2] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaRowRequest, static_cast<void (QObject::*)(IndexList,IndexList,QList<int>)>(nullptr),"replicaRowRequest(IndexList,IndexList,QList<int>)",m_methodArgCount+1,&m_methodArgTypes[1]); + m_methods[3] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaHeaderRequest, static_cast<void (QObject::*)(QList<Qt::Orientation>,QList<int>,QList<int>)>(nullptr),"replicaHeaderRequest(QList<Qt::Orientation>,QList<int>,QList<int>)",m_methodArgCount+2,&m_methodArgTypes[2]); + m_methods[4] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaSetCurrentIndex, static_cast<void (QObject::*)(IndexList,QItemSelectionModel::SelectionFlags)>(nullptr),"replicaSetCurrentIndex(IndexList,QItemSelectionModel::SelectionFlags)",m_methodArgCount+3,&m_methodArgTypes[3]); + m_methods[5] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaSetData, static_cast<void (QObject::*)(IndexList,QVariant,int)>(nullptr),"replicaSetData(IndexList,QVariant,int)",m_methodArgCount+4,&m_methodArgTypes[4]); + m_methods[6] = QtPrivate::qtro_method_index<AdapterType>(&AdapterType::replicaCacheRequest, static_cast<void (QObject::*)(size_t,QList<int>)>(nullptr),"replicaCacheRequest(size_t,QList<int>)",m_methodArgCount+5,&m_methodArgTypes[5]); } QString name() const override { return m_name; } diff --git a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp index 143e961..f8360ca 100644 --- a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp +++ b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp @@ -71,7 +71,7 @@ CacheData::~CacheData() { QAbstractItemModelReplicaImplementation::QAbstractItemModelReplicaImplementation() : QRemoteObjectReplica() - , m_selectionModel(0) + , m_selectionModel(nullptr) , m_rootItem(this) { QAbstractItemModelReplicaImplementation::registerMetatypes(); @@ -83,7 +83,7 @@ QAbstractItemModelReplicaImplementation::QAbstractItemModelReplicaImplementation QAbstractItemModelReplicaImplementation::QAbstractItemModelReplicaImplementation(QRemoteObjectNode *node, const QString &name) : QRemoteObjectReplica(ConstructWithNode) - , m_selectionModel(0) + , m_selectionModel(nullptr) , m_rootItem(this) { QAbstractItemModelReplicaImplementation::registerMetatypes(); @@ -155,7 +155,7 @@ inline void removeIndexFromRow(const QModelIndex &index, const QList<int> &roles void QAbstractItemModelReplicaImplementation::onReplicaCurrentChanged(const QModelIndex ¤t, const QModelIndex &previous) { - Q_UNUSED(previous); + Q_UNUSED(previous) IndexList currentIndex = toModelIndexList(current, q); qCDebug(QT_REMOTEOBJECT_MODELS) << Q_FUNC_INFO << "current=" << currentIndex; replicaSetCurrentIndex(currentIndex, QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Current); @@ -183,7 +183,7 @@ bool QAbstractItemModelReplicaImplementation::clearCache(const IndexList &start, Q_ASSERT(startIndex.isValid()); Q_ASSERT(endIndex.isValid()); Q_ASSERT(startIndex.parent() == endIndex.parent()); - Q_UNUSED(endIndex); + Q_UNUSED(endIndex) QModelIndex parentIndex = startIndex.parent(); auto parentItem = cacheData(parentIndex); @@ -336,7 +336,7 @@ void QAbstractItemModelReplicaImplementation::onRowsMoved(IndexList srcParent, i void QAbstractItemModelReplicaImplementation::onCurrentChanged(IndexList current, IndexList previous) { qCDebug(QT_REMOTEOBJECT_MODELS) << Q_FUNC_INFO << "current=" << current << "previous=" << previous; - Q_UNUSED(previous); + Q_UNUSED(previous) Q_ASSERT(m_selectionModel); bool ok; // If we have several tree models sharing a selection model, we @@ -761,7 +761,7 @@ QAbstractItemModelReplica::~QAbstractItemModelReplica() { } -static QVariant findData(const CachedRowEntry &row, const QModelIndex &index, int role, bool *cached = 0) +static QVariant findData(const CachedRowEntry &row, const QModelIndex &index, int role, bool *cached = nullptr) { if (index.column() < row.size()) { const CacheEntry &entry = row[index.column()]; @@ -966,7 +966,7 @@ bool QAbstractItemModelReplica::hasData(const QModelIndex &index, int role) cons bool cached = false; const CachedRowEntry &entry = item->cachedRowEntry; QVariant result = findData(entry, index, role, &cached); - Q_UNUSED(result); + Q_UNUSED(result) return cached; } diff --git a/src/remoteobjects/qremoteobjectdynamicreplica.cpp b/src/remoteobjects/qremoteobjectdynamicreplica.cpp index c2d7f24..b49055b 100644 --- a/src/remoteobjects/qremoteobjectdynamicreplica.cpp +++ b/src/remoteobjects/qremoteobjectdynamicreplica.cpp @@ -110,7 +110,7 @@ const QMetaObject* QRemoteObjectDynamicReplica::metaObject() const void *QRemoteObjectDynamicReplica::qt_metacast(const char *name) { if (!name) - return 0; + return nullptr; if (!strcmp(name, "QRemoteObjectDynamicReplica")) return static_cast<void*>(const_cast<QRemoteObjectDynamicReplica*>(this)); diff --git a/src/remoteobjects/qremoteobjectnode.cpp b/src/remoteobjects/qremoteobjectnode.cpp index c49c938..3f5bf80 100644 --- a/src/remoteobjects/qremoteobjectnode.cpp +++ b/src/remoteobjects/qremoteobjectnode.cpp @@ -1182,7 +1182,7 @@ void QRemoteObjectNodePrivate::connectReplica(QObject *object, QRemoteObjectRepl sig.prepend(QSIGNAL_CODE + '0'); const char * const csig = sig.constData(); const bool res = QObject::connect(object, csig, instance, csig); - Q_UNUSED(res); + Q_UNUSED(res) ++nConnections; qROPrivDebug() << sig << res; diff --git a/src/remoteobjects/qremoteobjectpacket.cpp b/src/remoteobjects/qremoteobjectpacket.cpp index fae1d99..bf44893 100644 --- a/src/remoteobjects/qremoteobjectpacket.cpp +++ b/src/remoteobjects/qremoteobjectpacket.cpp @@ -223,7 +223,7 @@ void deserializeInitPacket(QDataStream &in, QVariantList &values) { const bool success = deserializeQVariantList(in, values); Q_ASSERT(success); - Q_UNUSED(success); + Q_UNUSED(success) } void serializeInitDynamicPacket(DataStreamPacket &ds, const QRemoteObjectRootSource *source) @@ -589,7 +589,7 @@ void serializeInvokePacket(DataStreamPacket &ds, const QString &name, int call, ds << call; ds << index; - ds << (quint32)args.size(); + ds << quint32(args.size()); for (const auto &arg : args) ds << encodeVariant(arg); @@ -604,7 +604,7 @@ void deserializeInvokePacket(QDataStream& in, int &call, int &index, QVariantLis in >> index; const bool success = deserializeQVariantList(in, args); Q_ASSERT(success); - Q_UNUSED(success); + Q_UNUSED(success) in >> serialId; in >> propertyIndex; } @@ -708,7 +708,7 @@ QRO_::QRO_(const QVariant &value) QDataStream &operator<<(QDataStream &stream, const QRO_ &info) { - stream << info.name << info.typeName << (quint8)(info.type) << info.classDefinition << info.isNull; + stream << info.name << info.typeName << quint8(info.type) << info.classDefinition << info.isNull; qCDebug(QT_REMOTEOBJECT) << "Serializing " << info; // info.parameters will be filled in by serializeProperty return stream; diff --git a/src/remoteobjects/qremoteobjectreplica.cpp b/src/remoteobjects/qremoteobjectreplica.cpp index 50a7ea0..c45388b 100644 --- a/src/remoteobjects/qremoteobjectreplica.cpp +++ b/src/remoteobjects/qremoteobjectreplica.cpp @@ -507,7 +507,7 @@ void QRemoteObjectReplicaImplementation::configurePrivate(QRemoteObjectReplica * if (mm.methodType() == QMetaMethod::Signal) { const bool res = QMetaObject::connect(this, i, rep, i, Qt::DirectConnection, nullptr); qCDebug(QT_REMOTEOBJECT) << " Rep connect"<<i<<res<<mm.name(); - Q_UNUSED(res); + Q_UNUSED(res) } } if (m_methodOffset == 0) //We haven't initialized the offsets yet @@ -530,7 +530,7 @@ void QRemoteObjectReplicaImplementation::configurePrivate(QRemoteObjectReplica * ++m_numSignals; const bool res = QMetaObject::connect(this, i, rep, i, Qt::DirectConnection, nullptr); qCDebug(QT_REMOTEOBJECT) << " Connect"<<i<<res<<mm.name(); - Q_UNUSED(res); + Q_UNUSED(res) } } m_methodOffset = m_signalOffset + m_numSignals; @@ -539,7 +539,7 @@ void QRemoteObjectReplicaImplementation::configurePrivate(QRemoteObjectReplica * for (int i = m_signalOffset; i < m_methodOffset; ++i) { const bool res = QMetaObject::connect(this, i, rep, i, Qt::DirectConnection, nullptr); qCDebug(QT_REMOTEOBJECT) << " Connect"<<i<<res<<m_metaObject->method(i).name(); - Q_UNUSED(res); + Q_UNUSED(res) } if (isInitialized()) { qCDebug(QT_REMOTEOBJECT) << QStringLiteral("ReplicaImplementation initialized, emitting signal on replica"); @@ -899,17 +899,17 @@ void QStubReplicaImplementation::setProperty(int i, const QVariant &prop) void QStubReplicaImplementation::_q_send(QMetaObject::Call call, int index, const QVariantList &args) { - Q_UNUSED(call); - Q_UNUSED(index); - Q_UNUSED(args); + Q_UNUSED(call) + Q_UNUSED(index) + Q_UNUSED(args) qWarning("Tried calling a slot or setting a property on a replica that hasn't been initialized with a node"); } QRemoteObjectPendingCall QStubReplicaImplementation::_q_sendWithReply(QMetaObject::Call call, int index, const QVariantList &args) { - Q_UNUSED(call); - Q_UNUSED(index); - Q_UNUSED(args); + Q_UNUSED(call) + Q_UNUSED(index) + Q_UNUSED(args) qWarning("Tried calling a slot or setting a property on a replica that hasn't been initialized with a node"); return QRemoteObjectPendingCall(); //Invalid } diff --git a/src/remoteobjects/qremoteobjectsource.cpp b/src/remoteobjects/qremoteobjectsource.cpp index f52c1a8..f3281e8 100644 --- a/src/remoteobjects/qremoteobjectsource.cpp +++ b/src/remoteobjects/qremoteobjectsource.cpp @@ -145,8 +145,8 @@ QRemoteObjectSourceBase::QRemoteObjectSourceBase(QObject *obj, Private *d, const } } -QRemoteObjectSource::QRemoteObjectSource(QObject *obj, Private *d, const SourceApiMap *api, QObject *adapter, const QString &parentName) - : QRemoteObjectSourceBase(obj, d, api, adapter) +QRemoteObjectSource::QRemoteObjectSource(QObject *obj, Private *dd, const SourceApiMap *api, QObject *adapter, const QString &parentName) + : QRemoteObjectSourceBase(obj, dd, api, adapter) , m_name(api->typeName() == QLatin1String("QAbstractItemModelAdapter") ? MODEL().arg(parentName + QLatin1String("::") + api->name()) : CLASS().arg(parentName + QLatin1String("::") + api->name())) { @@ -198,7 +198,7 @@ void QRemoteObjectSourceBase::setConnections() //We know no one will inherit from this class, so no need to worry about indices from //derived classes. const auto target = isAdapter ? m_adapter : m_object; - if (!QMetaObject::connect(target, sourceIndex, this, QRemoteObjectSource::qobjectMethodOffset+idx, Qt::DirectConnection, 0)) { + if (!QMetaObject::connect(target, sourceIndex, this, QRemoteObjectSource::qobjectMethodOffset+idx, Qt::DirectConnection, nullptr)) { qCWarning(QT_REMOTEOBJECT) << "QRemoteObjectSourceBase: QMetaObject::connect returned false. Unable to connect."; return; } diff --git a/src/remoteobjects/qtremoteobjectglobal.cpp b/src/remoteobjects/qtremoteobjectglobal.cpp index dc39fe6..e695660 100644 --- a/src/remoteobjects/qtremoteobjectglobal.cpp +++ b/src/remoteobjects/qtremoteobjectglobal.cpp @@ -67,9 +67,9 @@ void copyStoredProperties(const QMetaObject *mo, const void *src, void *dst) mp.writeOnGadget(dst, mp.readOnGadget(src)); } #else - Q_UNUSED(mo); - Q_UNUSED(src); - Q_UNUSED(dst); + Q_UNUSED(mo) + Q_UNUSED(src) + Q_UNUSED(dst) #endif } @@ -86,9 +86,9 @@ void copyStoredProperties(const QMetaObject *mo, const void *src, QDataStream &d dst << mp.readOnGadget(src); } #else - Q_UNUSED(mo); - Q_UNUSED(src); - Q_UNUSED(dst); + Q_UNUSED(mo) + Q_UNUSED(src) + Q_UNUSED(dst) #endif } @@ -107,9 +107,9 @@ void copyStoredProperties(const QMetaObject *mo, QDataStream &src, void *dst) mp.writeOnGadget(dst, v); } #else - Q_UNUSED(mo); - Q_UNUSED(src); - Q_UNUSED(dst); + Q_UNUSED(mo) + Q_UNUSED(src) + Q_UNUSED(dst) #endif } diff --git a/tests/auto/benchmarks/tst_benchmarkstest.cpp b/tests/auto/benchmarks/tst_benchmarkstest.cpp index 4b55176..030d45a 100644 --- a/tests/auto/benchmarks/tst_benchmarkstest.cpp +++ b/tests/auto/benchmarks/tst_benchmarkstest.cpp @@ -47,7 +47,7 @@ public: int BenchmarksModel::rowCount(const QModelIndex &parent) const { - Q_UNUSED(parent); + Q_UNUSED(parent) return 100000; } @@ -103,7 +103,7 @@ void BenchmarksTest::initTestCase() { dataCenterLocal->setData1(5); const bool remoted = m_basicServer.enableRemoting(dataCenterLocal.data()); Q_ASSERT(remoted); - Q_UNUSED(remoted); + Q_UNUSED(remoted) m_basicClient.connectToNode(QUrl(QStringLiteral("local:benchmark_replica"))); Q_ASSERT(m_basicClient.lastError() == QRemoteObjectNode::NoError); @@ -126,7 +126,7 @@ void BenchmarksTest::benchPropertyChangesInt() connect(center.data(), &LocalDataCenterReplica::data1Changed, [&lastValue, ¢er, &loop]() { const bool res = (lastValue++ == center->data1()); Q_ASSERT(res); - Q_UNUSED(res); + Q_UNUSED(res) if (lastValue == 50000) loop.quit(); }); @@ -178,7 +178,7 @@ void BenchmarksTest::benchQLocalSocketInt() client.read(reinterpret_cast<char*>(&readout), sizeof(int)); const bool res = (lastValue++ == readout); Q_ASSERT(res); - Q_UNUSED(res); + Q_UNUSED(res) } if (lastValue >= 50000) loop.quit(); @@ -187,7 +187,7 @@ void BenchmarksTest::benchQLocalSocketInt() for (int i = 0; i < 50000; ++i) { const int res = serverSock->write(reinterpret_cast<char*>(&i), sizeof(int)); Q_ASSERT(res == sizeof(int)); - Q_UNUSED(res); + Q_UNUSED(res) } loop.exec(); } @@ -223,7 +223,7 @@ void BenchmarksTest::benchQLocalSocketQDataStreamInt() readStream >> readout; const bool res = (lastValue++ == readout); Q_ASSERT(res); - Q_UNUSED(res); + Q_UNUSED(res) } if (lastValue >= 50000) loop.quit(); diff --git a/tests/auto/integration/tst_integration.cpp b/tests/auto/integration/tst_integration.cpp index 3be8587..591cc30 100644 --- a/tests/auto/integration/tst_integration.cpp +++ b/tests/auto/integration/tst_integration.cpp @@ -339,7 +339,7 @@ private slots: const QScopedPointer<TestClassReplica> tc_rep(client->acquire<TestClassReplica>()); tc_rep->waitForSource(); QCOMPARE(tc.testEnum(), tc_rep->testEnum()); - QCOMPARE((qint32)tc.classEnum(), (qint32)TestClassSimpleSource::One); + QCOMPARE(qint32(tc.classEnum()), qint32(TestClassSimpleSource::One)); // set property on the replica (test property change packet) { @@ -348,7 +348,7 @@ private slots: tc_rep->pushClassEnum(TestClassReplica::Two); QVERIFY(spy.count() || spy.wait()); - QCOMPARE((qint32)tc.classEnum(), (qint32)tc_rep->classEnum()); + QCOMPARE(qint32(tc.classEnum()), qint32(tc_rep->classEnum())); } // set property on the source (test property change packet) @@ -357,7 +357,7 @@ private slots: tc.setClassEnum(TestClassSimpleSource::One); QVERIFY(spy.wait()); - QCOMPARE((qint32)tc.classEnum(), (qint32)tc_rep->classEnum()); + QCOMPARE(qint32(tc.classEnum()), qint32(tc_rep->classEnum())); } QScopedPointer<QRemoteObjectDynamicReplica> tc_repDynamic(client->acquireDynamic(QStringLiteral("TestClass"))); diff --git a/tests/auto/modelview/tst_modelview.cpp b/tests/auto/modelview/tst_modelview.cpp index b87b768..0153c22 100644 --- a/tests/auto/modelview/tst_modelview.cpp +++ b/tests/auto/modelview/tst_modelview.cpp @@ -269,7 +269,7 @@ void compareFlags(const QAbstractItemModel *sourceModel, const QAbstractItemMode class RolenamesListModel : public QAbstractListModel { public: - explicit RolenamesListModel(QObject *parent = 0) : QAbstractListModel(parent) { } + explicit RolenamesListModel(QObject *parent = nullptr) : QAbstractListModel(parent) { } int rowCount(const QModelIndex &) const override{return m_list.length(); } QVariant data(const QModelIndex &index, int role) const override { @@ -384,7 +384,7 @@ public: for (; it != end; ++it) { for (int role : it.value()) { QVariant v = m_replica->data(it.key(), role); - Q_UNUSED(v); + Q_UNUSED(v) } } } @@ -471,7 +471,7 @@ private: m_pending[index] = itroles; } #else - Q_UNUSED(roles); + Q_UNUSED(roles) m_pending.erase(it); if (m_replica->hasChildren(index)) { // ask for the row count to get an update @@ -1034,7 +1034,7 @@ void TestModelView::testModelTest() FetchData f(repModel.data()); f.addAll(); QVERIFY(f.fetchAndWait(MODELTEST_WAIT_TIME)); - Q_UNUSED(test); + Q_UNUSED(test) } void TestModelView::testSortFilterModel() diff --git a/tests/auto/proxy/tst_proxy.cpp b/tests/auto/proxy/tst_proxy.cpp index 03e9e47..2e4dc3a 100644 --- a/tests/auto/proxy/tst_proxy.cpp +++ b/tests/auto/proxy/tst_proxy.cpp @@ -139,7 +139,7 @@ void ProxyTest::testProxy() //Compare Replica to Source QCOMPARE(rep->rpm(), engine.rpm()); - QCOMPARE((EngineReplica::EngineType)rep->type(), EngineReplica::Gas); + QCOMPARE(EngineReplica::EngineType(rep->type()), EngineReplica::Gas); //Change Replica and make sure change propagates to source QSignalSpy sourceSpy(&engine, SIGNAL(rpmChanged(int))); diff --git a/tests/auto/proxy_multiprocess/server/mytestserver.cpp b/tests/auto/proxy_multiprocess/server/mytestserver.cpp index 7f5f6f3..19302ce 100644 --- a/tests/auto/proxy_multiprocess/server/mytestserver.cpp +++ b/tests/auto/proxy_multiprocess/server/mytestserver.cpp @@ -55,13 +55,13 @@ bool MyTestServer::quit() ParentClassSource::MyEnum MyTestServer::enumSlot(QPoint p, MyEnum myEnum) { - Q_UNUSED(p); - Q_UNUSED(myEnum); + Q_UNUSED(p) + Q_UNUSED(myEnum) return ParentClassSource::foobar; } Qt::DateFormat MyTestServer::dateSlot(Qt::DateFormat date) { - Q_UNUSED(date); + Q_UNUSED(date) return Qt::RFC2822Date; } diff --git a/tools/repc/repcodegenerator.cpp b/tools/repc/repcodegenerator.cpp index 39f451b..b37c30f 100644 --- a/tools/repc/repcodegenerator.cpp +++ b/tools/repc/repcodegenerator.cpp @@ -987,7 +987,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl out << QStringLiteral(" : SourceApiMap(), m_name(name)") << Qt::endl; out << QStringLiteral(" {") << Qt::endl; if (!astClass.hasPointerObjects()) - out << QStringLiteral(" Q_UNUSED(object);") << Qt::endl; + out << QStringLiteral(" Q_UNUSED(object)") << Qt::endl; const int enumCount = astClass.enums.count(); for (int i : astClass.subClassPropertyIndices) { @@ -1009,13 +1009,13 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl const ASTProperty &prop = astClass.properties.at(i); const QString propTypeName = fullyQualifiedTypeName(astClass, QStringLiteral("typename ObjectType"), typeForMode(prop, SOURCE)); out << QString::fromLatin1(" m_properties[%1] = QtPrivate::qtro_property_index<ObjectType>(&ObjectType::%2, " - "static_cast<%3 (QObject::*)()>(0),\"%2\");") + "static_cast<%3 (QObject::*)()>(nullptr),\"%2\");") .arg(QString::number(i+1), prop.name, propTypeName) << Qt::endl; if (prop.modifier == prop.ReadWrite) //Make sure we have a setter function - out << QStringLiteral(" QtPrivate::qtro_method_test<ObjectType>(&ObjectType::set%1, static_cast<void (QObject::*)(%2)>(0));") + out << QStringLiteral(" QtPrivate::qtro_method_test<ObjectType>(&ObjectType::set%1, static_cast<void (QObject::*)(%2)>(nullptr));") .arg(cap(prop.name), propTypeName) << Qt::endl; if (prop.modifier != prop.Constant) { //Make sure we have an onChange signal - out << QStringLiteral(" QtPrivate::qtro_method_test<ObjectType>(&ObjectType::%1Changed, static_cast<void (QObject::*)()>(0));") + out << QStringLiteral(" QtPrivate::qtro_method_test<ObjectType>(&ObjectType::%1Changed, static_cast<void (QObject::*)()>(nullptr));") .arg(prop.name) << Qt::endl; onChangeProperties << prop; propertyChangeIndex << i + 1; //m_properties[0] is the count, so index is one higher @@ -1026,7 +1026,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl out << QString::fromLatin1(" m_signals[0] = %1;").arg(signalCount+onChangeProperties.size()) << Qt::endl; for (int i = 0; i < changedCount; ++i) out << QString::fromLatin1(" m_signals[%1] = QtPrivate::qtro_signal_index<ObjectType>(&ObjectType::%2Changed, " - "static_cast<void (QObject::*)(%3)>(0),m_signalArgCount+%4,&m_signalArgTypes[%4]);") + "static_cast<void (QObject::*)(%3)>(nullptr),m_signalArgCount+%4,&m_signalArgTypes[%4]);") .arg(QString::number(i+1), onChangeProperties.at(i).name, fullyQualifiedTypeName(astClass, QStringLiteral("typename ObjectType"), typeForMode(onChangeProperties.at(i), SOURCE)), QString::number(i)) << Qt::endl; @@ -1035,7 +1035,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl for (int i = 0; i < signalCount; ++i) { const ASTFunction &sig = signalsList.at(i); out << QString::fromLatin1(" m_signals[%1] = QtPrivate::qtro_signal_index<ObjectType>(&ObjectType::%2, " - "static_cast<void (QObject::*)(%3)>(0),m_signalArgCount+%4,&m_signalArgTypes[%4]);") + "static_cast<void (QObject::*)(%3)>(nullptr),m_signalArgCount+%4,&m_signalArgTypes[%4]);") .arg(QString::number(changedCount+i+1), sig.name, sig.paramsAsString(ASTFunction::Normalized), QString::number(changedCount+i)) << Qt::endl; } const int slotCount = astClass.slotsList.count(); @@ -1051,7 +1051,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl const ASTProperty &prop = pushProps.at(i); const QString propTypeName = fullyQualifiedTypeName(astClass, QStringLiteral("typename ObjectType"), prop.type); out << QString::fromLatin1(" m_methods[%1] = QtPrivate::qtro_method_index<ObjectType>(&ObjectType::push%2, " - "static_cast<void (QObject::*)(%3)>(0),\"push%2(%4)\",m_methodArgCount+%5,&m_methodArgTypes[%5]);") + "static_cast<void (QObject::*)(%3)>(nullptr),\"push%2(%4)\",m_methodArgCount+%5,&m_methodArgTypes[%5]);") .arg(QString::number(i+1), cap(prop.name), propTypeName, QString(propTypeName).remove(QStringLiteral("typename ObjectType::")), // we don't want this in the string signature QString::number(i)) << Qt::endl; @@ -1062,7 +1062,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl const ASTFunction &slot = slotsList.at(i); const QString params = slot.paramsAsString(ASTFunction::Normalized); out << QString::fromLatin1(" m_methods[%1] = QtPrivate::qtro_method_index<ObjectType>(&ObjectType::%2, " - "static_cast<void (QObject::*)(%3)>(0),\"%2(%4)\",m_methodArgCount+%5,&m_methodArgTypes[%5]);") + "static_cast<void (QObject::*)(%3)>(nullptr),\"%2(%4)\",m_methodArgCount+%5,&m_methodArgTypes[%5]);") .arg(QString::number(i+pushCount+1), slot.name, params, QString(params).remove(QStringLiteral("typename ObjectType::")), // we don't want this in the string signature QString::number(i+pushCount)) << Qt::endl; @@ -1129,9 +1129,9 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl out << QStringLiteral(" return m_signalArgTypes[sigIndex][paramIndex];") << Qt::endl; out << QStringLiteral(" }") << Qt::endl; } else { - out << QStringLiteral(" int signalParameterCount(int index) const override { Q_UNUSED(index); return -1; }") << Qt::endl; + out << QStringLiteral(" int signalParameterCount(int index) const override { Q_UNUSED(index) return -1; }") << Qt::endl; out << QStringLiteral(" int signalParameterType(int sigIndex, int paramIndex) const override") << Qt::endl; - out << QStringLiteral(" { Q_UNUSED(sigIndex); Q_UNUSED(paramIndex); return -1; }") << Qt::endl; + out << QStringLiteral(" { Q_UNUSED(sigIndex) Q_UNUSED(paramIndex) return -1; }") << Qt::endl; } if (methodCount > 0) { out << QStringLiteral(" int methodParameterCount(int index) const override") << Qt::endl; @@ -1147,9 +1147,9 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl out << QStringLiteral(" return m_methodArgTypes[methodIndex][paramIndex];") << Qt::endl; out << QStringLiteral(" }") << Qt::endl; } else { - out << QStringLiteral(" int methodParameterCount(int index) const override { Q_UNUSED(index); return -1; }") << Qt::endl; + out << QStringLiteral(" int methodParameterCount(int index) const override { Q_UNUSED(index) return -1; }") << Qt::endl; out << QStringLiteral(" int methodParameterType(int methodIndex, int paramIndex) const override") << Qt::endl; - out << QStringLiteral(" { Q_UNUSED(methodIndex); Q_UNUSED(paramIndex); return -1; }") << Qt::endl; + out << QStringLiteral(" { Q_UNUSED(methodIndex) Q_UNUSED(paramIndex) return -1; }") << Qt::endl; } //propertyIndexFromSignal method out << QStringLiteral(" int propertyIndexFromSignal(int index) const override") << Qt::endl; @@ -1160,7 +1160,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl out << QString::fromLatin1(" case %1: return m_properties[%2];").arg(i).arg(propertyChangeIndex.at(i)) << Qt::endl; out << QStringLiteral(" }") << Qt::endl; } else - out << QStringLiteral(" Q_UNUSED(index);") << Qt::endl; + out << QStringLiteral(" Q_UNUSED(index)") << Qt::endl; out << QStringLiteral(" return -1;") << Qt::endl; out << QStringLiteral(" }") << Qt::endl; //propertyRawIndexFromSignal method @@ -1172,7 +1172,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl out << QString::fromLatin1(" case %1: return %2;").arg(i).arg(propertyChangeIndex.at(i)-1) << Qt::endl; out << QStringLiteral(" }") << Qt::endl; } else - out << QStringLiteral(" Q_UNUSED(index);") << Qt::endl; + out << QStringLiteral(" Q_UNUSED(index)") << Qt::endl; out << QStringLiteral(" return -1;") << Qt::endl; out << QStringLiteral(" }") << Qt::endl; @@ -1209,7 +1209,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl } out << QStringLiteral(" }") << Qt::endl; } else - out << QStringLiteral(" Q_UNUSED(index);") << Qt::endl; + out << QStringLiteral(" Q_UNUSED(index)") << Qt::endl; out << QStringLiteral(" return QByteArrayLiteral(\"\");") << Qt::endl; out << QStringLiteral(" }") << Qt::endl; @@ -1255,7 +1255,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl } out << QStringLiteral(" }") << Qt::endl; } else - out << QStringLiteral(" Q_UNUSED(index);") << Qt::endl; + out << QStringLiteral(" Q_UNUSED(index)") << Qt::endl; out << QStringLiteral(" return QByteArrayLiteral(\"\");") << Qt::endl; out << QStringLiteral(" }") << Qt::endl; @@ -1295,7 +1295,7 @@ void RepCodeGenerator::generateSourceAPI(QTextStream &out, const ASTClass &astCl } out << QStringLiteral(" }") << Qt::endl; } else - out << QStringLiteral(" Q_UNUSED(index);") << Qt::endl; + out << QStringLiteral(" Q_UNUSED(index)") << Qt::endl; out << QStringLiteral(" return QByteArrayLiteral(\"\");") << Qt::endl; out << QStringLiteral(" }") << Qt::endl; |