Add missing flush modes supported by zlib
parent
416f823866
commit
7c13b16d30
|
@ -188,7 +188,8 @@ XFileParser::XFileParser(const std::vector<char> &pBuffer) :
|
|||
Compression compression;
|
||||
uncompressed.resize(est_out + 1);
|
||||
char *out = &uncompressed.front();
|
||||
if (compression.open(mIsBinaryFormat ? Compression::Format::Binary : Compression::Format::ASCII, Compression::FlushMode::SyncFlush, -Compression::MAX_WBITS)) {
|
||||
if (compression.open(mIsBinaryFormat ? Compression::Format::Binary : Compression::Format::ASCII,
|
||||
Compression::FlushMode::SyncFlush, -Compression::MaxWBits)) {
|
||||
while (mP + 3 < mEnd) {
|
||||
uint16_t ofs = *((uint16_t *)mP);
|
||||
AI_SWAP2(ofs);
|
||||
|
@ -243,11 +244,11 @@ void XFileParser::ParseFile() {
|
|||
}
|
||||
|
||||
// parse specific object
|
||||
if (objectName == "template")
|
||||
if (objectName == "template") {
|
||||
ParseDataObjectTemplate();
|
||||
else if (objectName == "Frame")
|
||||
} else if (objectName == "Frame") {
|
||||
ParseDataObjectFrame(nullptr);
|
||||
else if (objectName == "Mesh") {
|
||||
} else if (objectName == "Mesh") {
|
||||
// some meshes have no frames at all
|
||||
Mesh *mesh = new Mesh;
|
||||
ParseDataObjectMesh(mesh);
|
||||
|
@ -286,12 +287,14 @@ void XFileParser::ParseDataObjectTemplate() {
|
|||
while (running) {
|
||||
std::string s = GetNextToken();
|
||||
|
||||
if (s == "}")
|
||||
if (s == "}") {
|
||||
break;
|
||||
}
|
||||
|
||||
if (s.length() == 0)
|
||||
if (s.length() == 0) {
|
||||
ThrowException("Unexpected end of file reached while parsing template definition");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -104,6 +104,12 @@ static int getFlushMode(Compression::FlushMode flush) {
|
|||
case Compression::FlushMode::NoFlush:
|
||||
z_flush = Z_NO_FLUSH;
|
||||
break;
|
||||
case Compression::FlushMode::Block:
|
||||
z_flush = Z_BLOCK;
|
||||
break;
|
||||
case Compression::FlushMode::Tree:
|
||||
z_flush = Z_TREES;
|
||||
break;
|
||||
case Compression::FlushMode::SyncFlush:
|
||||
z_flush = Z_SYNC_FLUSH;
|
||||
break;
|
||||
|
|
|
@ -70,6 +70,8 @@ public:
|
|||
enum class FlushMode {
|
||||
InvalidFormat = -1, ///< Invalid enum type.
|
||||
NoFlush = 0, ///< No flush, will be done on inflate end.
|
||||
Block, ///< Assists in combination of compress.
|
||||
Tree, ///< Assists in combination of compress and returns if stream is finish.
|
||||
SyncFlush, ///< Synced flush mode.
|
||||
Finish, ///< Finish mode, all in once, no block access.
|
||||
|
||||
|
|
Loading…
Reference in New Issue