diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-04-21 01:15:35 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-04-21 02:55:57 (GMT) |
commit | b1eb564830ff1b754de14919ce5c1547e9758f7c (patch) | |
tree | 71882ce7c961726ce7d42f3deb891fc7de476a92 | |
parent | 6181805f9ea66b37ee164bd67bdac2ac9d53fb65 (diff) | |
download | Qt-b1eb564830ff1b754de14919ce5c1547e9758f7c.zip Qt-b1eb564830ff1b754de14919ce5c1547e9758f7c.tar.gz Qt-b1eb564830ff1b754de14919ce5c1547e9758f7c.tar.bz2 |
Fix logic error in large file autotest
The function generating data blocks was filling the block to 16 bytes
short of the blockSize, then appending three 8 byte values, causing the
block to grow 8 bytes beyond blockSize and then truncating it back to
blockSize.
This commit makes the code fill the block to 24 bytes short of the
blockSize, so that the block will always end up at the correct size and
truncation is not needed.
Change-Id: I9fe6e6d6cf7bc445513b53e0a910d205c4c8002f
Reviewed-by: Rohan McGovern
-rw-r--r-- | tests/auto/qfile/largefile/tst_largefile.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index a9ad017..47f2e73 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -206,14 +206,13 @@ static inline QByteArray generateDataBlock(int blockSize, QString text, qint64 u QByteArray filler("0123456789"); block.append(filler.right(10 - block.size() % 10)); - topUpWith(block, filler, blockSize - 2 * sizeof(qint64)); + topUpWith(block, filler, blockSize - 3 * sizeof(qint64)); appendRaw(block, counter); appendRaw(block, userBits); appendRaw(block, randomBits); - Q_ASSERT( block.size() >= blockSize ); - block.resize(blockSize); + Q_ASSERT( block.size() == blockSize ); ++counter; return block; |