[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [messagelib] webengineviewer/src/checkphishingurl: Start to implement compression support
From: Montel Laurent <montel () kde ! org>
Date: 2016-11-24 13:01:02
Message-ID: E1c9teA-0002Qo-6A () code ! kde ! org
[Download RAW message or body]
Git commit 7634945edbab0ac39321461e2392eec57beeb75d by Montel Laurent.
Committed on 24/11/2016 at 12:27.
Pushed by mlaurent into branch 'master'.
Start to implement compression support
M +33 -4 webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
M +30 -24 webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h
https://commits.kde.org/messagelib/7634945edbab0ac39321461e2392eec57beeb75d
diff --git a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp \
b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp index \
af572b5..b66ce87 100644
--- a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
+++ b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
@@ -341,6 +341,17 @@ void CreatePhishingUrlDataBaseJob::parseResult(const QByteArray \
&value) deleteLater();
}
+UpdateDataBaseInfo::UpdateDataBaseInfo()
+ : responseType(Unknown)
+{
+
+}
+
+bool UpdateDataBaseInfo::isValid() const
+{
+ return (responseType != Unknown);
+}
+
void UpdateDataBaseInfo::clear()
{
additionList.clear();
@@ -381,29 +392,45 @@ bool UpdateDataBaseInfo::operator==(const UpdateDataBaseInfo \
&other) const return val;
}
+Removal::Removal()
+ : compressionType(UpdateDataBaseInfo::UnknownCompression)
+{
+
+}
+
bool Removal::operator==(const Removal &other) const
{
- bool value = (indexes == other.indexes);
+ bool value = (indexes == other.indexes) && (compressionType == \
other.compressionType); if (!value) {
qCDebug(WEBENGINEVIEWER_LOG) << " indexes " << indexes << " other.indexes " \
<< other.indexes; + qCDebug(WEBENGINEVIEWER_LOG) << "compressionType " << \
compressionType << " other.compressionType " << other.compressionType; }
return value;
}
bool Removal::isValid() const
{
+ if (compressionType == UpdateDataBaseInfo::UnknownCompression) {
+ qCWarning(WEBENGINEVIEWER_LOG) << "Compression Type undefined";
+ return false;
+ }
return !indexes.isEmpty();
}
Addition::Addition()
- : prefixSize(0)
+ : compressionType(UpdateDataBaseInfo::UnknownCompression),
+ prefixSize(0)
{
}
bool Addition::isValid() const
{
- bool hasCorrectPrefixSize = (prefixSize >= 4) && (prefixSize <= 32);
+ if (compressionType == UpdateDataBaseInfo::UnknownCompression) {
+ qCWarning(WEBENGINEVIEWER_LOG) << "Compression Type undefined";
+ return false;
+ }
+ const bool hasCorrectPrefixSize = (prefixSize >= 4) && (prefixSize <= 32);
if (!hasCorrectPrefixSize) {
qCWarning(WEBENGINEVIEWER_LOG) << "Prefix size is not correct";
return false;
@@ -418,10 +445,12 @@ bool Addition::isValid() const
bool Addition::operator==(const Addition &other) const
{
bool value = (hashString == other.hashString) &&
- (prefixSize == other.prefixSize);
+ (prefixSize == other.prefixSize) &&
+ (compressionType == other.compressionType);
if (!value) {
qCDebug(WEBENGINEVIEWER_LOG) << "hashString " << hashString << " \
other.hashString " << other.hashString;
qCDebug(WEBENGINEVIEWER_LOG) << "prefixSize " << prefixSize << " \
other.prefixSize " << other.prefixSize; + qCDebug(WEBENGINEVIEWER_LOG) << \
"compressionType " << compressionType << " other.compressionType " << \
other.compressionType; }
return value;
}
diff --git a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h \
b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h index \
f74f6bf..f0e67a7 100644
--- a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h
+++ b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h
@@ -28,31 +28,11 @@
class QNetworkAccessManager;
namespace WebEngineViewer
{
-struct WEBENGINEVIEWER_EXPORT Addition {
- Addition();
- bool isValid() const;
- bool operator==(const Addition &other) const;
-
- QByteArray hashString;
- int prefixSize;
-};
-
-struct WEBENGINEVIEWER_EXPORT Removal {
- bool operator==(const Removal &other) const;
- bool isValid() const;
- QList<int> indexes;
-};
-
+struct Addition;
+struct Removal;
struct WEBENGINEVIEWER_EXPORT UpdateDataBaseInfo {
- UpdateDataBaseInfo()
- : responseType(Unknown)
- {
-
- }
- bool isValid() const
- {
- return (responseType != Unknown);
- }
+ UpdateDataBaseInfo();
+ bool isValid() const;
enum ResponseType {
Unknown = 0,
@@ -60,6 +40,13 @@ struct WEBENGINEVIEWER_EXPORT UpdateDataBaseInfo {
PartialUpdate = 2
};
+ enum CompressionType {
+ UnknownCompression = 0,
+ RiceCompression = 1,
+ RawCompression = 2
+ };
+
+
QVector<Addition> additionList;
QVector<Removal> removalList;
QString minimumWaitDuration;
@@ -73,6 +60,25 @@ struct WEBENGINEVIEWER_EXPORT UpdateDataBaseInfo {
bool operator==(const UpdateDataBaseInfo &other) const;
};
+struct WEBENGINEVIEWER_EXPORT Addition {
+ Addition();
+ bool isValid() const;
+ bool operator==(const Addition &other) const;
+
+ QByteArray hashString;
+ UpdateDataBaseInfo::CompressionType compressionType;
+ int prefixSize;
+};
+
+struct WEBENGINEVIEWER_EXPORT Removal {
+ Removal();
+ bool operator==(const Removal &other) const;
+ bool isValid() const;
+ QList<int> indexes;
+ UpdateDataBaseInfo::CompressionType compressionType;
+};
+
+
class CreatePhishingUrlDataBaseJobPrivate;
/* https://developers.google.com/safe-browsing/v4/update-api */
class WEBENGINEVIEWER_EXPORT CreatePhishingUrlDataBaseJob : public QObject
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic