[FIX] Compute the md5 in the wrong way.错误的计算了md5值。

This commit is contained in:
zhangpengfei 2021-02-02 14:05:32 +08:00
parent 9d0fb57fa5
commit ee7ff13017
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);