diff options
author | João Abecasis <joao@abecasis.name> | 2009-10-16 16:10:47 (GMT) |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-10-21 11:46:07 (GMT) |
commit | badfa3435f740ec7120b2ed3367fa2be50382136 (patch) | |
tree | bbc42c4e2f12d59f54c6c15101cd4b7707be041c /src/corelib/io | |
parent | 512c2284cafb3eb23d06fc5cdc4e424b711a04b7 (diff) | |
download | Qt-badfa3435f740ec7120b2ed3367fa2be50382136.zip Qt-badfa3435f740ec7120b2ed3367fa2be50382136.tar.gz Qt-badfa3435f740ec7120b2ed3367fa2be50382136.tar.bz2 |
Fixes some issues with large files in 32-bit systems
Reviewed-by: Thiago Macieira
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qfile.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine.cpp | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 134c4b8..64d8ef3 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1064,7 +1064,7 @@ bool QFile::open(FILE *fh, OpenMode mode) if (mode & Append) { seek(size()); } else { - long pos = ftell(fh); + qint64 pos = (qint64)QT_FTELL(fh); if (pos != -1) seek(pos); } diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 2c5451d..c34f8ad 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -564,6 +564,9 @@ 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; @@ -577,7 +580,7 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos) } } 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; |