Skip to content
Snippets Groups Projects
Commit 6543789b authored by Karel Slaný's avatar Karel Slaný
Browse files

Storing written size in 64-bit int.

parent 01371421
1 merge request!380Using qint64 to Check Written Data
This commit is part of merge request !380. Comments created here will be created in the context of that merge request.
......@@ -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;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment