- fix for issue 772
- fixed some issues in zstream that prevented to use "getline" in zipped streams - added a "pooled buffers" system to keep a cache of file descriptors. This is potentially dangerous though, but shaves several seconds of loading time on the PSP. If problems arise on other platforms I'll make it a compilation parameter - gracefully fail when calling manacost information on a not properly initialized mana cost
This commit is contained in:
@@ -41,6 +41,11 @@ JZipCache::~JZipCache()
|
||||
dir.clear();
|
||||
}
|
||||
|
||||
void JFileSystem::Pause()
|
||||
{
|
||||
filesystem::closeTempFiles();
|
||||
}
|
||||
|
||||
void JFileSystem::preloadZip(const string& filename)
|
||||
{
|
||||
map<string,JZipCache *>::iterator it = mZipCache.find(filename);
|
||||
@@ -202,6 +207,7 @@ bool JFileSystem::MakeDir(const string & dir)
|
||||
JFileSystem::~JFileSystem()
|
||||
{
|
||||
clearZipCache();
|
||||
filesystem::closeTempFiles();
|
||||
SAFE_DELETE(mUserFS);
|
||||
SAFE_DELETE(mSystemFS);
|
||||
}
|
||||
@@ -286,7 +292,12 @@ bool JFileSystem::readIntoString(const string & FilePath, string & target)
|
||||
|
||||
int fileSize = GetFileSize(file);
|
||||
|
||||
target.resize((std::string::size_type) fileSize);
|
||||
try {
|
||||
target.resize((std::string::size_type) fileSize);
|
||||
} catch (bad_alloc&) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (fileSize)
|
||||
file.read(&target[0], fileSize);
|
||||
|
||||
Reference in New Issue
Block a user