diff --git a/src/io/filesystem.cpp b/src/io/filesystem.cpp index e9f2d754614086d2262431ad5155825e43a4c20e..a04f100318010b282690bb5d101b9446188c92ba 100644 --- a/src/io/filesystem.cpp +++ b/src/io/filesystem.cpp @@ -300,7 +300,7 @@ QString writeFile(const QString &filePath, const QString &fileName, QFile fout(nonconflictingFileName(filePath + QDir::separator() + nameCopy)); - if (!fout.open(QIODevice::WriteOnly)) { + if (Q_UNLIKELY(!fout.open(QIODevice::WriteOnly))) { logErrorNL("Cannot open file '%s'.", nameCopy.toUtf8().constData()); return QString(); @@ -308,11 +308,11 @@ QString writeFile(const QString &filePath, const QString &fileName, /* Get whole path. */ QString fullName = fout.fileName(); - int written = fout.write(data); + qint64 written = fout.write(data); bool flushed = fout.flush(); fout.close(); - if ((written != data.size()) || !flushed) { + if (Q_UNLIKELY((written != data.size()) || !flushed)) { if (deleteOnError) { QFile::remove(fullName); } @@ -528,7 +528,7 @@ bool writeZfoToLocalStorage(const QString &username, bool testing, bool flushed = fout.flush(); fout.close(); - if ((written != zfoData.size()) || !flushed) { + if (Q_UNLIKELY((written != zfoData.size()) || !flushed)) { QFile::remove(fullName); return false; }