fix: warnings when compiling with Qt 6.10 (#6422)

This commit is contained in:
nerix
2025-10-05 15:18:54 +02:00
committed by GitHub
parent 2c44a2efd2
commit 38a3bf2ef8
17 changed files with 105 additions and 24 deletions
+6 -1
View File
@@ -140,7 +140,12 @@ void ImageUploader::logToFile(const QString &originalFilePath,
// local path to an image (can be empty)
// timestamp
QSaveFile logSaveFile(logFileName);
logSaveFile.open(QIODevice::WriteOnly | QIODevice::Text);
if (!logSaveFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
qCDebug(chatterinoImageuploader)
<< "Failed to open log file" << logSaveFile.errorString();
return;
}
QJsonArray entries = QJsonDocument::fromJson(logs).array();
entries.push_back(newLogEntry);
logSaveFile.write(QJsonDocument(entries).toJson());
+10 -2
View File
@@ -178,7 +178,13 @@ void Updates::installUpdates()
combinePath(this->paths.miscDirectory, "update.zip");
QFile file(filename);
file.open(QIODevice::Truncate | QIODevice::WriteOnly);
if (!file.open(QIODevice::Truncate | QIODevice::WriteOnly))
{
qCWarning(chatterinoUpdate)
<< "Failed to save update.zip" << file.errorString();
this->setStatus_(WriteFileFailed);
return;
}
if (file.write(object) == -1)
{
@@ -238,7 +244,9 @@ void Updates::installUpdates()
combinePath(this->paths.miscDirectory, "Update.exe");
QFile file(filePath);
file.open(QIODevice::Truncate | QIODevice::WriteOnly);
// write() will fail if we couldn't open
std::ignore =
file.open(QIODevice::Truncate | QIODevice::WriteOnly);
if (file.write(object) == -1)
{
+13 -2
View File
@@ -128,7 +128,12 @@ void LoggingChannel::openLogFile()
qCDebug(chatterinoHelper) << "Logging to" << fileName;
this->fileHandle.setFileName(fileName);
this->fileHandle.open(QIODevice::Append);
if (!this->fileHandle.open(QIODevice::Append))
{
qCDebug(chatterinoHelper)
<< "Failed to open file" << this->fileHandle.errorString();
return;
}
appendLine(this->fileHandle, generateOpeningString(now));
}
@@ -159,7 +164,13 @@ void LoggingChannel::openStreamLogFile(const QString &streamID)
qCDebug(chatterinoHelper) << "Logging stream to" << fileName;
this->currentStreamFileHandle.setFileName(fileName);
this->currentStreamFileHandle.open(QIODevice::Append);
if (!this->currentStreamFileHandle.open(QIODevice::Append))
{
qCDebug(chatterinoHelper)
<< "Failed to open file"
<< this->currentStreamFileHandle.errorString();
return;
}
appendLine(this->currentStreamFileHandle, generateOpeningString(now));
}