| 1 |
#ifndef MINIZ_EXPORT |
| 2 |
#define MINIZ_EXPORT |
| 3 |
#endif |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
#pragma once |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
#if defined(__STRICT_ANSI__) |
| 121 |
#define MZ_FORCEINLINE |
| 122 |
#elif defined(_MSC_VER) |
| 123 |
#define MZ_FORCEINLINE __forceinline |
| 124 |
#elif defined(__GNUC__) |
| 125 |
#define MZ_FORCEINLINE __inline__ __attribute__((__always_inline__)) |
| 126 |
#else |
| 127 |
#define MZ_FORCEINLINE inline |
| 128 |
#endif |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
#ifdef MINIZ_NO_INFLATE_APIS |
| 166 |
#define MINIZ_NO_ARCHIVE_APIS |
| 167 |
#endif |
| 168 |
|
| 169 |
#ifdef MINIZ_NO_DEFLATE_APIS |
| 170 |
#define MINIZ_NO_ARCHIVE_WRITING_APIS |
| 171 |
#endif |
| 172 |
|
| 173 |
#if defined(__TINYC__) && (defined(__linux) || defined(__linux__)) |
| 174 |
|
| 175 |
#define MINIZ_NO_TIME |
| 176 |
#endif |
| 177 |
|
| 178 |
#include <stddef.h> |
| 179 |
|
| 180 |
#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS) |
| 181 |
#include <time.h> |
| 182 |
#endif |
| 183 |
|
| 184 |
#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__) |
| 185 |
|
| 186 |
#define MINIZ_X86_OR_X64_CPU 1 |
| 187 |
#else |
| 188 |
#define MINIZ_X86_OR_X64_CPU 0 |
| 189 |
#endif |
| 190 |
|
| 191 |
|
| 192 |
#if !defined(MINIZ_LITTLE_ENDIAN) |
| 193 |
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) |
| 194 |
|
| 195 |
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) |
| 196 |
|
| 197 |
#define MINIZ_LITTLE_ENDIAN 1 |
| 198 |
#else |
| 199 |
#define MINIZ_LITTLE_ENDIAN 0 |
| 200 |
#endif |
| 201 |
|
| 202 |
#else |
| 203 |
|
| 204 |
#if MINIZ_X86_OR_X64_CPU |
| 205 |
#define MINIZ_LITTLE_ENDIAN 1 |
| 206 |
#else |
| 207 |
#define MINIZ_LITTLE_ENDIAN 0 |
| 208 |
#endif |
| 209 |
|
| 210 |
#endif |
| 211 |
#endif |
| 212 |
|
| 213 |
|
| 214 |
#if defined(__has_feature) |
| 215 |
#if __has_feature(undefined_behavior_sanitizer) |
| 216 |
#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0 |
| 217 |
#endif |
| 218 |
#endif |
| 219 |
|
| 220 |
|
| 221 |
#if !defined(MINIZ_USE_UNALIGNED_LOADS_AND_STORES) |
| 222 |
#if MINIZ_X86_OR_X64_CPU |
| 223 |
|
| 224 |
#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0 |
| 225 |
#define MINIZ_UNALIGNED_USE_MEMCPY |
| 226 |
#else |
| 227 |
#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0 |
| 228 |
#endif |
| 229 |
#endif |
| 230 |
|
| 231 |
#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__) |
| 232 |
|
| 233 |
#define MINIZ_HAS_64BIT_REGISTERS 1 |
| 234 |
#else |
| 235 |
#define MINIZ_HAS_64BIT_REGISTERS 0 |
| 236 |
#endif |
| 237 |
|
| 238 |
#ifdef __cplusplus |
| 239 |
extern "C" |
| 240 |
{ |
| 241 |
#endif |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
typedef unsigned long mz_ulong; |
| 247 |
|
| 248 |
|
| 249 |
MINIZ_EXPORT void mz_free(void *p); |
| 250 |
|
| 251 |
#define MZ_ADLER32_INIT (1) |
| 252 |
|
| 253 |
MINIZ_EXPORT mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len); |
| 254 |
|
| 255 |
#define MZ_CRC32_INIT (0) |
| 256 |
|
| 257 |
MINIZ_EXPORT mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len); |
| 258 |
|
| 259 |
|
| 260 |
enum |
| 261 |
{ |
| 262 |
MZ_DEFAULT_STRATEGY = 0, |
| 263 |
MZ_FILTERED = 1, |
| 264 |
MZ_HUFFMAN_ONLY = 2, |
| 265 |
MZ_RLE = 3, |
| 266 |
MZ_FIXED = 4 |
| 267 |
}; |
| 268 |
|
| 269 |
|
| 270 |
#define MZ_DEFLATED 8 |
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size); |
| 275 |
typedef void (*mz_free_func)(void *opaque, void *address); |
| 276 |
typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size); |
| 277 |
|
| 278 |
|
| 279 |
enum |
| 280 |
{ |
| 281 |
MZ_NO_COMPRESSION = 0, |
| 282 |
MZ_BEST_SPEED = 1, |
| 283 |
MZ_BEST_COMPRESSION = 9, |
| 284 |
MZ_UBER_COMPRESSION = 10, |
| 285 |
MZ_DEFAULT_LEVEL = 6, |
| 286 |
MZ_DEFAULT_COMPRESSION = -1 |
| 287 |
}; |
| 288 |
|
| 289 |
#define MZ_VERSION "11.3.1" |
| 290 |
#define MZ_VERNUM 0xB301 |
| 291 |
#define MZ_VER_MAJOR 11 |
| 292 |
#define MZ_VER_MINOR 3 |
| 293 |
#define MZ_VER_REVISION 1 |
| 294 |
#define MZ_VER_SUBREVISION 0 |
| 295 |
|
| 296 |
#ifndef MINIZ_NO_ZLIB_APIS |
| 297 |
|
| 298 |
|
| 299 |
enum |
| 300 |
{ |
| 301 |
MZ_NO_FLUSH = 0, |
| 302 |
MZ_PARTIAL_FLUSH = 1, |
| 303 |
MZ_SYNC_FLUSH = 2, |
| 304 |
MZ_FULL_FLUSH = 3, |
| 305 |
MZ_FINISH = 4, |
| 306 |
MZ_BLOCK = 5 |
| 307 |
}; |
| 308 |
|
| 309 |
|
| 310 |
enum |
| 311 |
{ |
| 312 |
MZ_OK = 0, |
| 313 |
MZ_STREAM_END = 1, |
| 314 |
MZ_NEED_DICT = 2, |
| 315 |
MZ_ERRNO = -1, |
| 316 |
MZ_STREAM_ERROR = -2, |
| 317 |
MZ_DATA_ERROR = -3, |
| 318 |
MZ_MEM_ERROR = -4, |
| 319 |
MZ_BUF_ERROR = -5, |
| 320 |
MZ_VERSION_ERROR = -6, |
| 321 |
MZ_PARAM_ERROR = -10000 |
| 322 |
}; |
| 323 |
|
| 324 |
|
| 325 |
#define MZ_DEFAULT_WINDOW_BITS 15 |
| 326 |
|
| 327 |
struct mz_internal_state; |
| 328 |
|
| 329 |
|
| 330 |
typedef struct mz_stream_s |
| 331 |
{ |
| 332 |
const unsigned char *next_in; |
| 333 |
unsigned int avail_in; |
| 334 |
mz_ulong total_in; |
| 335 |
|
| 336 |
unsigned char *next_out; |
| 337 |
unsigned int avail_out; |
| 338 |
mz_ulong total_out; |
| 339 |
|
| 340 |
char *msg; |
| 341 |
struct mz_internal_state *state; |
| 342 |
|
| 343 |
mz_alloc_func zalloc; |
| 344 |
mz_free_func zfree; |
| 345 |
void *opaque; |
| 346 |
|
| 347 |
int data_type; |
| 348 |
mz_ulong adler; |
| 349 |
mz_ulong reserved; |
| 350 |
} mz_stream; |
| 351 |
|
| 352 |
typedef mz_stream *mz_streamp; |
| 353 |
|
| 354 |
|
| 355 |
MINIZ_EXPORT const char *mz_version(void); |
| 356 |
|
| 357 |
#ifndef MINIZ_NO_DEFLATE_APIS |
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
MINIZ_EXPORT int mz_deflateInit(mz_streamp pStream, int level); |
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
MINIZ_EXPORT int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy); |
| 378 |
|
| 379 |
|
| 380 |
MINIZ_EXPORT int mz_deflateReset(mz_streamp pStream); |
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
MINIZ_EXPORT int mz_deflate(mz_streamp pStream, int flush); |
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
MINIZ_EXPORT int mz_deflateEnd(mz_streamp pStream); |
| 399 |
|
| 400 |
|
| 401 |
MINIZ_EXPORT mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len); |
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
MINIZ_EXPORT int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); |
| 406 |
MINIZ_EXPORT int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level); |
| 407 |
|
| 408 |
|
| 409 |
MINIZ_EXPORT mz_ulong mz_compressBound(mz_ulong source_len); |
| 410 |
|
| 411 |
#endif |
| 412 |
|
| 413 |
#ifndef MINIZ_NO_INFLATE_APIS |
| 414 |
|
| 415 |
|
| 416 |
MINIZ_EXPORT int mz_inflateInit(mz_streamp pStream); |
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
MINIZ_EXPORT int mz_inflateInit2(mz_streamp pStream, int window_bits); |
| 421 |
|
| 422 |
|
| 423 |
MINIZ_EXPORT int mz_inflateReset(mz_streamp pStream); |
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
MINIZ_EXPORT int mz_inflate(mz_streamp pStream, int flush); |
| 440 |
|
| 441 |
|
| 442 |
MINIZ_EXPORT int mz_inflateEnd(mz_streamp pStream); |
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
MINIZ_EXPORT int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); |
| 447 |
MINIZ_EXPORT int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len); |
| 448 |
#endif |
| 449 |
|
| 450 |
|
| 451 |
MINIZ_EXPORT const char *mz_error(int err); |
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES |
| 456 |
typedef unsigned char Byte; |
| 457 |
typedef unsigned int uInt; |
| 458 |
typedef mz_ulong uLong; |
| 459 |
typedef Byte Bytef; |
| 460 |
typedef uInt uIntf; |
| 461 |
typedef char charf; |
| 462 |
typedef int intf; |
| 463 |
typedef void *voidpf; |
| 464 |
typedef uLong uLongf; |
| 465 |
typedef void *voidp; |
| 466 |
typedef void *const voidpc; |
| 467 |
#define Z_NULL 0 |
| 468 |
#define Z_NO_FLUSH MZ_NO_FLUSH |
| 469 |
#define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH |
| 470 |
#define Z_SYNC_FLUSH MZ_SYNC_FLUSH |
| 471 |
#define Z_FULL_FLUSH MZ_FULL_FLUSH |
| 472 |
#define Z_FINISH MZ_FINISH |
| 473 |
#define Z_BLOCK MZ_BLOCK |
| 474 |
#define Z_OK MZ_OK |
| 475 |
#define Z_STREAM_END MZ_STREAM_END |
| 476 |
#define Z_NEED_DICT MZ_NEED_DICT |
| 477 |
#define Z_ERRNO MZ_ERRNO |
| 478 |
#define Z_STREAM_ERROR MZ_STREAM_ERROR |
| 479 |
#define Z_DATA_ERROR MZ_DATA_ERROR |
| 480 |
#define Z_MEM_ERROR MZ_MEM_ERROR |
| 481 |
#define Z_BUF_ERROR MZ_BUF_ERROR |
| 482 |
#define Z_VERSION_ERROR MZ_VERSION_ERROR |
| 483 |
#define Z_PARAM_ERROR MZ_PARAM_ERROR |
| 484 |
#define Z_NO_COMPRESSION MZ_NO_COMPRESSION |
| 485 |
#define Z_BEST_SPEED MZ_BEST_SPEED |
| 486 |
#define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION |
| 487 |
#define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION |
| 488 |
#define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY |
| 489 |
#define Z_FILTERED MZ_FILTERED |
| 490 |
#define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY |
| 491 |
#define Z_RLE MZ_RLE |
| 492 |
#define Z_FIXED MZ_FIXED |
| 493 |
#define Z_DEFLATED MZ_DEFLATED |
| 494 |
#define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS |
| 495 |
|
| 496 |
typedef void *(*alloc_func)(void *opaque, size_t items, size_t size); |
| 497 |
|
| 498 |
typedef void (*free_func)(void *opaque, void *address); |
| 499 |
|
| 500 |
#define internal_state mz_internal_state |
| 501 |
#define z_stream mz_stream |
| 502 |
|
| 503 |
#ifndef MINIZ_NO_DEFLATE_APIS |
| 504 |
|
| 505 |
static MZ_FORCEINLINE int deflateInit(mz_streamp pStream, int level) |
| 506 |
{ |
| 507 |
return mz_deflateInit(pStream, level); |
| 508 |
} |
| 509 |
static MZ_FORCEINLINE int deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy) |
| 510 |
{ |
| 511 |
return mz_deflateInit2(pStream, level, method, window_bits, mem_level, strategy); |
| 512 |
} |
| 513 |
static MZ_FORCEINLINE int deflateReset(mz_streamp pStream) |
| 514 |
{ |
| 515 |
return mz_deflateReset(pStream); |
| 516 |
} |
| 517 |
static MZ_FORCEINLINE int deflate(mz_streamp pStream, int flush) |
| 518 |
{ |
| 519 |
return mz_deflate(pStream, flush); |
| 520 |
} |
| 521 |
static MZ_FORCEINLINE int deflateEnd(mz_streamp pStream) |
| 522 |
{ |
| 523 |
return mz_deflateEnd(pStream); |
| 524 |
} |
| 525 |
static MZ_FORCEINLINE mz_ulong deflateBound(mz_streamp pStream, mz_ulong source_len) |
| 526 |
{ |
| 527 |
return mz_deflateBound(pStream, source_len); |
| 528 |
} |
| 529 |
static MZ_FORCEINLINE int compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len) |
| 530 |
{ |
| 531 |
return mz_compress(pDest, pDest_len, pSource, source_len); |
| 532 |
} |
| 533 |
static MZ_FORCEINLINE int compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level) |
| 534 |
{ |
| 535 |
return mz_compress2(pDest, pDest_len, pSource, source_len, level); |
| 536 |
} |
| 537 |
static MZ_FORCEINLINE mz_ulong compressBound(mz_ulong source_len) |
| 538 |
{ |
| 539 |
return mz_compressBound(source_len); |
| 540 |
} |
| 541 |
#endif |
| 542 |
|
| 543 |
#ifndef MINIZ_NO_INFLATE_APIS |
| 544 |
|
| 545 |
static MZ_FORCEINLINE int inflateInit(mz_streamp pStream) |
| 546 |
{ |
| 547 |
return mz_inflateInit(pStream); |
| 548 |
} |
| 549 |
|
| 550 |
static MZ_FORCEINLINE int inflateInit2(mz_streamp pStream, int window_bits) |
| 551 |
{ |
| 552 |
return mz_inflateInit2(pStream, window_bits); |
| 553 |
} |
| 554 |
|
| 555 |
static MZ_FORCEINLINE int inflateReset(mz_streamp pStream) |
| 556 |
{ |
| 557 |
return mz_inflateReset(pStream); |
| 558 |
} |
| 559 |
|
| 560 |
static MZ_FORCEINLINE int inflate(mz_streamp pStream, int flush) |
| 561 |
{ |
| 562 |
return mz_inflate(pStream, flush); |
| 563 |
} |
| 564 |
|
| 565 |
static MZ_FORCEINLINE int inflateEnd(mz_streamp pStream) |
| 566 |
{ |
| 567 |
return mz_inflateEnd(pStream); |
| 568 |
} |
| 569 |
|
| 570 |
static MZ_FORCEINLINE int uncompress(unsigned char* pDest, mz_ulong* pDest_len, const unsigned char* pSource, mz_ulong source_len) |
| 571 |
{ |
| 572 |
return mz_uncompress(pDest, pDest_len, pSource, source_len); |
| 573 |
} |
| 574 |
|
| 575 |
static MZ_FORCEINLINE int uncompress2(unsigned char* pDest, mz_ulong* pDest_len, const unsigned char* pSource, mz_ulong* pSource_len) |
| 576 |
{ |
| 577 |
return mz_uncompress2(pDest, pDest_len, pSource, pSource_len); |
| 578 |
} |
| 579 |
#endif |
| 580 |
|
| 581 |
static MZ_FORCEINLINE mz_ulong crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len) |
| 582 |
{ |
| 583 |
return mz_crc32(crc, ptr, buf_len); |
| 584 |
} |
| 585 |
|
| 586 |
static MZ_FORCEINLINE mz_ulong adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len) |
| 587 |
{ |
| 588 |
return mz_adler32(adler, ptr, buf_len); |
| 589 |
} |
| 590 |
|
| 591 |
#define MAX_WBITS 15 |
| 592 |
#define MAX_MEM_LEVEL 9 |
| 593 |
|
| 594 |
static MZ_FORCEINLINE const char* zError(int err) |
| 595 |
{ |
| 596 |
return mz_error(err); |
| 597 |
} |
| 598 |
#define ZLIB_VERSION MZ_VERSION |
| 599 |
#define ZLIB_VERNUM MZ_VERNUM |
| 600 |
#define ZLIB_VER_MAJOR MZ_VER_MAJOR |
| 601 |
#define ZLIB_VER_MINOR MZ_VER_MINOR |
| 602 |
#define ZLIB_VER_REVISION MZ_VER_REVISION |
| 603 |
#define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION |
| 604 |
|
| 605 |
#define zlibVersion mz_version |
| 606 |
#define zlib_version mz_version() |
| 607 |
#endif |
| 608 |
|
| 609 |
#endif |
| 610 |
|
| 611 |
#ifdef __cplusplus |
| 612 |
} |
| 613 |
#endif |
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
#pragma once |
| 620 |
#include <assert.h> |
| 621 |
#include <stdint.h> |
| 622 |
#include <stdlib.h> |
| 623 |
#include <string.h> |
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
typedef unsigned char mz_uint8; |
| 629 |
typedef int16_t mz_int16; |
| 630 |
typedef uint16_t mz_uint16; |
| 631 |
typedef uint32_t mz_uint32; |
| 632 |
typedef uint32_t mz_uint; |
| 633 |
typedef int64_t mz_int64; |
| 634 |
typedef uint64_t mz_uint64; |
| 635 |
typedef int mz_bool; |
| 636 |
|
| 637 |
#define MZ_FALSE (0) |
| 638 |
#define MZ_TRUE (1) |
| 639 |
|
| 640 |
|
| 641 |
#ifdef _MSC_VER |
| 642 |
#define MZ_MACRO_END while (0, 0) |
| 643 |
#else |
| 644 |
#define MZ_MACRO_END while (0) |
| 645 |
#endif |
| 646 |
|
| 647 |
#ifdef MINIZ_NO_STDIO |
| 648 |
#define MZ_FILE void * |
| 649 |
#else |
| 650 |
#include <stdio.h> |
| 651 |
#define MZ_FILE FILE |
| 652 |
#endif |
| 653 |
|
| 654 |
#ifdef MINIZ_NO_TIME |
| 655 |
typedef struct mz_dummy_time_t_tag |
| 656 |
{ |
| 657 |
mz_uint32 m_dummy1; |
| 658 |
mz_uint32 m_dummy2; |
| 659 |
} mz_dummy_time_t; |
| 660 |
#define MZ_TIME_T mz_dummy_time_t |
| 661 |
#else |
| 662 |
#define MZ_TIME_T time_t |
| 663 |
#endif |
| 664 |
|
| 665 |
#define MZ_ASSERT(x) assert(x) |
| 666 |
|
| 667 |
#ifdef MINIZ_NO_MALLOC |
| 668 |
#define MZ_MALLOC(x) NULL |
| 669 |
#define MZ_FREE(x) (void)x, ((void)0) |
| 670 |
#define MZ_REALLOC(p, x) NULL |
| 671 |
#else |
| 672 |
#define MZ_MALLOC(x) malloc(x) |
| 673 |
#define MZ_FREE(x) free(x) |
| 674 |
#define MZ_REALLOC(p, x) realloc(p, x) |
| 675 |
#endif |
| 676 |
|
| 677 |
#define MZ_MAX(a, b) (((a) > (b)) ? (a) : (b)) |
| 678 |
#define MZ_MIN(a, b) (((a) < (b)) ? (a) : (b)) |
| 679 |
#define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj)) |
| 680 |
#define MZ_CLEAR_ARR(obj) memset((obj), 0, sizeof(obj)) |
| 681 |
#define MZ_CLEAR_PTR(obj) memset((obj), 0, sizeof(*obj)) |
| 682 |
|
| 683 |
#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN |
| 684 |
#define MZ_READ_LE16(p) *((const mz_uint16 *)(p)) |
| 685 |
#define MZ_READ_LE32(p) *((const mz_uint32 *)(p)) |
| 686 |
#else |
| 687 |
#define MZ_READ_LE16(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U)) |
| 688 |
#define MZ_READ_LE32(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U)) |
| 689 |
#endif |
| 690 |
|
| 691 |
#define MZ_READ_LE64(p) (((mz_uint64)MZ_READ_LE32(p)) | (((mz_uint64)MZ_READ_LE32((const mz_uint8 *)(p) + sizeof(mz_uint32))) << 32U)) |
| 692 |
|
| 693 |
#ifdef __cplusplus |
| 694 |
extern "C" |
| 695 |
{ |
| 696 |
#endif |
| 697 |
|
| 698 |
extern MINIZ_EXPORT void *miniz_def_alloc_func(void *opaque, size_t items, size_t size); |
| 699 |
extern MINIZ_EXPORT void miniz_def_free_func(void *opaque, void *address); |
| 700 |
extern MINIZ_EXPORT void *miniz_def_realloc_func(void *opaque, void *address, size_t items, size_t size); |
| 701 |
|
| 702 |
#define MZ_UINT16_MAX (0xFFFFU) |
| 703 |
#define MZ_UINT32_MAX (0xFFFFFFFFU) |
| 704 |
|
| 705 |
#ifdef __cplusplus |
| 706 |
} |
| 707 |
#endif |
| 708 |
#pragma once |
| 709 |
|
| 710 |
|
| 711 |
#ifndef MINIZ_NO_DEFLATE_APIS |
| 712 |
|
| 713 |
#ifdef __cplusplus |
| 714 |
extern "C" |
| 715 |
{ |
| 716 |
#endif |
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
#ifndef TDEFL_LESS_MEMORY |
| 721 |
#define TDEFL_LESS_MEMORY 0 |
| 722 |
#endif |
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
enum |
| 727 |
{ |
| 728 |
TDEFL_HUFFMAN_ONLY = 0, |
| 729 |
TDEFL_DEFAULT_MAX_PROBES = 128, |
| 730 |
TDEFL_MAX_PROBES_MASK = 0xFFF |
| 731 |
}; |
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
|
| 741 |
|
| 742 |
enum |
| 743 |
{ |
| 744 |
TDEFL_WRITE_ZLIB_HEADER = 0x01000, |
| 745 |
TDEFL_COMPUTE_ADLER32 = 0x02000, |
| 746 |
TDEFL_GREEDY_PARSING_FLAG = 0x04000, |
| 747 |
TDEFL_NONDETERMINISTIC_PARSING_FLAG = 0x08000, |
| 748 |
TDEFL_RLE_MATCHES = 0x10000, |
| 749 |
TDEFL_FILTER_MATCHES = 0x20000, |
| 750 |
TDEFL_FORCE_ALL_STATIC_BLOCKS = 0x40000, |
| 751 |
TDEFL_FORCE_ALL_RAW_BLOCKS = 0x80000 |
| 752 |
}; |
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
MINIZ_EXPORT void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); |
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
MINIZ_EXPORT size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); |
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
MINIZ_EXPORT void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int h, int num_chans, size_t *pLen_out, mz_uint level, mz_bool flip); |
| 780 |
MINIZ_EXPORT void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out); |
| 781 |
|
| 782 |
|
| 783 |
typedef mz_bool (*tdefl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser); |
| 784 |
|
| 785 |
|
| 786 |
MINIZ_EXPORT mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); |
| 787 |
|
| 788 |
enum |
| 789 |
{ |
| 790 |
TDEFL_MAX_HUFF_TABLES = 3, |
| 791 |
TDEFL_MAX_HUFF_SYMBOLS_0 = 288, |
| 792 |
TDEFL_MAX_HUFF_SYMBOLS_1 = 32, |
| 793 |
TDEFL_MAX_HUFF_SYMBOLS_2 = 19, |
| 794 |
TDEFL_LZ_DICT_SIZE = 32768, |
| 795 |
TDEFL_LZ_DICT_SIZE_MASK = TDEFL_LZ_DICT_SIZE - 1, |
| 796 |
TDEFL_MIN_MATCH_LEN = 3, |
| 797 |
TDEFL_MAX_MATCH_LEN = 258 |
| 798 |
}; |
| 799 |
|
| 800 |
|
| 801 |
#if TDEFL_LESS_MEMORY |
| 802 |
enum |
| 803 |
{ |
| 804 |
TDEFL_LZ_CODE_BUF_SIZE = 24 * 1024, |
| 805 |
TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13) / 10, |
| 806 |
TDEFL_MAX_HUFF_SYMBOLS = 288, |
| 807 |
TDEFL_LZ_HASH_BITS = 12, |
| 808 |
TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, |
| 809 |
TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, |
| 810 |
TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS |
| 811 |
}; |
| 812 |
#else |
| 813 |
enum |
| 814 |
{ |
| 815 |
TDEFL_LZ_CODE_BUF_SIZE = 64 * 1024, |
| 816 |
TDEFL_OUT_BUF_SIZE = (mz_uint)((TDEFL_LZ_CODE_BUF_SIZE * 13) / 10), |
| 817 |
TDEFL_MAX_HUFF_SYMBOLS = 288, |
| 818 |
TDEFL_LZ_HASH_BITS = 15, |
| 819 |
TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, |
| 820 |
TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, |
| 821 |
TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS |
| 822 |
}; |
| 823 |
#endif |
| 824 |
|
| 825 |
|
| 826 |
typedef enum |
| 827 |
{ |
| 828 |
TDEFL_STATUS_BAD_PARAM = -2, |
| 829 |
TDEFL_STATUS_PUT_BUF_FAILED = -1, |
| 830 |
TDEFL_STATUS_OKAY = 0, |
| 831 |
TDEFL_STATUS_DONE = 1 |
| 832 |
} tdefl_status; |
| 833 |
|
| 834 |
|
| 835 |
typedef enum |
| 836 |
{ |
| 837 |
TDEFL_NO_FLUSH = 0, |
| 838 |
TDEFL_SYNC_FLUSH = 2, |
| 839 |
TDEFL_FULL_FLUSH = 3, |
| 840 |
TDEFL_FINISH = 4 |
| 841 |
} tdefl_flush; |
| 842 |
|
| 843 |
|
| 844 |
typedef struct |
| 845 |
{ |
| 846 |
tdefl_put_buf_func_ptr m_pPut_buf_func; |
| 847 |
void *m_pPut_buf_user; |
| 848 |
mz_uint m_flags, m_max_probes[2]; |
| 849 |
int m_greedy_parsing; |
| 850 |
mz_uint m_adler32, m_lookahead_pos, m_lookahead_size, m_dict_size; |
| 851 |
mz_uint8 *m_pLZ_code_buf, *m_pLZ_flags, *m_pOutput_buf, *m_pOutput_buf_end; |
| 852 |
mz_uint m_num_flags_left, m_total_lz_bytes, m_lz_code_buf_dict_pos, m_bits_in, m_bit_buffer; |
| 853 |
mz_uint m_saved_match_dist, m_saved_match_len, m_saved_lit, m_output_flush_ofs, m_output_flush_remaining, m_finished, m_block_index, m_wants_to_finish; |
| 854 |
tdefl_status m_prev_return_status; |
| 855 |
const void *m_pIn_buf; |
| 856 |
void *m_pOut_buf; |
| 857 |
size_t *m_pIn_buf_size, *m_pOut_buf_size; |
| 858 |
tdefl_flush m_flush; |
| 859 |
const mz_uint8 *m_pSrc; |
| 860 |
size_t m_src_buf_left, m_out_buf_ofs; |
| 861 |
mz_uint8 m_dict[TDEFL_LZ_DICT_SIZE + TDEFL_MAX_MATCH_LEN - 1]; |
| 862 |
mz_uint16 m_huff_count[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; |
| 863 |
mz_uint16 m_huff_codes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; |
| 864 |
mz_uint8 m_huff_code_sizes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; |
| 865 |
mz_uint8 m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE]; |
| 866 |
mz_uint16 m_next[TDEFL_LZ_DICT_SIZE]; |
| 867 |
mz_uint16 m_hash[TDEFL_LZ_HASH_SIZE]; |
| 868 |
mz_uint8 m_output_buf[TDEFL_OUT_BUF_SIZE]; |
| 869 |
} tdefl_compressor; |
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
MINIZ_EXPORT tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); |
| 877 |
|
| 878 |
|
| 879 |
MINIZ_EXPORT 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); |
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
MINIZ_EXPORT tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush); |
| 884 |
|
| 885 |
MINIZ_EXPORT tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d); |
| 886 |
MINIZ_EXPORT mz_uint32 tdefl_get_adler32(tdefl_compressor *d); |
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
MINIZ_EXPORT mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy); |
| 893 |
|
| 894 |
#ifndef MINIZ_NO_MALLOC |
| 895 |
|
| 896 |
|
| 897 |
|
| 898 |
MINIZ_EXPORT tdefl_compressor *tdefl_compressor_alloc(void); |
| 899 |
MINIZ_EXPORT void tdefl_compressor_free(tdefl_compressor *pComp); |
| 900 |
#endif |
| 901 |
|
| 902 |
#ifdef __cplusplus |
| 903 |
} |
| 904 |
#endif |
| 905 |
|
| 906 |
#endif |
| 907 |
#pragma once |
| 908 |
|
| 909 |
|
| 910 |
|
| 911 |
#ifndef MINIZ_NO_INFLATE_APIS |
| 912 |
|
| 913 |
#ifdef __cplusplus |
| 914 |
extern "C" |
| 915 |
{ |
| 916 |
#endif |
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
enum |
| 923 |
{ |
| 924 |
TINFL_FLAG_PARSE_ZLIB_HEADER = 1, |
| 925 |
TINFL_FLAG_HAS_MORE_INPUT = 2, |
| 926 |
TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4, |
| 927 |
TINFL_FLAG_COMPUTE_ADLER32 = 8 |
| 928 |
}; |
| 929 |
|
| 930 |
|
| 931 |
|
| 932 |
|
| 933 |
|
| 934 |
|
| 935 |
|
| 936 |
|
| 937 |
|
| 938 |
MINIZ_EXPORT void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); |
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
#define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1)) |
| 943 |
MINIZ_EXPORT size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); |
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
typedef int (*tinfl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser); |
| 948 |
MINIZ_EXPORT int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); |
| 949 |
|
| 950 |
struct tinfl_decompressor_tag; |
| 951 |
typedef struct tinfl_decompressor_tag tinfl_decompressor; |
| 952 |
|
| 953 |
#ifndef MINIZ_NO_MALLOC |
| 954 |
|
| 955 |
|
| 956 |
|
| 957 |
MINIZ_EXPORT tinfl_decompressor *tinfl_decompressor_alloc(void); |
| 958 |
MINIZ_EXPORT void tinfl_decompressor_free(tinfl_decompressor *pDecomp); |
| 959 |
#endif |
| 960 |
|
| 961 |
|
| 962 |
#define TINFL_LZ_DICT_SIZE 32768 |
| 963 |
|
| 964 |
|
| 965 |
typedef enum |
| 966 |
{ |
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS = -4, |
| 971 |
|
| 972 |
|
| 973 |
TINFL_STATUS_BAD_PARAM = -3, |
| 974 |
|
| 975 |
|
| 976 |
TINFL_STATUS_ADLER32_MISMATCH = -2, |
| 977 |
|
| 978 |
|
| 979 |
TINFL_STATUS_FAILED = -1, |
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
|
| 985 |
TINFL_STATUS_DONE = 0, |
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
TINFL_STATUS_NEEDS_MORE_INPUT = 1, |
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
TINFL_STATUS_HAS_MORE_OUTPUT = 2 |
| 997 |
} tinfl_status; |
| 998 |
|
| 999 |
|
| 1000 |
#define tinfl_init(r) \ |
| 1001 |
do \ |
| 1002 |
{ \ |
| 1003 |
(r)->m_state = 0; \ |
| 1004 |
} \ |
| 1005 |
MZ_MACRO_END |
| 1006 |
#define tinfl_get_adler32(r) (r)->m_check_adler32 |
| 1007 |
|
| 1008 |
|
| 1009 |
|
| 1010 |
MINIZ_EXPORT 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); |
| 1011 |
|
| 1012 |
|
| 1013 |
enum |
| 1014 |
{ |
| 1015 |
TINFL_MAX_HUFF_TABLES = 3, |
| 1016 |
TINFL_MAX_HUFF_SYMBOLS_0 = 288, |
| 1017 |
TINFL_MAX_HUFF_SYMBOLS_1 = 32, |
| 1018 |
TINFL_MAX_HUFF_SYMBOLS_2 = 19, |
| 1019 |
TINFL_FAST_LOOKUP_BITS = 10, |
| 1020 |
TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS |
| 1021 |
}; |
| 1022 |
|
| 1023 |
#if MINIZ_HAS_64BIT_REGISTERS |
| 1024 |
#define TINFL_USE_64BIT_BITBUF 1 |
| 1025 |
#else |
| 1026 |
#define TINFL_USE_64BIT_BITBUF 0 |
| 1027 |
#endif |
| 1028 |
|
| 1029 |
#if TINFL_USE_64BIT_BITBUF |
| 1030 |
typedef mz_uint64 tinfl_bit_buf_t; |
| 1031 |
#define TINFL_BITBUF_SIZE (64) |
| 1032 |
#else |
| 1033 |
typedef mz_uint32 tinfl_bit_buf_t; |
| 1034 |
#define TINFL_BITBUF_SIZE (32) |
| 1035 |
#endif |
| 1036 |
|
| 1037 |
struct tinfl_decompressor_tag |
| 1038 |
{ |
| 1039 |
mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, m_check_adler32, m_dist, m_counter, m_num_extra, m_table_sizes[TINFL_MAX_HUFF_TABLES]; |
| 1040 |
tinfl_bit_buf_t m_bit_buf; |
| 1041 |
size_t m_dist_from_out_buf_start; |
| 1042 |
mz_int16 m_look_up[TINFL_MAX_HUFF_TABLES][TINFL_FAST_LOOKUP_SIZE]; |
| 1043 |
mz_int16 m_tree_0[TINFL_MAX_HUFF_SYMBOLS_0 * 2]; |
| 1044 |
mz_int16 m_tree_1[TINFL_MAX_HUFF_SYMBOLS_1 * 2]; |
| 1045 |
mz_int16 m_tree_2[TINFL_MAX_HUFF_SYMBOLS_2 * 2]; |
| 1046 |
mz_uint8 m_code_size_0[TINFL_MAX_HUFF_SYMBOLS_0]; |
| 1047 |
mz_uint8 m_code_size_1[TINFL_MAX_HUFF_SYMBOLS_1]; |
| 1048 |
mz_uint8 m_code_size_2[TINFL_MAX_HUFF_SYMBOLS_2]; |
| 1049 |
mz_uint8 m_raw_header[4], m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137]; |
| 1050 |
}; |
| 1051 |
|
| 1052 |
#ifdef __cplusplus |
| 1053 |
} |
| 1054 |
#endif |
| 1055 |
|
| 1056 |
#endif |
| 1057 |
|
| 1058 |
#pragma once |
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
#ifndef MINIZ_NO_ARCHIVE_APIS |
| 1064 |
|
| 1065 |
#ifdef __cplusplus |
| 1066 |
extern "C" |
| 1067 |
{ |
| 1068 |
#endif |
| 1069 |
|
| 1070 |
enum |
| 1071 |
{ |
| 1072 |
|
| 1073 |
MZ_ZIP_MAX_IO_BUF_SIZE = 64 * 1024, |
| 1074 |
MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 512, |
| 1075 |
MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 512 |
| 1076 |
}; |
| 1077 |
|
| 1078 |
typedef struct |
| 1079 |
{ |
| 1080 |
|
| 1081 |
mz_uint32 m_file_index; |
| 1082 |
|
| 1083 |
|
| 1084 |
mz_uint64 m_central_dir_ofs; |
| 1085 |
|
| 1086 |
|
| 1087 |
mz_uint16 m_version_made_by; |
| 1088 |
mz_uint16 m_version_needed; |
| 1089 |
mz_uint16 m_bit_flag; |
| 1090 |
mz_uint16 m_method; |
| 1091 |
|
| 1092 |
|
| 1093 |
mz_uint32 m_crc32; |
| 1094 |
|
| 1095 |
|
| 1096 |
mz_uint64 m_comp_size; |
| 1097 |
|
| 1098 |
|
| 1099 |
mz_uint64 m_uncomp_size; |
| 1100 |
|
| 1101 |
|
| 1102 |
mz_uint16 m_internal_attr; |
| 1103 |
mz_uint32 m_external_attr; |
| 1104 |
|
| 1105 |
|
| 1106 |
mz_uint64 m_local_header_ofs; |
| 1107 |
|
| 1108 |
|
| 1109 |
mz_uint32 m_comment_size; |
| 1110 |
|
| 1111 |
|
| 1112 |
mz_bool m_is_directory; |
| 1113 |
|
| 1114 |
|
| 1115 |
mz_bool m_is_encrypted; |
| 1116 |
|
| 1117 |
|
| 1118 |
mz_bool m_is_supported; |
| 1119 |
|
| 1120 |
|
| 1121 |
|
| 1122 |
char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE]; |
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE]; |
| 1127 |
|
| 1128 |
#ifdef MINIZ_NO_TIME |
| 1129 |
MZ_TIME_T m_padding; |
| 1130 |
#else |
| 1131 |
MZ_TIME_T m_time; |
| 1132 |
#endif |
| 1133 |
} mz_zip_archive_file_stat; |
| 1134 |
|
| 1135 |
typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n); |
| 1136 |
typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n); |
| 1137 |
typedef mz_bool (*mz_file_needs_keepalive)(void *pOpaque); |
| 1138 |
|
| 1139 |
struct mz_zip_internal_state_tag; |
| 1140 |
typedef struct mz_zip_internal_state_tag mz_zip_internal_state; |
| 1141 |
|
| 1142 |
typedef enum |
| 1143 |
{ |
| 1144 |
MZ_ZIP_MODE_INVALID = 0, |
| 1145 |
MZ_ZIP_MODE_READING = 1, |
| 1146 |
MZ_ZIP_MODE_WRITING = 2, |
| 1147 |
MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3 |
| 1148 |
} mz_zip_mode; |
| 1149 |
|
| 1150 |
typedef enum |
| 1151 |
{ |
| 1152 |
MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100, |
| 1153 |
MZ_ZIP_FLAG_IGNORE_PATH = 0x0200, |
| 1154 |
MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400, |
| 1155 |
MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY = 0x0800, |
| 1156 |
MZ_ZIP_FLAG_VALIDATE_LOCATE_FILE_FLAG = 0x1000, |
| 1157 |
MZ_ZIP_FLAG_VALIDATE_HEADERS_ONLY = 0x2000, |
| 1158 |
MZ_ZIP_FLAG_WRITE_ZIP64 = 0x4000, |
| 1159 |
MZ_ZIP_FLAG_WRITE_ALLOW_READING = 0x8000, |
| 1160 |
MZ_ZIP_FLAG_ASCII_FILENAME = 0x10000, |
| 1161 |
|
| 1162 |
|
| 1163 |
MZ_ZIP_FLAG_WRITE_HEADER_SET_SIZE = 0x20000, |
| 1164 |
MZ_ZIP_FLAG_READ_ALLOW_WRITING = 0x40000 |
| 1165 |
} mz_zip_flags; |
| 1166 |
|
| 1167 |
typedef enum |
| 1168 |
{ |
| 1169 |
MZ_ZIP_TYPE_INVALID = 0, |
| 1170 |
MZ_ZIP_TYPE_USER, |
| 1171 |
MZ_ZIP_TYPE_MEMORY, |
| 1172 |
MZ_ZIP_TYPE_HEAP, |
| 1173 |
MZ_ZIP_TYPE_FILE, |
| 1174 |
MZ_ZIP_TYPE_CFILE, |
| 1175 |
MZ_ZIP_TOTAL_TYPES |
| 1176 |
} mz_zip_type; |
| 1177 |
|
| 1178 |
|
| 1179 |
typedef enum |
| 1180 |
{ |
| 1181 |
MZ_ZIP_NO_ERROR = 0, |
| 1182 |
MZ_ZIP_UNDEFINED_ERROR, |
| 1183 |
MZ_ZIP_TOO_MANY_FILES, |
| 1184 |
MZ_ZIP_FILE_TOO_LARGE, |
| 1185 |
MZ_ZIP_UNSUPPORTED_METHOD, |
| 1186 |
MZ_ZIP_UNSUPPORTED_ENCRYPTION, |
| 1187 |
MZ_ZIP_UNSUPPORTED_FEATURE, |
| 1188 |
MZ_ZIP_FAILED_FINDING_CENTRAL_DIR, |
| 1189 |
MZ_ZIP_NOT_AN_ARCHIVE, |
| 1190 |
MZ_ZIP_INVALID_HEADER_OR_CORRUPTED, |
| 1191 |
MZ_ZIP_UNSUPPORTED_MULTIDISK, |
| 1192 |
MZ_ZIP_DECOMPRESSION_FAILED, |
| 1193 |
MZ_ZIP_COMPRESSION_FAILED, |
| 1194 |
MZ_ZIP_UNEXPECTED_DECOMPRESSED_SIZE, |
| 1195 |
MZ_ZIP_CRC_CHECK_FAILED, |
| 1196 |
MZ_ZIP_UNSUPPORTED_CDIR_SIZE, |
| 1197 |
MZ_ZIP_ALLOC_FAILED, |
| 1198 |
MZ_ZIP_FILE_OPEN_FAILED, |
| 1199 |
MZ_ZIP_FILE_CREATE_FAILED, |
| 1200 |
MZ_ZIP_FILE_WRITE_FAILED, |
| 1201 |
MZ_ZIP_FILE_READ_FAILED, |
| 1202 |
MZ_ZIP_FILE_CLOSE_FAILED, |
| 1203 |
MZ_ZIP_FILE_SEEK_FAILED, |
| 1204 |
MZ_ZIP_FILE_STAT_FAILED, |
| 1205 |
MZ_ZIP_INVALID_PARAMETER, |
| 1206 |
MZ_ZIP_INVALID_FILENAME, |
| 1207 |
MZ_ZIP_BUF_TOO_SMALL, |
| 1208 |
MZ_ZIP_INTERNAL_ERROR, |
| 1209 |
MZ_ZIP_FILE_NOT_FOUND, |
| 1210 |
MZ_ZIP_ARCHIVE_TOO_LARGE, |
| 1211 |
MZ_ZIP_VALIDATION_FAILED, |
| 1212 |
MZ_ZIP_WRITE_CALLBACK_FAILED, |
| 1213 |
MZ_ZIP_TOTAL_ERRORS |
| 1214 |
} mz_zip_error; |
| 1215 |
|
| 1216 |
typedef struct |
| 1217 |
{ |
| 1218 |
mz_uint64 m_archive_size; |
| 1219 |
mz_uint64 m_central_directory_file_ofs; |
| 1220 |
|
| 1221 |
|
| 1222 |
mz_uint32 m_total_files; |
| 1223 |
mz_zip_mode m_zip_mode; |
| 1224 |
mz_zip_type m_zip_type; |
| 1225 |
mz_zip_error m_last_error; |
| 1226 |
|
| 1227 |
mz_uint64 m_file_offset_alignment; |
| 1228 |
|
| 1229 |
mz_alloc_func m_pAlloc; |
| 1230 |
mz_free_func m_pFree; |
| 1231 |
mz_realloc_func m_pRealloc; |
| 1232 |
void *m_pAlloc_opaque; |
| 1233 |
|
| 1234 |
mz_file_read_func m_pRead; |
| 1235 |
mz_file_write_func m_pWrite; |
| 1236 |
mz_file_needs_keepalive m_pNeeds_keepalive; |
| 1237 |
void *m_pIO_opaque; |
| 1238 |
|
| 1239 |
mz_zip_internal_state *m_pState; |
| 1240 |
|
| 1241 |
} mz_zip_archive; |
| 1242 |
|
| 1243 |
typedef struct |
| 1244 |
{ |
| 1245 |
mz_zip_archive *pZip; |
| 1246 |
mz_uint flags; |
| 1247 |
|
| 1248 |
int status; |
| 1249 |
|
| 1250 |
mz_uint64 read_buf_size, read_buf_ofs, read_buf_avail, comp_remaining, out_buf_ofs, cur_file_ofs; |
| 1251 |
mz_zip_archive_file_stat file_stat; |
| 1252 |
void *pRead_buf; |
| 1253 |
void *pWrite_buf; |
| 1254 |
|
| 1255 |
size_t out_blk_remain; |
| 1256 |
|
| 1257 |
tinfl_decompressor inflator; |
| 1258 |
|
| 1259 |
#ifdef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS |
| 1260 |
mz_uint padding; |
| 1261 |
#else |
| 1262 |
mz_uint file_crc32; |
| 1263 |
#endif |
| 1264 |
|
| 1265 |
} mz_zip_reader_extract_iter_state; |
| 1266 |
|
| 1267 |
|
| 1268 |
|
| 1269 |
|
| 1270 |
|
| 1271 |
MINIZ_EXPORT mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint flags); |
| 1272 |
|
| 1273 |
MINIZ_EXPORT mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint flags); |
| 1274 |
|
| 1275 |
#ifndef MINIZ_NO_STDIO |
| 1276 |
|
| 1277 |
|
| 1278 |
|
| 1279 |
MINIZ_EXPORT mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags); |
| 1280 |
MINIZ_EXPORT mz_bool mz_zip_reader_init_file_v2(mz_zip_archive *pZip, const char *pFilename, mz_uint flags, mz_uint64 file_start_ofs, mz_uint64 archive_size); |
| 1281 |
|
| 1282 |
|
| 1283 |
|
| 1284 |
|
| 1285 |
MINIZ_EXPORT mz_bool mz_zip_reader_init_cfile(mz_zip_archive *pZip, MZ_FILE *pFile, mz_uint64 archive_size, mz_uint flags); |
| 1286 |
#endif |
| 1287 |
|
| 1288 |
|
| 1289 |
MINIZ_EXPORT mz_bool mz_zip_reader_end(mz_zip_archive *pZip); |
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
|
| 1295 |
MINIZ_EXPORT void mz_zip_zero_struct(mz_zip_archive *pZip); |
| 1296 |
|
| 1297 |
MINIZ_EXPORT mz_zip_mode mz_zip_get_mode(mz_zip_archive *pZip); |
| 1298 |
MINIZ_EXPORT mz_zip_type mz_zip_get_type(mz_zip_archive *pZip); |
| 1299 |
|
| 1300 |
|
| 1301 |
MINIZ_EXPORT mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip); |
| 1302 |
|
| 1303 |
MINIZ_EXPORT mz_uint64 mz_zip_get_archive_size(mz_zip_archive *pZip); |
| 1304 |
MINIZ_EXPORT mz_uint64 mz_zip_get_archive_file_start_offset(mz_zip_archive *pZip); |
| 1305 |
MINIZ_EXPORT MZ_FILE *mz_zip_get_cfile(mz_zip_archive *pZip); |
| 1306 |
|
| 1307 |
|
| 1308 |
MINIZ_EXPORT size_t mz_zip_read_archive_data(mz_zip_archive *pZip, mz_uint64 file_ofs, void *pBuf, size_t n); |
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
MINIZ_EXPORT mz_zip_error mz_zip_set_last_error(mz_zip_archive *pZip, mz_zip_error err_num); |
| 1313 |
MINIZ_EXPORT mz_zip_error mz_zip_peek_last_error(mz_zip_archive *pZip); |
| 1314 |
MINIZ_EXPORT mz_zip_error mz_zip_clear_last_error(mz_zip_archive *pZip); |
| 1315 |
MINIZ_EXPORT mz_zip_error mz_zip_get_last_error(mz_zip_archive *pZip); |
| 1316 |
MINIZ_EXPORT const char *mz_zip_get_error_string(mz_zip_error mz_err); |
| 1317 |
|
| 1318 |
|
| 1319 |
MINIZ_EXPORT mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index); |
| 1320 |
|
| 1321 |
|
| 1322 |
MINIZ_EXPORT mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index); |
| 1323 |
|
| 1324 |
|
| 1325 |
MINIZ_EXPORT mz_bool mz_zip_reader_is_file_supported(mz_zip_archive *pZip, mz_uint file_index); |
| 1326 |
|
| 1327 |
|
| 1328 |
|
| 1329 |
MINIZ_EXPORT mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size); |
| 1330 |
|
| 1331 |
|
| 1332 |
|
| 1333 |
|
| 1334 |
MINIZ_EXPORT int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags); |
| 1335 |
MINIZ_EXPORT mz_bool mz_zip_reader_locate_file_v2(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags, mz_uint32 *file_index); |
| 1336 |
|
| 1337 |
|
| 1338 |
MINIZ_EXPORT mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat); |
| 1339 |
|
| 1340 |
|
| 1341 |
|
| 1342 |
MINIZ_EXPORT mz_bool mz_zip_is_zip64(mz_zip_archive *pZip); |
| 1343 |
|
| 1344 |
|
| 1345 |
|
| 1346 |
MINIZ_EXPORT size_t mz_zip_get_central_dir_size(mz_zip_archive *pZip); |
| 1347 |
|
| 1348 |
|
| 1349 |
|
| 1350 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); |
| 1351 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); |
| 1352 |
|
| 1353 |
|
| 1354 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags); |
| 1355 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags); |
| 1356 |
|
| 1357 |
|
| 1358 |
|
| 1359 |
|
| 1360 |
MINIZ_EXPORT void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags); |
| 1361 |
MINIZ_EXPORT void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags); |
| 1362 |
|
| 1363 |
|
| 1364 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); |
| 1365 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); |
| 1366 |
|
| 1367 |
|
| 1368 |
MINIZ_EXPORT mz_zip_reader_extract_iter_state *mz_zip_reader_extract_iter_new(mz_zip_archive *pZip, mz_uint file_index, mz_uint flags); |
| 1369 |
MINIZ_EXPORT mz_zip_reader_extract_iter_state *mz_zip_reader_extract_file_iter_new(mz_zip_archive *pZip, const char *pFilename, mz_uint flags); |
| 1370 |
MINIZ_EXPORT size_t mz_zip_reader_extract_iter_read(mz_zip_reader_extract_iter_state *pState, void *pvBuf, size_t buf_size); |
| 1371 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_iter_free(mz_zip_reader_extract_iter_state *pState); |
| 1372 |
|
| 1373 |
#ifndef MINIZ_NO_STDIO |
| 1374 |
|
| 1375 |
|
| 1376 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags); |
| 1377 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags); |
| 1378 |
|
| 1379 |
|
| 1380 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_to_cfile(mz_zip_archive *pZip, mz_uint file_index, MZ_FILE *File, mz_uint flags); |
| 1381 |
MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_cfile(mz_zip_archive *pZip, const char *pArchive_filename, MZ_FILE *pFile, mz_uint flags); |
| 1382 |
#endif |
| 1383 |
|
| 1384 |
#if 0 |
| 1385 |
|
| 1386 |
typedef void *mz_zip_streaming_extract_state_ptr; |
| 1387 |
mz_zip_streaming_extract_state_ptr mz_zip_streaming_extract_begin(mz_zip_archive *pZip, mz_uint file_index, mz_uint flags); |
| 1388 |
mz_uint64 mz_zip_streaming_extract_get_size(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState); |
| 1389 |
mz_uint64 mz_zip_streaming_extract_get_cur_ofs(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState); |
| 1390 |
mz_bool mz_zip_streaming_extract_seek(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState, mz_uint64 new_ofs); |
| 1391 |
size_t mz_zip_streaming_extract_read(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState, void *pBuf, size_t buf_size); |
| 1392 |
mz_bool mz_zip_streaming_extract_end(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState); |
| 1393 |
#endif |
| 1394 |
|
| 1395 |
|
| 1396 |
|
| 1397 |
MINIZ_EXPORT mz_bool mz_zip_validate_file(mz_zip_archive *pZip, mz_uint file_index, mz_uint flags); |
| 1398 |
|
| 1399 |
|
| 1400 |
MINIZ_EXPORT mz_bool mz_zip_validate_archive(mz_zip_archive *pZip, mz_uint flags); |
| 1401 |
|
| 1402 |
|
| 1403 |
MINIZ_EXPORT mz_bool mz_zip_validate_mem_archive(const void *pMem, size_t size, mz_uint flags, mz_zip_error *pErr); |
| 1404 |
#ifndef MINIZ_NO_STDIO |
| 1405 |
MINIZ_EXPORT mz_bool mz_zip_validate_file_archive(const char *pFilename, mz_uint flags, mz_zip_error *pErr); |
| 1406 |
#endif |
| 1407 |
|
| 1408 |
|
| 1409 |
MINIZ_EXPORT mz_bool mz_zip_end(mz_zip_archive *pZip); |
| 1410 |
|
| 1411 |
|
| 1412 |
|
| 1413 |
#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS |
| 1414 |
|
| 1415 |
|
| 1416 |
|
| 1417 |
|
| 1418 |
MINIZ_EXPORT mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size); |
| 1419 |
MINIZ_EXPORT mz_bool mz_zip_writer_init_v2(mz_zip_archive *pZip, mz_uint64 existing_size, mz_uint flags); |
| 1420 |
|
| 1421 |
MINIZ_EXPORT mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size); |
| 1422 |
MINIZ_EXPORT mz_bool mz_zip_writer_init_heap_v2(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size, mz_uint flags); |
| 1423 |
|
| 1424 |
#ifndef MINIZ_NO_STDIO |
| 1425 |
MINIZ_EXPORT mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning); |
| 1426 |
MINIZ_EXPORT mz_bool mz_zip_writer_init_file_v2(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning, mz_uint flags); |
| 1427 |
MINIZ_EXPORT mz_bool mz_zip_writer_init_cfile(mz_zip_archive *pZip, MZ_FILE *pFile, mz_uint flags); |
| 1428 |
#endif |
| 1429 |
|
| 1430 |
|
| 1431 |
|
| 1432 |
|
| 1433 |
|
| 1434 |
|
| 1435 |
|
| 1436 |
MINIZ_EXPORT mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename); |
| 1437 |
MINIZ_EXPORT mz_bool mz_zip_writer_init_from_reader_v2(mz_zip_archive *pZip, const char *pFilename, mz_uint flags); |
| 1438 |
|
| 1439 |
|
| 1440 |
|
| 1441 |
|
| 1442 |
MINIZ_EXPORT mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags); |
| 1443 |
|
| 1444 |
|
| 1445 |
|
| 1446 |
MINIZ_EXPORT mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, |
| 1447 |
mz_uint64 uncomp_size, mz_uint32 uncomp_crc32); |
| 1448 |
|
| 1449 |
MINIZ_EXPORT mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, |
| 1450 |
mz_uint64 uncomp_size, mz_uint32 uncomp_crc32, MZ_TIME_T *last_modified, const char *user_extra_data_local, mz_uint user_extra_data_local_len, |
| 1451 |
const char *user_extra_data_central, mz_uint user_extra_data_central_len); |
| 1452 |
|
| 1453 |
|
| 1454 |
|
| 1455 |
MINIZ_EXPORT mz_bool mz_zip_writer_add_read_buf_callback(mz_zip_archive *pZip, const char *pArchive_name, mz_file_read_func read_callback, void *callback_opaque, mz_uint64 max_size, |
| 1456 |
const MZ_TIME_T *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, const char *user_extra_data_local, mz_uint user_extra_data_local_len, |
| 1457 |
const char *user_extra_data_central, mz_uint user_extra_data_central_len); |
| 1458 |
|
| 1459 |
#ifndef MINIZ_NO_STDIO |
| 1460 |
|
| 1461 |
|
| 1462 |
MINIZ_EXPORT mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); |
| 1463 |
|
| 1464 |
|
| 1465 |
MINIZ_EXPORT mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name, MZ_FILE *pSrc_file, mz_uint64 max_size, |
| 1466 |
const MZ_TIME_T *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, const char *user_extra_data_local, mz_uint user_extra_data_local_len, |
| 1467 |
const char *user_extra_data_central, mz_uint user_extra_data_central_len); |
| 1468 |
#endif |
| 1469 |
|
| 1470 |
|
| 1471 |
|
| 1472 |
MINIZ_EXPORT mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint src_file_index); |
| 1473 |
|
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
MINIZ_EXPORT mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip); |
| 1478 |
|
| 1479 |
|
| 1480 |
|
| 1481 |
MINIZ_EXPORT mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **ppBuf, size_t *pSize); |
| 1482 |
|
| 1483 |
|
| 1484 |
|
| 1485 |
MINIZ_EXPORT mz_bool mz_zip_writer_end(mz_zip_archive *pZip); |
| 1486 |
|
| 1487 |
|
| 1488 |
|
| 1489 |
|
| 1490 |
|
| 1491 |
|
| 1492 |
|
| 1493 |
MINIZ_EXPORT mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); |
| 1494 |
MINIZ_EXPORT mz_bool mz_zip_add_mem_to_archive_file_in_place_v2(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_zip_error *pErr); |
| 1495 |
|
| 1496 |
#ifndef MINIZ_NO_STDIO |
| 1497 |
|
| 1498 |
|
| 1499 |
|
| 1500 |
MINIZ_EXPORT void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint flags); |
| 1501 |
MINIZ_EXPORT void *mz_zip_extract_archive_file_to_heap_v2(const char *pZip_filename, const char *pArchive_name, const char *pComment, size_t *pSize, mz_uint flags, mz_zip_error *pErr); |
| 1502 |
#endif |
| 1503 |
|
| 1504 |
#endif |
| 1505 |
|
| 1506 |
#ifdef __cplusplus |
| 1507 |
} |
| 1508 |
#endif |
| 1509 |
|
| 1510 |
#endif |