summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/installer/binaryformat.cpp2
-rw-r--r--tests/auto/installer/binaryformat/tst_binaryformat.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libs/installer/binaryformat.cpp b/src/libs/installer/binaryformat.cpp
index 8e79e84c3..fe1c61ced 100644
--- a/src/libs/installer/binaryformat.cpp
+++ b/src/libs/installer/binaryformat.cpp
@@ -237,7 +237,7 @@ qint64 QInstaller::findMagicCookie(QFile *in, quint64 magicCookie)
while (searched >= 0) {
if (memcmp(&magicCookie, (mapped + searched), markerSize) == 0)
return (fileSize - maxSearch) + searched;
- searched -= markerSize;
+ --searched;
}
throw Error(QObject::tr("No marker found, stopped after %1.").arg(humanReadableSize(maxSearch)));
diff --git a/tests/auto/installer/binaryformat/tst_binaryformat.cpp b/tests/auto/installer/binaryformat/tst_binaryformat.cpp
index 6e520dc3e..59f0e8e03 100644
--- a/tests/auto/installer/binaryformat/tst_binaryformat.cpp
+++ b/tests/auto/installer/binaryformat/tst_binaryformat.cpp
@@ -46,7 +46,7 @@
#include <QTest>
#include <QTemporaryFile>
-static const qint64 scTinySize = 51200LL;
+static const qint64 scTinySize = 72704LL;
static const qint64 scSmallSize = 524288LL;
static const qint64 scLargeSize = 2097152LL;
@@ -92,7 +92,7 @@ private slots:
void testFindMagicCookieWithError()
{
- QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"No marker found, stopped after 50.00 KiB.\" ");
+ QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"No marker found, stopped after 71.00 KiB.\" ");
QTemporaryFile file;
file.open();
@@ -103,7 +103,7 @@ private slots:
// throws
QInstaller::findMagicCookie(&file, QInstaller::MagicCookie);
} catch (const QInstaller::Error &error) {
- QCOMPARE(qPrintable(error.message()), "No marker found, stopped after 50.00 KiB.");
+ QCOMPARE(qPrintable(error.message()), "No marker found, stopped after 71.00 KiB.");
} catch (...) {
QFAIL("Unexpected error.");
}