prefer standard find() over Find
This commit is contained in:
@@ -51,7 +51,7 @@ bool CourseLoaderCRS::LoadFromMsd( const CString &sPath, const MsdFile &msd, Cou
|
||||
{
|
||||
CString str = sParams[1];
|
||||
str.MakeLower();
|
||||
if( str.Find("yes") != -1 )
|
||||
if( str.find("yes") != string::npos )
|
||||
out.m_bRepeat = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@ bool IniFile::ReadFile( RageFileBasic &f )
|
||||
else
|
||||
{
|
||||
/* New value. */
|
||||
int iEqualIndex = line.Find("=");
|
||||
if( iEqualIndex != -1 )
|
||||
size_t iEqualIndex = line.find("=");
|
||||
if( iEqualIndex != string::npos )
|
||||
{
|
||||
RString valuename = line.Left(iEqualIndex);
|
||||
RString valuename = line.Left( (int) iEqualIndex );
|
||||
RString value = line.Right( line.size()-valuename.size()-1 );
|
||||
if( keyname.size() && valuename.size() )
|
||||
SetValue(keyname,valuename,value);
|
||||
|
||||
@@ -58,11 +58,11 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData
|
||||
out.SetNumTracks( iNumTracks );
|
||||
|
||||
// strip comments out of sSMNoteData
|
||||
while( sSMNoteData.Find("//") != -1 )
|
||||
while( sSMNoteData.find("//") != string::npos )
|
||||
{
|
||||
int iIndexCommentStart = sSMNoteData.Find("//");
|
||||
int iIndexCommentEnd = sSMNoteData.Find("\n", iIndexCommentStart);
|
||||
if( iIndexCommentEnd == -1 ) // comment doesn't have an end?
|
||||
size_t iIndexCommentStart = sSMNoteData.find("//");
|
||||
size_t iIndexCommentEnd = sSMNoteData.find("\n", iIndexCommentStart);
|
||||
if( iIndexCommentEnd == string::npos ) // comment doesn't have an end?
|
||||
sSMNoteData.erase( iIndexCommentStart, 2 );
|
||||
else
|
||||
sSMNoteData.erase( iIndexCommentStart, iIndexCommentEnd-iIndexCommentStart );
|
||||
|
||||
@@ -16,10 +16,10 @@ void NotesLoader::GetMainAndSubTitlesFromFullTitle( const CString sFullTitle, CS
|
||||
|
||||
for( unsigned i=0; i<ARRAYSIZE(sLeftSeps); i++ )
|
||||
{
|
||||
int iBeginIndex = sFullTitle.Find( sLeftSeps[i] );
|
||||
if( iBeginIndex == -1 )
|
||||
size_t iBeginIndex = sFullTitle.find( sLeftSeps[i] );
|
||||
if( iBeginIndex == string::npos )
|
||||
continue;
|
||||
sMainTitleOut = sFullTitle.Left( iBeginIndex );
|
||||
sMainTitleOut = sFullTitle.Left( (int) iBeginIndex );
|
||||
sSubTitleOut = sFullTitle.substr( iBeginIndex+1, sFullTitle.size()-iBeginIndex+1 );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, const NameToData_t &mapNa
|
||||
sData = sData.substr( iOpenBracket+1, iCloseBracket-iOpenBracket-1 );
|
||||
|
||||
// if there's a 6 in the description, it's probably part of "6panel" or "6-panel"
|
||||
if( sData.Find("6") != -1 )
|
||||
if( sData.find("6") != string::npos )
|
||||
out.m_StepsType = STEPS_TYPE_DANCE_SOLO;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,17 +103,17 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Steps &out, const Song &s
|
||||
sFName.MakeLower();
|
||||
|
||||
out.SetDescription(sFName);
|
||||
if( sFName.Find("crazy")!=-1 )
|
||||
if( sFName.find("crazy") != string::npos )
|
||||
{
|
||||
out.SetDifficulty(DIFFICULTY_HARD);
|
||||
if(!out.GetMeter()) out.SetMeter(8);
|
||||
}
|
||||
else if( sFName.Find("hard")!=-1 )
|
||||
else if( sFName.find("hard") != string::npos )
|
||||
{
|
||||
out.SetDifficulty(DIFFICULTY_MEDIUM);
|
||||
if(!out.GetMeter()) out.SetMeter(5);
|
||||
}
|
||||
else if( sFName.Find("easy")!=-1 )
|
||||
else if( sFName.find("easy") != string::npos )
|
||||
{
|
||||
out.SetDifficulty(DIFFICULTY_EASY);
|
||||
if(!out.GetMeter()) out.SetMeter(2);
|
||||
@@ -127,13 +127,13 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Steps &out, const Song &s
|
||||
out.m_StepsType = STEPS_TYPE_PUMP_SINGLE;
|
||||
|
||||
/* Check for "halfdouble" before "double". */
|
||||
if( sFName.Find("halfdouble") != -1 || sFName.Find("h_double") != -1 )
|
||||
if( sFName.find("halfdouble") != -1 || sFName.find("h_double") != string::npos )
|
||||
out.m_StepsType = STEPS_TYPE_PUMP_HALFDOUBLE;
|
||||
else if( sFName.Find("double") != -1 )
|
||||
else if( sFName.find("double") != string::npos )
|
||||
out.m_StepsType = STEPS_TYPE_PUMP_DOUBLE;
|
||||
else if( sFName.Find("_1") != -1 )
|
||||
else if( sFName.find("_1") != string::npos )
|
||||
out.m_StepsType = STEPS_TYPE_PUMP_SINGLE;
|
||||
else if( sFName.Find("_2") != -1 )
|
||||
else if( sFName.find("_2") != string::npos )
|
||||
out.m_StepsType = STEPS_TYPE_PUMP_COUPLE;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ void ScreenJukebox::SetSong()
|
||||
{
|
||||
CString s = a->sModifiers;
|
||||
s.MakeLower();
|
||||
if( s.Find("dark") != -1 ||
|
||||
s.Find("stealth") != -1 )
|
||||
if( s.find("dark") != string::npos ||
|
||||
s.find("stealth") != string::npos )
|
||||
{
|
||||
bModsAreOkToShow = false;
|
||||
break;
|
||||
|
||||
@@ -341,33 +341,33 @@ void ScreenPackages::HTMLParse()
|
||||
|
||||
//XXX: VERY DIRTY HTML PARSER!
|
||||
//Only designed to find links on websites.
|
||||
int i = m_sBUFFER.Find( "<A " );
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
int l = 0;
|
||||
int m = 0;
|
||||
size_t i = m_sBUFFER.find( "<A " );
|
||||
size_t j = 0;
|
||||
size_t k = 0;
|
||||
size_t l = 0;
|
||||
size_t m = 0;
|
||||
|
||||
for ( int mode = 0; mode < 2; mode++ )
|
||||
{
|
||||
while ( i>=0 )
|
||||
while ( i != string::npos )
|
||||
{
|
||||
k = m_sBUFFER.Find( ">", i+1 );
|
||||
l = m_sBUFFER.Find( "HREF", i+1);
|
||||
m = m_sBUFFER.Find( "=", l );
|
||||
k = m_sBUFFER.find( ">", i+1 );
|
||||
l = m_sBUFFER.find( "HREF", i+1);
|
||||
m = m_sBUFFER.find( "=", l );
|
||||
|
||||
if ( ( l > k ) || ( m > k ) ) //no "href" in this tag.
|
||||
if( k == string::npos || l == string::npos || m == string::npos || l > k || m > k ) //no "href" in this tag.
|
||||
{
|
||||
if ( mode == 0 )
|
||||
i = m_sBUFFER.Find( "<A ", i+1 );
|
||||
i = m_sBUFFER.find( "<A ", i+1 );
|
||||
else
|
||||
i = m_sBUFFER.Find( "<a ", i+1 );
|
||||
i = m_sBUFFER.find( "<a ", i+1 );
|
||||
continue;
|
||||
}
|
||||
|
||||
l = m_sBUFFER.Find( "</", m+1 );
|
||||
l = m_sBUFFER.find( "</", m+1 );
|
||||
|
||||
//Special case: There is exactly one extra tag in the link.
|
||||
j = m_sBUFFER.Find( ">", k+1 );
|
||||
j = m_sBUFFER.find( ">", k+1 );
|
||||
if ( j < l )
|
||||
k = j;
|
||||
|
||||
@@ -381,12 +381,12 @@ void ScreenPackages::HTMLParse()
|
||||
m_LinkTitles.push_back( TempTitle );
|
||||
|
||||
if ( mode == 0 )
|
||||
i = m_sBUFFER.Find( "<A ", i+1 );
|
||||
i = m_sBUFFER.find( "<A ", i+1 );
|
||||
else
|
||||
i = m_sBUFFER.Find( "<a ", i+1 );
|
||||
i = m_sBUFFER.find( "<a ", i+1 );
|
||||
}
|
||||
if ( mode == 0 )
|
||||
i = m_sBUFFER.Find( "<a " );
|
||||
i = m_sBUFFER.find( "<a " );
|
||||
}
|
||||
UpdateLinksList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user