115
115
#include "miniz_export.h"
116
116
117
117
/* Defines to completely disable specific portions of miniz.c:
118
- If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl . */
118
+ If all macros here are defined the only functionality remaining will be CRC-32 and adler-32. */
119
119
120
120
/* Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. */
121
121
/*#define MINIZ_NO_STDIO */
125
125
/* The current downside is the times written to your archives will be from 1979. */
126
126
/*#define MINIZ_NO_TIME */
127
127
128
+ /* Define MINIZ_NO_DEFLATE_APIS to disable all compression API's. */
129
+ /*#define MINIZ_NO_DEFLATE_APIS */
130
+
131
+ /* Define MINIZ_NO_INFLATE_APIS to disable all decompression API's. */
132
+ /*#define MINIZ_NO_INFLATE_APIS */
133
+
128
134
/* Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. */
129
135
/*#define MINIZ_NO_ARCHIVE_APIS */
130
136
143
149
functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. */
144
150
/*#define MINIZ_NO_MALLOC */
145
151
152
+ #ifdef MINIZ_NO_INFLATE_APIS
153
+ #define MINIZ_NO_ARCHIVE_APIS
154
+ #endif
155
+
156
+ #ifdef MINIZ_NO_DEFLATE_APIS
157
+ #define MINIZ_NO_ARCHIVE_WRITING_APIS
158
+ #endif
159
+
146
160
#if defined(__TINYC__ ) && (defined(__linux ) || defined(__linux__ ))
147
161
/* TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux */
148
162
#define MINIZ_NO_TIME
@@ -304,6 +318,8 @@ typedef mz_stream *mz_streamp;
304
318
/* Returns the version string of miniz.c. */
305
319
MINIZ_EXPORT const char * mz_version (void );
306
320
321
+ #ifndef MINIZ_NO_DEFLATE_APIS
322
+
307
323
/* mz_deflateInit() initializes a compressor with default options: */
308
324
/* Parameters: */
309
325
/* pStream must point to an initialized mz_stream struct. */
@@ -356,6 +372,10 @@ MINIZ_EXPORT int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const u
356
372
/* mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). */
357
373
MINIZ_EXPORT mz_ulong mz_compressBound (mz_ulong source_len );
358
374
375
+ #endif /*#ifndef MINIZ_NO_DEFLATE_APIS*/
376
+
377
+ #ifndef MINIZ_NO_INFLATE_APIS
378
+
359
379
/* Initializes a decompressor. */
360
380
MINIZ_EXPORT int mz_inflateInit (mz_streamp pStream );
361
381
@@ -389,6 +409,7 @@ MINIZ_EXPORT int mz_inflateEnd(mz_streamp pStream);
389
409
/* Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. */
390
410
MINIZ_EXPORT int mz_uncompress (unsigned char * pDest , mz_ulong * pDest_len , const unsigned char * pSource , mz_ulong source_len );
391
411
MINIZ_EXPORT int mz_uncompress2 (unsigned char * pDest , mz_ulong * pDest_len , const unsigned char * pSource , mz_ulong * pSource_len );
412
+ #endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
392
413
393
414
/* Returns a string description of the specified error code, or NULL if the error code is invalid. */
394
415
MINIZ_EXPORT const char * mz_error (int err );
@@ -439,6 +460,8 @@ typedef void *const voidpc;
439
460
#define free_func mz_free_func
440
461
#define internal_state mz_internal_state
441
462
#define z_stream mz_stream
463
+
464
+ #ifndef MINIZ_NO_DEFLATE_APIS
442
465
#define deflateInit mz_deflateInit
443
466
#define deflateInit2 mz_deflateInit2
444
467
#define deflateReset mz_deflateReset
@@ -448,13 +471,18 @@ typedef void *const voidpc;
448
471
#define compress mz_compress
449
472
#define compress2 mz_compress2
450
473
#define compressBound mz_compressBound
474
+ #endif /*#ifndef MINIZ_NO_DEFLATE_APIS*/
475
+
476
+ #ifndef MINIZ_NO_INFLATE_APIS
451
477
#define inflateInit mz_inflateInit
452
478
#define inflateInit2 mz_inflateInit2
453
479
#define inflateReset mz_inflateReset
454
480
#define inflate mz_inflate
455
481
#define inflateEnd mz_inflateEnd
456
482
#define uncompress mz_uncompress
457
483
#define uncompress2 mz_uncompress2
484
+ #endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
485
+
458
486
#define crc32 mz_crc32
459
487
#define adler32 mz_adler32
460
488
#define MAX_WBITS 15
0 commit comments