From 5a3063968c21be4522f3cc5bfd9d1471cc4d57c2 Mon Sep 17 00:00:00 2001 From: kh1 Date: Fri, 11 Jul 2014 15:36:38 +0200 Subject: Make the marker and the find function class members. Prepare for QTIFW-292 and QTIFW-345. Change-Id: I065366742d28e72bc5ae55e70eabf6532b809fea Reviewed-by: Karsten Heimrich --- tools/devtool/binaryreplace.cpp | 8 +++++--- tools/devtool/main.cpp | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'tools/devtool') diff --git a/tools/devtool/binaryreplace.cpp b/tools/devtool/binaryreplace.cpp index 1e832dcfc..f170059f7 100644 --- a/tools/devtool/binaryreplace.cpp +++ b/tools/devtool/binaryreplace.cpp @@ -113,7 +113,7 @@ int BinaryReplace::replace(const QString &source, const QString &target) QInstaller::openForAppend(&installerBaseNew); installerBaseNew.seek(installerBaseNew.size()); - if (m_binaryLayout.magicMarker == QInstaller::MagicInstallerMarker) { + if (m_binaryLayout.magicMarker == QInstaller::BinaryContent::MagicInstallerMarker) { QInstaller::openForRead(&installerBaseOld); installerBaseOld.seek(m_binaryLayout.metadataResourceSegments.first().start()); QInstaller::appendData(&installerBaseNew, &installerBaseOld, installerBaseOld @@ -122,8 +122,10 @@ int BinaryReplace::replace(const QString &source, const QString &target) } else { QInstaller::appendInt64(&installerBaseNew, 0); QInstaller::appendInt64(&installerBaseNew, 4 * sizeof(qint64)); - QInstaller::appendInt64(&installerBaseNew, QInstaller::MagicUninstallerMarker); - QInstaller::appendInt64(&installerBaseNew, QInstaller::MagicCookie); + QInstaller::appendInt64(&installerBaseNew, + QInstaller::BinaryContent::MagicUninstallerMarker); + QInstaller::appendInt64(&installerBaseNew, + QInstaller::BinaryContent::MagicCookie); } installerBaseNew.close(); #else diff --git a/tools/devtool/main.cpp b/tools/devtool/main.cpp index 713b0e02b..b03bc4ff1 100644 --- a/tools/devtool/main.cpp +++ b/tools/devtool/main.cpp @@ -106,17 +106,19 @@ int main(int argc, char *argv[]) try { QFile *file = new QFile(path); QInstaller::openForRead(file); - qint64 pos = QInstaller::findMagicCookie(file, QInstaller::MagicCookie); + qint64 pos = QInstaller::BinaryContent::findMagicCookie(file, + QInstaller::BinaryContent::MagicCookie); QInstaller::BinaryLayout layout = QInstaller::BinaryContent::readBinaryLayout(file, pos); - if (layout.magicMarker == QInstaller::MagicUninstallerMarker) { + if (layout.magicMarker == QInstaller::BinaryContent::MagicUninstallerMarker) { QFileInfo fi(path); if (QInstaller::isInBundle(fi.absoluteFilePath(), &bundlePath)) fi.setFile(bundlePath); path = fi.absolutePath() + QLatin1Char('/') + fi.baseName() + QLatin1String(".dat"); file->setFileName(path); - pos = QInstaller::findMagicCookie(file, QInstaller::MagicCookie); + pos = QInstaller::BinaryContent::findMagicCookie(file, + QInstaller::BinaryContent::MagicCookie); layout = QInstaller::BinaryContent::readBinaryLayout(file, pos); } @@ -181,7 +183,7 @@ int main(int argc, char *argv[]) if (parser.isSet(dump)) { // To dump the content we do not need the binary format engine. - if (layout.magicMarker != QInstaller::MagicInstallerMarker) + if (layout.magicMarker != QInstaller::BinaryContent::MagicInstallerMarker) throw QInstaller::Error(QLatin1String("Source file is not an installer.")); BinaryDump bd; return bd.dump(index, parser.value(dump)); -- cgit v1.2.3