summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfsfileengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qfsfileengine.cpp')
-rw-r--r--src/corelib/io/qfsfileengine.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index b69a5e55a5..d376dc711b 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -132,11 +132,9 @@ void QFSFileEnginePrivate::init()
#ifdef Q_OS_WIN
fileAttrib = INVALID_FILE_ATTRIBUTES;
fileHandle = INVALID_HANDLE_VALUE;
+ mapHandle = INVALID_HANDLE_VALUE;
cachedFd = -1;
#endif
-#ifdef Q_USE_DEPRECATED_MAP_API
- fileMapHandle = INVALID_HANDLE_VALUE;
-#endif
}
/*!
@@ -329,9 +327,9 @@ bool QFSFileEnginePrivate::openFh(QIODevice::OpenMode openMode, FILE *fh)
int ret;
do {
ret = QT_FSEEK(fh, 0, SEEK_END);
- } while (ret == -1 && errno == EINTR);
+ } while (ret != 0 && errno == EINTR);
- if (ret == -1) {
+ if (ret != 0) {
q->setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError,
qt_error_string(int(errno)));
@@ -576,20 +574,23 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos)
if (lastIOCommand != QFSFileEnginePrivate::IOFlushCommand && !q->flush())
return false;
+ if (pos < 0 || pos != qint64(QT_OFF_T(pos)))
+ return false;
+
if (fh) {
// Buffered stdlib mode.
int ret;
do {
ret = QT_FSEEK(fh, QT_OFF_T(pos), SEEK_SET);
- } while (ret == -1 && errno == EINTR);
+ } while (ret != 0 && errno == EINTR);
- if (ret == -1) {
+ if (ret != 0) {
q->setError(QFile::ReadError, qt_error_string(int(errno)));
return false;
}
} else {
// Unbuffered stdio mode.
- if (QT_LSEEK(fd, pos, SEEK_SET) == -1) {
+ if (QT_LSEEK(fd, QT_OFF_T(pos), SEEK_SET) == -1) {
qWarning() << "QFile::at: Cannot set file position" << pos;
q->setError(QFile::PositionError, qt_error_string(errno));
return false;