Enable the modernize-user-nullptr check on clang-tidy
authorKevin Ottens <kevin.ottens@nextcloud.com>
Wed, 12 Aug 2020 14:14:48 +0000 (16:14 +0200)
committerKevin Ottens <ervin@ipsquad.net>
Wed, 12 Aug 2020 17:45:25 +0000 (19:45 +0200)
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
13 files changed:
.clang-tidy
src/3rdparty/QProgressIndicator/QProgressIndicator.h
src/3rdparty/qtsingleapplication/qtlocalpeer.h
src/common/checksums.h
src/common/filesystembase.h
src/common/syncjournaldb.h
src/common/utility.h
src/gui/accountstate.h
src/gui/headerbanner.h
src/gui/tray/ActivityListModel.h
src/gui/tray/UserModel.h
src/libsync/capabilities.h
test/syncenginetestutils.h

index 34de4128fa414c40e8c646b8fdf7a7243a5d8c70..17e948c2a1ab240e012cb93ad8263dc0faa3bf5e 100644 (file)
@@ -18,6 +18,7 @@ Checks: '-*,
     modernize-use-nodiscard,
     modernize-use-noexcept,
     modernize-user-override,
+    modernize-use-nullptr,
     modernize-use-transparent-functors,
     modernize-use-uncaught-exceptions,
     modernize-use-using,
index 727866009ac2ab0527aa622d38dbf72f670ca0e6..4871cb8a25eeebfb7a701a408fdbec87b8bcb6a2 100644 (file)
@@ -42,7 +42,7 @@ class QProgressIndicator : public QWidget
     Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped)
     Q_PROPERTY(QColor color READ color WRITE setColor)
 public:
-    QProgressIndicator(QWidget* parent = 0);
+    QProgressIndicator(QWidget* parent = nullptr);
 
     /*! Returns the delay between animation steps.
         \return The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds.
index 36193631912a9975ac719b00a5c78d3ab8fc4291..ce93a5e0ae9c396a61d1353b99d686183e5dd34b 100644 (file)
@@ -40,7 +40,7 @@ class QtLocalPeer : public QObject
     Q_OBJECT
 
 public:
-    explicit QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
+    explicit QtLocalPeer(QObject *parent = nullptr, const QString &appId = QString());
     bool isClient();
     bool sendMessage(const QString &message, int timeout, bool block);
     QString applicationId() const
index 02cfbe8eb5da2baf3c8e47a6ec03e142c728485c..29a5bcf12a2e9d4e0234f6f2c720d4adc40561cc 100644 (file)
@@ -70,7 +70,7 @@ class OCSYNC_EXPORT ComputeChecksum : public QObject
 {
     Q_OBJECT
 public:
-    explicit ComputeChecksum(QObject *parent = 0);
+    explicit ComputeChecksum(QObject *parent = nullptr);
 
     /**
      * Sets the checksum type to be used. The default is empty.
@@ -112,7 +112,7 @@ class OCSYNC_EXPORT ValidateChecksumHeader : public QObject
 {
     Q_OBJECT
 public:
-    explicit ValidateChecksumHeader(QObject *parent = 0);
+    explicit ValidateChecksumHeader(QObject *parent = nullptr);
 
     /**
      * Check a file's actual checksum against the provided checksumHeader
index 08abdfcb139a854807d8fb5076e931e7150d256f..c4a19056efe317a07060ecfb76a1cff0662387c1 100644 (file)
@@ -107,7 +107,7 @@ namespace FileSystem {
      * Equivalent to QFile::remove(), except on Windows, where it will also
      * successfully remove read-only files.
      */
-    bool OCSYNC_EXPORT remove(const QString &fileName, QString *errorString = 0);
+    bool OCSYNC_EXPORT remove(const QString &fileName, QString *errorString = nullptr);
 
     /**
      * Move the specified file or folder to the trash. (Only implemented on linux)
index e8ecbaa2ed3f7e9017f33623129509fbc07d1605..c6520cbd18a9d1b9254bbd076b654b60599bb58f 100644 (file)
@@ -42,7 +42,7 @@ class OCSYNC_EXPORT SyncJournalDb : public QObject
 {
     Q_OBJECT
 public:
-    explicit SyncJournalDb(const QString &dbFilePath, QObject *parent = 0);
+    explicit SyncJournalDb(const QString &dbFilePath, QObject *parent = nullptr);
     virtual ~SyncJournalDb();
 
     /// Create a journal path for a specific configuration
index 1aa17928c48f7ec795499b0f6391c16082be7c7a..6e973863135374a6549e88eb85e74f33cc97932c 100644 (file)
@@ -188,7 +188,7 @@ namespace Utility {
 
     /**  Returns a new settings pre-set in a specific group.  The Settings will be created
          with the given parent. If no parent is specified, the caller must destroy the settings */
-    OCSYNC_EXPORT std::unique_ptr<QSettings> settingsWithGroup(const QString &group, QObject *parent = 0);
+    OCSYNC_EXPORT std::unique_ptr<QSettings> settingsWithGroup(const QString &group, QObject *parent = nullptr);
 
     /** Sanitizes a string that shall become part of a filename.
      *
index 7e390e16703ca12dfacb3ed1bce3a781ffbb0f5a..78aee40af0a9b8cb4353db887b91646eeee02f27 100644 (file)
@@ -229,7 +229,7 @@ class AccountApp : public QObject
 public:
     AccountApp(const QString &name, const QUrl &url,
         const QString &id, const QUrl &iconUrl,
-        QObject* parent = 0);
+        QObject* parent = nullptr);
 
     QString name() const;
     QUrl url() const;
index c52d73c1f827e857d0fd80ff19aaf53cfa810cff..f91590f24713998006930d9c8683599ab502a0e0 100644 (file)
@@ -73,7 +73,7 @@ class HeaderBanner : public QWidget
 {
     Q_OBJECT
 public:
-    HeaderBanner(QWidget *parent = 0);
+    HeaderBanner(QWidget *parent = nullptr);
 
     void setup(const QString &title, const QPixmap &logo, const QPixmap &banner,
                const Qt::TextFormat titleFormat, const QString &styleSheet);
index 8f6fba4e2b778cad87c453ee85da69e2d4efaaf0..fd7da9aa43cf57949c0a69b8f9a1b01b5f75cd39 100644 (file)
@@ -56,7 +56,7 @@ public:
     AccountConnectedRole,
     SyncFileStatusRole};
 
-    explicit ActivityListModel(AccountState *accountState, QObject* parent = 0);
+    explicit ActivityListModel(AccountState *accountState, QObject* parent = nullptr);
 
     QVariant data(const QModelIndex &index, int role) const override;
     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
index 10836dfd6b5e820693684caf88d03f6f35da96df..8fcd65f80ff82f144c63dfb4b1595a5fd1495e6f 100644 (file)
@@ -22,7 +22,7 @@ class User : public QObject
     Q_PROPERTY(bool hasLocalFolder READ hasLocalFolder NOTIFY hasLocalFolderChanged)
     Q_PROPERTY(bool serverHasTalk READ serverHasTalk NOTIFY serverHasTalkChanged)
 public:
-    User(AccountStatePtr &account, const bool &isCurrent = false, QObject* parent = 0);
+    User(AccountStatePtr &account, const bool &isCurrent = false, QObject* parent = nullptr);
 
     AccountPtr account() const;
 
@@ -143,7 +143,7 @@ protected:
 
 private:
     static UserModel *_instance;
-    UserModel(QObject *parent = 0);
+    UserModel(QObject *parent = nullptr);
     QList<User*> _users;
     int _currentUserId = 0;
     bool _init = true;
@@ -185,7 +185,7 @@ protected:
 
 private:
     static UserAppsModel *_instance;
-    UserAppsModel(QObject *parent = 0);
+    UserAppsModel(QObject *parent = nullptr);
 
     AccountAppList _apps;
 };
index 1fdd169c6408d7c5c480c22874bd8b7f8d0c6510..a92db1e7c5a910077282c1cf5a69c9c43fbc36bc 100644 (file)
@@ -147,7 +147,7 @@ class OWNCLOUDSYNC_EXPORT DirectEditor : public QObject
 {
     Q_OBJECT
 public:
-    DirectEditor(const QString &id, const QString &name, QObject* parent = 0);
+    DirectEditor(const QString &id, const QString &name, QObject* parent = nullptr);
 
     void addMimetype(const QByteArray &mimeType);
     void addOptionalMimetype(const QByteArray &mimeType);
index 17889a1a7afec6b3375ba7f0e277a8f40e7329c7..fedf091ac828ac3eef14fde2d5ab2daf19565319 100644 (file)
@@ -238,7 +238,7 @@ public:
                 etag = file->etag;
             return file;
         }
-        return 0;
+        return nullptr;
     }
 
     FileInfo *createDir(const QString &relativePath) {
@@ -816,7 +816,7 @@ public:
 
 protected:
     QNetworkReply *createRequest(Operation op, const QNetworkRequest &request,
-                                         QIODevice *outgoingData = 0) {
+                                         QIODevice *outgoingData = nullptr) {
         if (_override) {
             if (auto reply = _override(op, request, outgoingData))
                 return reply;