diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-21 10:41:54 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-26 07:13:18 +0000 |
commit | 499ec43937e926e4f2fa57a9baa455fcb3862262 (patch) | |
tree | 206c90d47387f8322b68f5e3db613189397e1af3 /tools | |
parent | 53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff) |
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.
Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).
Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/main.cpp | 6 | ||||
-rw-r--r-- | tools/qmlcachegen/generateloader.cpp | 2 | ||||
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 4 | ||||
-rw-r--r-- | tools/qmleasing/segmentproperties.cpp | 2 | ||||
-rw-r--r-- | tools/qmleasing/splineeditor.cpp | 2 | ||||
-rw-r--r-- | tools/qmlimportscanner/main.cpp | 2 | ||||
-rw-r--r-- | tools/qmlplugindump/main.cpp | 10 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerapplication.cpp | 2 | ||||
-rw-r--r-- | tools/qmlscene/main.cpp | 4 | ||||
-rw-r--r-- | tools/qmltime/qmltime.cpp | 4 |
10 files changed, 19 insertions, 19 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 83680a5ba1..73b2700ba4 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -69,8 +69,8 @@ #define FILE_OPEN_EVENT_WAIT_TIME 3000 // ms -static Config *conf = 0; -static QQmlApplicationEngine *qae = 0; +static Config *conf = nullptr; +static QQmlApplicationEngine *qae = nullptr; #if defined(Q_OS_DARWIN) || defined(QT_GUI_LIB) static int exitTimerId = -1; #endif @@ -436,7 +436,7 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory) int main(int argc, char *argv[]) { getAppFlags(argc, argv); - QCoreApplication *app = 0; + QCoreApplication *app = nullptr; switch (applicationType) { case QmlApplicationTypeCore: app = new QCoreApplication(argc, argv); diff --git a/tools/qmlcachegen/generateloader.cpp b/tools/qmlcachegen/generateloader.cpp index 083af29a2d..0d6c80a859 100644 --- a/tools/qmlcachegen/generateloader.cpp +++ b/tools/qmlcachegen/generateloader.cpp @@ -98,7 +98,7 @@ struct VirtualDirectoryEntry struct DataStream { - DataStream(QVector<unsigned char > *data = 0) + DataStream(QVector<unsigned char > *data = nullptr) : data(data) {} diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index 1751ba2ecf..9c97ef7694 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -197,7 +197,7 @@ static bool compileQmlFile(const QString &inputFileName, SaveFunction saveFuncti QmlIR::JSCodeGen v4CodeGen(irDocument.code, &irDocument.jsGenerator, &irDocument.jsModule, &irDocument.jsParserEngine, irDocument.program, - /*import cache*/0, &irDocument.jsGenerator.stringTable, illegalNames); + /*import cache*/nullptr, &irDocument.jsGenerator.stringTable, illegalNames); v4CodeGen.setUseFastLookups(false); // Disable lookups in non-standalone (aka QML) mode for (QmlIR::Object *object: qAsConst(irDocument.objects)) { if (object->functionsAndExpressions->count == 0) @@ -298,7 +298,7 @@ static bool compileJSFile(const QString &inputFileName, const QString &inputFile { QmlIR::JSCodeGen v4CodeGen(irDocument.code, &irDocument.jsGenerator, &irDocument.jsModule, &irDocument.jsParserEngine, - irDocument.program, /*import cache*/0, + irDocument.program, /*import cache*/nullptr, &irDocument.jsGenerator.stringTable, illegalNames); v4CodeGen.setUseFastLookups(false); // Disable lookups in non-standalone (aka QML) mode v4CodeGen.generateFromProgram(inputFileName, inputFileUrl, sourceCode, program, diff --git a/tools/qmleasing/segmentproperties.cpp b/tools/qmleasing/segmentproperties.cpp index 01123d3e97..f37527f863 100644 --- a/tools/qmleasing/segmentproperties.cpp +++ b/tools/qmleasing/segmentproperties.cpp @@ -30,7 +30,7 @@ #include "splineeditor.h" SegmentProperties::SegmentProperties(QWidget *parent) : - QWidget(parent), m_splineEditor(0), m_blockSignals(false) + QWidget(parent), m_splineEditor(nullptr), m_blockSignals(false) { QVBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp index af5c519b04..2a6081903f 100644 --- a/tools/qmleasing/splineeditor.cpp +++ b/tools/qmleasing/splineeditor.cpp @@ -42,7 +42,7 @@ const int canvasHeight = 320; const int canvasMargin = 160; SplineEditor::SplineEditor(QWidget *parent) : - QWidget(parent), m_pointListWidget(0), m_block(false) + QWidget(parent), m_pointListWidget(nullptr), m_block(false) { setFixedSize(canvasWidth + canvasMargin * 2, canvasHeight + canvasMargin * 2); diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp index d596613553..5bd66243e6 100644 --- a/tools/qmlimportscanner/main.cpp +++ b/tools/qmlimportscanner/main.cpp @@ -509,7 +509,7 @@ int main(int argc, char *argv[]) while (i < args.count()) { const QString &arg = args.at(i); ++i; - QStringList *argReceiver = 0; + QStringList *argReceiver = nullptr; if (!arg.startsWith(QLatin1Char('-')) || arg == QLatin1String("-")) { qmlRootPaths += arg; } else if (arg == QLatin1String("-rootPath")) { diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 422e37fd89..5c5a6a8eb1 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -300,7 +300,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine, continue; inObjectInstantiation = tyName; - QObject *object = 0; + QObject *object = nullptr; if (ty.isSingleton()) { QQmlType::SingletonInstanceInfo *siinfo = ty.singletonInstanceInfo(); @@ -403,7 +403,7 @@ public: return exportString; } - void writeMetaContent(const QMetaObject *meta, KnownAttributes *knownAttributes = 0) + void writeMetaContent(const QMetaObject *meta, KnownAttributes *knownAttributes = nullptr) { QSet<QString> implicitSignals; for (int index = meta->propertyOffset(); index < meta->propertyCount(); ++index) { @@ -642,7 +642,7 @@ private: qml->writeScriptBinding(QLatin1String("isPointer"), QLatin1String("true")); } - void dump(const QMetaProperty &prop, KnownAttributes *knownAttributes = 0) + void dump(const QMetaProperty &prop, KnownAttributes *knownAttributes = nullptr) { int revision = prop.revision(); QByteArray propName = prop.name(); @@ -658,7 +658,7 @@ private: } void dump(const QMetaMethod &meth, const QSet<QString> &implicitSignals, - KnownAttributes *knownAttributes = 0) + KnownAttributes *knownAttributes = nullptr) { if (meth.methodType() == QMetaMethod::Signal) { if (meth.access() != QMetaMethod::Public) @@ -973,7 +973,7 @@ int main(int argc, char *argv[]) sigAction.sa_handler = &sigSegvHandler; sigAction.sa_flags = 0; - sigaction(SIGSEGV, &sigAction, 0); + sigaction(SIGSEGV, &sigAction, nullptr); #endif #ifdef QT_SIMULATOR diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp index 67e8769ac1..3ab6741afa 100644 --- a/tools/qmlprofiler/qmlprofilerapplication.cpp +++ b/tools/qmlprofiler/qmlprofilerapplication.cpp @@ -76,7 +76,7 @@ Q_STATIC_ASSERT(sizeof(features) == QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) : QCoreApplication(argc, argv), m_runMode(LaunchMode), - m_process(0), + m_process(nullptr), m_hostName(QLatin1String("127.0.0.1")), m_port(0), m_pendingRequest(REQUEST_NONE), diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index fc8b9c5292..9bfeca7897 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -310,7 +310,7 @@ static void displayFileDialog(Options *options) { #if defined(QT_WIDGETS_LIB) && QT_CONFIG(filedialog) if (options->applicationType == Options::QmlApplicationTypeWidget) { - QString fileName = QFileDialog::getOpenFileName(0, "Open QML file", QString(), "QML Files (*.qml)"); + QString fileName = QFileDialog::getOpenFileName(nullptr, "Open QML file", QString(), "QML Files (*.qml)"); if (!fileName.isEmpty()) { QFileInfo fi(fileName); options->url = QUrl::fromLocalFile(fi.canonicalFilePath()); @@ -640,7 +640,7 @@ int main(int argc, char ** argv) } else { QQuickItem *contentItem = qobject_cast<QQuickItem *>(topLevel); if (contentItem) { - QQuickView* qxView = new QQuickView(&engine, NULL); + QQuickView* qxView = new QQuickView(&engine, nullptr); window.reset(qxView); // Set window default properties; the qml can still override them if (options.resizeViewToRootItem) diff --git a/tools/qmltime/qmltime.cpp b/tools/qmltime/qmltime.cpp index b337ccac5c..b897d304fc 100644 --- a/tools/qmltime/qmltime.cpp +++ b/tools/qmltime/qmltime.cpp @@ -66,10 +66,10 @@ private: }; QML_DECLARE_TYPE(Timer); -Timer *Timer::m_timer = 0; +Timer *Timer::m_timer = nullptr; Timer::Timer() - : m_component(0) + : m_component(nullptr) , m_willparent(false) , m_item(new QQuickItem) { |