summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@trolltech.com>2009-07-14 12:15:26 (GMT)
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-07-14 12:18:25 (GMT)
commitb427fd6bd0e5e182fa507a1930356f9cbdeacd86 (patch)
treeddc43da25abce970e7a30a50ad0dd3a1cb4c0bfe /src/corelib/io
parent9e00fcde7a13bb561aebaa5e84c94297089f0c7f (diff)
downloadQt-b427fd6bd0e5e182fa507a1930356f9cbdeacd86.zip
Qt-b427fd6bd0e5e182fa507a1930356f9cbdeacd86.tar.gz
Qt-b427fd6bd0e5e182fa507a1930356f9cbdeacd86.tar.bz2
large file support for Windows CE
Seeking in files above 0x80000000 failed on Windows CE. SetFilePointer was used in the 32 bit version. That means, seeking only worked for positions <= LONG_MAX (which is 0x80000000 - 1). Task-number: 255242 Reviewed-by: mauricek
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 618566a..5365ff5 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -588,21 +588,23 @@ qint64 QFSFileEnginePrivate::nativePos() const
if (fileHandle == INVALID_HANDLE_VALUE)
return 0;
-#if !defined(QT_NO_LIBRARY)
+#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
QFSFileEnginePrivate::resolveLibs();
if (!ptrSetFilePointerEx) {
#endif
- DWORD newFilePointer = SetFilePointer(fileHandle, 0, NULL, FILE_CURRENT);
- if (newFilePointer == 0xFFFFFFFF) {
+ LARGE_INTEGER filepos;
+ filepos.HighPart = 0;
+ DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT);
+ if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
thatQ->setError(QFile::UnspecifiedError, qt_error_string());
return 0;
}
- // Note: returns <4GB; does not work with large files. This is the
- // case for MOC, UIC, qmake and other bootstrapped tools, and for
- // Win9x/ME.
- return qint64(newFilePointer);
-#if !defined(QT_NO_LIBRARY)
+ // Note: This is the case for MOC, UIC, qmake and other
+ // bootstrapped tools, and for Windows CE.
+ filepos.LowPart = newFilePointer;
+ return filepos.QuadPart;
+#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
}
// This approach supports large files.
@@ -631,21 +633,22 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos)
return seekFdFh(pos);
}
-#if !defined(QT_NO_LIBRARY)
+#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
QFSFileEnginePrivate::resolveLibs();
if (!ptrSetFilePointerEx) {
#endif
- LONG seekToPos = LONG(pos); // <- lossy
- DWORD newFilePointer = SetFilePointer(fileHandle, seekToPos, NULL, FILE_BEGIN);
- if (newFilePointer == 0xFFFFFFFF) {
- thatQ->setError(QFile::UnspecifiedError, qt_error_string());
+ DWORD newFilePointer;
+ LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos);
+ newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN);
+ if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+ thatQ->setError(QFile::PositionError, qt_error_string());
return false;
}
- // Note: does not work with large files. This is the case for MOC,
- // UIC, qmake and other bootstrapped tools, and for Win9x/ME.
+ // Note: This is the case for MOC, UIC, qmake and other
+ // bootstrapped tools, and for Windows CE.
return true;
-#if !defined(QT_NO_LIBRARY)
+#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
}
// This approach supports large files.