X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6ebb51430cd8e4a9a11c6c5a5ca7c3ff9d7a72a..64ea838d8f4d1853b7d850db93ee565e901d099a:/src/zlib/uncompr.c?ds=sidebyside diff --git a/src/zlib/uncompr.c b/src/zlib/uncompr.c index 1de520634a..b59e3d0def 100644 --- a/src/zlib/uncompr.c +++ b/src/zlib/uncompr.c @@ -1,11 +1,12 @@ /* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-1998 Jean-loup Gailly. + * Copyright (C) 1995-2003 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ -#include "../zlib/zlib.h" +#define ZLIB_INTERNAL +#include "zlib.h" /* =========================================================================== Decompresses the source buffer into the destination buffer. sourceLen is @@ -22,15 +23,11 @@ enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted. */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface -int ZEXPORT uncompress (Bytef* dest, uLongf* destLen, const Bytef* source, uLong sourceLen) -#else int ZEXPORT uncompress (dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; -#endif { z_stream stream; int err; @@ -53,7 +50,9 @@ int ZEXPORT uncompress (dest, destLen, source, sourceLen) err = inflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { inflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; } *destLen = stream.total_out;