Skip to content

Instantly share code, notes, and snippets.

@zopieux
Created April 18, 2026 15:42
Show Gist options
  • Select an option

  • Save zopieux/12a89f1a6dad76ab449d65d539f35178 to your computer and use it in GitHub Desktop.

Select an option

Save zopieux/12a89f1a6dad76ab449d65d539f35178 to your computer and use it in GitHub Desktop.
diff --git a/src/cli/Utils.cpp b/src/cli/Utils.cpp
index efceeab5..dc362845 100644
--- a/src/cli/Utils.cpp
+++ b/src/cli/Utils.cpp
@@ -51,22 +51,22 @@ namespace Utils
void setDefaultTextStreams()
{
auto fd = new QFile();
- fd->open(stdout, QIODevice::WriteOnly);
+ Q_UNUSED(fd->open(stdout, QIODevice::WriteOnly));
STDOUT.setDevice(fd);
fd = new QFile();
- fd->open(stderr, QIODevice::WriteOnly);
+ Q_UNUSED(fd->open(stderr, QIODevice::WriteOnly));
STDERR.setDevice(fd);
fd = new QFile();
- fd->open(stdin, QIODevice::ReadOnly);
+ Q_UNUSED(fd->open(stdin, QIODevice::ReadOnly));
STDIN.setDevice(fd);
fd = new QFile();
#ifdef Q_OS_WIN
- fd->open(fopen("nul", "w"), QIODevice::WriteOnly);
+ Q_UNUSED(fd->open(fopen("nul", "w"), QIODevice::WriteOnly));
#else
- fd->open(fopen("/dev/null", "w"), QIODevice::WriteOnly);
+ Q_UNUSED(fd->open(fopen("/dev/null", "w"), QIODevice::WriteOnly));
#endif
DEVNULL.setDevice(fd);
diff --git a/src/core/Database.cpp b/src/core/Database.cpp
index 86470fe1..e9c40c7a 100644
--- a/src/core/Database.cpp
+++ b/src/core/Database.cpp
@@ -524,7 +524,7 @@ bool Database::import(const QString& xmlExportPath, QString* error)
{
KdbxXmlReader reader(KeePass2::FILE_VERSION_4);
QFile file(xmlExportPath);
- file.open(QIODevice::ReadOnly);
+ Q_UNUSED(file.open(QIODevice::ReadOnly));
reader.readDatabase(&file, this);
diff --git a/src/format/KdbxXmlReader.cpp b/src/format/KdbxXmlReader.cpp
index cfc6375d..18794f53 100644
--- a/src/format/KdbxXmlReader.cpp
+++ b/src/format/KdbxXmlReader.cpp
@@ -57,7 +57,7 @@ KdbxXmlReader::KdbxXmlReader(quint32 version, QHash<QString, QByteArray> binaryP
QSharedPointer<Database> KdbxXmlReader::readDatabase(const QString& filename)
{
QFile file(filename);
- file.open(QIODevice::ReadOnly);
+ Q_UNUSED(file.open(QIODevice::ReadOnly));
return readDatabase(&file);
}
diff --git a/src/format/KdbxXmlWriter.cpp b/src/format/KdbxXmlWriter.cpp
index a2509fdb..1bf49109 100644
--- a/src/format/KdbxXmlWriter.cpp
+++ b/src/format/KdbxXmlWriter.cpp
@@ -80,7 +80,7 @@ void KdbxXmlWriter::writeDatabase(QIODevice* device,
void KdbxXmlWriter::writeDatabase(const QString& filename, Database* db)
{
QFile file(filename);
- file.open(QIODevice::WriteOnly | QIODevice::Truncate);
+ Q_UNUSED(file.open(QIODevice::WriteOnly | QIODevice::Truncate));
writeDatabase(&file, db);
}
diff --git a/tests/util/TemporaryFile.cpp b/tests/util/TemporaryFile.cpp
index 413f0330..0df0dffa 100644
--- a/tests/util/TemporaryFile.cpp
+++ b/tests/util/TemporaryFile.cpp
@@ -31,7 +31,7 @@ TemporaryFile::TemporaryFile(QObject* parent)
: QFile(parent)
{
QTemporaryFile tmp;
- tmp.open();
+ Q_UNUSED(tmp.open());
QFile::setFileName(tmp.fileName());
tmp.close();
}
@@ -40,7 +40,7 @@ TemporaryFile::TemporaryFile(const QString& templateName, QObject* parent)
: QFile(parent)
{
QTemporaryFile tmp(templateName);
- tmp.open();
+ Q_UNUSED(tmp.open());
QFile::setFileName(tmp.fileName());
tmp.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment