@@ -479,44 +479,116 @@ extern "C"
479479#define Z_FIXED MZ_FIXED
480480#define Z_DEFLATED MZ_DEFLATED
481481#define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
482- #define alloc_func mz_alloc_func
483- #define free_func mz_free_func
482+ /* See mz_alloc_func */
483+ typedef void * (* alloc_func )(void * opaque , size_t items , size_t size );
484+ /* See mz_free_func */
485+ typedef void (* free_func )(void * opaque , void * address );
486+
484487#define internal_state mz_internal_state
485488#define z_stream mz_stream
486489
487490#ifndef MINIZ_NO_DEFLATE_APIS
488- #define deflateInit mz_deflateInit
489- #define deflateInit2 mz_deflateInit2
490- #define deflateReset mz_deflateReset
491- #define deflate mz_deflate
492- #define deflateEnd mz_deflateEnd
493- #define deflateBound mz_deflateBound
494- #define compress mz_compress
495- #define compress2 mz_compress2
496- #define compressBound mz_compressBound
491+ /* Compatiblity with zlib API. See called functions for documentation */
492+ static int deflateInit (mz_streamp pStream , int level )
493+ {
494+ return mz_deflateInit (pStream , level );
495+ }
496+ static int deflateInit2 (mz_streamp pStream , int level , int method , int window_bits , int mem_level , int strategy )
497+ {
498+ return mz_deflateInit2 (pStream , level , method , window_bits , mem_level , strategy );
499+ }
500+ static int deflateReset (mz_streamp pStream )
501+ {
502+ return mz_deflateReset (pStream );
503+ }
504+ static int deflate (mz_streamp pStream , int flush )
505+ {
506+ return mz_deflate (pStream , flush );
507+ }
508+ static int deflateEnd (mz_streamp pStream )
509+ {
510+ return mz_deflateEnd (pStream );
511+ }
512+ static mz_ulong deflateBound (mz_streamp pStream , mz_ulong source_len )
513+ {
514+ return mz_deflateBound (pStream , source_len );
515+ }
516+ static int compress (unsigned char * pDest , mz_ulong * pDest_len , const unsigned char * pSource , mz_ulong source_len )
517+ {
518+ return mz_compress (pDest , pDest_len , pSource , source_len );
519+ }
520+ static int compress2 (unsigned char * pDest , mz_ulong * pDest_len , const unsigned char * pSource , mz_ulong source_len , int level )
521+ {
522+ return mz_compress2 (pDest , pDest_len , pSource , source_len , level );
523+ }
524+ static mz_ulong compressBound (mz_ulong source_len )
525+ {
526+ return mz_compressBound (source_len );
527+ }
497528#endif /*#ifndef MINIZ_NO_DEFLATE_APIS*/
498529
499530#ifndef MINIZ_NO_INFLATE_APIS
500- #define inflateInit mz_inflateInit
501- #define inflateInit2 mz_inflateInit2
502- #define inflateReset mz_inflateReset
503- #define inflate mz_inflate
504- #define inflateEnd mz_inflateEnd
505- #define uncompress mz_uncompress
506- #define uncompress2 mz_uncompress2
531+ /* Compatiblity with zlib API. See called functions for documentation */
532+ static int inflateInit (mz_streamp pStream )
533+ {
534+ return mz_inflateInit (pStream );
535+ }
536+
537+ static int inflateInit2 (mz_streamp pStream , int window_bits )
538+ {
539+ return mz_inflateInit2 (pStream , window_bits );
540+ }
541+
542+ static int inflateReset (mz_streamp pStream )
543+ {
544+ return mz_inflateReset (pStream );
545+ }
546+
547+ static int inflate (mz_streamp pStream , int flush )
548+ {
549+ return mz_inflate (pStream , flush );
550+ }
551+
552+ static int inflateEnd (mz_streamp pStream )
553+ {
554+ return mz_inflateEnd (pStream );
555+ }
556+
557+ static int uncompress (unsigned char * pDest , mz_ulong * pDest_len , const unsigned char * pSource , mz_ulong source_len )
558+ {
559+ return mz_uncompress (pDest , pDest_len , pSource , source_len );
560+ }
561+
562+ static int uncompress2 (unsigned char * pDest , mz_ulong * pDest_len , const unsigned char * pSource , mz_ulong * pSource_len )
563+ {
564+ return mz_uncompress2 (pDest , pDest_len , pSource , pSource_len );
565+ }
507566#endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
508567
509- #define crc32 mz_crc32
510- #define adler32 mz_adler32
568+ static mz_ulong crc32 (mz_ulong crc , const unsigned char * ptr , size_t buf_len )
569+ {
570+ return mz_crc32 (crc , ptr , buf_len );
571+ }
572+
573+ static mz_ulong adler32 (mz_ulong adler , const unsigned char * ptr , size_t buf_len )
574+ {
575+ return mz_adler32 (adler , ptr , buf_len );
576+ }
577+
511578#define MAX_WBITS 15
512579#define MAX_MEM_LEVEL 9
513- #define zError mz_error
580+
581+ static const char * zError (int err )
582+ {
583+ return mz_error (err );
584+ }
514585#define ZLIB_VERSION MZ_VERSION
515586#define ZLIB_VERNUM MZ_VERNUM
516587#define ZLIB_VER_MAJOR MZ_VER_MAJOR
517588#define ZLIB_VER_MINOR MZ_VER_MINOR
518589#define ZLIB_VER_REVISION MZ_VER_REVISION
519590#define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
591+
520592#define zlibVersion mz_version
521593#define zlib_version mz_version()
522594#endif /* #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES */
@@ -530,4 +602,4 @@ extern "C"
530602#include "miniz_common.h"
531603#include "miniz_tdef.h"
532604#include "miniz_tinfl.h"
533- #include "miniz_zip.h"
605+ #include "miniz_zip.h"
0 commit comments