mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 03:09:13 +00:00
Replace hsStream::Open duplicated methods everywhere with a single plFileName interface
This commit is contained in:
@ -61,23 +61,13 @@ plZlibStream::~plZlibStream()
|
||||
hsAssert(!fOutput && !fZStream, "plZlibStream not closed");
|
||||
}
|
||||
|
||||
bool plZlibStream::Open(const char* filename, const char* mode)
|
||||
{
|
||||
wchar_t* wFilename = hsStringToWString(filename);
|
||||
wchar_t* wMode = hsStringToWString(mode);
|
||||
bool ret = Open(wFilename, wMode);
|
||||
delete [] wFilename;
|
||||
delete [] wMode;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool plZlibStream::Open(const wchar_t* filename, const wchar_t* mode)
|
||||
bool plZlibStream::Open(const plFileName& filename, const char* mode)
|
||||
{
|
||||
fFilename = filename;
|
||||
fMode = mode;
|
||||
|
||||
fOutput = new hsUNIXStream;
|
||||
return fOutput->Open(filename, L"wb");
|
||||
return fOutput->Open(filename, "wb");
|
||||
}
|
||||
|
||||
bool plZlibStream::Close()
|
||||
@ -298,7 +288,7 @@ void plZlibStream::Rewind()
|
||||
{
|
||||
// hack so rewind will work (someone thought it would be funny to not implement base class functions)
|
||||
Close();
|
||||
Open(fFilename.c_str(), fMode.c_str());
|
||||
Open(fFilename, fMode);
|
||||
fHeader = kNeedMoreData;
|
||||
fDecompressedOk = false;
|
||||
}
|
||||
|
@ -60,7 +60,9 @@ protected:
|
||||
Validate fHeader;
|
||||
std::vector<uint8_t> fHeaderCache;
|
||||
|
||||
std::wstring fFilename, fMode; // needed for rewind function
|
||||
// needed for rewind function
|
||||
plFileName fFilename;
|
||||
const char* fMode;
|
||||
|
||||
int IValidateGzHeader(uint32_t byteCount, const void* buffer);
|
||||
|
||||
@ -68,8 +70,7 @@ public:
|
||||
plZlibStream();
|
||||
virtual ~plZlibStream();
|
||||
|
||||
virtual bool Open(const char* filename, const char* mode);
|
||||
virtual bool Open(const wchar_t* filename, const wchar_t* mode);
|
||||
virtual bool Open(const plFileName& filename, const char* mode);
|
||||
virtual bool Close();
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
|
||||
|
Reference in New Issue
Block a user