Hi Rui & Beilei,

On Fri, May 27, 2011 at 11:05 AM, Wang Rui <[email protected]> wrote:
> His name is Beilei Geng. Maybe he's busy with something else but I can
> confirm his real name. :-)

Thanks for the clarification.

I have just done a review and I don't think the change is the perfect
fix as I can't
see what one would need any if ( spat.length() < rpat.length() ) as a
test to whether
to increment the position or not.   Looking at the code I believe the
the position
increment should also be done as there is no point searching to repleace a
string section that has already been repleaced  i.e.

// Search in str for all occurences of spat and replace them with 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);
        pos += rpat.length();
    }
}

Does this look sensible?  If so I'll merge this.

Cheers,
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to