From 917e923111928e8d108ff4d3540f4a5bbe6d30f7 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Mon, 31 Oct 2022 22:45:32 +0200 Subject: [PATCH] QFile review Signed-off-by: Ivailo Monev --- src/core/io/qfile.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/io/qfile.cpp b/src/core/io/qfile.cpp index 9d92c18d4..f07a3696a 100644 --- a/src/core/io/qfile.cpp +++ b/src/core/io/qfile.cpp @@ -651,8 +651,6 @@ QFile::rename(const QString &oldName, const QString &newName) \note To create a valid link on Windows, \a linkName must have a \c{.lnk} file extension. - \note Symbian filesystem does not support links. - \sa setFileName() */ @@ -1040,7 +1038,7 @@ uchar *QFile::map(qint64 offset, qint64 size) { Q_D(QFile); unsetError(); - if (openMode() == QIODevice::NotOpen) { + if (!isOpen()) { d->setError(QFile::PermissionsError, qt_error_string(EACCES)); return 0; } @@ -1054,8 +1052,9 @@ uchar *QFile::map(qint64 offset, qint64 size) // If we know the mapping will extend beyond EOF, fail early to avoid // undefined behavior. Otherwise, let mmap have its say. if (d->doStat(QFileSystemMetaData::SizeAttribute) - && (QT_OFF_T(size) > d->metaData.size() - QT_OFF_T(offset))) + && (QT_OFF_T(size) > d->metaData.size() - QT_OFF_T(offset))) { qWarning("QFile::map: Mapping a file beyond its size is not portable"); + } int access = 0; if (openMode() & QIODevice::ReadOnly) access |= PROT_READ; @@ -1501,7 +1500,8 @@ QString QFile::errorString() const void QFile::unsetError() { Q_D(QFile); - d->setError(QFile::NoError, QString()); + d->error = QFile::NoError; + d->errorString.clear(); } #ifndef QT_NO_QOBJECT -- 2.11.0