diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-01-05 19:55:29 +0300 |
---|---|---|
committer | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-01-05 19:55:29 +0300 |
commit | 0a380d4edd5ba7da3c58f4b76dabeae4dc0e79d9 (patch) | |
tree | 6ee736289e0a024533aa6b4a56492e79a23ae98d /src | |
parent | 1cd21e7ae8113d27aab71f8bccd300ab439a9eff (diff) | |
parent | 8620dc8b793dceef3ac21f902baaff69b312af22 (diff) |
Merge remote-tracking branch 'origin/2.7' into master
Diffstat (limited to 'src')
-rw-r--r-- | src/common/filesystembase.cpp | 2 | ||||
-rw-r--r-- | src/common/ownsql.cpp | 9 | ||||
-rw-r--r-- | src/common/utility.h | 3 | ||||
-rw-r--r-- | src/csync/csync.cpp | 2 | ||||
-rw-r--r-- | src/csync/csync_exclude.cpp | 4 | ||||
-rw-r--r-- | src/gui/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/gui/MacOSXBundleInfo.plist | 2 | ||||
-rw-r--r-- | src/gui/folderwatcher_win.cpp | 9 | ||||
-rw-r--r-- | src/libsync/discovery.cpp | 11 |
9 files changed, 24 insertions, 24 deletions
diff --git a/src/common/filesystembase.cpp b/src/common/filesystembase.cpp index 2ad4e6e72..ba8050ec1 100644 --- a/src/common/filesystembase.cpp +++ b/src/common/filesystembase.cpp @@ -141,7 +141,7 @@ bool FileSystem::rename(const QString &originFileName, (wchar_t *)dest.utf16(), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH); if (!success) { - error = Utility::formatLastWinError(); + error = Utility::formatWinError(GetLastError()); } } else #endif diff --git a/src/common/ownsql.cpp b/src/common/ownsql.cpp index ea703b169..9d4c3ba77 100644 --- a/src/common/ownsql.cpp +++ b/src/common/ownsql.cpp @@ -279,20 +279,19 @@ int SqlQuery::prepare(const QByteArray &sql, bool allow_failure) * There is no overloads to QByteArray::startWith that takes Qt::CaseInsensitive. * Returns true if 'a' starts with 'b' in a case insensitive way */ -static bool startsWithInsensitive(const QByteArray &a, const char *b) +static bool startsWithInsensitive(const QByteArray &a, const QByteArray &b) { - int len = strlen(b); - return a.size() >= len && qstrnicmp(a.constData(), b, len) == 0; + return a.size() >= b.size() && qstrnicmp(a.constData(), b.constData(), b.size()) == 0; } bool SqlQuery::isSelect() { - return startsWithInsensitive(_sql, "SELECT"); + return startsWithInsensitive(_sql, QByteArrayLiteral("SELECT")); } bool SqlQuery::isPragma() { - return startsWithInsensitive(_sql, "PRAGMA"); + return startsWithInsensitive(_sql, QByteArrayLiteral("PRAGMA")); } bool SqlQuery::exec() diff --git a/src/common/utility.h b/src/common/utility.h index a87540306..286c32cb8 100644 --- a/src/common/utility.h +++ b/src/common/utility.h @@ -241,9 +241,6 @@ namespace Utility { OCSYNC_EXPORT void UnixTimeToLargeIntegerFiletime(time_t t, LARGE_INTEGER *hundredNSecs); OCSYNC_EXPORT QString formatWinError(long error); - inline QString formatLastWinError() { - return formatWinError(GetLastError()); - }; class OCSYNC_EXPORT NtfsPermissionLookupRAII { diff --git a/src/csync/csync.cpp b/src/csync/csync.cpp index a32c5324f..dfbb2016d 100644 --- a/src/csync/csync.cpp +++ b/src/csync/csync.cpp @@ -1,7 +1,7 @@ /* * libcsync -- a library to sync a directory with another * - * Copyright (c) 2020 by Hannah von Reth <hannah.vonreth@owncloud.com> + * Copyright (c) by Hannah von Reth <hannah.vonreth@owncloud.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index 413e08a05..820fed7fb 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -42,7 +42,7 @@ */ OCSYNC_EXPORT void csync_exclude_expand_escapes(QByteArray &input) { - size_t o = 0; + qsizetype o = 0; char *line = input.data(); auto len = input.size(); for (int i = 0; i < len; ++i) { @@ -139,7 +139,7 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu bname = path.midRef(lastSlash + 1); } - size_t blen = bname.size(); + qsizetype blen = bname.size(); // 9 = strlen(".sync_.db") if (blen >= 9 && bname.at(0) == QLatin1Char('.')) { if (bname.contains(QLatin1String(".db"))) { diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index a8b170e52..cf61cb041 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -170,8 +170,10 @@ elseif( WIN32 ) elseif(UNIX AND NOT APPLE ) ## handle DBUS for Fdo notifications find_package(Qt5 COMPONENTS DBus) - target_link_libraries(owncloudCore PUBLIC Qt5::DBus) - target_compile_definitions(owncloudCore PUBLIC "USE_FDO_NOTIFICATIONS") + if (TARGET Qt5::DBus) + target_link_libraries(owncloudCore PUBLIC Qt5::DBus) + target_compile_definitions(owncloudCore PUBLIC "USE_FDO_NOTIFICATIONS") + endif() target_sources(owncloudCore PRIVATE folderwatcher_linux.cpp) endif() diff --git a/src/gui/MacOSXBundleInfo.plist b/src/gui/MacOSXBundleInfo.plist index d7618055d..5d907094f 100644 --- a/src/gui/MacOSXBundleInfo.plist +++ b/src/gui/MacOSXBundleInfo.plist @@ -25,7 +25,7 @@ <key>CFBundleShortVersionString</key> <string>${MIRALL_VERSION_STRING}</string> <key>NSHumanReadableCopyright</key> - <string>(C) 2014-2020 ${APPLICATION_VENDOR}</string> + <string>(C) 2014-2021 ${APPLICATION_VENDOR}</string> <key>SUShowReleaseNotes</key> <false/> <key>SUPublicDSAKeyFile</key> diff --git a/src/gui/folderwatcher_win.cpp b/src/gui/folderwatcher_win.cpp index 7e4a36a8f..fd20725bd 100644 --- a/src/gui/folderwatcher_win.cpp +++ b/src/gui/folderwatcher_win.cpp @@ -43,7 +43,8 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize, NULL); if (_directory == INVALID_HANDLE_VALUE) { - qCWarning(lcFolderWatcher) << "Failed to create handle for" << _path << ", error:" << Utility::formatLastWinError(); + const auto error = GetLastError(); + qCWarning(lcFolderWatcher) << "Failed to create handle for" << _path << ", error:" << Utility::formatWinError(error); _directory = 0; return; } @@ -92,12 +93,13 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize, 2, handles, false, // awake once one of them arrives INFINITE); + const auto error = GetLastError(); if (result == 1) { qCDebug(lcFolderWatcher) << "Received stop event, aborting folder watcher thread"; break; } if (result != 0) { - qCWarning(lcFolderWatcher) << "WaitForMultipleObjects failed" << result << Utility::formatLastWinError(); + qCWarning(lcFolderWatcher) << "WaitForMultipleObjects failed" << result << Utility::formatWinError(error); break; } @@ -126,10 +128,11 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize, && curEntry->Action != FILE_ACTION_RENAMED_OLD_NAME) { const auto wfile = longfile.toStdWString(); const int longNameSize = GetLongPathNameW(wfile.data(), fileNameBuffer, fileNameBufferSize); + const auto error = GetLastError(); if (longNameSize > 0) { longfile = QString::fromWCharArray(fileNameBuffer, longNameSize); } else { - qCWarning(lcFolderWatcher) << "Error converting file name" << longfile << "to full length, keeping original name." << Utility::formatLastWinError(); + qCWarning(lcFolderWatcher) << "Error converting file name" << longfile << "to full length, keeping original name." << Utility::formatWinError(error); } } diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 3c2a13fda..b11dd6577 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -840,16 +840,15 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( item->_type = localEntry.isDirectory ? ItemTypeDirectory : localEntry.isVirtualFile ? ItemTypeVirtualFile : ItemTypeFile; _childModified = true; - auto postProcessLocalNew = [item, localEntry, this]() { + auto postProcessLocalNew = [item, localEntry, path, this]() { if (localEntry.isVirtualFile) { - // Remove the spurious file if it looks like a placeholder file - // (we know placeholder files contain " ") - if (localEntry.size <= 1) { - qCWarning(lcDisco) << "Wiping virtual file without db entry for" << _currentFolder._local + QLatin1Char('/') + localEntry.name; + const bool isPlaceHolder = _discoveryData->_syncOptions._vfs->isDehydratedPlaceholder(_discoveryData->_localDir + path._local); + if (isPlaceHolder) { + qCWarning(lcDisco) << "Wiping virtual file without db entry for" << path._local; item->_instruction = CSYNC_INSTRUCTION_REMOVE; item->_direction = SyncFileItem::Down; } else { - qCWarning(lcDisco) << "Virtual file without db entry for" << _currentFolder._local << localEntry.name + qCWarning(lcDisco) << "Virtual file without db entry for" << path._local << "but looks odd, keeping"; item->_instruction = CSYNC_INSTRUCTION_IGNORE; } |