Merge pull request #122 from iaom/0126-dev

[FIX] Compute the md5 in the wrong way.错误的计算了md5值。
This commit is contained in:
张佳萍 2021-02-02 14:17:09 +08:00 committed by GitHub
commit 7289562d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -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();
}
/**

View File

@ -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"<<sourcePath.section("/",0,-2,QString::SectionIncludeLeadingSep);
// qDebug() << "sourcePath ---------------------------: " << sourcePath;
// qDebug() << "sourcePath.section -------------------: " << sourcePath.section("/",0,-2,QString::SectionIncludeLeadingSep);
// qDebug() << "ConstructDocumentForPath -- uniqueterm: " << uniqueterm;
// qDebug() << "ConstructDocumentForPath -- upTerm: " << upTerm;
Document doc;
doc.setData(sourcePath);

View File

@ -98,7 +98,7 @@ bool InotifyIndex::AddWatch(const QString &path){
// Q_ASSERT(ret != -1);
assert(ret != -1);
currentPath[ret] = path;
//qDebug() << "Watch:" << path;
// qDebug() << "Watch: " << path << "ret: " << ret;
return true;
}
@ -131,6 +131,7 @@ bool InotifyIndex::RemoveWatch(const QString &path){
IndexGenerator::getInstance()->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<inotify_event *>(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);