mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
Merge pull request #1988 from nextcloud/nullptr_everywhere
Use nullptr when appropriate
This commit is contained in:
commit
1f2bfc0f42
18 changed files with 65 additions and 65 deletions
|
@ -123,7 +123,7 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout, bool block)
|
||||||
Sleep(DWORD(ms));
|
Sleep(DWORD(ms));
|
||||||
#else
|
#else
|
||||||
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
|
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
|
||||||
nanosleep(&ts, NULL);
|
nanosleep(&ts, nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!connOk)
|
if (!connOk)
|
||||||
|
|
|
@ -53,7 +53,7 @@ static QString instancesLockFilename(const QString &appSessionId)
|
||||||
QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv)
|
QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv)
|
||||||
: QApplication(argc, argv),
|
: QApplication(argc, argv),
|
||||||
firstPeer(-1),
|
firstPeer(-1),
|
||||||
pidPeer(0)
|
pidPeer(nullptr)
|
||||||
{
|
{
|
||||||
this->appId = appId;
|
this->appId = appId;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char *
|
||||||
|
|
||||||
// This shared memory holds a zero-terminated array of active (or crashed) instances
|
// This shared memory holds a zero-terminated array of active (or crashed) instances
|
||||||
instances = new QSharedMemory(appSessionId, this);
|
instances = new QSharedMemory(appSessionId, this);
|
||||||
actWin = 0;
|
actWin = nullptr;
|
||||||
block = false;
|
block = false;
|
||||||
|
|
||||||
// First instance creates the shared memory, later instances attach to it
|
// First instance creates the shared memory, later instances attach to it
|
||||||
|
@ -71,7 +71,7 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char *
|
||||||
qWarning() << "Failed to initialize instances shared memory: "
|
qWarning() << "Failed to initialize instances shared memory: "
|
||||||
<< instances->errorString();
|
<< instances->errorString();
|
||||||
delete instances;
|
delete instances;
|
||||||
instances = 0;
|
instances = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ struct CmdOptions
|
||||||
|
|
||||||
// we can't use csync_set_userdata because the SyncEngine sets it already.
|
// we can't use csync_set_userdata because the SyncEngine sets it already.
|
||||||
// So we have to use a global variable
|
// So we have to use a global variable
|
||||||
CmdOptions *opts = 0;
|
CmdOptions *opts = nullptr;
|
||||||
|
|
||||||
class EchoDisabler
|
class EchoDisabler
|
||||||
{
|
{
|
||||||
|
|
|
@ -263,13 +263,13 @@ QByteArray CSyncChecksumHook::hook(const QByteArray &path, const QByteArray &oth
|
||||||
{
|
{
|
||||||
QByteArray type = parseChecksumHeaderType(QByteArray(otherChecksumHeader));
|
QByteArray type = parseChecksumHeaderType(QByteArray(otherChecksumHeader));
|
||||||
if (type.isEmpty())
|
if (type.isEmpty())
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
qCInfo(lcChecksums) << "Computing" << type << "checksum of" << path << "in the csync hook";
|
qCInfo(lcChecksums) << "Computing" << type << "checksum of" << path << "in the csync hook";
|
||||||
QByteArray checksum = ComputeChecksum::computeNow(QString::fromUtf8(path), type);
|
QByteArray checksum = ComputeChecksum::computeNow(QString::fromUtf8(path), type);
|
||||||
if (checksum.isNull()) {
|
if (checksum.isNull()) {
|
||||||
qCWarning(lcChecksums) << "Failed to compute checksum" << type << "for" << path;
|
qCWarning(lcChecksums) << "Failed to compute checksum" << type << "for" << path;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeChecksumHeader(type, checksum);
|
return makeChecksumHeader(type, checksum);
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace OCC {
|
||||||
Q_LOGGING_CATEGORY(lcSql, "nextcloud.sync.database.sql", QtInfoMsg)
|
Q_LOGGING_CATEGORY(lcSql, "nextcloud.sync.database.sql", QtInfoMsg)
|
||||||
|
|
||||||
SqlDatabase::SqlDatabase()
|
SqlDatabase::SqlDatabase()
|
||||||
: _db(0)
|
: _db(nullptr)
|
||||||
, _errId(0)
|
, _errId(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ SqlDatabase::~SqlDatabase()
|
||||||
|
|
||||||
bool SqlDatabase::isOpen()
|
bool SqlDatabase::isOpen()
|
||||||
{
|
{
|
||||||
return _db != 0;
|
return _db != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SqlDatabase::openHelper(const QString &filename, int sqliteFlags)
|
bool SqlDatabase::openHelper(const QString &filename, int sqliteFlags)
|
||||||
|
@ -68,7 +68,7 @@ bool SqlDatabase::openHelper(const QString &filename, int sqliteFlags)
|
||||||
|
|
||||||
sqliteFlags |= SQLITE_OPEN_NOMUTEX;
|
sqliteFlags |= SQLITE_OPEN_NOMUTEX;
|
||||||
|
|
||||||
SQLITE_DO(sqlite3_open_v2(filename.toUtf8().constData(), &_db, sqliteFlags, 0));
|
SQLITE_DO(sqlite3_open_v2(filename.toUtf8().constData(), &_db, sqliteFlags, nullptr));
|
||||||
|
|
||||||
if (_errId != SQLITE_OK) {
|
if (_errId != SQLITE_OK) {
|
||||||
qCWarning(lcSql) << "Error:" << _error << "for" << filename;
|
qCWarning(lcSql) << "Error:" << _error << "for" << filename;
|
||||||
|
@ -196,7 +196,7 @@ void SqlDatabase::close()
|
||||||
SQLITE_DO(sqlite3_close(_db));
|
SQLITE_DO(sqlite3_close(_db));
|
||||||
if (_errId != SQLITE_OK)
|
if (_errId != SQLITE_OK)
|
||||||
qCWarning(lcSql) << "Closing database failed" << _error;
|
qCWarning(lcSql) << "Closing database failed" << _error;
|
||||||
_db = 0;
|
_db = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ bool SqlDatabase::transaction()
|
||||||
if (!_db) {
|
if (!_db) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SQLITE_DO(sqlite3_exec(_db, "BEGIN", 0, 0, 0));
|
SQLITE_DO(sqlite3_exec(_db, "BEGIN", nullptr, nullptr, nullptr));
|
||||||
return _errId == SQLITE_OK;
|
return _errId == SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ bool SqlDatabase::commit()
|
||||||
if (!_db) {
|
if (!_db) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SQLITE_DO(sqlite3_exec(_db, "COMMIT", 0, 0, 0));
|
SQLITE_DO(sqlite3_exec(_db, "COMMIT", nullptr, nullptr, nullptr));
|
||||||
return _errId == SQLITE_OK;
|
return _errId == SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ int SqlQuery::prepare(const QByteArray &sql, bool allow_failure)
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int rc;
|
int rc;
|
||||||
do {
|
do {
|
||||||
rc = sqlite3_prepare_v2(_db, _sql.constData(), -1, &_stmt, 0);
|
rc = sqlite3_prepare_v2(_db, _sql.constData(), -1, &_stmt, nullptr);
|
||||||
if ((rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED)) {
|
if ((rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED)) {
|
||||||
n++;
|
n++;
|
||||||
OCC::Utility::usleep(SQLITE_SLEEP_TIME_USEC);
|
OCC::Utility::usleep(SQLITE_SLEEP_TIME_USEC);
|
||||||
|
@ -462,7 +462,7 @@ void SqlQuery::finish()
|
||||||
if (!_stmt)
|
if (!_stmt)
|
||||||
return;
|
return;
|
||||||
SQLITE_DO(sqlite3_finalize(_stmt));
|
SQLITE_DO(sqlite3_finalize(_stmt));
|
||||||
_stmt = 0;
|
_stmt = nullptr;
|
||||||
if (_sqldb) {
|
if (_sqldb) {
|
||||||
_sqldb->_queries.remove(this);
|
_sqldb->_queries.remove(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1861,12 +1861,12 @@ QByteArray SyncJournalDb::getChecksumType(int checksumTypeId)
|
||||||
return {};
|
return {};
|
||||||
query.bindValue(1, checksumTypeId);
|
query.bindValue(1, checksumTypeId);
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!query.next()) {
|
if (!query.next()) {
|
||||||
qCWarning(lcDb) << "No checksum type mapping found for" << checksumTypeId;
|
qCWarning(lcDb) << "No checksum type mapping found for" << checksumTypeId;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return query.baValue(0);
|
return query.baValue(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ namespace {
|
||||||
|
|
||||||
QString description(quint64 value) const
|
QString description(quint64 value) const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Utility", name, 0, value);
|
return QCoreApplication::translate("Utility", name, nullptr, value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// QTBUG-3945 and issue #4855: QT_TRANSLATE_NOOP does not work with plural form because lupdate
|
// QTBUG-3945 and issue #4855: QT_TRANSLATE_NOOP does not work with plural form because lupdate
|
||||||
|
@ -313,7 +313,7 @@ namespace {
|
||||||
{ QT_TRANSLATE_NOOP("Utility", "%n hour(s)", 0, _), 3600 * 1000LL },
|
{ QT_TRANSLATE_NOOP("Utility", "%n hour(s)", 0, _), 3600 * 1000LL },
|
||||||
{ QT_TRANSLATE_NOOP("Utility", "%n minute(s)", 0, _), 60 * 1000LL },
|
{ QT_TRANSLATE_NOOP("Utility", "%n minute(s)", 0, _), 60 * 1000LL },
|
||||||
{ QT_TRANSLATE_NOOP("Utility", "%n second(s)", 0, _), 1000LL },
|
{ QT_TRANSLATE_NOOP("Utility", "%n second(s)", 0, _), 1000LL },
|
||||||
{ 0, 0 }
|
{ nullptr, 0 }
|
||||||
};
|
};
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ QString Utility::platformName()
|
||||||
|
|
||||||
void Utility::crash()
|
void Utility::crash()
|
||||||
{
|
{
|
||||||
volatile int *a = (int *)(NULL);
|
volatile int *a = (int *)nullptr;
|
||||||
*a = 1;
|
*a = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ csync_s::csync_s(const char *localUri, OCC::SyncJournalDb *statedb)
|
||||||
int csync_update(CSYNC *ctx) {
|
int csync_update(CSYNC *ctx) {
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
if (ctx == NULL) {
|
if (ctx == nullptr) {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ static int _csync_treewalk_visitor(csync_file_stat_t *cur, CSYNC * ctx, const cs
|
||||||
other_file_it = other_tree->find(renamed_path);
|
other_file_it = other_tree->find(renamed_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
csync_file_stat_t *other = (other_file_it != other_tree->cend()) ? other_file_it->second.get() : NULL;
|
csync_file_stat_t *other = (other_file_it != other_tree->cend()) ? other_file_it->second.get() : nullptr;
|
||||||
|
|
||||||
ctx->status_code = CSYNC_STATUS_OK;
|
ctx->status_code = CSYNC_STATUS_OK;
|
||||||
|
|
||||||
|
@ -256,14 +256,14 @@ csync_s::~csync_s() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *csync_get_userdata(CSYNC *ctx) {
|
void *csync_get_userdata(CSYNC *ctx) {
|
||||||
if (ctx == NULL) {
|
if (ctx == nullptr) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return ctx->callbacks.userdata;
|
return ctx->callbacks.userdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
int csync_set_userdata(CSYNC *ctx, void *userdata) {
|
int csync_set_userdata(CSYNC *ctx, void *userdata) {
|
||||||
if (ctx == NULL) {
|
if (ctx == nullptr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,15 +273,15 @@ int csync_set_userdata(CSYNC *ctx, void *userdata) {
|
||||||
}
|
}
|
||||||
|
|
||||||
csync_auth_callback csync_get_auth_callback(CSYNC *ctx) {
|
csync_auth_callback csync_get_auth_callback(CSYNC *ctx) {
|
||||||
if (ctx == NULL) {
|
if (ctx == nullptr) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx->callbacks.auth_function;
|
return ctx->callbacks.auth_function;
|
||||||
}
|
}
|
||||||
|
|
||||||
int csync_set_status(CSYNC *ctx, int status) {
|
int csync_set_status(CSYNC *ctx, int status) {
|
||||||
if (ctx == NULL || status < 0) {
|
if (ctx == nullptr || status < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ int csync_set_status(CSYNC *ctx, int status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CSYNC_STATUS csync_get_status(CSYNC *ctx) {
|
CSYNC_STATUS csync_get_status(CSYNC *ctx) {
|
||||||
if (ctx == NULL) {
|
if (ctx == nullptr) {
|
||||||
return CSYNC_STATUS_ERROR;
|
return CSYNC_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,21 +305,21 @@ const char *csync_get_status_string(CSYNC *ctx)
|
||||||
|
|
||||||
void csync_request_abort(CSYNC *ctx)
|
void csync_request_abort(CSYNC *ctx)
|
||||||
{
|
{
|
||||||
if (ctx != NULL) {
|
if (ctx != nullptr) {
|
||||||
ctx->abort = true;
|
ctx->abort = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void csync_resume(CSYNC *ctx)
|
void csync_resume(CSYNC *ctx)
|
||||||
{
|
{
|
||||||
if (ctx != NULL) {
|
if (ctx != nullptr) {
|
||||||
ctx->abort = false;
|
ctx->abort = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int csync_abort_requested(CSYNC *ctx)
|
int csync_abort_requested(CSYNC *ctx)
|
||||||
{
|
{
|
||||||
if (ctx != NULL) {
|
if (ctx != nullptr) {
|
||||||
return ctx->abort;
|
return ctx->abort;
|
||||||
} else {
|
} else {
|
||||||
return (1 == 0);
|
return (1 == 0);
|
||||||
|
|
|
@ -133,7 +133,7 @@ bool csync_is_windows_reserved_word(const char *filename)
|
||||||
|
|
||||||
static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const char *path, bool excludeConflictFiles)
|
static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const char *path, bool excludeConflictFiles)
|
||||||
{
|
{
|
||||||
const char *bname = NULL;
|
const char *bname = nullptr;
|
||||||
size_t blen = 0;
|
size_t blen = 0;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
CSYNC_EXCLUDE_TYPE match = CSYNC_NOT_EXCLUDED;
|
CSYNC_EXCLUDE_TYPE match = CSYNC_NOT_EXCLUDED;
|
||||||
|
|
|
@ -590,9 +590,9 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
|
||||||
unsigned int depth) {
|
unsigned int depth) {
|
||||||
QByteArray filename;
|
QByteArray filename;
|
||||||
QByteArray fullpath;
|
QByteArray fullpath;
|
||||||
csync_vio_handle_t *dh = NULL;
|
csync_vio_handle_t *dh = nullptr;
|
||||||
std::unique_ptr<csync_file_stat_t> dirent;
|
std::unique_ptr<csync_file_stat_t> dirent;
|
||||||
csync_file_stat_t *previous_fs = NULL;
|
csync_file_stat_t *previous_fs = nullptr;
|
||||||
int read_from_db = 0;
|
int read_from_db = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dh = csync_vio_opendir(ctx, uri)) == NULL) {
|
if ((dh = csync_vio_opendir(ctx, uri)) == nullptr) {
|
||||||
if (ctx->abort) {
|
if (ctx->abort) {
|
||||||
qCDebug(lcUpdate, "Aborted!");
|
qCDebug(lcUpdate, "Aborted!");
|
||||||
ctx->status_code = CSYNC_STATUS_ABORTED;
|
ctx->status_code = CSYNC_STATUS_ABORTED;
|
||||||
|
@ -783,7 +783,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
|
||||||
|
|
||||||
error:
|
error:
|
||||||
ctx->remote.read_from_db = read_from_db;
|
ctx->remote.read_from_db = read_from_db;
|
||||||
if (dh != NULL) {
|
if (dh != nullptr) {
|
||||||
csync_vio_closedir(ctx, dh);
|
csync_vio_closedir(ctx, dh);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -57,7 +57,7 @@ static const _instr_code_struct _instr[] =
|
||||||
{ "INSTRUCTION_ERROR", CSYNC_INSTRUCTION_ERROR },
|
{ "INSTRUCTION_ERROR", CSYNC_INSTRUCTION_ERROR },
|
||||||
{ "INSTRUCTION_TYPE_CHANGE", CSYNC_INSTRUCTION_TYPE_CHANGE },
|
{ "INSTRUCTION_TYPE_CHANGE", CSYNC_INSTRUCTION_TYPE_CHANGE },
|
||||||
{ "INSTRUCTION_UPDATE_METADATA", CSYNC_INSTRUCTION_UPDATE_METADATA },
|
{ "INSTRUCTION_UPDATE_METADATA", CSYNC_INSTRUCTION_UPDATE_METADATA },
|
||||||
{ NULL, CSYNC_INSTRUCTION_ERROR }
|
{ nullptr, CSYNC_INSTRUCTION_ERROR }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct csync_memstat_s {
|
struct csync_memstat_s {
|
||||||
|
@ -74,7 +74,7 @@ const char *csync_instruction_str(enum csync_instructions_e instr)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
while (_instr[idx].instr_str != NULL) {
|
while (_instr[idx].instr_str != nullptr) {
|
||||||
if (_instr[idx].instr_code == instr) {
|
if (_instr[idx].instr_code == instr) {
|
||||||
return _instr[idx].instr_str;
|
return _instr[idx].instr_str;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ void csync_memstat_check(void) {
|
||||||
|
|
||||||
/* get process memory stats */
|
/* get process memory stats */
|
||||||
fp = fopen("/proc/self/statm","r");
|
fp = fopen("/proc/self/statm","r");
|
||||||
if (fp == NULL) {
|
if (fp == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s = fscanf(fp, "%d%d%d%d%d%d%d", &m.size, &m.resident, &m.shared, &m.trs,
|
s = fscanf(fp, "%d%d%d%d%d%d%d", &m.size, &m.resident, &m.shared, &m.trs,
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
/* Convert a locale String to UTF8 */
|
/* Convert a locale String to UTF8 */
|
||||||
QByteArray c_utf8_from_locale(const mbchar_t *wstr)
|
QByteArray c_utf8_from_locale(const mbchar_t *wstr)
|
||||||
{
|
{
|
||||||
if (wstr == NULL) {
|
if (wstr == nullptr) {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ extern "C" {
|
||||||
/* Convert a an UTF8 string to locale */
|
/* Convert a an UTF8 string to locale */
|
||||||
mbchar_t* c_utf8_string_to_locale(const char *str)
|
mbchar_t* c_utf8_string_to_locale(const char *str)
|
||||||
{
|
{
|
||||||
if (str == NULL ) {
|
if (str == nullptr ) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
mbchar_t *dst = NULL;
|
mbchar_t *dst = NULL;
|
||||||
|
@ -111,8 +111,8 @@ mbchar_t* c_utf8_string_to_locale(const char *str)
|
||||||
|
|
||||||
mbchar_t* c_utf8_path_to_locale(const char *str)
|
mbchar_t* c_utf8_path_to_locale(const char *str)
|
||||||
{
|
{
|
||||||
if( str == NULL ) {
|
if( str == nullptr ) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
size_t strLength = strlen(str);
|
size_t strLength = strlen(str);
|
||||||
|
|
|
@ -47,13 +47,13 @@ csync_vio_handle_t *csync_vio_opendir(CSYNC *ctx, const char *name) {
|
||||||
default:
|
default:
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int csync_vio_closedir(CSYNC *ctx, csync_vio_handle_t *dhandle) {
|
int csync_vio_closedir(CSYNC *ctx, csync_vio_handle_t *dhandle) {
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
if (dhandle == NULL) {
|
if (dhandle == nullptr) {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -87,12 +87,12 @@ std::unique_ptr<csync_file_stat_t> csync_vio_readdir(CSYNC *ctx, csync_vio_handl
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *csync_vio_get_status_string(CSYNC *ctx) {
|
char *csync_vio_get_status_string(CSYNC *ctx) {
|
||||||
if(ctx->error_string) {
|
if(ctx->error_string) {
|
||||||
return ctx->error_string;
|
return ctx->error_string;
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,18 +49,18 @@ typedef struct dhandle_s {
|
||||||
static int _csync_vio_local_stat_mb(const mbchar_t *wuri, csync_file_stat_t *buf);
|
static int _csync_vio_local_stat_mb(const mbchar_t *wuri, csync_file_stat_t *buf);
|
||||||
|
|
||||||
csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
|
csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
|
||||||
dhandle_t *handle = NULL;
|
dhandle_t *handle = nullptr;
|
||||||
mbchar_t *dirname = NULL;
|
mbchar_t *dirname = nullptr;
|
||||||
|
|
||||||
handle = (dhandle_t*)c_malloc(sizeof(dhandle_t));
|
handle = (dhandle_t*)c_malloc(sizeof(dhandle_t));
|
||||||
|
|
||||||
dirname = c_utf8_path_to_locale(name);
|
dirname = c_utf8_path_to_locale(name);
|
||||||
|
|
||||||
handle->dh = _topendir( dirname );
|
handle->dh = _topendir( dirname );
|
||||||
if (handle->dh == NULL) {
|
if (handle->dh == nullptr) {
|
||||||
c_free_locale_string(dirname);
|
c_free_locale_string(dirname);
|
||||||
SAFE_FREE(handle);
|
SAFE_FREE(handle);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->path = c_strdup(name);
|
handle->path = c_strdup(name);
|
||||||
|
@ -70,10 +70,10 @@ csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int csync_vio_local_closedir(csync_vio_handle_t *dhandle) {
|
int csync_vio_local_closedir(csync_vio_handle_t *dhandle) {
|
||||||
dhandle_t *handle = NULL;
|
dhandle_t *handle = nullptr;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
if (dhandle == NULL) {
|
if (dhandle == nullptr) {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -89,15 +89,15 @@ int csync_vio_local_closedir(csync_vio_handle_t *dhandle) {
|
||||||
|
|
||||||
std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *dhandle) {
|
std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *dhandle) {
|
||||||
|
|
||||||
dhandle_t *handle = NULL;
|
dhandle_t *handle = nullptr;
|
||||||
|
|
||||||
handle = (dhandle_t *) dhandle;
|
handle = (dhandle_t *) dhandle;
|
||||||
struct _tdirent *dirent = NULL;
|
struct _tdirent *dirent = nullptr;
|
||||||
std::unique_ptr<csync_file_stat_t> file_stat;
|
std::unique_ptr<csync_file_stat_t> file_stat;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dirent = _treaddir(handle->dh);
|
dirent = _treaddir(handle->dh);
|
||||||
if (dirent == NULL)
|
if (dirent == nullptr)
|
||||||
return {};
|
return {};
|
||||||
} while (qstrcmp(dirent->d_name, ".") == 0 || qstrcmp(dirent->d_name, "..") == 0);
|
} while (qstrcmp(dirent->d_name, ".") == 0 || qstrcmp(dirent->d_name, "..") == 0);
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,7 @@ void FolderWizardRemotePath::slotFolderEntryEdited(const QString &text)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ui.folderTreeWidget->setCurrentItem(0);
|
_ui.folderTreeWidget->setCurrentItem(nullptr);
|
||||||
_lscolTimer.start(); // avoid sending a request on each keystroke
|
_lscolTimer.start(); // avoid sending a request on each keystroke
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ void FolderWizardRemotePath::slotLsColFolderEntry()
|
||||||
LsColJob *job = runLsColJob(path);
|
LsColJob *job = runLsColJob(path);
|
||||||
// No error handling, no updating, we do this manually
|
// No error handling, no updating, we do this manually
|
||||||
// because of extra logic in the typed-path case.
|
// because of extra logic in the typed-path case.
|
||||||
disconnect(job, 0, this, 0);
|
disconnect(job, nullptr, this, nullptr);
|
||||||
connect(job, &LsColJob::finishedWithError,
|
connect(job, &LsColJob::finishedWithError,
|
||||||
this, &FolderWizardRemotePath::slotTypedPathError);
|
this, &FolderWizardRemotePath::slotTypedPathError);
|
||||||
connect(job, &LsColJob::directoryListingSubfolders,
|
connect(job, &LsColJob::directoryListingSubfolders,
|
||||||
|
|
|
@ -101,9 +101,9 @@ void HeaderBanner::setup(const QString &title, const QPixmap &logo, const QPixma
|
||||||
{
|
{
|
||||||
QStyle *style = parentWidget()->style();
|
QStyle *style = parentWidget()->style();
|
||||||
//const int layoutHorizontalSpacing = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
|
//const int layoutHorizontalSpacing = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
|
||||||
int topLevelMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, parentWidget());
|
int topLevelMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr, parentWidget());
|
||||||
int topLevelMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, 0, parentWidget());
|
int topLevelMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr, parentWidget());
|
||||||
int topLevelMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, 0, parentWidget());
|
int topLevelMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr, parentWidget());
|
||||||
//int topLevelMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, parentWidget());
|
//int topLevelMarginBottom = style->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, parentWidget());
|
||||||
|
|
||||||
layout->setRowMinimumHeight(0, ModernHeaderTopMargin);
|
layout->setRowMinimumHeight(0, ModernHeaderTopMargin);
|
||||||
|
|
|
@ -144,7 +144,7 @@ WebViewPageUrlSchemeHandler::WebViewPageUrlSchemeHandler(QObject *parent)
|
||||||
void WebViewPageUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *request) {
|
void WebViewPageUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *request) {
|
||||||
QUrl url = request->requestUrl();
|
QUrl url = request->requestUrl();
|
||||||
|
|
||||||
QString path = url.path(0).mid(1); // get undecoded path
|
QString path = url.path().mid(1); // get undecoded path
|
||||||
const QStringList parts = path.split("&");
|
const QStringList parts = path.split("&");
|
||||||
|
|
||||||
QString server;
|
QString server;
|
||||||
|
|
|
@ -65,7 +65,7 @@ Logger::Logger(QObject *parent)
|
||||||
Logger::~Logger()
|
Logger::~Logger()
|
||||||
{
|
{
|
||||||
#ifndef NO_MSG_HANDLER
|
#ifndef NO_MSG_HANDLER
|
||||||
qInstallMessageHandler(0);
|
qInstallMessageHandler(nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue