diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index d6e7ecb592..f5236a0156 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -197,7 +197,11 @@ public: mutable int cachedFd; mutable DWORD fileAttrib; #else - QHash > maps; + struct StartAndLength { + int start; // offset % PageSize + size_t length; // length + offset % PageSize + }; + QHash maps; #endif int fd; diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 0b3e401be8..484a60fb74 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -621,7 +621,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla access, sharemode, nativeHandle(), realOffset); if (MAP_FAILED != mapAddress) { uchar *address = extra + static_cast(mapAddress); - maps[address] = QPair(extra, realSize); + maps[address] = {extra, realSize}; return address; } @@ -652,8 +652,8 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr) return false; } - uchar *start = ptr - it->first; - size_t len = it->second; + uchar *start = ptr - it->start; + size_t len = it->length; if (-1 == munmap(start, len)) { q->setError(QFile::UnspecifiedError, qt_error_string(errno)); return false;