summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-11-23 13:07:40 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-11-23 13:07:40 (GMT)
commitf54e239174cea9ce54acd8fd7e6360a663bcfcae (patch)
tree9b1016cde186982a757a3764167bd1d509d2b281 /src/corelib
parent772dffde89f33d7738207a32455b8b7c81e73551 (diff)
parentc7f14f778b3e974631d29cb1ad87891f6b350f61 (diff)
downloadQt-f54e239174cea9ce54acd8fd7e6360a663bcfcae.zip
Qt-f54e239174cea9ce54acd8fd7e6360a663bcfcae.tar.gz
Qt-f54e239174cea9ce54acd8fd7e6360a663bcfcae.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp2
-rw-r--r--src/corelib/io/qiodevice.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 05e6fab..35737b3 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -1254,7 +1254,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla
// undefined behavior. Otherwise, let mmap have its say.
if (doStat()
&& (QT_OFF_T(size) > st.st_size - QT_OFF_T(offset)))
- return 0;
+ qWarning("QFSFileEngine::map: Mapping a file beyond its size is not portable");
int access = 0;
if (openMode & QIODevice::ReadOnly) access |= PROT_READ;
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index b84961f..0e5a2de 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1157,6 +1157,10 @@ QByteArray QIODevice::readLine(qint64 maxSize)
// If resize fails or maxSize == 0, read incrementally
if (maxSize == 0)
maxSize = INT_MAX;
+
+ // The first iteration needs to leave an extra byte for the terminating null
+ result.resize(1);
+
qint64 readResult;
do {
result.resize(int(qMin(maxSize, result.size() + QIODEVICE_BUFFERSIZE)));
@@ -1164,7 +1168,7 @@ QByteArray QIODevice::readLine(qint64 maxSize)
if (readResult > 0 || readBytes == 0)
readBytes += readResult;
} while (readResult == QIODEVICE_BUFFERSIZE
- && result[int(readBytes)] != '\n');
+ && result[int(readBytes - 1)] != '\n');
} else
readBytes = readLine(result.data(), result.size());