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