summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2020-09-30 15:27:57 +0300
committerKatja Marttila <katja.marttila@qt.io>2020-11-04 10:07:47 +0300
commitd3cae4df15598bf4797cd7fc03aced50bb5a25a1 (patch)
treed5889d6dc6bb99702eeec61337ba0544e94ff071 /tools
parent07f4848b5ee0cdc9407d9a0de4d30ca5e03403e0 (diff)
Remove unused code blocks and functions
Results analyzed using cppcheck tools. Also add Q_DECL_OVERRIDE to overwrited functions. Change-Id: Iab5eb43206af0050c1dd84efb7ed860ab9594496 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/archivegen/archive.cpp22
-rw-r--r--tools/binarycreator/rcc/rccmain.cpp7
-rw-r--r--tools/common/repositorygen.cpp4
3 files changed, 12 insertions, 21 deletions
diff --git a/tools/archivegen/archive.cpp b/tools/archivegen/archive.cpp
index d31e8fdc3..e1a40a880 100644
--- a/tools/archivegen/archive.cpp
+++ b/tools/archivegen/archive.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -41,15 +41,15 @@ using namespace QInstaller;
class FailOnErrorCallback : public Lib7z::UpdateCallback
{
- HRESULT OpenFileError(const wchar_t*, DWORD) {
+ HRESULT OpenFileError(const wchar_t*, DWORD) Q_DECL_OVERRIDE {
return S_FALSE;
}
- HRESULT CanNotFindError(const wchar_t*, DWORD) {
+ HRESULT CanNotFindError(const wchar_t*, DWORD) Q_DECL_OVERRIDE {
return S_FALSE;
}
- HRESULT OpenResult(const wchar_t*, HRESULT result, const wchar_t*) {
+ HRESULT OpenResult(const wchar_t*, HRESULT result, const wchar_t*) Q_DECL_OVERRIDE {
return result;
}
};
@@ -62,12 +62,12 @@ public:
}
private:
- HRESULT SetTotal(UInt64 size) {
+ HRESULT SetTotal(UInt64 size) Q_DECL_OVERRIDE {
m_PercentPrinter.SetTotal(size);
return S_OK;
}
- HRESULT SetCompleted(const UInt64 *size) {
+ HRESULT SetCompleted(const UInt64 *size) Q_DECL_OVERRIDE {
if (size) {
m_PercentPrinter.SetRatio(*size);
m_PercentPrinter.PrintRatio();
@@ -75,7 +75,7 @@ private:
return S_OK;
}
- HRESULT OpenResult(const wchar_t *file, HRESULT result, const wchar_t*) {
+ HRESULT OpenResult(const wchar_t *file, HRESULT result, const wchar_t*) Q_DECL_OVERRIDE {
if (result != S_OK) {
printBlock(QCoreApplication::translate("archivegen", "Cannot update file \"%1\". "
"Unsupported archive.").arg(QDir::toNativeSeparators(QString::fromWCharArray(file))), Q_NULLPTR);
@@ -83,17 +83,17 @@ private:
return result;
}
- HRESULT OpenFileError(const wchar_t *file, DWORD) {
+ HRESULT OpenFileError(const wchar_t *file, DWORD) Q_DECL_OVERRIDE {
printBlock(QCoreApplication::translate("archivegen", "Cannot open file "), file);
return S_FALSE;
}
- HRESULT CanNotFindError(const wchar_t *file, DWORD) {
+ HRESULT CanNotFindError(const wchar_t *file, DWORD) Q_DECL_OVERRIDE {
printBlock(QCoreApplication::translate("archivegen", "Cannot find file "), file);
return S_FALSE;
}
- HRESULT StartArchive(const wchar_t *name, bool) {
+ HRESULT StartArchive(const wchar_t *name, bool) Q_DECL_OVERRIDE {
printLine(QCoreApplication::translate("archivegen", "Create archive."));
if (name) {
m_PercentPrinter.PrintNewLine();
@@ -102,7 +102,7 @@ private:
return S_OK;
}
- HRESULT FinishArchive() {
+ HRESULT FinishArchive() Q_DECL_OVERRIDE {
m_PercentPrinter.PrintNewLine();
printLine(QCoreApplication::translate("archivegen", "Finished archive."));
return S_OK;
diff --git a/tools/binarycreator/rcc/rccmain.cpp b/tools/binarycreator/rcc/rccmain.cpp
index 74e9fca77..8c33997dd 100644
--- a/tools/binarycreator/rcc/rccmain.cpp
+++ b/tools/binarycreator/rcc/rccmain.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -76,11 +76,6 @@ void dumpRecursive(const QDir &dir, QTextStream &out)
int createProject(const QString &outFileName)
{
- QDir currentDir = QDir::current();
- QString currentDirName = currentDir.dirName();
- if (currentDirName.isEmpty())
- currentDirName = QLatin1String("root");
-
QFile file;
bool isOk = false;
if (outFileName.isEmpty()) {
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index 6f17ad5ac..5a6c0bf83 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -682,13 +682,10 @@ void QInstallerTools::compressMetaDirectories(const QString &repoDir, const QStr
const QHash<QString, QString> &versionMapping, bool createSplitMetadata, bool createUnifiedMetadata)
{
QDomDocument doc;
- QDomElement root;
// use existing Updates.xml, if any
QFile existingUpdatesXml(QFileInfo(QDir(repoDir), QLatin1String("Updates.xml")).absoluteFilePath());
if (!existingUpdatesXml.open(QIODevice::ReadOnly) || !doc.setContent(&existingUpdatesXml)) {
qDebug() << "Cannot find Updates.xml";
- } else {
- root = doc.documentElement();
}
existingUpdatesXml.close();
@@ -726,7 +723,6 @@ QStringList QInstallerTools::unifyMetadata(const QStringList &entryList, const Q
// Compress all metadata from repository to one single 7z
const QString metadataFilename = QDateTime::currentDateTime().
toString(QLatin1String("yyyy-MM-dd-hhmm")) + QLatin1String("_meta.7z");
- QDateTime dateTime = QDateTime::currentDateTime();
const QString tmpTarget = repoDir + QDir::separator() + metadataFilename;
Lib7z::createArchive(tmpTarget, absPaths, Lib7z::TmpFile::No);