From ee7ff130170821819017f2b9c7d932a3120f4266 Mon Sep 17 00:00:00 2001 From: zhangpengfei Date: Tue, 2 Feb 2021 14:05:32 +0800 Subject: [PATCH] =?UTF-8?q?[FIX]=20Compute=20the=20md5=20in=20the=20wrong?= =?UTF-8?q?=20way.=E9=94=99=E8=AF=AF=E7=9A=84=E8=AE=A1=E7=AE=97=E4=BA=86md?= =?UTF-8?q?5=E5=80=BC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/file-utils.cpp | 2 +- libsearch/index/construct-document.cpp | 5 +++++ libsearch/index/inotify-index.cpp | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index e86872d..4a61453 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -45,7 +45,7 @@ FileUtils::FileUtils() std::string FileUtils::makeDocUterm(QString path) { - return QCryptographicHash::hash(path.toUtf8(),QCryptographicHash::Md5).toStdString(); + return QCryptographicHash::hash(path.toUtf8(),QCryptographicHash::Md5).toHex().toStdString(); } /** diff --git a/libsearch/index/construct-document.cpp b/libsearch/index/construct-document.cpp index ba1e98f..5c0797a 100644 --- a/libsearch/index/construct-document.cpp +++ b/libsearch/index/construct-document.cpp @@ -56,6 +56,11 @@ void ConstructDocumentForPath::run() QString uniqueterm = QString::fromStdString(FileUtils::makeDocUterm(sourcePath)); QString upTerm = QString::fromStdString(FileUtils::makeDocUterm(sourcePath.section("/",0,-2,QString::SectionIncludeLeadingSep))); +// qDebug()<<"sourcePath"<deleteAllIndex(new QStringList(i.value())); /*--------------------------------*/ currentPath.erase(i++); +// i++; } else{ i++; @@ -142,7 +143,7 @@ bool InotifyIndex::RemoveWatch(const QString &path){ } // qDebug() << path; //这个貌似不用删,先mark一下 - currentPath.remove(currentPath.key(path)); +// currentPath.remove(currentPath.key(path)); return true; } @@ -156,6 +157,7 @@ void InotifyIndex::eventProcess(const char* buf, ssize_t tmp){ for (; p < buf + numRead;) { struct inotify_event * event = reinterpret_cast(p); + qDebug() << "Read Event event->wd: " << event->wd; qDebug() << "Read Event: " << currentPath[event->wd] << QString(event->name) << event->cookie << event->wd << event->mask; if(event->name[0] != '.'){ qDebug() << QString(currentPath[event->wd] + '/' + event->name);