1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-25 06:05:45 +00:00

Small fix for non-MSVC

This commit is contained in:
fgenesis 2012-06-01 18:43:41 +00:00
parent b30d124d50
commit cd18ef2a43
2 changed files with 56 additions and 55 deletions

View file

@ -2510,9 +2510,16 @@ void Continuity::loadFileData(int slot, TiXmlDocument &doc)
{
unsigned long size = 0;
char *buf = readCompressedFile(teh_file, &size);
if (!buf || !doc.LoadMem(buf, size))
errorLog("Failed to load save data: " + teh_file);
return;
if (!buf)
{
errorLog("Failed to decompress save file: " + teh_file);
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");

View file

@ -6,8 +6,6 @@
// for weird gcc/mingw hackfix below
#include <string.h>
#define PRINTFAIL(s, ...) fprintf(stderr, (s "\n"), __VA_ARGS__)
DeflateCompressor::DeflateCompressor()
: _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:
break; // all good
case Z_OK:
PRINTFAIL("ZLIB: Output buffer not large enough");
*dst_size = 0;
return;
default:
PRINTFAIL("ZLIB: Error %d", ret);
*dst_size = 0;
return;
}
if (Z_OK != deflateEnd(&c_stream))
{
PRINTFAIL("Can't compress (zlib: deflateEnd)");
*dst_size = 0;
return;
}
@ -163,7 +158,6 @@ void DeflateCompressor::Decompress(void)
decompress((void*)target, &origsize, (const void*)contents(), size(), _windowBits);
if(origsize != rs)
{
PRINTFAIL("DeflateCompressor: Inflate error! cursize=%u origsize=%u realsize=%u",size(),origsize,rs);
delete [] target;
return;
}