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

Attachment: osg2cpp.cpp
Description: Binary data

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

Reply via email to