Q3BSP: Use C++11 range-based for loop

pull/898/head
Turo Lamminen 2016-05-22 12:58:27 +03:00
parent a09a6a40c0
commit 6c9c040419
2 changed files with 6 additions and 6 deletions

View File

@ -131,11 +131,11 @@ static void normalizePathName( const std::string &rPath, std::string &rNormalize
static const unsigned int numDelimiters = 2;
const char delimiters[ numDelimiters ] = { '/', '\\' };
rNormalizedPath = rPath;
for ( unsigned int i=0; i<numDelimiters; i++ )
for (const char delimiter : delimiters)
{
for ( size_t j=0; j<rNormalizedPath.size(); j++ )
{
if ( rNormalizedPath[j] == delimiters[ i ] )
if ( rNormalizedPath[j] == delimiter )
{
rNormalizedPath[ j ] = sep[ 0 ];
}

View File

@ -195,8 +195,8 @@ Q3BSPZipArchive::Q3BSPZipArchive(IOSystem* pIOHandler, const std::string& rFile)
// ------------------------------------------------------------------------------------------------
// Destructor.
Q3BSPZipArchive::~Q3BSPZipArchive() {
for( std::map<std::string, ZipFile*>::iterator it(m_ArchiveMap.begin()), end(m_ArchiveMap.end()); it != end; ++it ) {
delete it->second;
for(auto &file : m_ArchiveMap) {
delete file.second;
}
m_ArchiveMap.clear();
@ -269,8 +269,8 @@ void Q3BSPZipArchive::Close(IOStream *pFile) {
void Q3BSPZipArchive::getFileList(std::vector<std::string> &rFileList) {
rFileList.clear();
for(std::map<std::string, ZipFile*>::iterator it(m_ArchiveMap.begin()), end(m_ArchiveMap.end()); it != end; ++it) {
rFileList.push_back(it->first);
for(auto &file : m_ArchiveMap) {
rFileList.push_back(file.first);
}
}