Fix last review findings and finish windows bits

This commit is contained in:
Kim Kulling
2022-02-14 20:25:18 +01:00
parent 52b6c4f7c0
commit c718500c55
6 changed files with 48 additions and 51 deletions

View File

@@ -117,13 +117,13 @@ XFileParser::XFileParser(const std::vector<char> &pBuffer) :
mIsBinaryFormat = true;
compressed = true;
} else
ThrowException("Unsupported xfile format '", mP[8], mP[9], mP[10], mP[11], "'");
ThrowException("Unsupported x-file format '", mP[8], mP[9], mP[10], mP[11], "'");
// float size
mBinaryFloatSize = (unsigned int)(mP[12] - 48) * 1000 + (unsigned int)(mP[13] - 48) * 100 + (unsigned int)(mP[14] - 48) * 10 + (unsigned int)(mP[15] - 48);
if (mBinaryFloatSize != 32 && mBinaryFloatSize != 64)
ThrowException("Unknown float size ", mBinaryFloatSize, " specified in xfile header.");
ThrowException("Unknown float size ", mBinaryFloatSize, " specified in x-file header.");
// The x format specifies size in bits, but we work in bytes
mBinaryFloatSize /= 8;
@@ -188,7 +188,7 @@ 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, -MAX_WBITS)) {
if (compression.open(mIsBinaryFormat ? Compression::Format::Binary : Compression::Format::ASCII, Compression::FlushMode::SyncFlush, -Compression::MAX_WBITS)) {
while (mP + 3 < mEnd) {
uint16_t ofs = *((uint16_t *)mP);
AI_SWAP2(ofs);