src/util.cpp substitute semantics ?
"Robbie Gates" <[email protected]>
| Newsgroups | gmane.text.doxygen.devel |
|---|---|
| Message-ID | <[email protected]> |
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);
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/