Formatting cleanup, modified a function to pass by const reference.
This commit is contained in:
@@ -129,7 +129,7 @@ private:
|
||||
string mZipFileName;
|
||||
char *mPassword;
|
||||
bool mZipAvailable;
|
||||
void preloadZip(string filename);
|
||||
void preloadZip(const string& filename);
|
||||
#if defined (WIN32) || defined (LINUX) || defined(IOS)
|
||||
FILE *mFile;
|
||||
#else
|
||||
|
||||
+14
-7
@@ -25,17 +25,21 @@
|
||||
#include <string>
|
||||
|
||||
|
||||
JZipCache::JZipCache(){}
|
||||
JZipCache::JZipCache()
|
||||
{}
|
||||
|
||||
JZipCache::~JZipCache(){
|
||||
JZipCache::~JZipCache()
|
||||
{
|
||||
map<string,unz_file_pos *>::iterator it;
|
||||
for (it = dir.begin(); it != dir.end(); ++it){
|
||||
for (it = dir.begin(); it != dir.end(); ++it)
|
||||
{
|
||||
delete(it->second);
|
||||
}
|
||||
dir.clear();
|
||||
}
|
||||
|
||||
void JFileSystem::preloadZip(string filename){
|
||||
void JFileSystem::preloadZip(const string& filename)
|
||||
{
|
||||
map<string,JZipCache *>::iterator it = mZipCache.find(filename);
|
||||
if (it != mZipCache.end()) return;
|
||||
|
||||
@@ -48,10 +52,12 @@ void JFileSystem::preloadZip(string filename){
|
||||
if (!mZipAvailable || !mZipFile) return;
|
||||
}
|
||||
int err = unzGoToFirstFile (mZipFile);
|
||||
while (err == UNZ_OK){
|
||||
while (err == UNZ_OK)
|
||||
{
|
||||
unz_file_pos* filePos = new unz_file_pos();
|
||||
char filenameInzip[4096];
|
||||
if (unzGetCurrentFileInfo(mZipFile, NULL, filenameInzip, sizeof(filenameInzip), NULL, 0, NULL, 0) == UNZ_OK){
|
||||
if (unzGetCurrentFileInfo(mZipFile, NULL, filenameInzip, sizeof(filenameInzip), NULL, 0, NULL, 0) == UNZ_OK)
|
||||
{
|
||||
unzGetFilePos(mZipFile, filePos);
|
||||
string name = filenameInzip;
|
||||
cache->dir[name] = filePos;
|
||||
@@ -217,7 +223,8 @@ bool JFileSystem::OpenFile(const string &filename)
|
||||
|
||||
void JFileSystem::CloseFile()
|
||||
{
|
||||
if (mZipAvailable && mZipFile != NULL){
|
||||
if (mZipAvailable && mZipFile != NULL)
|
||||
{
|
||||
unzCloseCurrentFile(mZipFile);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user