From ac69b162683ecd80d4bcfe877d4444797f1f6930 Mon Sep 17 00:00:00 2001 From: Dalton Durst Date: Wed, 20 Jan 2021 09:59:30 -0600 Subject: [PATCH] Use empty qstring instead of nullptr https://github.com/ubports/unity8/pull/356#pullrequestreview-572324879 --- plugins/Utils/windowstatestorage.cpp | 2 +- plugins/Utils/windowstatestorage.h | 2 +- tests/plugins/Utils/WindowStateStorageTest.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Utils/windowstatestorage.cpp b/plugins/Utils/windowstatestorage.cpp index 924965a6b8..e03dd9e339 100644 --- a/plugins/Utils/windowstatestorage.cpp +++ b/plugins/Utils/windowstatestorage.cpp @@ -275,7 +275,7 @@ WindowStateStorage::WindowStateStorage(const QString &dbName, QObject *parent): { qRegisterMetaType("WindowStateStorage::WindowState"); QString dbFile; - if (dbName == nullptr) { + if (dbName.isEmpty()) { const QString dbPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/unity8/"); QDir dir; dir.mkpath(dbPath); diff --git a/plugins/Utils/windowstatestorage.h b/plugins/Utils/windowstatestorage.h index a85399466a..82b620c698 100644 --- a/plugins/Utils/windowstatestorage.h +++ b/plugins/Utils/windowstatestorage.h @@ -50,7 +50,7 @@ class WindowStateStorage: public QObject Q_DECLARE_FLAGS(WindowStates, WindowState) Q_FLAG(WindowStates) - WindowStateStorage(const QString &dbName = nullptr, QObject *parent = nullptr); + WindowStateStorage(const QString &dbName = QString(), QObject *parent = nullptr); virtual ~WindowStateStorage(); Q_INVOKABLE WindowState getState(const QString &windowId, WindowState defaultValue) const; diff --git a/tests/plugins/Utils/WindowStateStorageTest.cpp b/tests/plugins/Utils/WindowStateStorageTest.cpp index de4333e266..1b50a3e21f 100644 --- a/tests/plugins/Utils/WindowStateStorageTest.cpp +++ b/tests/plugins/Utils/WindowStateStorageTest.cpp @@ -46,7 +46,7 @@ private Q_SLOTS: // copy the old database or risk the wrath of long-time users. void testDbNameDefault() { delete storage; - storage = new WindowStateStorage(nullptr, this); + storage = new WindowStateStorage(QString(), this); QCOMPARE(storage->getDbName(), QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/unity8/windowstatestorage.sqlite")); }