ソースを参照

more fixes for attributes without init value

done with clang-tidy

run-clang-tidy -p build -header-filter='.*' -config="{Checks: '*', CheckOptions: [{key: UseAssignment, value: true}]}" -checks='-*,cppcoreguidelines-pro-type-member-init' -fix

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
Matthieu Gallien 3 年 前
コミット
76e88572d6

+ 1 - 1
src/common/ownsql.h

@@ -164,7 +164,7 @@ private:
     sqlite3 *_db = nullptr;
     sqlite3_stmt *_stmt = nullptr;
     QString _error;
-    int _errId;
+    int _errId = 0;
     QByteArray _sql;
 
     friend class SqlDatabase;

+ 2 - 2
src/common/syncjournaldb.h

@@ -131,8 +131,8 @@ public:
     {
         QString _file; // The relative path of a file
         QString _url; // the poll url. (This pollinfo is invalid if _url is empty)
-        qint64 _modtime; // The modtime of the file being uploaded
-        qint64 _fileSize;
+        qint64 _modtime = 0LL; // The modtime of the file being uploaded
+        qint64 _fileSize = 0LL;
     };
 
     DownloadInfo getDownloadInfo(const QString &file);

+ 4 - 4
src/gui/accountstate.h

@@ -226,7 +226,7 @@ private:
     ConnectionStatus _connectionStatus;
     ConnectionStatus _lastConnectionValidatorStatus = ConnectionStatus::Undefined;
     QStringList _connectionErrors;
-    bool _waitingForNewCredentials;
+    bool _waitingForNewCredentials = false;
     QDateTime _timeOfLastETagCheck;
     QPointer<ConnectionValidator> _connectionValidator;
     QByteArray _notificationsEtagResponseHeader;
@@ -242,20 +242,20 @@ private:
     /**
      * Milliseconds for which to delay reconnection after 503/maintenance.
      */
-    int _maintenanceToConnectedDelay;
+    int _maintenanceToConnectedDelay = 0;
 
     /**
      * Connects remote wipe check with the account
      * the log out triggers the check (loads app password -> create request)
      */
-    RemoteWipe *_remoteWipe;
+    RemoteWipe *_remoteWipe = nullptr;
 
     /**
      * Holds the App names and URLs available on the server
      */
     AccountAppList _apps;
 
-    bool _isDesktopNotificationsAllowed;
+    bool _isDesktopNotificationsAllowed = false;
 
     int _retryCount = 0;
 

+ 2 - 2
src/gui/folderwatcher_linux.h

@@ -54,13 +54,13 @@ protected:
     void removeFoldersBelow(const QString &path);
 
 private:
-    FolderWatcher *_parent;
+    FolderWatcher *_parent = nullptr;
 
     QString _folder;
     QHash<int, QString> _watchToPath;
     QMap<QString, int> _pathToWatch;
     QScopedPointer<QSocketNotifier> _socket;
-    int _fd;
+    int _fd = 0;
 };
 }
 

+ 1 - 1
src/gui/socketapi/socketapi.h

@@ -89,7 +89,7 @@ private:
         // Relative path of the file locally, without any vfs suffix
         [[nodiscard]] QString folderRelativePathNoVfsSuffix() const;
 
-        Folder *folder;
+        Folder *folder = nullptr;
         // Absolute path of the file locally. (May be a virtual file)
         QString localPath;
         // Relative path of the file locally, as in the DB. (May be a virtual file)

+ 6 - 6
src/gui/tray/activitydata.h

@@ -50,7 +50,7 @@ public:
     QString _label;
     QString _link;
     QByteArray _verb;
-    bool _primary;
+    bool _primary = false;
 };
 
 /**
@@ -73,9 +73,9 @@ public:
     QString _source;
     QString _link;
     QString _mimeType;
-    int _fileId;
+    int _fileId = 0;
     QString _view;
-    bool _isMimeTypeIcon;
+    bool _isMimeTypeIcon = false;
     QString _filename;
 };
 
@@ -123,9 +123,9 @@ public:
     };
 
     Type _type;
-    qlonglong _id;
+    qlonglong _id = 0LL;
     QString _fileAction;
-    int _objectId;
+    int _objectId = 0;
     TalkNotificationData _talkNotificationData;
     QString _objectType;
     QString _objectName;
@@ -137,7 +137,7 @@ public:
     QString _folder;
     QString _file;
     QString _renamedFile;
-    bool _isMultiObjectActivity;
+    bool _isMultiObjectActivity = false;
     QUrl _link;
     QDateTime _dateTime;
     qint64 _expireAtMsecs = -1;

+ 2 - 2
src/gui/tray/unifiedsearchresult.h

@@ -44,8 +44,8 @@ struct UnifiedSearchResult
     QUrl _resourceUrl;
     QString _darkIcons;
     QString _lightIcons;
-    bool _darkIconsIsThumbnail;
-    bool _lightIconsIsThumbnail;
+    bool _darkIconsIsThumbnail = false;
+    bool _lightIconsIsThumbnail = false;
     Type _type = Type::Default;
 };
 }

+ 1 - 1
src/libsync/bulkpropagatorjob.h

@@ -44,7 +44,7 @@ class BulkPropagatorJob : public PropagatorJob
     struct UploadFileInfo {
       QString _file; /// I'm still unsure if I should use a SyncFilePtr here.
       QString _path; /// the full path on disk.
-      qint64 _size;
+      qint64 _size = 0LL;
     };
 
     struct BulkUploadItem

+ 2 - 2
src/libsync/clientsideencryption.h

@@ -180,8 +180,8 @@ struct EncryptedFile {
     QByteArray authenticationTag;
     QString encryptedFilename;
     QString originalFilename;
-    int fileVersion;
-    int metadataKey;
+    int fileVersion = 0;
+    int metadataKey = 0;
 };
 
 class OWNCLOUDSYNC_EXPORT FolderMetadata {

+ 2 - 2
src/libsync/discoveryphase.h

@@ -274,10 +274,10 @@ public:
     // input
     QString _localDir; // absolute path to the local directory. ends with '/'
     QString _remoteFolder; // remote folder, ends with '/'
-    SyncJournalDb *_statedb;
+    SyncJournalDb *_statedb = nullptr;
     AccountPtr _account;
     SyncOptions _syncOptions;
-    ExcludedFiles *_excludes;
+    ExcludedFiles *_excludes = nullptr;
     QRegularExpression _invalidFilenameRx; // FIXME: maybe move in ExcludedFiles
     QStringList _serverBlacklistedFiles; // The blacklist from the capabilities
     QStringList _leadingAndTrailingSpacesFilesAllowed;

+ 2 - 2
src/libsync/propagateupload.h

@@ -232,7 +232,7 @@ protected:
     struct UploadFileInfo {
       QString _file; /// I'm still unsure if I should use a SyncFilePtr here.
       QString _path; /// the full path on disk.
-      qint64 _size;
+      qint64 _size = 0LL;
     };
     UploadFileInfo _fileToUpload;
     QByteArray _transmissionChecksumHeader;
@@ -389,7 +389,7 @@ private:
     // (Only used from slotPropfindIterate/slotPropfindFinished because the LsColJob use signals to report data.)
     struct ServerChunkInfo
     {
-        qint64 size;
+        qint64 size = 0LL;
         QString originalName;
     };
     QMap<qint64, ServerChunkInfo> _serverChunks;

+ 1 - 1
src/libsync/propagatorjobs.h

@@ -45,7 +45,7 @@ public:
 private:
     bool removeRecursively(const QString &path);
     QString _error;
-    bool _moveToTrash;
+    bool _moveToTrash = false;
 };
 
 /**

+ 1 - 1
src/libsync/syncengine.h

@@ -250,7 +250,7 @@ private:
     // See SyncEngine::groupNeededScheduledSyncRuns and
     // SyncEngine::slotScheduleFilesDelayedSync for usage.
     struct ScheduledSyncBucket {
-        qint64 scheduledSyncTimerSecs;
+        qint64 scheduledSyncTimerSecs = 0LL;
         QVector<QString> files;
     };
 

+ 2 - 2
src/libsync/userstatusconnector.h

@@ -41,8 +41,8 @@ struct OWNCLOUDSYNC_EXPORT ClearAt
 {
     ClearAtType _type = ClearAtType::Period;
 
-    quint64 _timestamp;
-    int _period;
+    quint64 _timestamp = 0ULL;
+    int _period = 0;
     QString _endof;
 };
 

+ 9 - 9
test/sharetestutils.h

@@ -34,16 +34,16 @@ struct FakeFileReplyDefinition
     QString fileOwnerUid;
     QString fileOwnerDisplayName;
     QString fileTarget;
-    bool fileHasPreview;
+    bool fileHasPreview = false;
     QString fileFileParent;
     QString fileSource;
     QString fileItemSource;
     QString fileItemType;
-    int fileMailSend;
+    int fileMailSend = 0;
     QString fileMimeType;
     QString fileParent;
     QString filePath;
-    int fileStorage;
+    int fileStorage = 0;
     QString fileStorageId;
 };
 
@@ -60,17 +60,17 @@ struct FakeShareDefinition
 
     FakeFileReplyDefinition fileDefinition;
     QString shareId;
-    bool shareCanDelete;
-    bool shareCanEdit;
+    bool shareCanDelete = false;
+    bool shareCanEdit = false;
     QString shareUidOwner;
     QString shareDisplayNameOwner;
     QString sharePassword;
-    int sharePermissions;
+    int sharePermissions = 0;
     QString shareNote;
-    int shareHideDownload;
+    int shareHideDownload = 0;
     QString shareExpiration;
-    bool shareSendPasswordByTalk;
-    int shareType;
+    bool shareSendPasswordByTalk = false;
+    int shareType = 0;
     QString shareShareWith;
     QString shareShareWithDisplayName;
     QString shareToken;