Merge branch 'dev'

This commit is contained in:
Jonas Kulla 2014-01-15 01:56:58 +01:00
commit 81ec731e5a
2 changed files with 17 additions and 12 deletions

View File

@ -47,7 +47,6 @@ struct Exception
Type type;
std::string msg;
Exception(Type type, const char *format, ...)
: type(type)
{

View File

@ -309,7 +309,7 @@ RGSS_openArchive(PHYSFS_Io *io, const char *, int forWrite)
uint32_t magic = RGSS_MAGIC;
/* Top level entry list */
BoostSet<std::string> &topLevel = data->dirHash["."];
BoostSet<std::string> &topLevel = data->dirHash[""];
while (true)
{
@ -620,8 +620,7 @@ struct FileSystemPrivate
const char *foundName = completeFileName(filename, type, foundExt);
if (!foundName)
throw Exception(Exception::NoFileError,
"No such file or directory - %s", filename);
throw Exception(Exception::NoFileError, "%s", filename);
PHYSFS_File *handle = PHYSFS_openRead(foundName);
if (!handle)
@ -695,17 +694,23 @@ static void cacheEnumCB(void *d, const char *origdir,
char buf[512];
if (*origdir != '.')
snprintf(buf, sizeof(buf), "%s/%s", origdir, fname);
else
if (*origdir == '\0')
strncpy(buf, fname, sizeof(buf));
else
snprintf(buf, sizeof(buf), "%s/%s", origdir, fname);
std::string mixedCase(buf);
char *ptr = buf;
/* Trim leading slash */
if (*ptr == '/')
++ptr;
std::string mixedCase(ptr);
for (char *p = buf; *p; ++p)
*p = tolower(*p);
std::string lowerCase(buf);
std::string lowerCase(ptr);
p->pathCache.insert(lowerCase, mixedCase);
@ -714,7 +719,7 @@ static void cacheEnumCB(void *d, const char *origdir,
void FileSystem::createPathCache()
{
PHYSFS_enumerateFilesCallback(".", cacheEnumCB, p);
PHYSFS_enumerateFilesCallback("", cacheEnumCB, p);
p->havePathCache = true;
}
@ -734,14 +739,15 @@ static Sint64 SDL_RWopsSize(SDL_RWops *ops)
return PHYSFS_fileLength(f);
}
static Sint64 SDL_RWopsSeek(SDL_RWops *ops, Sint64 offset, int whence)
static Sint64 SDL_RWopsSeek(SDL_RWops *ops, int64_t offset, int whence)
{
PHYSFS_File *f = sdlPHYS(ops);
if (!f)
return -1;
Sint64 base;
int64_t base;
switch (whence)
{
default: