diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2015-02-26 16:07:49 +0200 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2015-03-12 05:33:20 +0000 |
commit | 9dd0bb851b34fcfea5e9be106d8f4209d59d5bf5 (patch) | |
tree | 238e1b1a79919103da6d1d127b8e785767509409 /src/corelib/io/qprocess.cpp | |
parent | 2d5210a684b266e71fc6f7efbd81fbfd720b341c (diff) |
Make QRingBuffer a 64-bit safe
According to I/O API, QIODevice and its inherited classes should be
able to process a full 64-bit offsets and lengths. This requires
64-bit parameters in operations with internal buffers. Rework
QRingBuffer to avoid implicit truncation of numbers and fix some
64-bit issues in code.
Change-Id: Iadd6fd5fefd2d64e6c084e2feebb4dc2d6df66de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r-- | src/corelib/io/qprocess.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 6451bae0ba..d5c861f9ad 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1912,12 +1912,12 @@ qint64 QProcess::readData(char *data, qint64 maxlen) return 1; } - qint64 bytesToRead = qint64(qMin(readBuffer->size(), (int)maxlen)); + qint64 bytesToRead = qMin(readBuffer->size(), maxlen); qint64 readSoFar = 0; while (readSoFar < bytesToRead) { const char *ptr = readBuffer->readPointer(); - int bytesToReadFromThisBlock = qMin<qint64>(bytesToRead - readSoFar, - readBuffer->nextDataBlockSize()); + qint64 bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar, + readBuffer->nextDataBlockSize()); memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock); readSoFar += bytesToReadFromThisBlock; readBuffer->free(bytesToReadFromThisBlock); |