From ff8f495d44bab77044363c0e10deabbb628b492c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 20 Mar 2016 15:52:19 +0100 Subject: [PATCH] NOISSUE remove unused 'INetworkValidator' --- .../minecraft/onesix/OneSixVersionFormat.cpp | 9 ------ logic/net/CacheDownload.h | 32 ++----------------- 2 files changed, 2 insertions(+), 39 deletions(-) diff --git a/logic/minecraft/onesix/OneSixVersionFormat.cpp b/logic/minecraft/onesix/OneSixVersionFormat.cpp index d4b372c3..b5e05b22 100644 --- a/logic/minecraft/onesix/OneSixVersionFormat.cpp +++ b/logic/minecraft/onesix/OneSixVersionFormat.cpp @@ -15,15 +15,6 @@ static void readString(const QJsonObject &root, const QString &key, QString &var } } -static QString readStringRet(const QJsonObject &root, const QString &key) -{ - if (root.contains(key)) - { - return requireString(root.value(key)); - } - return QString(); -} - LibraryPtr OneSixVersionFormat::libraryFromJson(const QJsonObject &libObj, const QString &filename) { LibraryPtr out = MojangVersionFormat::libraryFromJson(libObj, filename); diff --git a/logic/net/CacheDownload.h b/logic/net/CacheDownload.h index f640b740..8eea66f9 100644 --- a/logic/net/CacheDownload.h +++ b/logic/net/CacheDownload.h @@ -22,30 +22,6 @@ #include "multimc_logic_export.h" -/* FIXME: move to its own file(s) */ -class MULTIMC_LOGIC_EXPORT INetworkValidator -{ -public: - virtual ~INetworkValidator() {} - - virtual void validate(const QByteArray &data) = 0; -}; -class MULTIMC_LOGIC_EXPORT JsonValidator : public INetworkValidator -{ -public: - void validate(const QByteArray &data) override; -}; -class MULTIMC_LOGIC_EXPORT MD5HashValidator : public INetworkValidator -{ -public: - explicit MD5HashValidator(const QByteArray &expected) - : m_expected(expected) {} - void validate(const QByteArray &data) override; - -private: - QByteArray m_expected; -}; - typedef std::shared_ptr CacheDownloadPtr; class MULTIMC_LOGIC_EXPORT CacheDownload : public NetAction { @@ -54,13 +30,13 @@ private: MetaEntryPtr m_entry; /// if saving to file, use the one specified in this string QString m_target_path; + /// this is the output file, if any std::shared_ptr m_output_file; + /// the hash-as-you-download QCryptographicHash md5sum; - INetworkValidator *m_validator = nullptr; - bool wroteAnyData = false; public: @@ -74,10 +50,6 @@ public: { return m_target_path; } - void setValidator(INetworkValidator *validator) - { - m_validator = validator; - } protected slots: virtual void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);