1 --- src/util.cpp.orig 2022-12-25 18:59:09 UTC 2 +++ src/util.cpp 3 @@ -30,6 +30,7 @@ 4 #include <cinttypes> 5 #include <sstream> 6 7 +#include <sys/types.h> 8 #include "md5.h" 9 10 #include "regex.h" 11 @@ -3754,26 +3755,18 @@ QCString convertNameToFile(const QCString &name,bool a 12 if (resultLen>=128) // prevent names that cannot be created! 13 { 14 // third algorithm based on MD5 hash 15 - uchar md5_sig[16]; 16 - char sigStr[33]; 17 - MD5Buffer(result.data(),resultLen,md5_sig); 18 - MD5SigToString(md5_sig,sigStr); 19 + QCString sigStr(33); 20 + MD5Data((const unsigned char *)result.data(),resultLen,sigStr.rawData()); 21 result=result.left(128-32)+sigStr; 22 } 23 } 24 if (createSubdirs) 25 { 26 - int l1Dir=0,l2Dir=0; 27 - int createSubdirsLevel = Config_getInt(CREATE_SUBDIRS_LEVEL); 28 - int createSubdirsBitmaskL2 = (1<<createSubdirsLevel)-1; 29 - 30 // compute md5 hash to determine sub directory to use 31 - uchar md5_sig[16]; 32 - MD5Buffer(result.data(),result.length(),md5_sig); 33 - l1Dir = md5_sig[14] & 0xf; 34 - l2Dir = md5_sig[15] & createSubdirsBitmaskL2; 35 + char md5[33]; 36 + MD5Data((const unsigned char *)result.data(),result.length(),md5); 37 38 - result.prepend(QCString().sprintf("d%x/d%02x/",l1Dir,l2Dir)); 39 + result.prepend(QCString().sprintf("d%c/d%c%c/",md5[29],md5[30],md5[31])); 40 } 41 //printf("*** convertNameToFile(%s)->%s\n",qPrint(name),qPrint(result)); 42 return result; 43 @@ -7429,6 +7422,11 @@ QCString removeEmptyLines(const QCString &s) 44 QCString removeEmptyLines(const QCString &s) 45 { 46 BufStr out(s.length()+1); 47 + if (s.length()==0) 48 + { 49 + out.addChar('\0'); 50 + return out.data(); 51 + } 52 const char *p=s.data(); 53 if (p) 54 { 55