Replace QVector, QList with std::vector, std::list

An exception is made of TexPool, which will need a
bit more testing before transitioning to std containers.

Also replace 'int' with 'size_t' where it is used only
as an array index.
This commit is contained in:
Jonas Kulla 2013-12-26 20:18:33 +01:00
parent 8215bc7e7d
commit 231e38ae8e
16 changed files with 188 additions and 165 deletions

View file

@ -35,6 +35,7 @@
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <QDebug>
@ -66,8 +67,6 @@ struct RGSS_entryHandle
}
};
typedef QList<QByteArray> QByteList;
struct RGSS_archiveData
{
PHYSFS_Io *archiveIo;
@ -503,7 +502,7 @@ struct FileSystemPrivate
/* All keys are lower case */
QHash<QByteArray, QByteArray> pathCache;
QList<QByteArray> extensions[FileSystem::Undefined];
std::vector<QByteArray> extensions[FileSystem::Undefined];
/* Attempt to locate an extension string in a filename.
* Either a pointer into the input string pointing at the
@ -552,8 +551,8 @@ struct FileSystemPrivate
if (type != FileSystem::Undefined)
{
QList<QByteArray> &extList = extensions[type];
for (int i = 0; i < extList.count(); ++i)
std::vector<QByteArray> &extList = extensions[type];
for (size_t i = 0; i < extList.size(); ++i)
{
const char *ext = extList[i].constData();
@ -600,7 +599,8 @@ FileSystem::FileSystem(const char *argv0,
p = new FileSystemPrivate;
/* Image extensions */
p->extensions[Image] << "jpg" << "png";
p->extensions[Image].push_back("jpg");
p->extensions[Image].push_back("png");
/* Audio extensions */
const Sound_DecoderInfo **di;
@ -620,12 +620,13 @@ FileSystem::FileSystem(const char *argv0,
break;
}
p->extensions[Audio] << buf;
p->extensions[Audio].push_back(buf);
}
}
/* Font extensions */
p->extensions[Font] << "ttf" << "otf";
p->extensions[Font].push_back("ttf");
p->extensions[Font].push_back("otf");
PHYSFS_init(argv0);
PHYSFS_registerArchiver(&RGSS_Archiver);