mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 14:34:34 +00:00
Small fix for non-MSVC
This commit is contained in:
parent
b30d124d50
commit
cd18ef2a43
2 changed files with 56 additions and 55 deletions
|
@ -2510,10 +2510,17 @@ void Continuity::loadFileData(int slot, TiXmlDocument &doc)
|
||||||
{
|
{
|
||||||
unsigned long size = 0;
|
unsigned long size = 0;
|
||||||
char *buf = readCompressedFile(teh_file, &size);
|
char *buf = readCompressedFile(teh_file, &size);
|
||||||
if (!buf || !doc.LoadMem(buf, size))
|
if (!buf)
|
||||||
errorLog("Failed to load save data: " + teh_file);
|
{
|
||||||
|
errorLog("Failed to decompress save file: " + teh_file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!doc.LoadMem(buf, size))
|
||||||
|
{
|
||||||
|
errorLog("Failed to load save data: " + teh_file + " -- Error: " + doc.ErrorDesc());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
teh_file = dsq->continuity.getSaveFileName(slot, "xml");
|
teh_file = dsq->continuity.getSaveFileName(slot, "xml");
|
||||||
if (exists(teh_file))
|
if (exists(teh_file))
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
// for weird gcc/mingw hackfix below
|
// for weird gcc/mingw hackfix below
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define PRINTFAIL(s, ...) fprintf(stderr, (s "\n"), __VA_ARGS__)
|
|
||||||
|
|
||||||
|
|
||||||
DeflateCompressor::DeflateCompressor()
|
DeflateCompressor::DeflateCompressor()
|
||||||
: _windowBits(-MAX_WBITS), // negative, because we want a raw deflate stream, and not zlib-wrapped
|
: _windowBits(-MAX_WBITS), // negative, because we want a raw deflate stream, and not zlib-wrapped
|
||||||
|
@ -57,18 +55,15 @@ void DeflateCompressor::compress(void* dst, uint32 *dst_size, const void* src, u
|
||||||
case Z_STREAM_END:
|
case Z_STREAM_END:
|
||||||
break; // all good
|
break; // all good
|
||||||
case Z_OK:
|
case Z_OK:
|
||||||
PRINTFAIL("ZLIB: Output buffer not large enough");
|
|
||||||
*dst_size = 0;
|
*dst_size = 0;
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
PRINTFAIL("ZLIB: Error %d", ret);
|
|
||||||
*dst_size = 0;
|
*dst_size = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Z_OK != deflateEnd(&c_stream))
|
if (Z_OK != deflateEnd(&c_stream))
|
||||||
{
|
{
|
||||||
PRINTFAIL("Can't compress (zlib: deflateEnd)");
|
|
||||||
*dst_size = 0;
|
*dst_size = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +158,6 @@ void DeflateCompressor::Decompress(void)
|
||||||
decompress((void*)target, &origsize, (const void*)contents(), size(), _windowBits);
|
decompress((void*)target, &origsize, (const void*)contents(), size(), _windowBits);
|
||||||
if(origsize != rs)
|
if(origsize != rs)
|
||||||
{
|
{
|
||||||
PRINTFAIL("DeflateCompressor: Inflate error! cursize=%u origsize=%u realsize=%u",size(),origsize,rs);
|
|
||||||
delete [] target;
|
delete [] target;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue