Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/gui/folderwatcher_linux.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014 ownCloud GmbH
* SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "config.h"

Check failure on line 7 in src/gui/folderwatcher_linux.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/folderwatcher_linux.cpp:7:10 [clang-diagnostic-error]

'config.h' file not found

#include <sys/inotify.h>

Expand Down Expand Up @@ -149,14 +149,21 @@

// iterate events in buffer
unsigned int ulen = len;
for (i = 0; i + sizeof(inotify_event) < ulen; i += sizeof(inotify_event) + (event ? event->len : 0)) {
for (i = 0; i + sizeof(inotify_event) <= ulen; i += sizeof(inotify_event) + (event ? event->len : 0)) {

Check warning on line 152 in src/gui/folderwatcher_linux.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/folderwatcher_linux.cpp:152:82 [readability-implicit-bool-conversion]

implicit conversion 'struct inotify_event *' -> bool
// cast an inotify_event
event = (struct inotify_event *)&buffer[i];
if (!event) {
qCDebug(lcFolderWatcher) << "NULL event";
continue;
}

if (event->mask & IN_Q_OVERFLOW) {

Check warning on line 160 in src/gui/folderwatcher_linux.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/folderwatcher_linux.cpp:160:13 [readability-implicit-bool-conversion]

implicit conversion 'unsigned int' -> bool
qCWarning(lcFolderWatcher)
<< "The inotify event queue overflowed; triggering a full local discovery";
emit _parent->lostChanges();

Check warning on line 163 in src/gui/folderwatcher_linux.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/folderwatcher_linux.cpp:163:18 [cppcoreguidelines-init-variables]

variable '_parent' is not initialized
continue;
}

// Fire event for the path that was changed.
if (event->len == 0 || event->wd <= -1)
continue;
Expand Down
1 change: 1 addition & 0 deletions src/gui/folderwatcher_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/

#include <QThread>

Check failure on line 7 in src/gui/folderwatcher_win.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/folderwatcher_win.cpp:7:10 [clang-diagnostic-error]

'QThread' file not found
#include <QDir>

#include "common/asserts.h"
Expand Down Expand Up @@ -72,6 +72,7 @@
const DWORD errorCode = GetLastError();
if (errorCode == ERROR_NOTIFY_ENUM_DIR) {
qCDebug(lcFolderWatcher) << "The buffer for changes overflowed! Triggering a generic change and resizing";
emit lostChanges();

Check warning on line 75 in src/gui/folderwatcher_win.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/folderwatcher_win.cpp:75:22 [modernize-use-trailing-return-type]

use a trailing return type for this function
emit changed(_path);
*increaseBufferSize = true;
} else {
Expand Down
Loading