[Doxygen-develop] src/util.cpp substitute semantics ?
Brought to you by:
dimitri
From: Robbie G. <ro...@m8...> - 2008-10-16 03:17:02
|
Hi All, it looks to me like the reimplemented subsitute in src/util.cpp in the 1.5.7.1 release has different semantics to the original when passed a null string (i.e. 0 ptr) for the dst argument. It now returns the string unchanged, whereas previously it treated it as if dst was the empty string. The patch below restores the old behaviour. It's a bit of a hack, but its as local a change as i could make. I noticed this because our header.html uses relpath, and the relativePathToRoot function in src/util.cpp returns a null string, rather than an empty string, when the relative path is empty. Hope this helps, - robbie @@ -4447,10 +4447,10 @@ QCString substitute(const char *s,const char *src,const char *dst) { - if (s==0 || src==0 || dst==0) return s; + if (s==0 || src==0) return s; const char *p, *q; int srcLen = strlen(src); - int dstLen = strlen(dst); + int dstLen = dst ? strlen(dst) : 0; int resLen; if (srcLen!=dstLen) { @@ -4469,7 +4469,10 @@ int l = (int)(q-p); memcpy(r,p,l); r+=l; - memcpy(r,dst,dstLen); + if (dst) + { + memcpy(r,dst,dstLen); + } r+=dstLen; } strcpy(r,p); |