Hi Geng Bl,

Thanks for the fix.  What name should I use from attribution?

Cheers,
Robert.

On Fri, May 13, 2011 at 1:27 AM, geng_bl <[email protected]> wrote:
> Hi Robert,
>
> the osg2cpp example change problem has fix by Wang Rui, but I found there is
> a cant't stop loop in the function searchAndReplace if the length of spat
> less then the length of rpat
>
> void searchAndReplace(std::string& str, const std::string& spat, const
> std::string& rpat)
> {
>     std::string::size_type pos = 0;
>     while ((pos = str.find(spat, pos)) != std::string::npos)
>     {
>         str.replace(pos, spat.length(), rpat);
>     }
> }
>
> so I modify it to
> void searchAndReplace(std::string& str, const std::string& spat, const
> std::string& rpat)
> {
>     std::string::size_type pos = 0;
>     while ((pos = str.find(spat, pos)) != std::string::npos)
>     {
>         str.replace(pos, spat.length(), rpat);
>         if ( spat.length() < rpat.length() )
>         {
>             pos += rpat.length();
>         }
>     }
> }
>
> the attach file is the last version.
>
> Cheers
>
> 2011-05-13
> ________________________________
> geng_bl
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to