1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

More post-merge fixes

This commit is contained in:
AlexVinS 2016-02-05 09:28:36 +03:00
parent 483276b128
commit a3f0d1a94e
2 changed files with 40 additions and 44 deletions

View File

@ -11,19 +11,19 @@
#include "MinizipExtensions.h"
#include "CMemoryBuffer.h"
#include "FileStream.h"
///CIOApi
voidpf ZCALLBACK CIOApi::openFileProxy(voidpf opaque, const void * filename, int mode)
{
assert(opaque != nullptr);
std::string filename_s;
boost::filesystem::path path;
if(filename != nullptr)
filename_s = (const char *)filename;
path = static_cast<const boost::filesystem::path::value_type *>(filename);
return ((CIOApi *)opaque)->openFile(filename_s, mode);
return ((CIOApi *)opaque)->openFile(path, mode);
}
uLong ZCALLBACK CIOApi::readFileProxy(voidpf opaque, voidpf stream, void * buf, uLong size)
@ -136,14 +136,10 @@ CDefaultIOApi::~CDefaultIOApi()
zlib_filefunc64_def CDefaultIOApi::getApiStructure() const
{
zlib_filefunc64_def api;
fill_fopen64_filefunc(&api);
return api;
return * FileStream::GetMinizipFilefunc();
}
CInputOutputStream * CDefaultIOApi::openFile(const std::string& filename, int mode) const
CInputOutputStream * CDefaultIOApi::openFile(const boost::filesystem::path & filename, int mode) const
{
throw new std::runtime_error("CDefaultIOApi::openFile call not expected.");
}
@ -160,9 +156,9 @@ CProxyIOApi::~CProxyIOApi()
}
CInputOutputStream * CProxyIOApi::openFile(const std::string& filename, int mode) const
CInputOutputStream * CProxyIOApi::openFile(const boost::filesystem::path & filename, int mode) const
{
logGlobal->traceStream() << "CProxyIOApi: stream opened for " <<filename<<" with mode "<<mode;
logGlobal->traceStream() << "CProxyIOApi: stream opened for " <<filename.string() <<" with mode "<<mode;
data->seek(0);
return data;

View File

@ -31,7 +31,7 @@ public:
virtual zlib_filefunc64_def getApiStructure() const;
protected:
virtual CInputOutputStream * openFile(const std::string & filename, int mode) const = 0;
virtual CInputOutputStream * openFile(const boost::filesystem::path & filename, int mode) const = 0;
///default implementation deletes stream object
virtual void closeFile(CInputOutputStream * stream) const;
@ -57,7 +57,7 @@ public:
zlib_filefunc64_def getApiStructure() const override;
protected:
CInputOutputStream * openFile(const std::string & filename, int mode) const override;
CInputOutputStream * openFile(const boost::filesystem::path & filename, int mode) const override;
};
///redirects all file IO to single stream
@ -67,7 +67,7 @@ public:
CProxyIOApi(CInputOutputStream * buffer);
~CProxyIOApi();
protected:
CInputOutputStream * openFile(const std::string & filename, int mode) const override;
CInputOutputStream * openFile(const boost::filesystem::path & filename, int mode) const override;
void closeFile(CInputOutputStream * stream) const override;
private:
CInputOutputStream * data;