Re: expansion of aliases with multiple references to same argument

"Dimitri van Heesch" <[email protected]>
Newsgroups gmane.text.doxygen.devel
Message-ID <[email protected]>
Hi Robbie,

This is indeed a bug. I'll use a slightly different fix by starting with an
empty result string, i.e.:

  QCString result;
  int p=0,i;
  while ((i=aliasValue.find(paramMarker,p))!=-1) // search for marker
  {
    result+=aliasValue.mid(p,i-p);
    if (i==0 || aliasValue.at(i-1)!='\\') // found unescaped marker
    {
      result += paramValue;
      p=i+markerLen;
    }
    else // ignore escaped markers
    {
      result += aliasValue.mid(i,markerLen);
      p=i+1;
    }
  }
  result+=aliasValue.right(aliasValue.length()-p);

but the result should be the same.

Regards,
   Dimitri

On 7/31/07, Robbie Gates <[email protected]> wrote:
>
> Hi All,
>   i'm seeing what looks like a bug with an alias of the form
>     "THING{1} =<a href=\"http://prefix/THING-\1\">THING-\1</a>"
> I was expecting THING{456} to expand to
>     <a href=\"http://prefix/THING-456\">THING-456</a>
> However, with 1.5.3, it looks like i'm getting
>     <a href=\"http://prefix/THING-456\">THING4561</a>
> It looks to me like replaceAliasArgument in util.cpp is the culprit -
> the code uses aliasValue each time around the loop to find the
> replacement index, but uses these as indexes into result. If the alias
> arguments expand to strings of length other than 2, these indexes are
> not in sync after the first replacement.  By replacing aliasValue with
> result in the loop condition and the escaped marker check i get the
> expected behaviour (patch below).
>
> - robbie
>
> 6201c6201
> <   while ((i=aliasValue.find(paramMarker,p))!=-1) // search for marker
> ---
> >   while ((i=result.find(paramMarker,p))!=-1) // search for marker
> 6205c6205
> <     if (i==0 || aliasValue.at(i-1)!='\\') // found unescaped marker
> ---
> >     if (i==0 || result.at(i-1)!='\\') // found unescaped marker
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Doxygen-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/doxygen-develop
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

_______________________________________________
Doxygen-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-develop
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.