mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2025-05-10 17:34:09 +02:00
Enable the modernize-use-using check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
parent
7bb54e34d7
commit
d58ec4bf70
.clang-tidy
shell_integration/dolphin
src
3rdparty
cmd
csync
gui
libsync
test
@ -20,6 +20,7 @@ Checks: '-*,
|
||||
modernize-user-override,
|
||||
modernize-use-transparent-functors,
|
||||
modernize-use-uncaught-exceptions,
|
||||
modernize-use-using,
|
||||
'
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: '.*'
|
||||
|
@ -30,7 +30,7 @@ class OwncloudDolphinPlugin : public KOverlayIconPlugin
|
||||
Q_PLUGIN_METADATA(IID "com.owncloud.ovarlayiconplugin" FILE "ownclouddolphinoverlayplugin.json")
|
||||
Q_OBJECT
|
||||
|
||||
typedef QHash<QByteArray, QByteArray> StatusMap;
|
||||
using StatusMap = QHash<QByteArray, QByteArray>;
|
||||
StatusMap m_status;
|
||||
|
||||
public:
|
||||
|
10
src/3rdparty/qtokenizer/qtokenizer.h
vendored
10
src/3rdparty/qtokenizer/qtokenizer.h
vendored
@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
template <class T, class const_iterator>
|
||||
struct QTokenizerPrivate {
|
||||
typedef typename T::value_type char_type;
|
||||
using char_type = typename T::value_type;
|
||||
|
||||
struct State {
|
||||
bool inQuote = false;
|
||||
@ -113,7 +113,7 @@ struct QTokenizerPrivate {
|
||||
template <class T, class const_iterator>
|
||||
class QTokenizer {
|
||||
public:
|
||||
typedef typename T::value_type char_type;
|
||||
using char_type = typename T::value_type;
|
||||
|
||||
/*!
|
||||
\class QTokenizer
|
||||
@ -253,9 +253,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
typedef QTokenizer<QByteArray, QByteArray::const_iterator> QByteArrayTokenizer;
|
||||
typedef QTokenizer<std::string, std::string::const_iterator> StringTokenizer;
|
||||
typedef QTokenizer<std::wstring, std::wstring::const_iterator> WStringTokenizer;
|
||||
using QByteArrayTokenizer = QTokenizer<QByteArray, QByteArray::const_iterator>;
|
||||
using StringTokenizer = QTokenizer<std::string, std::string::const_iterator>;
|
||||
using WStringTokenizer = QTokenizer<std::wstring, std::wstring::const_iterator>;
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QLibrary>
|
||||
#include <qt_windows.h>
|
||||
typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*);
|
||||
using PProcessIdToSessionId = BOOL (WINAPI*)(DWORD, DWORD*);
|
||||
static PProcessIdToSessionId pProcessIdToSessionId = 0;
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace OCC {
|
||||
class NetrcParser
|
||||
{
|
||||
public:
|
||||
typedef QPair<QString, QString> LoginPair;
|
||||
using LoginPair = QPair<QString, QString>;
|
||||
|
||||
NetrcParser(const QString &file = QString());
|
||||
bool parse();
|
||||
|
@ -95,7 +95,7 @@ enum csync_status_codes_e {
|
||||
CSYNC_STATUS_INDIVIDUAL_CANNOT_ENCODE
|
||||
};
|
||||
|
||||
typedef enum csync_status_codes_e CSYNC_STATUS;
|
||||
using CSYNC_STATUS = enum csync_status_codes_e;
|
||||
|
||||
#ifndef likely
|
||||
# define likely(x) (x)
|
||||
@ -146,7 +146,7 @@ enum ItemType {
|
||||
// currently specified at https://github.com/owncloud/core/issues/8322 are 9 to 10
|
||||
#define REMOTE_PERM_BUF_SIZE 15
|
||||
|
||||
typedef struct csync_file_stat_s csync_file_stat_t;
|
||||
using csync_file_stat_t = struct csync_file_stat_s;
|
||||
|
||||
struct OCSYNC_EXPORT csync_file_stat_s {
|
||||
time_t modtime = 0;
|
||||
@ -193,26 +193,19 @@ struct OCSYNC_EXPORT csync_file_stat_s {
|
||||
/**
|
||||
* csync handle
|
||||
*/
|
||||
typedef struct csync_s CSYNC;
|
||||
using CSYNC = struct csync_s;
|
||||
|
||||
typedef int (*csync_auth_callback) (const char *prompt, char *buf, size_t len,
|
||||
int echo, int verify, void *userdata);
|
||||
using csync_auth_callback = int (*)(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata);
|
||||
|
||||
typedef void (*csync_update_callback) (bool local,
|
||||
const char *dirUrl,
|
||||
void *userdata);
|
||||
using csync_update_callback = void (*)(bool local, const char *dirUrl, void *userdata);
|
||||
|
||||
typedef void csync_vio_handle_t;
|
||||
typedef csync_vio_handle_t* (*csync_vio_opendir_hook) (const char *url,
|
||||
void *userdata);
|
||||
typedef std::unique_ptr<csync_file_stat_t> (*csync_vio_readdir_hook) (csync_vio_handle_t *dhhandle,
|
||||
void *userdata);
|
||||
typedef void (*csync_vio_closedir_hook) (csync_vio_handle_t *dhhandle,
|
||||
void *userdata);
|
||||
using csync_vio_handle_t = void;
|
||||
using csync_vio_opendir_hook = csync_vio_handle_t *(*)(const char *url, void *userdata);
|
||||
using csync_vio_readdir_hook = std::unique_ptr<csync_file_stat_t> (*)(csync_vio_handle_t *dhandle, void *userdata);
|
||||
using csync_vio_closedir_hook = void (*)(csync_vio_handle_t *dhandle, void *userdata);
|
||||
|
||||
/* Compute the checksum of the given \a checksumTypeId for \a path. */
|
||||
typedef QByteArray (*csync_checksum_hook)(
|
||||
const QByteArray &path, const QByteArray &otherChecksumHeader, void *userdata);
|
||||
using csync_checksum_hook = QByteArray (*)(const QByteArray &path, const QByteArray &otherChecksumHeader, void *userdata);
|
||||
|
||||
/**
|
||||
* @brief Update detection
|
||||
|
@ -45,7 +45,7 @@ enum csync_exclude_type_e {
|
||||
CSYNC_FILE_EXCLUDE_CONFLICT,
|
||||
CSYNC_FILE_EXCLUDE_CANNOT_ENCODE
|
||||
};
|
||||
typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE;
|
||||
using CSYNC_EXCLUDE_TYPE = enum csync_exclude_type_e;
|
||||
|
||||
class ExcludedFilesTest;
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef int (*csync_walker_fn) (CSYNC *ctx, std::unique_ptr<csync_file_stat_t> fs);
|
||||
using csync_walker_fn = int (*)(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> fs);
|
||||
|
||||
/**
|
||||
* @brief The walker function to use in the file tree walker.
|
||||
|
@ -37,10 +37,10 @@
|
||||
Q_LOGGING_CATEGORY(lcCSyncUtils, "nextcloud.sync.csync.utils", QtInfoMsg)
|
||||
|
||||
|
||||
typedef struct {
|
||||
using _instr_code_struct = struct {
|
||||
const char *instr_str;
|
||||
enum csync_instructions_e instr_code;
|
||||
} _instr_code_struct;
|
||||
};
|
||||
|
||||
static const _instr_code_struct _instr[] =
|
||||
{
|
||||
|
@ -80,10 +80,10 @@
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef struct stat64 csync_stat_t;
|
||||
typedef struct stat64 csync_stat_t; // NOLINT this is sometimes compiled in C mode
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#else
|
||||
typedef struct stat csync_stat_t;
|
||||
typedef struct stat csync_stat_t; // NOLINT this is sometimes compiled in C mode
|
||||
#endif
|
||||
|
||||
#ifndef O_NOATIME
|
||||
@ -112,7 +112,7 @@ typedef struct stat csync_stat_t;
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 && defined _UNICODE
|
||||
typedef wchar_t mbchar_t;
|
||||
typedef wchar_t mbchar_t; // NOLINT this is sometimes compiled in C mode
|
||||
#define _topen _wopen
|
||||
#define _tdirent _wdirent
|
||||
#define _topendir _wopendir
|
||||
@ -133,7 +133,7 @@ typedef wchar_t mbchar_t;
|
||||
#define _tchdir _wchdir
|
||||
#define _tgetcwd _wgetcwd
|
||||
#else
|
||||
typedef char mbchar_t;
|
||||
typedef char mbchar_t; // NOLINT this is sometimes compiled in C mode
|
||||
#define _tdirent dirent
|
||||
#define _topen open
|
||||
#define _topendir opendir
|
||||
|
@ -28,9 +28,11 @@
|
||||
#include "csync.h"
|
||||
#include "csync_private.h"
|
||||
|
||||
typedef struct fhandle_s {
|
||||
using fhandle_t = struct fhandle_s {
|
||||
|
||||
int fd;
|
||||
} fhandle_t;
|
||||
|
||||
};
|
||||
|
||||
csync_vio_handle_t *csync_vio_opendir(CSYNC *ctx, const char *name);
|
||||
int csync_vio_closedir(CSYNC *ctx, csync_vio_handle_t *dhandle);
|
||||
|
@ -43,10 +43,10 @@ Q_LOGGING_CATEGORY(lcCSyncVIOLocal, "nextcloud.sync.csync.vio_local", QtInfoMsg)
|
||||
* directory functions
|
||||
*/
|
||||
|
||||
typedef struct dhandle_s {
|
||||
using dhandle_t = struct dhandle_s {
|
||||
DIR *dh;
|
||||
char *path;
|
||||
} dhandle_t;
|
||||
};
|
||||
|
||||
static int _csync_vio_local_stat_mb(const mbchar_t *wuri, csync_file_stat_t *buf);
|
||||
|
||||
|
@ -43,12 +43,12 @@ Q_LOGGING_CATEGORY(lcCSyncVIOLocal, "nextcloud.sync.csync.vio_local", QtInfoMsg)
|
||||
* directory functions
|
||||
*/
|
||||
|
||||
typedef struct dhandle_s {
|
||||
using dhandle_t = struct dhandle_s {
|
||||
WIN32_FIND_DATA ffd;
|
||||
HANDLE hFind;
|
||||
int firstFind;
|
||||
mbchar_t *path; // Always ends with '\'
|
||||
} dhandle_t;
|
||||
};
|
||||
|
||||
static int _csync_vio_local_stat_mb(const mbchar_t *uri, csync_file_stat_t *buf);
|
||||
|
||||
|
@ -32,8 +32,8 @@ class Account;
|
||||
class AccountApp;
|
||||
class RemoteWipe;
|
||||
|
||||
typedef QExplicitlySharedDataPointer<AccountState> AccountStatePtr;
|
||||
typedef QList<AccountApp*> AccountAppList;
|
||||
using AccountStatePtr = QExplicitlySharedDataPointer<AccountState>;
|
||||
using AccountAppList = QList<AccountApp *>;
|
||||
|
||||
/**
|
||||
* @brief Extra info about an ownCloud server account.
|
||||
@ -75,7 +75,7 @@ public:
|
||||
};
|
||||
|
||||
/// The actual current connectivity status.
|
||||
typedef ConnectionValidator::Status ConnectionStatus;
|
||||
using ConnectionStatus = ConnectionValidator::Status;
|
||||
|
||||
/// Use the account as parent
|
||||
explicit AccountState(AccountPtr account);
|
||||
|
@ -20,17 +20,17 @@
|
||||
|
||||
/* Forward declaration required since gio header files interfere with QObject headers */
|
||||
struct _CloudProvidersProviderExporter;
|
||||
typedef _CloudProvidersProviderExporter CloudProvidersProviderExporter;
|
||||
using CloudProvidersProviderExporter = _CloudProvidersProviderExporter;
|
||||
struct _CloudProvidersAccountExporter;
|
||||
typedef _CloudProvidersAccountExporter CloudProvidersAccountExporter;
|
||||
using CloudProvidersAccountExporter = _CloudProvidersAccountExporter;
|
||||
struct _GMenuModel;
|
||||
typedef _GMenuModel GMenuModel;
|
||||
using GMenuModel = _GMenuModel;
|
||||
struct _GMenu;
|
||||
typedef _GMenu GMenu;
|
||||
using GMenu = _GMenu;
|
||||
struct _GActionGroup;
|
||||
typedef _GActionGroup GActionGroup;
|
||||
typedef char gchar;
|
||||
typedef void* gpointer;
|
||||
using GActionGroup = _GActionGroup;
|
||||
using gchar = char;
|
||||
using gpointer = void*;
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
|
@ -95,8 +95,8 @@ public:
|
||||
|
||||
~Folder();
|
||||
|
||||
typedef QMap<QString, Folder *> Map;
|
||||
typedef QMapIterator<QString, Folder *> MapIterator;
|
||||
using Map = QMap<QString, Folder *>;
|
||||
using MapIterator = QMapIterator<QString, Folder *>;
|
||||
|
||||
/**
|
||||
* The account the folder is configured on.
|
||||
|
@ -66,7 +66,7 @@ class ShareeModel : public QAbstractListModel
|
||||
public:
|
||||
explicit ShareeModel(const AccountPtr &account, const QString &type, QObject *parent = nullptr);
|
||||
|
||||
typedef QVector<QSharedPointer<Sharee>> ShareeSet; // FIXME: make it a QSet<Sharee> when Sharee can be compared
|
||||
using ShareeSet = QVector<QSharedPointer<Sharee>>; // FIXME: make it a QSet<Sharee> when Sharee can be compared
|
||||
void fetch(const QString &search, const ShareeSet &blacklist);
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
TypeCircle = Sharee::Circle
|
||||
};
|
||||
|
||||
typedef SharePermissions Permissions;
|
||||
using Permissions = SharePermissions;
|
||||
|
||||
/*
|
||||
* Constructor for shares
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "socketapisocket_mac.h"
|
||||
#else
|
||||
#include <QLocalServer>
|
||||
typedef QLocalServer SocketApiServer;
|
||||
using SocketApiServer = QLocalServer;
|
||||
#endif
|
||||
|
||||
class QUrl;
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
class Activity
|
||||
{
|
||||
public:
|
||||
typedef QPair<qlonglong, QString> Identifier;
|
||||
using Identifier = QPair<qlonglong, QString>;
|
||||
|
||||
enum Type {
|
||||
ActivityType,
|
||||
@ -92,8 +92,7 @@ bool operator<(const Activity &rhs, const Activity &lhs);
|
||||
*
|
||||
* A QList based list of Activities
|
||||
*/
|
||||
|
||||
typedef QList<Activity> ActivityList;
|
||||
using ActivityList = QList<Activity>;
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(OCC::Activity::Type)
|
||||
|
@ -51,7 +51,7 @@ namespace OCC {
|
||||
|
||||
class AbstractCredentials;
|
||||
class Account;
|
||||
typedef QSharedPointer<Account> AccountPtr;
|
||||
using AccountPtr = QSharedPointer<Account>;
|
||||
class AccessManager;
|
||||
class SimpleNetworkJob;
|
||||
|
||||
|
@ -20,9 +20,9 @@
|
||||
namespace OCC {
|
||||
|
||||
class Account;
|
||||
typedef QSharedPointer<Account> AccountPtr;
|
||||
using AccountPtr = QSharedPointer<Account>;
|
||||
class AccountState;
|
||||
typedef QExplicitlySharedDataPointer<AccountState> AccountStatePtr;
|
||||
using AccountStatePtr = QExplicitlySharedDataPointer<AccountState>;
|
||||
|
||||
} // namespace OCC
|
||||
|
||||
|
@ -201,7 +201,7 @@ private:
|
||||
QString keychainProxyPasswordKey() const;
|
||||
|
||||
private:
|
||||
typedef QSharedPointer<AbstractCredentials> SharedCreds;
|
||||
using SharedCreds = QSharedPointer<AbstractCredentials>;
|
||||
|
||||
static bool _askedUser;
|
||||
static QString _oCVersion;
|
||||
|
@ -27,7 +27,7 @@ namespace OCC {
|
||||
|
||||
class SyncFileItem;
|
||||
class SyncJournalFileRecord;
|
||||
typedef QSharedPointer<SyncFileItem> SyncFileItemPtr;
|
||||
using SyncFileItemPtr = QSharedPointer<SyncFileItem>;
|
||||
|
||||
/**
|
||||
* @brief The SyncFileItem class
|
||||
@ -254,7 +254,7 @@ inline bool operator<(const SyncFileItemPtr &item1, const SyncFileItemPtr &item2
|
||||
return *item1 < *item2;
|
||||
}
|
||||
|
||||
typedef QVector<SyncFileItemPtr> SyncFileItemVector;
|
||||
using SyncFileItemVector = QVector<SyncFileItemPtr>;
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(OCC::SyncFileItem)
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
struct PathComparator {
|
||||
bool operator()( const QString& lhs, const QString& rhs ) const;
|
||||
};
|
||||
typedef std::map<QString, SyncFileStatus::SyncFileStatusTag, PathComparator> ProblemsMap;
|
||||
using ProblemsMap = std::map<QString, SyncFileStatus::SyncFileStatusTag, PathComparator>;
|
||||
SyncFileStatus::SyncFileStatusTag lookupProblem(const QString &pathToMatch, const ProblemsMap &problemMap);
|
||||
|
||||
enum SharedFlag { UnknownShared,
|
||||
|
@ -698,7 +698,7 @@ static void check_csync_exclude_expand_escapes(void **state)
|
||||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
typedef ExcludedFilesTest T;
|
||||
using T = ExcludedFilesTest;
|
||||
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test_setup_teardown(T::check_csync_exclude_add, T::setup, T::teardown),
|
||||
|
@ -43,11 +43,11 @@
|
||||
|
||||
static mbchar_t wd_buffer[WD_BUFFER_SIZE];
|
||||
|
||||
typedef struct {
|
||||
using statevar = struct {
|
||||
CSYNC *csync;
|
||||
char *result;
|
||||
char *ignored_dir;
|
||||
} statevar;
|
||||
};
|
||||
|
||||
/* remove the complete test dir */
|
||||
static int wipe_testdir()
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
typedef QList< QPair<QString,QString> > QueryItems;
|
||||
using QueryItems = QList<QPair<QString, QString>>;
|
||||
|
||||
Q_DECLARE_METATYPE(QueryItems)
|
||||
|
||||
|
@ -65,7 +65,7 @@ private slots:
|
||||
|
||||
void testParseEtag()
|
||||
{
|
||||
typedef QPair<const char*, const char*> Test;
|
||||
using Test = QPair<const char*, const char*>;
|
||||
QList<Test> tests;
|
||||
tests.append(Test("\"abcd\"", "abcd"));
|
||||
tests.append(Test("\"\"", ""));
|
||||
|
@ -130,7 +130,7 @@ private slots:
|
||||
|
||||
void testDownloadInfo()
|
||||
{
|
||||
typedef SyncJournalDb::DownloadInfo Info;
|
||||
using Info = SyncJournalDb::DownloadInfo;
|
||||
Info record = _db.getDownloadInfo("nonexistant");
|
||||
QVERIFY(!record._valid);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user