Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
clang-tidy:
runs-on: ubuntu-latest
container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3
container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-sid-6.10.2-1
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-clang-compile-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
name: Linux Clang compilation and tests
runs-on: ubuntu-latest
container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3
container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-sid-6.10.2-1
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-gcc-compile-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
name: Linux GCC compilation and tests
runs-on: ubuntu-latest
container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3
container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-sid-6.10.2-1
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
name: SonarCloud analysis
runs-on: [ubuntu-latest, self-hosted]
container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3
container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-sid-6.10.2-1
env:
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
Expand Down
10 changes: 7 additions & 3 deletions src/gui/folderwatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ void FolderWatcher::performSetPermissionsTest(const QString &path)

if (!QFile::exists(path)) {
QFile f(path);
f.open(QIODevice::WriteOnly);
if (!f.isOpen()) {
const auto openResult = f.open(QIODevice::WriteOnly);
if (!openResult || !f.isOpen()) {
qCWarning(lcFolderWatcher()) << "Failed to create test file: " << path;
return;
}
Expand Down Expand Up @@ -158,7 +158,11 @@ void FolderWatcher::startNotificationTestWhenReady()
FileSystem::setModTime(path, mtime + 1);
} else {
QFile f(path);
f.open(QIODevice::WriteOnly | QIODevice::Append);
const auto openResult = f.open(QIODevice::WriteOnly | QIODevice::Append);
if (!openResult || !f.isOpen()) {
qCWarning(lcFolderWatcher()) << "Failed to create test file: " << path;
return;
}
}
FileSystem::setFileHidden(path, true);

Expand Down
10 changes: 8 additions & 2 deletions src/gui/syncrunfilelog.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 <QRegularExpression>

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

View workflow job for this annotation

GitHub Actions / build

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

'QRegularExpression' file not found

#include "syncrunfilelog.h"
#include "common/utility.h"
Expand Down Expand Up @@ -37,7 +37,10 @@
while (FileSystem::fileExists(filename)) {

QFile file(filename);
file.open(QIODevice::ReadOnly| QIODevice::Text);
const auto openResult = file.open(QIODevice::ReadOnly| QIODevice::Text);
if (!openResult) {
qWarning() << "error while opening the file" << filename;
}
QTextStream in(&file);
QString line = in.readLine();

Expand Down Expand Up @@ -66,7 +69,10 @@
}
_file.reset(new QFile(filename));

_file->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
const auto openResult = _file->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
if (!openResult) {
qWarning() << "error while opening the file" << filename;
}
_out.setDevice(_file.data());


Expand Down
5 changes: 4 additions & 1 deletion src/gui/updater/ocupdater.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 "theme.h"

Check failure on line 7 in src/gui/updater/ocupdater.cpp

View workflow job for this annotation

GitHub Actions / build

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

'theme.h' file not found
#include "configfile.h"
#include "common/utility.h"
#include "accessmanager.h"
Expand Down Expand Up @@ -400,7 +400,10 @@
setDownloadState(Downloading);
_file.reset(new QTemporaryFile);
_file->setAutoRemove(true);
_file->open();
const auto openResult = _file->open();
if (!openResult) {
qCWarning(lcUpdater()) << "error while opening the temporary file";
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/gui/wizard/owncloudsetuppage.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 <QDir>

Check failure on line 7 in src/gui/wizard/owncloudsetuppage.cpp

View workflow job for this annotation

GitHub Actions / build

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

'QDir' file not found
#include <QFileDialog>
#include <QUrl>
#include <QTimer>
Expand Down Expand Up @@ -411,7 +411,11 @@
void OwncloudSetupPage::slotCertificateAccepted()
{
QFile certFile(addCertDial->getCertificatePath());
certFile.open(QFile::ReadOnly);
const auto openResult = certFile.open(QFile::ReadOnly);
if (!openResult) {
qWarning() << "Failed to open certificate file:" << addCertDial->getCertificatePath();
return;
}
QByteArray certData = certFile.readAll();
QByteArray certPassword = addCertDial->getCertificatePasswd().toLocal8Bit();

Expand Down
13 changes: 11 additions & 2 deletions src/libsync/clientsideencryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2488,8 +2488,17 @@ bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &i
bool EncryptionHelper::fileDecryption(const QByteArray &key, const QByteArray& iv,
QFile *input, QFile *output)
{
input->open(QIODevice::ReadOnly);
output->open(QIODevice::WriteOnly);
const auto inputOpenResult = input->open(QIODevice::ReadOnly);
if (!inputOpenResult) {
qCWarning(lcCse()) << "Failed to open input file";
return false;
}

const auto outputOpenResult = output->open(QIODevice::WriteOnly);
if (!outputOpenResult) {
qCWarning(lcCse()) << "Failed to open output file";
return false;
}

// Init
CipherCtx ctx;
Expand Down
25 changes: 20 additions & 5 deletions test/syncenginetestutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ void DiskFileModifier::insert(const QString &relativePath, qint64 size, char con
if (!file.exists()) {
QVERIFY(!file.exists());
}
file.open(QFile::WriteOnly);
const auto openResult = file.open(QFile::WriteOnly);
if (!openResult) {
qWarning() << "error while opening the file" << relativePath << _rootDir.filePath(relativePath);
}
QByteArray buf(1024, contentChar);
for (int x = 0; x < size / buf.size(); ++x) {
file.write(buf);
Expand All @@ -90,15 +93,21 @@ void DiskFileModifier::setContents(const QString &relativePath, char contentChar
QFile file { _rootDir.filePath(relativePath) };
QVERIFY(file.exists());
qint64 size = file.size();
file.open(QFile::WriteOnly);
const auto openResult = file.open(QFile::WriteOnly);
if (!openResult) {
qWarning() << "error while opening the file" << relativePath << _rootDir.filePath(relativePath);
}
file.write(QByteArray {}.fill(contentChar, size));
}

void DiskFileModifier::appendByte(const QString &relativePath)
{
QFile file { _rootDir.filePath(relativePath) };
QVERIFY(file.exists());
file.open(QFile::ReadWrite);
const auto openResult = file.open(QFile::ReadWrite);
if (!openResult) {
qWarning() << "error while opening the file" << relativePath << _rootDir.filePath(relativePath);
}
QByteArray contents = file.read(1);
file.seek(file.size());
file.write(contents);
Expand Down Expand Up @@ -1455,7 +1464,10 @@ void FakeFolder::toDisk(QDir &dir, const FileInfo &templateFi)
toDisk(subDir, child);
} else {
QFile file { dir.filePath(child.name) };
file.open(QFile::WriteOnly);
const auto openResult = file.open(QFile::WriteOnly);
if (!openResult) {
qWarning() << "error while opening the file" << child.name << dir.filePath(child.name);
}
file.write(QByteArray {}.fill(child.contentChar, child.size));
file.close();
OCC::FileSystem::setModTime(file.fileName(), OCC::Utility::qDateTimeToTime_t(child.lastModified));
Expand All @@ -1474,7 +1486,10 @@ void FakeFolder::fromDisk(QDir &dir, FileInfo &templateFi)
fromDisk(subDir, subFi);
} else {
QFile f { diskChild.filePath() };
f.open(QFile::ReadOnly);
const auto openResult = f.open(QFile::ReadOnly);
if (!openResult) {
qWarning() << "error while opening the file" << diskChild.filePath();
}
auto content = f.read(1);
if (content.size() == 0) {
qWarning() << "Empty file at:" << diskChild.filePath();
Expand Down
6 changes: 5 additions & 1 deletion test/testfolderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* any purpose.
*/

#include <qglobal.h>

Check failure on line 11 in test/testfolderman.cpp

View workflow job for this annotation

GitHub Actions / build

test/testfolderman.cpp:11:10 [clang-diagnostic-error]

'qglobal.h' file not found
#include <QTemporaryDir>
#include <QtTest>

Expand Down Expand Up @@ -281,7 +281,11 @@
QVERIFY(dir2.mkpath("free2/sub"));
{
QFile f(dir.path() + "/sub/file.txt");
f.open(QFile::WriteOnly);
const auto openResult = f.open(QFile::WriteOnly);
if (!openResult) {
qWarning() << "Failed to create file:" << dir.path() + "/sub/file.txt";
return;
}
f.write("hello");
}
QString dirPath = dir2.canonicalPath();
Expand Down
6 changes: 5 additions & 1 deletion test/testlockfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "lockfilejobs.h"

Check failure on line 6 in test/testlockfile.cpp

View workflow job for this annotation

GitHub Actions / build

test/testlockfile.cpp:6:10 [clang-diagnostic-error]

'lockfilejobs.h' file not found

#include "account.h"
#include "accountstate.h"
Expand Down Expand Up @@ -938,7 +938,11 @@
QVERIFY(fakeFolder.syncJournal().setFileRecord(record));
qDebug() << fakeFolder.localPath() + u"parent/child/.~lock.hello.odt#"_s;
QFile newLockFile(fakeFolder.localPath() + u"parent/child/.~lock.hello.odt#"_s);
newLockFile.open(QFile::OpenModeFlag::NewOnly);
const auto openResult = newLockFile.open(QFile::OpenModeFlag::NewOnly);
if (!openResult) {
qWarning() << "Failed to create lock file:" << fakeFolder.localPath() + u"parent/child/.~lock.hello.odt#"_s;
return;
}
OCC::FileSystem::setFileHidden(fakeFolder.localPath() + u"parent/child/.~lock.hello.odt#"_s, true);

fakeFolder.remoteModifier().remove(u"parent/child"_s);
Expand Down
Loading