GUI: Use checksum for clang output to see if code is changed

This commit is contained in:
Daniel Marjamäki 2017-08-07 09:28:35 +02:00
parent e1a086f83a
commit b250791a1e
1 changed files with 4 additions and 3 deletions

View File

@ -154,12 +154,13 @@ void CheckThread::runAddons(const QString &addonPath, const ImportProject::FileS
process.start(cmd,args2); process.start(cmd,args2);
process.waitForFinished(); process.waitForFinished();
const QByteArray &ba = process.readAllStandardOutput(); const QByteArray &ba = process.readAllStandardOutput();
const quint16 chksum = qChecksum(ba.data(), ba.length());
QFile f1(analyzerInfoFile + '.' + addon + "-E"); QFile f1(analyzerInfoFile + '.' + addon + "-E");
if (f1.open(QIODevice::ReadOnly | QIODevice::Text)) { if (f1.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in1(&f1); QTextStream in1(&f1);
QString data = in1.readAll(); const quint16 oldchksum = in1.readAll().toInt();
if (data == ba) { if (oldchksum == chksum) {
QFile f2(analyzerInfoFile + '.' + addon + "-results"); QFile f2(analyzerInfoFile + '.' + addon + "-results");
if (f2.open(QIODevice::ReadOnly | QIODevice::Text)) { if (f2.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in2(&f2); QTextStream in2(&f2);
@ -171,7 +172,7 @@ void CheckThread::runAddons(const QString &addonPath, const ImportProject::FileS
} }
f1.open(QIODevice::WriteOnly | QIODevice::Text); f1.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream out1(&f1); QTextStream out1(&f1);
out1 << ba; out1 << chksum;
QFile::remove(analyzerInfoFile + '.' + addon + "-results"); QFile::remove(analyzerInfoFile + '.' + addon + "-results");
} }