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
@@ -314,6 +328,8 @@ typedef mz_stream *mz_streamp;
314
328
/* Returns the version string of miniz.c. */
315
329
MINIZ_EXPORT const char * mz_version (void );
316
330
331
+ #ifndef MINIZ_NO_DEFLATE_APIS
332
+
317
333
/* mz_deflateInit() initializes a compressor with default options: */
318
334
/* Parameters: */
319
335
/* pStream must point to an initialized mz_stream struct. */
@@ -366,6 +382,10 @@ MINIZ_EXPORT int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const u
366
382
/* mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). */
367
383
MINIZ_EXPORT mz_ulong mz_compressBound (mz_ulong source_len );
368
384
385
+ #endif /*#ifndef MINIZ_NO_DEFLATE_APIS*/
386
+
387
+ #ifndef MINIZ_NO_INFLATE_APIS
388
+
369
389
/* Initializes a decompressor. */
370
390
MINIZ_EXPORT int mz_inflateInit (mz_streamp pStream );
371
391
@@ -399,6 +419,7 @@ MINIZ_EXPORT int mz_inflateEnd(mz_streamp pStream);
399
419
/* Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. */
400
420
MINIZ_EXPORT int mz_uncompress (unsigned char * pDest , mz_ulong * pDest_len , const unsigned char * pSource , mz_ulong source_len );
401
421
MINIZ_EXPORT int mz_uncompress2 (unsigned char * pDest , mz_ulong * pDest_len , const unsigned char * pSource , mz_ulong * pSource_len );
422
+ #endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
402
423
403
424
/* Returns a string description of the specified error code, or NULL if the error code is invalid. */
404
425
MINIZ_EXPORT const char * mz_error (int err );
@@ -449,6 +470,8 @@ typedef void *const voidpc;
449
470
#define free_func mz_free_func
450
471
#define internal_state mz_internal_state
451
472
#define z_stream mz_stream
473
+
474
+ #ifndef MINIZ_NO_DEFLATE_APIS
452
475
#define deflateInit mz_deflateInit
453
476
#define deflateInit2 mz_deflateInit2
454
477
#define deflateReset mz_deflateReset
@@ -458,13 +481,18 @@ typedef void *const voidpc;
458
481
#define compress mz_compress
459
482
#define compress2 mz_compress2
460
483
#define compressBound mz_compressBound
484
+ #endif /*#ifndef MINIZ_NO_DEFLATE_APIS*/
485
+
486
+ #ifndef MINIZ_NO_INFLATE_APIS
461
487
#define inflateInit mz_inflateInit
462
488
#define inflateInit2 mz_inflateInit2
463
489
#define inflateReset mz_inflateReset
464
490
#define inflate mz_inflate
465
491
#define inflateEnd mz_inflateEnd
466
492
#define uncompress mz_uncompress
467
493
#define uncompress2 mz_uncompress2
494
+ #endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
495
+
468
496
#define crc32 mz_crc32
469
497
#define adler32 mz_adler32
470
498
#define MAX_WBITS 15
0 commit comments