Oolite 1.91.0.7658-250404-b1488af
All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
miniz.h File Reference
#include <stddef.h>
#include <time.h>
+ Include dependency graph for miniz.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mz_stream_s
 

Macros

#define MINIZ_X86_OR_X64_CPU   0
 
#define MINIZ_LITTLE_ENDIAN   0
 
#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES   0
 
#define MINIZ_HAS_64BIT_REGISTERS   0
 
#define MZ_ADLER32_INIT   (1)
 
#define MZ_CRC32_INIT   (0)
 
#define MZ_DEFLATED   8
 
#define MZ_VERSION   "11.0.2"
 
#define MZ_VERNUM   0xB002
 
#define MZ_VER_MAJOR   11
 
#define MZ_VER_MINOR   2
 
#define MZ_VER_REVISION   0
 
#define MZ_VER_SUBREVISION   0
 
#define MZ_DEFAULT_WINDOW_BITS   15
 
#define Z_NULL   0
 
#define Z_NO_FLUSH   MZ_NO_FLUSH
 
#define Z_PARTIAL_FLUSH   MZ_PARTIAL_FLUSH
 
#define Z_SYNC_FLUSH   MZ_SYNC_FLUSH
 
#define Z_FULL_FLUSH   MZ_FULL_FLUSH
 
#define Z_FINISH   MZ_FINISH
 
#define Z_BLOCK   MZ_BLOCK
 
#define Z_OK   MZ_OK
 
#define Z_STREAM_END   MZ_STREAM_END
 
#define Z_NEED_DICT   MZ_NEED_DICT
 
#define Z_ERRNO   MZ_ERRNO
 
#define Z_STREAM_ERROR   MZ_STREAM_ERROR
 
#define Z_DATA_ERROR   MZ_DATA_ERROR
 
#define Z_MEM_ERROR   MZ_MEM_ERROR
 
#define Z_BUF_ERROR   MZ_BUF_ERROR
 
#define Z_VERSION_ERROR   MZ_VERSION_ERROR
 
#define Z_PARAM_ERROR   MZ_PARAM_ERROR
 
#define Z_NO_COMPRESSION   MZ_NO_COMPRESSION
 
#define Z_BEST_SPEED   MZ_BEST_SPEED
 
#define Z_BEST_COMPRESSION   MZ_BEST_COMPRESSION
 
#define Z_DEFAULT_COMPRESSION   MZ_DEFAULT_COMPRESSION
 
#define Z_DEFAULT_STRATEGY   MZ_DEFAULT_STRATEGY
 
#define Z_FILTERED   MZ_FILTERED
 
#define Z_HUFFMAN_ONLY   MZ_HUFFMAN_ONLY
 
#define Z_RLE   MZ_RLE
 
#define Z_FIXED   MZ_FIXED
 
#define Z_DEFLATED   MZ_DEFLATED
 
#define Z_DEFAULT_WINDOW_BITS   MZ_DEFAULT_WINDOW_BITS
 
#define alloc_func   mz_alloc_func
 
#define free_func   mz_free_func
 
#define internal_state   mz_internal_state
 
#define z_stream   mz_stream
 
#define deflateInit   mz_deflateInit
 
#define deflateInit2   mz_deflateInit2
 
#define deflateReset   mz_deflateReset
 
#define deflate   mz_deflate
 
#define deflateEnd   mz_deflateEnd
 
#define deflateBound   mz_deflateBound
 
#define compress   mz_compress
 
#define compress2   mz_compress2
 
#define compressBound   mz_compressBound
 
#define inflateInit   mz_inflateInit
 
#define inflateInit2   mz_inflateInit2
 
#define inflateReset   mz_inflateReset
 
#define inflate   mz_inflate
 
#define inflateEnd   mz_inflateEnd
 
#define uncompress   mz_uncompress
 
#define uncompress2   mz_uncompress2
 
#define crc32   mz_crc32
 
#define adler32   mz_adler32
 
#define MAX_WBITS   15
 
#define MAX_MEM_LEVEL   9
 
#define zError   mz_error
 
#define ZLIB_VERSION   MZ_VERSION
 
#define ZLIB_VERNUM   MZ_VERNUM
 
#define ZLIB_VER_MAJOR   MZ_VER_MAJOR
 
#define ZLIB_VER_MINOR   MZ_VER_MINOR
 
#define ZLIB_VER_REVISION   MZ_VER_REVISION
 
#define ZLIB_VER_SUBREVISION   MZ_VER_SUBREVISION
 
#define zlibVersion   mz_version
 
#define zlib_version   mz_version()
 

Typedefs

typedef unsigned long mz_ulong
 
typedef void *(* mz_alloc_func) (void *opaque, size_t items, size_t size)
 
typedef void(* mz_free_func) (void *opaque, void *address)
 
typedef void *(* mz_realloc_func) (void *opaque, void *address, size_t items, size_t size)
 
typedef struct mz_stream_s mz_stream
 
typedef mz_streammz_streamp
 
typedef unsigned char Byte
 
typedef unsigned int uInt
 
typedef mz_ulong uLong
 
typedef Byte Bytef
 
typedef uInt uIntf
 
typedef char charf
 
typedef int intf
 
typedef void * voidpf
 
typedef uLong uLongf
 
typedef void * voidp
 
typedef void *const voidpc
 

Enumerations

enum  {
  MZ_DEFAULT_STRATEGY = 0 , MZ_FILTERED = 1 , MZ_HUFFMAN_ONLY = 2 , MZ_RLE = 3 ,
  MZ_FIXED = 4
}
 
enum  {
  MZ_NO_COMPRESSION = 0 , MZ_BEST_SPEED = 1 , MZ_BEST_COMPRESSION = 9 , MZ_UBER_COMPRESSION = 10 ,
  MZ_DEFAULT_LEVEL = 6 , MZ_DEFAULT_COMPRESSION = -1
}
 
enum  {
  MZ_NO_FLUSH = 0 , MZ_PARTIAL_FLUSH = 1 , MZ_SYNC_FLUSH = 2 , MZ_FULL_FLUSH = 3 ,
  MZ_FINISH = 4 , MZ_BLOCK = 5
}
 
enum  {
  MZ_OK = 0 , MZ_STREAM_END = 1 , MZ_NEED_DICT = 2 , MZ_ERRNO = -1 ,
  MZ_STREAM_ERROR = -2 , MZ_DATA_ERROR = -3 , MZ_MEM_ERROR = -4 , MZ_BUF_ERROR = -5 ,
  MZ_VERSION_ERROR = -6 , MZ_PARAM_ERROR = -10000
}
 

Functions

MINIZ_EXPORT void mz_free (void *p)
 
MINIZ_EXPORT mz_ulong mz_adler32 (mz_ulong adler, const unsigned char *ptr, size_t buf_len)
 
MINIZ_EXPORT mz_ulong mz_crc32 (mz_ulong crc, const unsigned char *ptr, size_t buf_len)
 
MINIZ_EXPORT const char * mz_version (void)
 
MINIZ_EXPORT int mz_deflateInit (mz_streamp pStream, int level)
 
MINIZ_EXPORT int mz_deflateInit2 (mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy)
 
MINIZ_EXPORT int mz_deflateReset (mz_streamp pStream)
 
MINIZ_EXPORT int mz_deflate (mz_streamp pStream, int flush)
 
MINIZ_EXPORT int mz_deflateEnd (mz_streamp pStream)
 
MINIZ_EXPORT mz_ulong mz_deflateBound (mz_streamp pStream, mz_ulong source_len)
 
MINIZ_EXPORT int mz_compress (unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
 
MINIZ_EXPORT int mz_compress2 (unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level)
 
MINIZ_EXPORT mz_ulong mz_compressBound (mz_ulong source_len)
 
MINIZ_EXPORT int mz_inflateInit (mz_streamp pStream)
 
MINIZ_EXPORT int mz_inflateInit2 (mz_streamp pStream, int window_bits)
 
MINIZ_EXPORT int mz_inflateReset (mz_streamp pStream)
 
MINIZ_EXPORT int mz_inflate (mz_streamp pStream, int flush)
 
MINIZ_EXPORT int mz_inflateEnd (mz_streamp pStream)
 
MINIZ_EXPORT int mz_uncompress (unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
 
MINIZ_EXPORT int mz_uncompress2 (unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len)
 
MINIZ_EXPORT const char * mz_error (int err)
 

Macro Definition Documentation

◆ adler32

#define adler32   mz_adler32

Definition at line 512 of file miniz.h.

◆ alloc_func

#define alloc_func   mz_alloc_func

Definition at line 484 of file miniz.h.

Referenced by unzOpenCurrentFile3().

◆ compress

#define compress   mz_compress

Definition at line 496 of file miniz.h.

◆ compress2

#define compress2   mz_compress2

Definition at line 497 of file miniz.h.

◆ compressBound

#define compressBound   mz_compressBound

Definition at line 498 of file miniz.h.

◆ crc32

#define crc32   mz_crc32

Definition at line 511 of file miniz.h.

Referenced by mz_crc32(), and unzReadCurrentFile().

◆ deflate

#define deflate   mz_deflate

Definition at line 493 of file miniz.h.

◆ deflateBound

#define deflateBound   mz_deflateBound

Definition at line 495 of file miniz.h.

◆ deflateEnd

#define deflateEnd   mz_deflateEnd

Definition at line 494 of file miniz.h.

◆ deflateInit

#define deflateInit   mz_deflateInit

Definition at line 490 of file miniz.h.

◆ deflateInit2

#define deflateInit2   mz_deflateInit2

Definition at line 491 of file miniz.h.

◆ deflateReset

#define deflateReset   mz_deflateReset

Definition at line 492 of file miniz.h.

◆ free_func

#define free_func   mz_free_func

Definition at line 485 of file miniz.h.

Referenced by unzOpenCurrentFile3().

◆ inflate

#define inflate   mz_inflate

Definition at line 505 of file miniz.h.

Referenced by unzReadCurrentFile().

◆ inflateEnd

#define inflateEnd   mz_inflateEnd

Definition at line 506 of file miniz.h.

Referenced by unzCloseCurrentFile().

◆ inflateInit

#define inflateInit   mz_inflateInit

Definition at line 502 of file miniz.h.

◆ inflateInit2

#define inflateInit2   mz_inflateInit2

Definition at line 503 of file miniz.h.

Referenced by unzOpenCurrentFile3().

◆ inflateReset

#define inflateReset   mz_inflateReset

Definition at line 504 of file miniz.h.

◆ internal_state

#define internal_state   mz_internal_state

Definition at line 486 of file miniz.h.

◆ MAX_MEM_LEVEL

#define MAX_MEM_LEVEL   9

Definition at line 514 of file miniz.h.

◆ MAX_WBITS

#define MAX_WBITS   15

Definition at line 513 of file miniz.h.

Referenced by unzOpenCurrentFile3().

◆ MINIZ_HAS_64BIT_REGISTERS

#define MINIZ_HAS_64BIT_REGISTERS   0

Definition at line 225 of file miniz.h.

◆ MINIZ_LITTLE_ENDIAN

#define MINIZ_LITTLE_ENDIAN   0

Definition at line 197 of file miniz.h.

◆ MINIZ_USE_UNALIGNED_LOADS_AND_STORES

#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES   0

Definition at line 217 of file miniz.h.

◆ MINIZ_X86_OR_X64_CPU

#define MINIZ_X86_OR_X64_CPU   0

Definition at line 178 of file miniz.h.

◆ MZ_ADLER32_INIT

#define MZ_ADLER32_INIT   (1)

Definition at line 240 of file miniz.h.

Referenced by mz_adler32(), and mz_deflateInit2().

◆ MZ_CRC32_INIT

◆ MZ_DEFAULT_WINDOW_BITS

#define MZ_DEFAULT_WINDOW_BITS   15

Definition at line 314 of file miniz.h.

Referenced by mz_deflateInit(), mz_deflateInit2(), mz_inflateInit(), and mz_inflateInit2().

◆ MZ_DEFLATED

◆ MZ_VER_MAJOR

#define MZ_VER_MAJOR   11

Definition at line 280 of file miniz.h.

◆ MZ_VER_MINOR

#define MZ_VER_MINOR   2

Definition at line 281 of file miniz.h.

◆ MZ_VER_REVISION

#define MZ_VER_REVISION   0

Definition at line 282 of file miniz.h.

◆ MZ_VER_SUBREVISION

#define MZ_VER_SUBREVISION   0

Definition at line 283 of file miniz.h.

◆ MZ_VERNUM

#define MZ_VERNUM   0xB002

Definition at line 279 of file miniz.h.

◆ MZ_VERSION

#define MZ_VERSION   "11.0.2"

Definition at line 278 of file miniz.h.

Referenced by mz_version().

◆ uncompress

#define uncompress   mz_uncompress

Definition at line 507 of file miniz.h.

◆ uncompress2

#define uncompress2   mz_uncompress2

Definition at line 508 of file miniz.h.

◆ Z_BEST_COMPRESSION

#define Z_BEST_COMPRESSION   MZ_BEST_COMPRESSION

Definition at line 475 of file miniz.h.

◆ Z_BEST_SPEED

#define Z_BEST_SPEED   MZ_BEST_SPEED

Definition at line 474 of file miniz.h.

◆ Z_BLOCK

#define Z_BLOCK   MZ_BLOCK

Definition at line 462 of file miniz.h.

◆ Z_BUF_ERROR

#define Z_BUF_ERROR   MZ_BUF_ERROR

Definition at line 470 of file miniz.h.

◆ Z_DATA_ERROR

#define Z_DATA_ERROR   MZ_DATA_ERROR

Definition at line 468 of file miniz.h.

Referenced by unzReadCurrentFile().

◆ Z_DEFAULT_COMPRESSION

#define Z_DEFAULT_COMPRESSION   MZ_DEFAULT_COMPRESSION

Definition at line 476 of file miniz.h.

◆ Z_DEFAULT_STRATEGY

#define Z_DEFAULT_STRATEGY   MZ_DEFAULT_STRATEGY

Definition at line 477 of file miniz.h.

◆ Z_DEFAULT_WINDOW_BITS

#define Z_DEFAULT_WINDOW_BITS   MZ_DEFAULT_WINDOW_BITS

Definition at line 483 of file miniz.h.

◆ Z_DEFLATED

#define Z_DEFLATED   MZ_DEFLATED

◆ Z_ERRNO

#define Z_ERRNO   MZ_ERRNO

Definition at line 466 of file miniz.h.

◆ Z_FILTERED

#define Z_FILTERED   MZ_FILTERED

Definition at line 478 of file miniz.h.

◆ Z_FINISH

#define Z_FINISH   MZ_FINISH

Definition at line 461 of file miniz.h.

◆ Z_FIXED

#define Z_FIXED   MZ_FIXED

Definition at line 481 of file miniz.h.

◆ Z_FULL_FLUSH

#define Z_FULL_FLUSH   MZ_FULL_FLUSH

Definition at line 460 of file miniz.h.

◆ Z_HUFFMAN_ONLY

#define Z_HUFFMAN_ONLY   MZ_HUFFMAN_ONLY

Definition at line 479 of file miniz.h.

◆ Z_MEM_ERROR

#define Z_MEM_ERROR   MZ_MEM_ERROR

Definition at line 469 of file miniz.h.

◆ Z_NEED_DICT

#define Z_NEED_DICT   MZ_NEED_DICT

Definition at line 465 of file miniz.h.

◆ Z_NO_COMPRESSION

#define Z_NO_COMPRESSION   MZ_NO_COMPRESSION

Definition at line 473 of file miniz.h.

◆ Z_NO_FLUSH

#define Z_NO_FLUSH   MZ_NO_FLUSH

Definition at line 457 of file miniz.h.

◆ Z_NULL

#define Z_NULL   0

Definition at line 456 of file miniz.h.

◆ Z_OK

#define Z_OK   MZ_OK

Definition at line 463 of file miniz.h.

Referenced by unzOpenCurrentFile3(), and unzReadCurrentFile().

◆ Z_PARAM_ERROR

#define Z_PARAM_ERROR   MZ_PARAM_ERROR

Definition at line 472 of file miniz.h.

◆ Z_PARTIAL_FLUSH

#define Z_PARTIAL_FLUSH   MZ_PARTIAL_FLUSH

Definition at line 458 of file miniz.h.

◆ Z_RLE

#define Z_RLE   MZ_RLE

Definition at line 480 of file miniz.h.

◆ z_stream

#define z_stream   mz_stream

Definition at line 487 of file miniz.h.

◆ Z_STREAM_END

#define Z_STREAM_END   MZ_STREAM_END

Definition at line 464 of file miniz.h.

Referenced by unzReadCurrentFile().

◆ Z_STREAM_ERROR

#define Z_STREAM_ERROR   MZ_STREAM_ERROR

Definition at line 467 of file miniz.h.

◆ Z_SYNC_FLUSH

#define Z_SYNC_FLUSH   MZ_SYNC_FLUSH

Definition at line 459 of file miniz.h.

Referenced by unzReadCurrentFile().

◆ Z_VERSION_ERROR

#define Z_VERSION_ERROR   MZ_VERSION_ERROR

Definition at line 471 of file miniz.h.

◆ zError

#define zError   mz_error

Definition at line 515 of file miniz.h.

◆ ZLIB_VER_MAJOR

#define ZLIB_VER_MAJOR   MZ_VER_MAJOR

Definition at line 518 of file miniz.h.

◆ ZLIB_VER_MINOR

#define ZLIB_VER_MINOR   MZ_VER_MINOR

Definition at line 519 of file miniz.h.

◆ ZLIB_VER_REVISION

#define ZLIB_VER_REVISION   MZ_VER_REVISION

Definition at line 520 of file miniz.h.

◆ ZLIB_VER_SUBREVISION

#define ZLIB_VER_SUBREVISION   MZ_VER_SUBREVISION

Definition at line 521 of file miniz.h.

◆ ZLIB_VERNUM

#define ZLIB_VERNUM   MZ_VERNUM

Definition at line 517 of file miniz.h.

◆ ZLIB_VERSION

#define ZLIB_VERSION   MZ_VERSION

Definition at line 516 of file miniz.h.

◆ zlib_version

#define zlib_version   mz_version()

Definition at line 523 of file miniz.h.

◆ zlibVersion

#define zlibVersion   mz_version

Definition at line 522 of file miniz.h.

Typedef Documentation

◆ Byte

typedef unsigned char Byte

Definition at line 445 of file miniz.h.

◆ Bytef

typedef Byte Bytef

Definition at line 448 of file miniz.h.

◆ charf

typedef char charf

Definition at line 450 of file miniz.h.

◆ intf

typedef int intf

Definition at line 451 of file miniz.h.

◆ mz_alloc_func

typedef void *(* mz_alloc_func) (void *opaque, size_t items, size_t size)

Definition at line 263 of file miniz.h.

◆ mz_free_func

typedef void(* mz_free_func) (void *opaque, void *address)

Definition at line 264 of file miniz.h.

◆ mz_realloc_func

typedef void *(* mz_realloc_func) (void *opaque, void *address, size_t items, size_t size)

Definition at line 265 of file miniz.h.

◆ mz_stream

typedef struct mz_stream_s mz_stream

◆ mz_streamp

Definition at line 341 of file miniz.h.

◆ mz_ulong

typedef unsigned long mz_ulong

Definition at line 235 of file miniz.h.

◆ uInt

typedef unsigned int uInt

Definition at line 446 of file miniz.h.

◆ uIntf

typedef uInt uIntf

Definition at line 449 of file miniz.h.

◆ uLong

typedef uLong

Definition at line 447 of file miniz.h.

◆ uLongf

typedef uLong uLongf

Definition at line 453 of file miniz.h.

◆ voidp

typedef void* voidp

Definition at line 454 of file miniz.h.

◆ voidpc

typedef void* const voidpc

Definition at line 455 of file miniz.h.

◆ voidpf

typedef voidpf

Definition at line 452 of file miniz.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MZ_DEFAULT_STRATEGY 
MZ_FILTERED 
MZ_HUFFMAN_ONLY 
MZ_RLE 
MZ_FIXED 

Definition at line 249 of file miniz.h.

250{
252 MZ_FILTERED = 1,
253 MZ_HUFFMAN_ONLY = 2,
254 MZ_RLE = 3,
255 MZ_FIXED = 4
256};
@ MZ_FILTERED
Definition miniz.h:252
@ MZ_FIXED
Definition miniz.h:255
@ MZ_DEFAULT_STRATEGY
Definition miniz.h:251
@ MZ_RLE
Definition miniz.h:254
@ MZ_HUFFMAN_ONLY
Definition miniz.h:253

◆ anonymous enum

anonymous enum
Enumerator
MZ_OK 
MZ_STREAM_END 
MZ_NEED_DICT 
MZ_ERRNO 
MZ_STREAM_ERROR 
MZ_DATA_ERROR 
MZ_MEM_ERROR 
MZ_BUF_ERROR 
MZ_VERSION_ERROR 
MZ_PARAM_ERROR 

Definition at line 299 of file miniz.h.

300{
301 MZ_OK = 0,
302 MZ_STREAM_END = 1,
303 MZ_NEED_DICT = 2,
304 MZ_ERRNO = -1,
305 MZ_STREAM_ERROR = -2,
306 MZ_DATA_ERROR = -3,
307 MZ_MEM_ERROR = -4,
308 MZ_BUF_ERROR = -5,
309 MZ_VERSION_ERROR = -6,
310 MZ_PARAM_ERROR = -10000
311};
@ MZ_MEM_ERROR
Definition miniz.h:307
@ MZ_PARAM_ERROR
Definition miniz.h:310
@ MZ_NEED_DICT
Definition miniz.h:303
@ MZ_VERSION_ERROR
Definition miniz.h:309
@ MZ_STREAM_END
Definition miniz.h:302
@ MZ_ERRNO
Definition miniz.h:304
@ MZ_OK
Definition miniz.h:301
@ MZ_BUF_ERROR
Definition miniz.h:308
@ MZ_STREAM_ERROR
Definition miniz.h:305
@ MZ_DATA_ERROR
Definition miniz.h:306

◆ anonymous enum

anonymous enum
Enumerator
MZ_NO_FLUSH 
MZ_PARTIAL_FLUSH 
MZ_SYNC_FLUSH 
MZ_FULL_FLUSH 
MZ_FINISH 
MZ_BLOCK 

Definition at line 288 of file miniz.h.

289{
290 MZ_NO_FLUSH = 0,
292 MZ_SYNC_FLUSH = 2,
293 MZ_FULL_FLUSH = 3,
294 MZ_FINISH = 4,
295 MZ_BLOCK = 5
296};
@ MZ_SYNC_FLUSH
Definition miniz.h:292
@ MZ_BLOCK
Definition miniz.h:295
@ MZ_FULL_FLUSH
Definition miniz.h:293
@ MZ_FINISH
Definition miniz.h:294
@ MZ_PARTIAL_FLUSH
Definition miniz.h:291
@ MZ_NO_FLUSH
Definition miniz.h:290

◆ anonymous enum

anonymous enum
Enumerator
MZ_NO_COMPRESSION 
MZ_BEST_SPEED 
MZ_BEST_COMPRESSION 
MZ_UBER_COMPRESSION 
MZ_DEFAULT_LEVEL 
MZ_DEFAULT_COMPRESSION 

Definition at line 268 of file miniz.h.

269{
271 MZ_BEST_SPEED = 1,
276};
@ MZ_BEST_SPEED
Definition miniz.h:271
@ MZ_NO_COMPRESSION
Definition miniz.h:270
@ MZ_UBER_COMPRESSION
Definition miniz.h:273
@ MZ_DEFAULT_LEVEL
Definition miniz.h:274
@ MZ_BEST_COMPRESSION
Definition miniz.h:272
@ MZ_DEFAULT_COMPRESSION
Definition miniz.h:275

Function Documentation

◆ mz_adler32()

MINIZ_EXPORT mz_ulong mz_adler32 ( mz_ulong adler,
const unsigned char * ptr,
size_t buf_len )

Definition at line 41 of file miniz.c.

42{
43 mz_uint32 i, s1 = (mz_uint32)(adler & 0xffff), s2 = (mz_uint32)(adler >> 16);
44 size_t block_len = buf_len % 5552;
45 if (!ptr)
46 return MZ_ADLER32_INIT;
47 while (buf_len)
48 {
49 for (i = 0; i + 7 < block_len; i += 8, ptr += 8)
50 {
51 s1 += ptr[0], s2 += s1;
52 s1 += ptr[1], s2 += s1;
53 s1 += ptr[2], s2 += s1;
54 s1 += ptr[3], s2 += s1;
55 s1 += ptr[4], s2 += s1;
56 s1 += ptr[5], s2 += s1;
57 s1 += ptr[6], s2 += s1;
58 s1 += ptr[7], s2 += s1;
59 }
60 for (; i < block_len; ++i)
61 s1 += *ptr++, s2 += s1;
62 s1 %= 65521U, s2 %= 65521U;
63 buf_len -= block_len;
64 block_len = 5552;
65 }
66 return (s2 << 16) + s1;
67}
#define MZ_ADLER32_INIT
Definition miniz.h:240

References MZ_ADLER32_INIT.

Referenced by tdefl_compress().

+ Here is the caller graph for this function:

◆ mz_compress()

MINIZ_EXPORT int mz_compress ( unsigned char * pDest,
mz_ulong * pDest_len,
const unsigned char * pSource,
mz_ulong source_len )

Definition at line 350 of file miniz.c.

351{
352 return mz_compress2(pDest, pDest_len, pSource, source_len, MZ_DEFAULT_COMPRESSION);
353}
int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level)
Definition miniz.c:320

References mz_compress2(), and MZ_DEFAULT_COMPRESSION.

+ Here is the call graph for this function:

◆ mz_compress2()

MINIZ_EXPORT int mz_compress2 ( unsigned char * pDest,
mz_ulong * pDest_len,
const unsigned char * pSource,
mz_ulong source_len,
int level )

Definition at line 320 of file miniz.c.

321{
322 int status;
324 memset(&stream, 0, sizeof(stream));
325
326 /* In case mz_ulong is 64-bits (argh I hate longs). */
327 if ((mz_uint64)(source_len | *pDest_len) > 0xFFFFFFFFU)
328 return MZ_PARAM_ERROR;
329
330 stream.next_in = pSource;
331 stream.avail_in = (mz_uint32)source_len;
332 stream.next_out = pDest;
333 stream.avail_out = (mz_uint32)*pDest_len;
334
335 status = mz_deflateInit(&stream, level);
336 if (status != MZ_OK)
337 return status;
338
339 status = mz_deflate(&stream, MZ_FINISH);
340 if (status != MZ_STREAM_END)
341 {
343 return (status == MZ_OK) ? MZ_BUF_ERROR : status;
344 }
345
346 *pDest_len = stream.total_out;
347 return mz_deflateEnd(&stream);
348}
voidpf stream
Definition ioapi.h:134
int mz_deflateEnd(mz_streamp pStream)
Definition miniz.c:301
int mz_deflateInit(mz_streamp pStream, int level)
Definition miniz.c:193
int mz_deflate(mz_streamp pStream, int flush)
Definition miniz.c:243
struct mz_stream_s mz_stream

References MZ_BUF_ERROR, mz_deflate(), mz_deflateEnd(), mz_deflateInit(), MZ_FINISH, MZ_OK, MZ_PARAM_ERROR, and MZ_STREAM_END.

Referenced by mz_compress().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mz_compressBound()

MINIZ_EXPORT mz_ulong mz_compressBound ( mz_ulong source_len)

Definition at line 355 of file miniz.c.

356{
357 return mz_deflateBound(NULL, source_len);
358}
mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len)
Definition miniz.c:313

References mz_deflateBound().

+ Here is the call graph for this function:

◆ mz_crc32()

MINIZ_EXPORT mz_ulong mz_crc32 ( mz_ulong crc,
const unsigned char * ptr,
size_t buf_len )

◆ mz_deflate()

MINIZ_EXPORT int mz_deflate ( mz_streamp pStream,
int flush )

Definition at line 243 of file miniz.c.

244{
245 size_t in_bytes, out_bytes;
246 mz_ulong orig_total_in, orig_total_out;
247 int mz_status = MZ_OK;
248
249 if ((!pStream) || (!pStream->state) || (flush < 0) || (flush > MZ_FINISH) || (!pStream->next_out))
250 return MZ_STREAM_ERROR;
251 if (!pStream->avail_out)
252 return MZ_BUF_ERROR;
253
254 if (flush == MZ_PARTIAL_FLUSH)
255 flush = MZ_SYNC_FLUSH;
256
257 if (((tdefl_compressor *)pStream->state)->m_prev_return_status == TDEFL_STATUS_DONE)
258 return (flush == MZ_FINISH) ? MZ_STREAM_END : MZ_BUF_ERROR;
259
260 orig_total_in = pStream->total_in;
261 orig_total_out = pStream->total_out;
262 for (;;)
263 {
264 tdefl_status defl_status;
265 in_bytes = pStream->avail_in;
266 out_bytes = pStream->avail_out;
267
268 defl_status = tdefl_compress((tdefl_compressor *)pStream->state, pStream->next_in, &in_bytes, pStream->next_out, &out_bytes, (tdefl_flush)flush);
269 pStream->next_in += (mz_uint)in_bytes;
270 pStream->avail_in -= (mz_uint)in_bytes;
271 pStream->total_in += (mz_uint)in_bytes;
272 pStream->adler = tdefl_get_adler32((tdefl_compressor *)pStream->state);
273
274 pStream->next_out += (mz_uint)out_bytes;
275 pStream->avail_out -= (mz_uint)out_bytes;
276 pStream->total_out += (mz_uint)out_bytes;
277
278 if (defl_status < 0)
279 {
280 mz_status = MZ_STREAM_ERROR;
281 break;
282 }
283 else if (defl_status == TDEFL_STATUS_DONE)
284 {
285 mz_status = MZ_STREAM_END;
286 break;
287 }
288 else if (!pStream->avail_out)
289 break;
290 else if ((!pStream->avail_in) && (flush != MZ_FINISH))
291 {
292 if ((flush) || (pStream->total_in != orig_total_in) || (pStream->total_out != orig_total_out))
293 break;
294 return MZ_BUF_ERROR; /* Can't make forward progress without some input.
295 */
296 }
297 }
298 return mz_status;
299}
mz_uint32 tdefl_get_adler32(tdefl_compressor *d)
Definition miniz.c:2034
tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush)
Definition miniz.c:1919
unsigned long mz_ulong
Definition miniz.h:235
mz_ulong adler
Definition miniz.h:337
unsigned char * next_out
Definition miniz.h:325
mz_ulong total_out
Definition miniz.h:327
unsigned int avail_out
Definition miniz.h:326
struct mz_internal_state * state
Definition miniz.h:330
const unsigned char * next_in
Definition miniz.h:321
unsigned int avail_in
Definition miniz.h:322
mz_ulong total_in
Definition miniz.h:323

References mz_stream_s::adler, mz_stream_s::avail_in, mz_stream_s::avail_out, MZ_BUF_ERROR, MZ_FINISH, MZ_OK, MZ_PARTIAL_FLUSH, MZ_STREAM_END, MZ_STREAM_ERROR, MZ_SYNC_FLUSH, mz_stream_s::next_in, mz_stream_s::next_out, mz_stream_s::state, tdefl_compress(), tdefl_get_adler32(), mz_stream_s::total_in, and mz_stream_s::total_out.

Referenced by mz_compress2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mz_deflateBound()

MINIZ_EXPORT mz_ulong mz_deflateBound ( mz_streamp pStream,
mz_ulong source_len )

Definition at line 313 of file miniz.c.

314{
315 (void)pStream;
316 /* This is really over conservative. (And lame, but it's actually pretty tricky to compute a true upper bound given the way tdefl's blocking works.) */
317 return MZ_MAX(128 + (source_len * 110) / 100, 128 + source_len + ((source_len / (31 * 1024)) + 1) * 5);
318}

Referenced by mz_compressBound().

+ Here is the caller graph for this function:

◆ mz_deflateEnd()

MINIZ_EXPORT int mz_deflateEnd ( mz_streamp pStream)

Definition at line 301 of file miniz.c.

302{
303 if (!pStream)
304 return MZ_STREAM_ERROR;
305 if (pStream->state)
306 {
307 pStream->zfree(pStream->opaque, pStream->state);
308 pStream->state = NULL;
309 }
310 return MZ_OK;
311}
void * opaque
Definition miniz.h:334
mz_free_func zfree
Definition miniz.h:333

References MZ_OK, MZ_STREAM_ERROR, mz_stream_s::opaque, mz_stream_s::state, and mz_stream_s::zfree.

Referenced by mz_compress2(), and mz_deflateInit2().

+ Here is the caller graph for this function:

◆ mz_deflateInit()

MINIZ_EXPORT int mz_deflateInit ( mz_streamp pStream,
int level )

Definition at line 193 of file miniz.c.

194{
196}
int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy)
Definition miniz.c:198
#define MZ_DEFLATED
Definition miniz.h:259
#define MZ_DEFAULT_WINDOW_BITS
Definition miniz.h:314

References MZ_DEFAULT_STRATEGY, MZ_DEFAULT_WINDOW_BITS, MZ_DEFLATED, and mz_deflateInit2().

Referenced by mz_compress2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mz_deflateInit2()

MINIZ_EXPORT int mz_deflateInit2 ( mz_streamp pStream,
int level,
int method,
int window_bits,
int mem_level,
int strategy )

Definition at line 198 of file miniz.c.

199{
200 tdefl_compressor *pComp;
201 mz_uint comp_flags = TDEFL_COMPUTE_ADLER32 | tdefl_create_comp_flags_from_zip_params(level, window_bits, strategy);
202
203 if (!pStream)
204 return MZ_STREAM_ERROR;
205 if ((method != MZ_DEFLATED) || ((mem_level < 1) || (mem_level > 9)) || ((window_bits != MZ_DEFAULT_WINDOW_BITS) && (-window_bits != MZ_DEFAULT_WINDOW_BITS)))
206 return MZ_PARAM_ERROR;
207
208 pStream->data_type = 0;
209 pStream->adler = MZ_ADLER32_INIT;
210 pStream->msg = NULL;
211 pStream->reserved = 0;
212 pStream->total_in = 0;
213 pStream->total_out = 0;
214 if (!pStream->zalloc)
215 pStream->zalloc = miniz_def_alloc_func;
216 if (!pStream->zfree)
217 pStream->zfree = miniz_def_free_func;
218
219 pComp = (tdefl_compressor *)pStream->zalloc(pStream->opaque, 1, sizeof(tdefl_compressor));
220 if (!pComp)
221 return MZ_MEM_ERROR;
222
223 pStream->state = (struct mz_internal_state *)pComp;
224
225 if (tdefl_init(pComp, NULL, NULL, comp_flags) != TDEFL_STATUS_OKAY)
226 {
227 mz_deflateEnd(pStream);
228 return MZ_PARAM_ERROR;
229 }
230
231 return MZ_OK;
232}
MINIZ_EXPORT void * miniz_def_alloc_func(void *opaque, size_t items, size_t size)
Definition miniz.c:168
tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags)
Definition miniz.c:1993
MINIZ_EXPORT void miniz_def_free_func(void *opaque, void *address)
Definition miniz.c:173
mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy)
Definition miniz.c:2117
int data_type
Definition miniz.h:336
mz_alloc_func zalloc
Definition miniz.h:332
char * msg
Definition miniz.h:329
mz_ulong reserved
Definition miniz.h:338

References mz_stream_s::adler, mz_stream_s::data_type, miniz_def_alloc_func(), miniz_def_free_func(), mz_stream_s::msg, MZ_ADLER32_INIT, MZ_DEFAULT_WINDOW_BITS, MZ_DEFLATED, mz_deflateEnd(), MZ_MEM_ERROR, MZ_OK, MZ_PARAM_ERROR, MZ_STREAM_ERROR, mz_stream_s::opaque, mz_stream_s::reserved, mz_stream_s::state, tdefl_create_comp_flags_from_zip_params(), tdefl_init(), mz_stream_s::total_in, mz_stream_s::total_out, mz_stream_s::zalloc, and mz_stream_s::zfree.

Referenced by mz_deflateInit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mz_deflateReset()

MINIZ_EXPORT int mz_deflateReset ( mz_streamp pStream)

Definition at line 234 of file miniz.c.

235{
236 if ((!pStream) || (!pStream->state) || (!pStream->zalloc) || (!pStream->zfree))
237 return MZ_STREAM_ERROR;
238 pStream->total_in = pStream->total_out = 0;
239 tdefl_init((tdefl_compressor *)pStream->state, NULL, NULL, ((tdefl_compressor *)pStream->state)->m_flags);
240 return MZ_OK;
241}

References MZ_OK, MZ_STREAM_ERROR, mz_stream_s::state, tdefl_init(), mz_stream_s::total_in, mz_stream_s::total_out, mz_stream_s::zalloc, and mz_stream_s::zfree.

+ Here is the call graph for this function:

◆ mz_error()

MINIZ_EXPORT const char * mz_error ( int err)

Definition at line 601 of file miniz.c.

602{
603 static struct
604 {
605 int m_err;
606 const char *m_pDesc;
607 } s_error_descs[] =
608 {
609 { MZ_OK, "" }, { MZ_STREAM_END, "stream end" }, { MZ_NEED_DICT, "need dictionary" }, { MZ_ERRNO, "file error" }, { MZ_STREAM_ERROR, "stream error" }, { MZ_DATA_ERROR, "data error" }, { MZ_MEM_ERROR, "out of memory" }, { MZ_BUF_ERROR, "buf error" }, { MZ_VERSION_ERROR, "version error" }, { MZ_PARAM_ERROR, "parameter error" }
610 };
611 mz_uint i;
612 for (i = 0; i < sizeof(s_error_descs) / sizeof(s_error_descs[0]); ++i)
613 if (s_error_descs[i].m_err == err)
614 return s_error_descs[i].m_pDesc;
615 return NULL;
616}

References MZ_BUF_ERROR, MZ_DATA_ERROR, MZ_ERRNO, MZ_MEM_ERROR, MZ_NEED_DICT, MZ_OK, MZ_PARAM_ERROR, MZ_STREAM_END, MZ_STREAM_ERROR, and MZ_VERSION_ERROR.

◆ mz_free()

MINIZ_EXPORT void mz_free ( void * p)

Definition at line 163 of file miniz.c.

164{
165 MZ_FREE(p);
166}

◆ mz_inflate()

MINIZ_EXPORT int mz_inflate ( mz_streamp pStream,
int flush )

Definition at line 440 of file miniz.c.

441{
442 inflate_state *pState;
443 mz_uint n, first_call, decomp_flags = TINFL_FLAG_COMPUTE_ADLER32;
444 size_t in_bytes, out_bytes, orig_avail_in;
445 tinfl_status status;
446
447 if ((!pStream) || (!pStream->state))
448 return MZ_STREAM_ERROR;
449 if (flush == MZ_PARTIAL_FLUSH)
450 flush = MZ_SYNC_FLUSH;
451 if ((flush) && (flush != MZ_SYNC_FLUSH) && (flush != MZ_FINISH))
452 return MZ_STREAM_ERROR;
453
454 pState = (inflate_state *)pStream->state;
455 if (pState->m_window_bits > 0)
456 decomp_flags |= TINFL_FLAG_PARSE_ZLIB_HEADER;
457 orig_avail_in = pStream->avail_in;
458
459 first_call = pState->m_first_call;
460 pState->m_first_call = 0;
461 if (pState->m_last_status < 0)
462 return MZ_DATA_ERROR;
463
464 if (pState->m_has_flushed && (flush != MZ_FINISH))
465 return MZ_STREAM_ERROR;
466 pState->m_has_flushed |= (flush == MZ_FINISH);
467
468 if ((flush == MZ_FINISH) && (first_call))
469 {
470 /* MZ_FINISH on the first call implies that the input and output buffers are large enough to hold the entire compressed/decompressed file. */
471 decomp_flags |= TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF;
472 in_bytes = pStream->avail_in;
473 out_bytes = pStream->avail_out;
474 status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pStream->next_out, pStream->next_out, &out_bytes, decomp_flags);
475 pState->m_last_status = status;
476 pStream->next_in += (mz_uint)in_bytes;
477 pStream->avail_in -= (mz_uint)in_bytes;
478 pStream->total_in += (mz_uint)in_bytes;
479 pStream->adler = tinfl_get_adler32(&pState->m_decomp);
480 pStream->next_out += (mz_uint)out_bytes;
481 pStream->avail_out -= (mz_uint)out_bytes;
482 pStream->total_out += (mz_uint)out_bytes;
483
484 if (status < 0)
485 return MZ_DATA_ERROR;
486 else if (status != TINFL_STATUS_DONE)
487 {
488 pState->m_last_status = TINFL_STATUS_FAILED;
489 return MZ_BUF_ERROR;
490 }
491 return MZ_STREAM_END;
492 }
493 /* flush != MZ_FINISH then we must assume there's more input. */
494 if (flush != MZ_FINISH)
495 decomp_flags |= TINFL_FLAG_HAS_MORE_INPUT;
496
497 if (pState->m_dict_avail)
498 {
499 n = MZ_MIN(pState->m_dict_avail, pStream->avail_out);
500 memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n);
501 pStream->next_out += n;
502 pStream->avail_out -= n;
503 pStream->total_out += n;
504 pState->m_dict_avail -= n;
505 pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1);
506 return ((pState->m_last_status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK;
507 }
508
509 for (;;)
510 {
511 in_bytes = pStream->avail_in;
512 out_bytes = TINFL_LZ_DICT_SIZE - pState->m_dict_ofs;
513
514 status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pState->m_dict, pState->m_dict + pState->m_dict_ofs, &out_bytes, decomp_flags);
515 pState->m_last_status = status;
516
517 pStream->next_in += (mz_uint)in_bytes;
518 pStream->avail_in -= (mz_uint)in_bytes;
519 pStream->total_in += (mz_uint)in_bytes;
520 pStream->adler = tinfl_get_adler32(&pState->m_decomp);
521
522 pState->m_dict_avail = (mz_uint)out_bytes;
523
524 n = MZ_MIN(pState->m_dict_avail, pStream->avail_out);
525 memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n);
526 pStream->next_out += n;
527 pStream->avail_out -= n;
528 pStream->total_out += n;
529 pState->m_dict_avail -= n;
530 pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1);
531
532 if (status < 0)
533 return MZ_DATA_ERROR; /* Stream is corrupted (there could be some uncompressed data left in the output dictionary - oh well). */
534 else if ((status == TINFL_STATUS_NEEDS_MORE_INPUT) && (!orig_avail_in))
535 return MZ_BUF_ERROR; /* Signal caller that we can't make forward progress without supplying more input or by setting flush to MZ_FINISH. */
536 else if (flush == MZ_FINISH)
537 {
538 /* The output buffer MUST be large to hold the remaining uncompressed data when flush==MZ_FINISH. */
539 if (status == TINFL_STATUS_DONE)
540 return pState->m_dict_avail ? MZ_BUF_ERROR : MZ_STREAM_END;
541 /* status here must be TINFL_STATUS_HAS_MORE_OUTPUT, which means there's at least 1 more byte on the way. If there's no more room left in the output buffer then something is wrong. */
542 else if (!pStream->avail_out)
543 return MZ_BUF_ERROR;
544 }
545 else if ((status == TINFL_STATUS_DONE) || (!pStream->avail_in) || (!pStream->avail_out) || (pState->m_dict_avail))
546 break;
547 }
548
549 return ((status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK;
550}
tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags)
Definition miniz.c:2438
int m_window_bits
Definition miniz.c:368
mz_uint m_dict_ofs
Definition miniz.c:367
mz_uint m_has_flushed
Definition miniz.c:367
mz_uint m_dict_avail
Definition miniz.c:367
mz_uint8 m_dict[TINFL_LZ_DICT_SIZE]
Definition miniz.c:369
mz_uint m_first_call
Definition miniz.c:367
tinfl_status m_last_status
Definition miniz.c:370
tinfl_decompressor m_decomp
Definition miniz.c:366

References mz_stream_s::adler, mz_stream_s::avail_in, mz_stream_s::avail_out, inflate_state::m_decomp, inflate_state::m_dict, inflate_state::m_dict_avail, inflate_state::m_dict_ofs, inflate_state::m_first_call, inflate_state::m_has_flushed, inflate_state::m_last_status, inflate_state::m_window_bits, MZ_BUF_ERROR, MZ_DATA_ERROR, MZ_FINISH, MZ_OK, MZ_PARTIAL_FLUSH, MZ_STREAM_END, MZ_STREAM_ERROR, MZ_SYNC_FLUSH, mz_stream_s::next_in, mz_stream_s::next_out, mz_stream_s::state, tinfl_decompress(), mz_stream_s::total_in, and mz_stream_s::total_out.

Referenced by mz_uncompress2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mz_inflateEnd()

MINIZ_EXPORT int mz_inflateEnd ( mz_streamp pStream)

Definition at line 552 of file miniz.c.

553{
554 if (!pStream)
555 return MZ_STREAM_ERROR;
556 if (pStream->state)
557 {
558 pStream->zfree(pStream->opaque, pStream->state);
559 pStream->state = NULL;
560 }
561 return MZ_OK;
562}

References MZ_OK, MZ_STREAM_ERROR, mz_stream_s::opaque, mz_stream_s::state, and mz_stream_s::zfree.

Referenced by mz_uncompress2().

+ Here is the caller graph for this function:

◆ mz_inflateInit()

MINIZ_EXPORT int mz_inflateInit ( mz_streamp pStream)

Definition at line 409 of file miniz.c.

410{
412}
int mz_inflateInit2(mz_streamp pStream, int window_bits)
Definition miniz.c:373

References MZ_DEFAULT_WINDOW_BITS, and mz_inflateInit2().

Referenced by mz_uncompress2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mz_inflateInit2()

MINIZ_EXPORT int mz_inflateInit2 ( mz_streamp pStream,
int window_bits )

Definition at line 373 of file miniz.c.

374{
375 inflate_state *pDecomp;
376 if (!pStream)
377 return MZ_STREAM_ERROR;
378 if ((window_bits != MZ_DEFAULT_WINDOW_BITS) && (-window_bits != MZ_DEFAULT_WINDOW_BITS))
379 return MZ_PARAM_ERROR;
380
381 pStream->data_type = 0;
382 pStream->adler = 0;
383 pStream->msg = NULL;
384 pStream->total_in = 0;
385 pStream->total_out = 0;
386 pStream->reserved = 0;
387 if (!pStream->zalloc)
388 pStream->zalloc = miniz_def_alloc_func;
389 if (!pStream->zfree)
390 pStream->zfree = miniz_def_free_func;
391
392 pDecomp = (inflate_state *)pStream->zalloc(pStream->opaque, 1, sizeof(inflate_state));
393 if (!pDecomp)
394 return MZ_MEM_ERROR;
395
396 pStream->state = (struct mz_internal_state *)pDecomp;
397
398 tinfl_init(&pDecomp->m_decomp);
399 pDecomp->m_dict_ofs = 0;
400 pDecomp->m_dict_avail = 0;
401 pDecomp->m_last_status = TINFL_STATUS_NEEDS_MORE_INPUT;
402 pDecomp->m_first_call = 1;
403 pDecomp->m_has_flushed = 0;
404 pDecomp->m_window_bits = window_bits;
405
406 return MZ_OK;
407}

References mz_stream_s::adler, mz_stream_s::data_type, inflate_state::m_decomp, inflate_state::m_dict_avail, inflate_state::m_dict_ofs, inflate_state::m_first_call, inflate_state::m_has_flushed, inflate_state::m_last_status, inflate_state::m_window_bits, miniz_def_alloc_func(), miniz_def_free_func(), mz_stream_s::msg, MZ_DEFAULT_WINDOW_BITS, MZ_MEM_ERROR, MZ_OK, MZ_PARAM_ERROR, MZ_STREAM_ERROR, mz_stream_s::opaque, mz_stream_s::reserved, mz_stream_s::state, mz_stream_s::total_in, mz_stream_s::total_out, mz_stream_s::zalloc, and mz_stream_s::zfree.

Referenced by mz_inflateInit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mz_inflateReset()

MINIZ_EXPORT int mz_inflateReset ( mz_streamp pStream)

Definition at line 414 of file miniz.c.

415{
416 inflate_state *pDecomp;
417 if (!pStream)
418 return MZ_STREAM_ERROR;
419
420 pStream->data_type = 0;
421 pStream->adler = 0;
422 pStream->msg = NULL;
423 pStream->total_in = 0;
424 pStream->total_out = 0;
425 pStream->reserved = 0;
426
427 pDecomp = (inflate_state *)pStream->state;
428
429 tinfl_init(&pDecomp->m_decomp);
430 pDecomp->m_dict_ofs = 0;
431 pDecomp->m_dict_avail = 0;
432 pDecomp->m_last_status = TINFL_STATUS_NEEDS_MORE_INPUT;
433 pDecomp->m_first_call = 1;
434 pDecomp->m_has_flushed = 0;
435 /* pDecomp->m_window_bits = window_bits */;
436
437 return MZ_OK;
438}

References mz_stream_s::adler, mz_stream_s::data_type, inflate_state::m_decomp, inflate_state::m_dict_avail, inflate_state::m_dict_ofs, inflate_state::m_first_call, inflate_state::m_has_flushed, inflate_state::m_last_status, mz_stream_s::msg, MZ_OK, MZ_STREAM_ERROR, mz_stream_s::reserved, mz_stream_s::state, mz_stream_s::total_in, and mz_stream_s::total_out.

◆ mz_uncompress()

MINIZ_EXPORT int mz_uncompress ( unsigned char * pDest,
mz_ulong * pDest_len,
const unsigned char * pSource,
mz_ulong source_len )

Definition at line 594 of file miniz.c.

595{
596 return mz_uncompress2(pDest, pDest_len, pSource, &source_len);
597}
int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len)
Definition miniz.c:563

References mz_uncompress2().

+ Here is the call graph for this function:

◆ mz_uncompress2()

MINIZ_EXPORT int mz_uncompress2 ( unsigned char * pDest,
mz_ulong * pDest_len,
const unsigned char * pSource,
mz_ulong * pSource_len )

Definition at line 563 of file miniz.c.

564{
566 int status;
567 memset(&stream, 0, sizeof(stream));
568
569 /* In case mz_ulong is 64-bits (argh I hate longs). */
570 if ((mz_uint64)(*pSource_len | *pDest_len) > 0xFFFFFFFFU)
571 return MZ_PARAM_ERROR;
572
573 stream.next_in = pSource;
574 stream.avail_in = (mz_uint32)*pSource_len;
575 stream.next_out = pDest;
576 stream.avail_out = (mz_uint32)*pDest_len;
577
578 status = mz_inflateInit(&stream);
579 if (status != MZ_OK)
580 return status;
581
582 status = mz_inflate(&stream, MZ_FINISH);
583 *pSource_len = *pSource_len - stream.avail_in;
584 if (status != MZ_STREAM_END)
585 {
587 return ((status == MZ_BUF_ERROR) && (!stream.avail_in)) ? MZ_DATA_ERROR : status;
588 }
589 *pDest_len = stream.total_out;
590
591 return mz_inflateEnd(&stream);
592}
int mz_inflateInit(mz_streamp pStream)
Definition miniz.c:409
int mz_inflate(mz_streamp pStream, int flush)
Definition miniz.c:440
int mz_inflateEnd(mz_streamp pStream)
Definition miniz.c:552

References MZ_BUF_ERROR, MZ_DATA_ERROR, MZ_FINISH, mz_inflate(), mz_inflateEnd(), mz_inflateInit(), MZ_OK, MZ_PARAM_ERROR, and MZ_STREAM_END.

Referenced by mz_uncompress().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mz_version()

MINIZ_EXPORT const char * mz_version ( void )

Definition at line 184 of file miniz.c.

185{
186 return MZ_VERSION;
187}
#define MZ_VERSION
Definition miniz.h:278

References MZ_VERSION.