summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Haller <thomas.haller@redheads.de>2019-05-13 12:24:39 (GMT)
committerThomas Haller <thomas.haller@redheads.de>2019-05-13 12:24:39 (GMT)
commit577e3a15a0c17ce6ef7ae501116050bd6f403afd (patch)
tree9153fafd961704fa03a668314dbeb431e893fb99 /src
parent8cd3470a3ad064dbb75f3d2fc6af5f69726040f3 (diff)
downloadDoxygen-577e3a15a0c17ce6ef7ae501116050bd6f403afd.zip
Doxygen-577e3a15a0c17ce6ef7ae501116050bd6f403afd.tar.gz
Doxygen-577e3a15a0c17ce6ef7ae501116050bd6f403afd.tar.bz2
node numbers removed for md5 calculation to avoid false md5 mismatches
Diffstat (limited to 'src')
-rw-r--r--src/dot.cpp41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/dot.cpp b/src/dot.cpp
index 2d4c41a..d48f147 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -743,6 +743,25 @@ static void removeDotGraph(const QCString &dotName)
}
+/*! Calculates the md5 signature for a given graph.
+ * Node numbers are removed to not have md5 mismatches in case just the node
+ * numbers are different.
+ */
+static void calculateMd5Signature(QGString const & theGraph, QCString & sigStr)
+{
+ ASSERT(sigStr.length() >= 32);
+
+ uchar md5_sig[16];
+
+ // convert to a string with regexp
+ QCString theGraphTemp(theGraph.data());
+ // remove node numbers
+ theGraphTemp.replace(QRegExp("Node[0-9]*"), "Node");
+ // calculate md5
+ MD5Buffer((const unsigned char*)theGraphTemp.data(), theGraphTemp.length(), md5_sig);
+ // convert result to a string
+ MD5SigToString(md5_sig, sigStr.rawData(), 33);
+}
/*! Checks if a file "baseName".md5 exists. If so the contents
* are compared with \a md5. If equal FALSE is returned. If the .md5
@@ -2381,10 +2400,9 @@ void DotGfxHierarchyTable::createGraph(DotNode *n,FTextStream &out,
}
}
writeGraphFooter(md5stream);
- uchar md5_sig[16];
QCString sigStr(33);
- MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
- MD5SigToString(md5_sig,sigStr.rawData(),33);
+ calculateMd5Signature(theGraph, sigStr);
+
bool regenerate=FALSE;
if (checkAndUpdateMd5Signature(absBaseName,sigStr) ||
!checkDeliverables(absImgName,absMapName))
@@ -3157,10 +3175,9 @@ QCString computeMd5Signature(DotNode *root,
}
}
writeGraphFooter(md5stream);
- uchar md5_sig[16];
QCString sigStr(33);
- MD5Buffer((const unsigned char *)buf.data(),buf.length(),md5_sig);
- MD5SigToString(md5_sig,sigStr.rawData(),33);
+ calculateMd5Signature(buf, sigStr);
+
graphStr=buf.data();
//printf("md5: %s | file: %s\n",sigStr,baseName.data());
return sigStr;
@@ -4057,10 +4074,8 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
FTextStream md5stream(&theGraph);
//m_dir->writeDepGraph(md5stream);
writeDotDirDepGraph(md5stream,m_dir,linkRelations);
- uchar md5_sig[16];
QCString sigStr(33);
- MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
- MD5SigToString(md5_sig,sigStr.rawData(),33);
+ calculateMd5Signature(theGraph, sigStr);
bool regenerate=FALSE;
if (checkAndUpdateMd5Signature(absBaseName,sigStr) ||
!checkDeliverables(graphFormat==GOF_BITMAP ? absImgName :
@@ -4200,10 +4215,8 @@ void generateGraphLegend(const char *path)
md5stream << " Node18 -> Node9 [dir=\"back\",color=\"darkorchid3\",fontsize=\"" << FONTSIZE << "\",style=\"dashed\",label=\"m_usedClass\",fontname=\"" << FONTNAME << "\"];\n";
md5stream << " Node18 [shape=\"box\",label=\"Used\",fontsize=\"" << FONTSIZE << "\",height=0.2,width=0.4,fontname=\"" << FONTNAME << "\",color=\"black\",URL=\"$classUsed" << Doxygen::htmlFileExtension << "\"];\n";
writeGraphFooter(md5stream);
- uchar md5_sig[16];
QCString sigStr(33);
- MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
- MD5SigToString(md5_sig,sigStr.rawData(),33);
+ calculateMd5Signature(theGraph, sigStr);
QCString absBaseName = (QCString)path+"/graph_legend";
QCString absDotName = absBaseName+".dot";
QCString imgExt = getDotImageExtension();
@@ -4614,10 +4627,8 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t,
}
writeGraphFooter(md5stream);
- uchar md5_sig[16];
QCString sigStr(33);
- MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
- MD5SigToString(md5_sig,sigStr.rawData(),33);
+ calculateMd5Signature(theGraph, sigStr);
QCString imgExt = getDotImageExtension();
QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
QCString baseName = m_diskName;