summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/binarycontent.cpp
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-07-11 15:36:38 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2014-07-15 11:37:07 +0200
commit5a3063968c21be4522f3cc5bfd9d1471cc4d57c2 (patch)
treea6930edf0ec7ba9316e4cc151c684396e5989eeb /src/libs/installer/binarycontent.cpp
parent62ef1132ae0775dae628b45f2642c25b19b740a5 (diff)
Make the marker and the find function class members.
Prepare for QTIFW-292 and QTIFW-345. Change-Id: I065366742d28e72bc5ae55e70eabf6532b809fea Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'src/libs/installer/binarycontent.cpp')
-rw-r--r--src/libs/installer/binarycontent.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libs/installer/binarycontent.cpp b/src/libs/installer/binarycontent.cpp
index 27c486353..435821959 100644
--- a/src/libs/installer/binarycontent.cpp
+++ b/src/libs/installer/binarycontent.cpp
@@ -52,6 +52,8 @@
#include <QFile>
#include <QResource>
+namespace QInstaller {
+
/*!
Search through 1MB, if smaller through the whole file. Note: QFile::map() does
not change QFile::pos(). Fallback to read the file content in case we can't map it.
@@ -59,7 +61,7 @@
Note: Failing to map the file can happen for example while having a remote connection
established to the admin server process and we do not support map over the socket.
*/
-qint64 QInstaller::findMagicCookie(QFile *in, quint64 magicCookie)
+qint64 BinaryContent::findMagicCookie(QFile *in, quint64 magicCookie)
{
Q_ASSERT(in);
Q_ASSERT(in->isOpen());
@@ -98,8 +100,6 @@ qint64 QInstaller::findMagicCookie(QFile *in, quint64 magicCookie)
return -1; // never reached
}
-namespace QInstaller {
-
/*!
\internal
Registers the resource found at \a segment within \a file into the Qt resource system.
@@ -304,7 +304,7 @@ BinaryContent BinaryContent::readFromBinary(const QString &path)
// Try to read the binary layout of the calling application. We need to figure out
// if we are in installer or an unistaller (maintenance, package manager, updater) binary.
QInstaller::openForRead(c.d->m_appBinary.data());
- quint64 cookiePos = findMagicCookie(c.d->m_appBinary.data(), QInstaller::MagicCookie);
+ quint64 cookiePos = findMagicCookie(c.d->m_appBinary.data(), BinaryContent::MagicCookie);
if (!c.d->m_appBinary->seek(cookiePos - sizeof(qint64))) { // seek to read the marker
throw Error(QCoreApplication::translate("BinaryContent",
"Could not seek to %1 to read the magic marker.").arg(cookiePos - sizeof(qint64)));
@@ -322,7 +322,7 @@ BinaryContent BinaryContent::readFromBinary(const QString &path)
c.d->m_binaryDataFile.reset(new QFile(fi.absolutePath() + QLatin1Char('/') + fi.baseName()
+ QLatin1String(".dat")));
QInstaller::openForRead(c.d->m_binaryDataFile.data());
- cookiePos = findMagicCookie(c.d->m_binaryDataFile.data(), QInstaller::MagicCookieDat);
+ cookiePos = findMagicCookie(c.d->m_binaryDataFile.data(), BinaryContent::MagicCookieDat);
readBinaryData(c, c.d->m_binaryDataFile, readBinaryLayout(c.d->m_binaryDataFile.data(),
cookiePos));
} else {