From 6543789b79fcc17f44c65c4dcc25df8350224035 Mon Sep 17 00:00:00 2001 From: Karel Slany <karel.slany@nic.cz> Date: Fri, 14 Feb 2025 15:24:38 +0100 Subject: [PATCH] Storing written size in 64-bit int. --- src/io/filesystem.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/io/filesystem.cpp b/src/io/filesystem.cpp index e9f2d7546..a04f10031 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; } -- GitLab