From cb39c1095d874388c3bdf5909feaed98a444f1fc Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Mon, 27 Jul 2020 16:10:40 +0200 Subject: [PATCH] dbhub: Simplify code and remove debug code --- src/RemoteDock.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/RemoteDock.cpp b/src/RemoteDock.cpp index 1411f24a..c4e45e86 100644 --- a/src/RemoteDock.cpp +++ b/src/RemoteDock.cpp @@ -608,13 +608,13 @@ bool RemoteDock::isLocalDatabaseModified(const QString& local_file, const QStrin // Search tree entry for currently checked out commit json tree = obj["commits"][commit_id]["tree"]["entries"]; - for(auto it=tree.cbegin();it!=tree.cend();++it) + for(const auto& it : tree) { - if(it.value()["entry_type"] == "db" && it.value()["name"] == dbname.toStdString()) + if(it["entry_type"] == "db" && it["name"] == dbname.toStdString()) { // When we have found it, check if the current file matches the remote file by first checking if the // file size is equal and then comparing their SHA256 hashes - if(QFileInfo(local_file).size() == it.value()["size"]) + if(QFileInfo(local_file).size() == it["size"]) { QFile file(local_file); if(!file.open(QFile::ReadOnly)) @@ -622,13 +622,10 @@ bool RemoteDock::isLocalDatabaseModified(const QString& local_file, const QStrin QCryptographicHash hash(QCryptographicHash::Sha256); hash.addData(&file); - if(hash.result().toHex().toStdString() == it.value()["sha256"]) + if(hash.result().toHex().toStdString() == it["sha256"]) { modified = false; return; - } else { - qWarning() << hash.result().toHex() << " - " << QString::fromStdString(it.value()["sha256"]); - qWarning() << QString::fromStdString(tree.dump()); } }