summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-10-16 16:10:47 (GMT)
committerJoão Abecasis <joao@abecasis.name>2009-10-21 11:46:07 (GMT)
commitbadfa3435f740ec7120b2ed3367fa2be50382136 (patch)
treebbc42c4e2f12d59f54c6c15101cd4b7707be041c /src
parent512c2284cafb3eb23d06fc5cdc4e424b711a04b7 (diff)
downloadQt-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')
-rw-r--r--src/corelib/io/qfile.cpp2
-rw-r--r--src/corelib/io/qfsfileengine.cpp5
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;