[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [messagelib] webengineviewer/src/checkphishingurl: Use a QByteArray here
From: Montel Laurent <montel () kde ! org>
Date: 2016-11-26 8:57:03
Message-ID: E1cAYn9-0004Xl-7f () code ! kde ! org
[Download RAW message or body]
Git commit da46d75382859dfc15399c1ccecde0e4272c8b6d by Montel Laurent.
Committed on 26/11/2016 at 08:56.
Pushed by mlaurent into branch 'master'.
Use a QByteArray here
M +3 -4 webengineviewer/src/checkphishingurl/autotests/createdatabasefilejobtest.cpp
M +3 -3 webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
M +3 -3 webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp
M +1 -1 webengineviewer/src/checkphishingurl/createdatabasefilejob.h
M +1 -1 webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
M +1 -1 webengineviewer/src/checkphishingurl/updatedatabaseinfo.h
https://commits.kde.org/messagelib/da46d75382859dfc15399c1ccecde0e4272c8b6d
diff --git a/webengineviewer/src/checkphishingurl/autotests/createdatabasefilejobtest.cpp \
b/webengineviewer/src/checkphishingurl/autotests/createdatabasefilejobtest.cpp index \
541e27d..f6c9b92 100644
--- a/webengineviewer/src/checkphishingurl/autotests/createdatabasefilejobtest.cpp
+++ b/webengineviewer/src/checkphishingurl/autotests/createdatabasefilejobtest.cpp
@@ -148,7 +148,7 @@ void CreateDatabaseFileJobTest::shouldRemoveElementInDataBase()
info.responseType = WebEngineViewer::UpdateDataBaseInfo::FullUpdate;
info.platformType = QStringLiteral("WINDOWS");
info.newClientState = QStringLiteral("ChAIBRADGAEiAzAwMSiAEDABEAFGpqhd");
- info.sha256 = QStringLiteral("vLPta+N40Sip7Xo3XXgYvW5dpahS96vPwaOjxVospm8=");
+ info.sha256 = QByteArrayLiteral("vLPta+N40Sip7Xo3XXgYvW5dpahS96vPwaOjxVospm8=");
databasejob.setUpdateDataBaseInfo(info);
@@ -227,8 +227,7 @@ void CreateDatabaseFileJobTest::shouldRemoveElementInDataBase()
updateinfo.responseType = WebEngineViewer::UpdateDataBaseInfo::PartialUpdate;
updateinfo.platformType = QStringLiteral("WINDOWS");
updateinfo.newClientState = QStringLiteral("ChAIBRADGAEiAzAwMSiAEDABEAFGpqhd");
- //TODO fix sha256
- updateinfo.sha256 = \
QStringLiteral("yTnyjAgIFeS6Cv+b4IJHngYbdvp5uz1bx9V4el5CyeE="); + \
updateinfo.sha256 = QByteArrayLiteral("yTnyjAgIFeS6Cv+b4IJHngYbdvp5uz1bx9V4el5CyeE=");
WebEngineViewer::CreateDatabaseFileJob updateDatabasejob;
qDebug()<<" new filename " << createDataBaseName;
@@ -278,7 +277,7 @@ void CreateDatabaseFileJobTest::shouldCreateCorrectBinaryFile()
info.responseType = WebEngineViewer::UpdateDataBaseInfo::FullUpdate;
info.platformType = QStringLiteral("WINDOWS");
info.newClientState = QStringLiteral("ChAIBRADGAEiAzAwMSiAEDABEAFGpqhd");
- info.sha256 = QStringLiteral("vLPta+N40Sip7Xo3XXgYvW5dpahS96vPwaOjxVospm8=");
+ info.sha256 = QByteArrayLiteral("vLPta+N40Sip7Xo3XXgYvW5dpahS96vPwaOjxVospm8=");
databasejob.setUpdateDataBaseInfo(info);
diff --git a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp \
b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp \
index 7aaf3c8..7f21ad8 100644
--- a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
+++ b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
@@ -85,7 +85,7 @@ void \
CreatePhishingUrlDataBaseJobTest::shouldClearUpdateDataBaseInfo()
value.responseType = WebEngineViewer::UpdateDataBaseInfo::PartialUpdate;
value.platformType = QStringLiteral("WINDOWS");
value.newClientState = QStringLiteral("ChAIBRADGAEiAzAwMSiAEDABEAFGpqhd");
- value.sha256 = QStringLiteral("YSgoRtsRlgHDqDA3LAhM1gegEpEzs1TjzU33vqsR8iM=");
+ value.sha256 = QByteArrayLiteral("YSgoRtsRlgHDqDA3LAhM1gegEpEzs1TjzU33vqsR8iM=");
value.additionList = additionList;
value.removalList = removalList;
@@ -227,7 +227,7 @@ void CreatePhishingUrlDataBaseJobTest::shouldParseResult_data()
value.responseType = WebEngineViewer::UpdateDataBaseInfo::PartialUpdate;
value.platformType = QStringLiteral("WINDOWS");
value.newClientState = QStringLiteral("ChAIBRADGAEiAzAwMSiAEDABEAFGpqhd");
- value.sha256 = QStringLiteral("YSgoRtsRlgHDqDA3LAhM1gegEpEzs1TjzU33vqsR8iM=");
+ value.sha256 = QByteArrayLiteral("YSgoRtsRlgHDqDA3LAhM1gegEpEzs1TjzU33vqsR8iM=");
value.additionList = additionList;
value.removalList = removalList;
@@ -250,7 +250,7 @@ void CreatePhishingUrlDataBaseJobTest::shouldParseResult_data()
value.responseType = WebEngineViewer::UpdateDataBaseInfo::FullUpdate;
value.platformType = QStringLiteral("WINDOWS");
value.newClientState = QStringLiteral("Cg0IARAGGAEiAzAwMTABELmwARoCGAUmgN3G");
- value.sha256 = QStringLiteral("ANcYWR8Umuoir+uNs1AhfxqW0iXEPDkxN6Pp2QF8dSs=");
+ value.sha256 = QByteArrayLiteral("ANcYWR8Umuoir+uNs1AhfxqW0iXEPDkxN6Pp2QF8dSs=");
value.additionList = additionList2;
QTest::newRow("test2") << QStringLiteral("test2.json") << \
WebEngineViewer::CreatePhishingUrlDataBaseJob::ValidData << value;
diff --git a/webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp \
b/webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp index \
fa55c37..71661b1 100644
--- a/webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp
+++ b/webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp
@@ -140,7 +140,7 @@ void CreateDatabaseFileJob::removeElementFromDataBase(const \
QVector<Removal> &re
//qDebug() << " oldDataBaseAddition.count() AFTER : " << \
oldDataBaseAddition.count(); }
-void CreateDatabaseFileJob::createFileFromFullUpdate(const QVector<Addition> \
&additionList, const QString &sha256) +void \
CreateDatabaseFileJob::createFileFromFullUpdate(const QVector<Addition> \
&additionList, const QByteArray &sha256) {
//1 add version number
const quint16 major = WebEngineViewer::CheckPhishingUrlUtil::majorVersion();
@@ -201,9 +201,9 @@ void CreateDatabaseFileJob::createFileFromFullUpdate(const \
QVector<Addition> &ad
//qCWarning(WEBENGINEVIEWER_LOG) << " \
newSsha256Value"<<newSsha256Value.toBase64(); //qCWarning(WEBENGINEVIEWER_LOG) << " \
sha256 " << sha256;
- const bool checkSumCorrect = (sha256.toLatin1() == newSsha256Value.toBase64());
+ const bool checkSumCorrect = (sha256 == newSsha256Value.toBase64());
if (!checkSumCorrect) {
- qCWarning(WEBENGINEVIEWER_LOG) << " newSsha256Value different from sha256 : \
" << newSsha256Value.toBase64() << " from server " << sha256.toLatin1(); + \
qCWarning(WEBENGINEVIEWER_LOG) << " newSsha256Value different from sha256 : " << \
newSsha256Value.toBase64() << " from server " << sha256; }
finished(checkSumCorrect);
}
diff --git a/webengineviewer/src/checkphishingurl/createdatabasefilejob.h \
b/webengineviewer/src/checkphishingurl/createdatabasefilejob.h index 353d41a..edc6418 \
100644
--- a/webengineviewer/src/checkphishingurl/createdatabasefilejob.h
+++ b/webengineviewer/src/checkphishingurl/createdatabasefilejob.h
@@ -45,7 +45,7 @@ private:
void removeElementFromDataBase(const QVector<Removal> &removalList, \
QVector<Addition> &oldDataBaseAddition); void createBinaryFile();
void generateFile(bool fullUpdate);
- void createFileFromFullUpdate(const QVector<Addition> &additionList, const \
QString &sha256); + void createFileFromFullUpdate(const QVector<Addition> \
&additionList, const QByteArray &sha256); WebEngineViewer::UpdateDataBaseInfo \
mInfoDataBase; QString mFileName;
QFile mFile;
diff --git a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp \
b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp index \
3de4798..3e94184 100644
--- a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
+++ b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
@@ -360,7 +360,7 @@ void CreatePhishingUrlDataBaseJob::parseResult(const QByteArray \
&value) while (mapCheckSum.hasNext()) {
mapCheckSum.next();
if (mapCheckSum.key() == \
QLatin1String("sha256")) {
- databaseInfo.sha256 = \
mapCheckSum.value().toString(); + \
databaseInfo.sha256 = mapCheckSum.value().toByteArray(); } else {
qCDebug(WEBENGINEVIEWER_LOG) << "Invalid \
checksum key" << mapCheckSum.key(); }
diff --git a/webengineviewer/src/checkphishingurl/updatedatabaseinfo.h \
b/webengineviewer/src/checkphishingurl/updatedatabaseinfo.h index 41adff6..e3fcc2c \
100644
--- a/webengineviewer/src/checkphishingurl/updatedatabaseinfo.h
+++ b/webengineviewer/src/checkphishingurl/updatedatabaseinfo.h
@@ -54,7 +54,7 @@ struct WEBENGINEVIEWER_EXPORT UpdateDataBaseInfo {
ResponseType responseType;
QString platformType;
QString newClientState;
- QString sha256;
+ QByteArray sha256;
void clear();
bool operator==(const UpdateDataBaseInfo &other) const;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic