mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Remove the use of goto from src/csync/csync_exclude.cpp
This commit is contained in:
parent
4f596dae8c
commit
f220151527
1 changed files with 9 additions and 23 deletions
|
@ -132,9 +132,6 @@ OCSYNC_EXPORT bool csync_is_windows_reserved_word(const QStringRef &filename)
|
|||
|
||||
static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool excludeConflictFiles)
|
||||
{
|
||||
int rc = -1;
|
||||
CSYNC_EXCLUDE_TYPE match = CSYNC_NOT_EXCLUDED;
|
||||
|
||||
/* split up the path */
|
||||
QStringRef bname(&path);
|
||||
int lastSlash = path.lastIndexOf(QLatin1Char('/'));
|
||||
|
@ -160,8 +157,7 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu
|
|||
// check the strlen and ignore the file if its name is longer than 254 chars.
|
||||
// whenever changing this also check createDownloadTmpFileName
|
||||
if (blen > 254) {
|
||||
match = CSYNC_FILE_EXCLUDE_LONG_FILENAME;
|
||||
goto out;
|
||||
return CSYNC_FILE_EXCLUDE_LONG_FILENAME;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -171,17 +167,14 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu
|
|||
// not allow to sync those to avoid file loss/ambiguities (#416)
|
||||
if (blen > 1) {
|
||||
if (bname.at(blen - 1) == QLatin1Char(' ')) {
|
||||
match = CSYNC_FILE_EXCLUDE_TRAILING_SPACE;
|
||||
goto out;
|
||||
return CSYNC_FILE_EXCLUDE_TRAILING_SPACE;
|
||||
} else if (bname.at(blen - 1) == QLatin1Char('.')) {
|
||||
match = CSYNC_FILE_EXCLUDE_INVALID_CHAR;
|
||||
goto out;
|
||||
return CSYNC_FILE_EXCLUDE_INVALID_CHAR;
|
||||
}
|
||||
}
|
||||
|
||||
if (csync_is_windows_reserved_word(bname)) {
|
||||
match = CSYNC_FILE_EXCLUDE_INVALID_CHAR;
|
||||
goto out;
|
||||
return CSYNC_FILE_EXCLUDE_INVALID_CHAR;
|
||||
}
|
||||
|
||||
// Filter out characters not allowed in a filename on windows
|
||||
|
@ -199,8 +192,7 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu
|
|||
case '>':
|
||||
case '<':
|
||||
case '|':
|
||||
match = CSYNC_FILE_EXCLUDE_INVALID_CHAR;
|
||||
goto out;
|
||||
return CSYNC_FILE_EXCLUDE_INVALID_CHAR;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -209,21 +201,15 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu
|
|||
|
||||
/* We create a Desktop.ini on Windows for the sidebar icon, make sure we don't sync it. */
|
||||
if (blen == 11 && path == bname) {
|
||||
rc = bname.compare(QLatin1String("Desktop.ini"), Qt::CaseInsensitive);
|
||||
if (rc == 0) {
|
||||
match = CSYNC_FILE_SILENTLY_EXCLUDED;
|
||||
goto out;
|
||||
if (bname.compare(QLatin1String("Desktop.ini"), Qt::CaseInsensitive) == 0) {
|
||||
return CSYNC_FILE_SILENTLY_EXCLUDED;
|
||||
}
|
||||
}
|
||||
|
||||
if (excludeConflictFiles && OCC::Utility::isConflictFile(path)) {
|
||||
match = CSYNC_FILE_EXCLUDE_CONFLICT;
|
||||
goto out;
|
||||
return CSYNC_FILE_EXCLUDE_CONFLICT;
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
return match;
|
||||
return CSYNC_NOT_EXCLUDED;
|
||||
}
|
||||
|
||||
static QString leftIncludeLast(const QString &arr, const QChar &c)
|
||||
|
|
Loading…
Reference in a new issue