* use const reference in foreach() also

This commit is contained in:
giantpune 2011-05-17 21:18:45 +00:00
parent 3ee828284a
commit d0ca7c0f15
6 changed files with 353 additions and 358 deletions

View File

@ -13,7 +13,7 @@ SettingTxtDialog::SettingTxtDialog( QWidget *parent, const QByteArray &old, qint
QString str( copy ); QString str( copy );
str.replace( "\r\n", "\n" );//maybe not needed to do this in 2 steps, but there may be some reason the file only uses "\n", so do it this way to be safe str.replace( "\r\n", "\n" );//maybe not needed to do this in 2 steps, but there may be some reason the file only uses "\n", so do it this way to be safe
QStringList parts = str.split( "\n", QString::SkipEmptyParts ); QStringList parts = str.split( "\n", QString::SkipEmptyParts );
foreach( QString part, parts ) foreach( const QString &part, parts )
{ {
QString p = part; QString p = part;
if( part.startsWith( "AREA=" ) ) if( part.startsWith( "AREA=" ) )

View File

@ -230,7 +230,7 @@ const QByteArray DataFromSave( const SaveGame &save, const QString &name )
quint32 SaveItemSize( const SaveGame &save ) quint32 SaveItemSize( const SaveGame &save )
{ {
quint32 ret = 0; quint32 ret = 0;
foreach( QByteArray ba, save.data ) foreach( const QByteArray &ba, save.data )
ret += ba.size(); ret += ba.size();
return ret; return ret;
} }

View File

@ -896,7 +896,7 @@ void U8::CreateEntryList()
if( child.IsOK() ) if( child.IsOK() )
{ {
nestedU8s.insert( path, child ); nestedU8s.insert( path, child );
foreach( QString chPath, child.Entries() ) foreach( const QString &chPath, child.Entries() )
{ {
QString newPath = path + "/" + chPath; QString newPath = path + "/" + chPath;
paths << newPath; paths << newPath;

View File

@ -111,7 +111,7 @@ void PrintColoredString( const char *msg, int highlite )
{ {
QString str( msg ); QString str( msg );
QStringList list = str.split( "\n", QString::SkipEmptyParts ); QStringList list = str.split( "\n", QString::SkipEmptyParts );
foreach( QString s, list ) foreach( const QString &s, list )
{ {
QString m = s; QString m = s;
QString m2 = s.trimmed(); QString m2 = s.trimmed();
@ -183,7 +183,7 @@ void Usage()
qDebug() << ""; qDebug() << "";
qDebug() << " -all does all of the above"; qDebug() << " -all does all of the above";
qDebug() << ""; qDebug() << "";
qDebug() << " -v increase verbosity"; qDebug() << " -v increase verbosity ( can be used more than once )";
qDebug() << ""; qDebug() << "";
qDebug() << " -continue try to keep going as fas as possible on errors that should be fatal"; qDebug() << " -continue try to keep going as fas as possible on errors that should be fatal";
qDebug() << ""; qDebug() << "";
@ -754,12 +754,7 @@ bool CheckTitleIntegrity( quint64 tid )
break; break;
} }
} }
} }
} }
if( upper == 0x10005 || upper == 0x10007 ) //dont try to verify all the contents of DLC, it will just find a bunch of missing contents and bitch about them if( upper == 0x10005 || upper == 0x10007 ) //dont try to verify all the contents of DLC, it will just find a bunch of missing contents and bitch about them
@ -1197,7 +1192,7 @@ void CheckSettingTxt()
QString str( settingTxt ); QString str( settingTxt );
str.replace( "\r\n", "\n" );//maybe not needed to do this in 2 steps, but there may be some reason the file only uses "\n", so do it this way to be safe str.replace( "\r\n", "\n" );//maybe not needed to do this in 2 steps, but there may be some reason the file only uses "\n", so do it this way to be safe
QStringList parts = str.split( "\n", QString::SkipEmptyParts ); QStringList parts = str.split( "\n", QString::SkipEmptyParts );
foreach( QString part, parts ) foreach( const QString &part, parts )
{ {
if( part.startsWith( "AREA=" ) ) if( part.startsWith( "AREA=" ) )
{ {

View File

@ -329,7 +329,7 @@ void MainWindow::on_actionImportWad_triggered()
if( fns.isEmpty() ) if( fns.isEmpty() )
return; return;
foreach( QString fn, fns ) foreach( const QString &fn, fns )
{ {
QByteArray data = ReadFile( fn ); QByteArray data = ReadFile( fn );
if( data.isEmpty() ) if( data.isEmpty() )

View File

@ -229,7 +229,7 @@ void NewNandBin::on_pushButton_badBlockFile_clicked()
str.replace( "\r\n", "\n" ); str.replace( "\r\n", "\n" );
QStringList lines = str.split( "\n", QString::SkipEmptyParts ); QStringList lines = str.split( "\n", QString::SkipEmptyParts );
foreach( QString line, lines ) foreach( const QString &line, lines )
{ {
if( line.size() > 5 ) if( line.size() > 5 )
continue; continue;