(Miniz) Add (untested) version of inflateReset and add some shim functions

This commit is contained in:
twinaphex 2013-11-08 19:06:20 +01:00
parent 720ea1a99d
commit e5bd675225
2 changed files with 39 additions and 3 deletions

31
deps/miniz/miniz.c vendored
View File

@ -127,6 +127,11 @@ typedef struct
tinfl_status m_last_status;
} inflate_state;
int inflateInit2_(z_streamp pStream, int window_bits, char *version, int stream_size)
{
return mz_inflateInit2(pStream, window_bits);
}
int mz_inflateInit2(mz_streamp pStream, int window_bits)
{
inflate_state *pDecomp;
@ -161,6 +166,11 @@ int mz_inflateInit(mz_streamp pStream)
return mz_inflateInit2(pStream, MZ_DEFAULT_WINDOW_BITS);
}
int inflate(z_streamp pStream, int flush)
{
return mz_inflate(pStream, flush);
}
int mz_inflate(mz_streamp pStream, int flush)
{
inflate_state* pState;
@ -252,6 +262,22 @@ int mz_inflate(mz_streamp pStream, int flush)
return ((status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK;
}
int inflateReset(z_streamp pStream)
{
return mz_inflateReset(pStream);
}
int mz_inflateReset(mz_streamp pStream)
{
mz_inflateEnd(pStream);
return mz_inflateInit(pStream);
}
int inflateEnd(z_streamp pStream)
{
return mz_inflateEnd(pStream);
}
int mz_inflateEnd(mz_streamp pStream)
{
if (!pStream)
@ -264,6 +290,11 @@ int mz_inflateEnd(mz_streamp pStream)
return MZ_OK;
}
int uncompress(Bytef *pDest, uLongf *pDest_len, const Bytef *pSource, uLong source_len)
{
return mz_uncompress(pDest, pDest_len, pSource, source_len);
}
int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
{
mz_stream stream;

11
deps/miniz/zlib.h vendored
View File

@ -324,6 +324,7 @@ int mz_inflateInit2(mz_streamp pStream, int window_bits);
// MZ_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call mz_inflate() again
// with more input data, or with more room in the output buffer (except when using single call decompression, described above).
int mz_inflate(mz_streamp pStream, int flush);
int mz_inflateReset(mz_streamp pStream);
// Deinitializes a decompressor.
int mz_inflateEnd(mz_streamp pStream);
@ -392,9 +393,6 @@ const char *mz_error(int err);
#define compressBound mz_compressBound
#define inflateInit mz_inflateInit
#define inflateInit2 mz_inflateInit2
#define inflate mz_inflate
#define inflateEnd mz_inflateEnd
#define uncompress mz_uncompress
#define crc32 crc32
#define adler32 mz_adler32
#define MAX_WBITS 15
@ -408,6 +406,13 @@ const char *mz_error(int err);
#define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
#define zlibVersion mz_version
#define zlib_version mz_version()
typedef z_stream *z_streamp;
int inflateReset(z_streamp pStream);
int uncompress(Bytef *pDest, uLongf *pDest_len, const Bytef *pSource, uLong source_len);
int inflateEnd(z_streamp pStream);
int inflate(z_streamp pStream, int flush);
int inflateInit2_(z_streamp pStream, int window_bits, char *version, int stream_size);
#endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
#endif // MINIZ_NO_ZLIB_APIS