mirror of
				https://github.com/eledio-devices/thirdparty-miniz.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	clang-format the sources
This commit is contained in:
		
							
								
								
									
										85
									
								
								miniz.c
									
									
									
									
									
								
							
							
						
						
									
										85
									
								
								miniz.c
									
									
									
									
									
								
							| @@ -89,43 +89,43 @@ mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len) | |||||||
| { | { | ||||||
|     static const mz_uint32 s_crc_table[256] = |     static const mz_uint32 s_crc_table[256] = | ||||||
|         { |         { | ||||||
|             0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, |           0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, | ||||||
|             0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, |           0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, | ||||||
|             0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, |           0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, | ||||||
|             0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, |           0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, | ||||||
|             0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, |           0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, | ||||||
|             0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, |           0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, | ||||||
|             0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, |           0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, | ||||||
|             0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, |           0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, | ||||||
|             0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, |           0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, | ||||||
|             0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, |           0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, | ||||||
|             0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, |           0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, | ||||||
|             0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, |           0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, | ||||||
|             0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, |           0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, | ||||||
|             0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, |           0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, | ||||||
|             0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, |           0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, | ||||||
|             0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, |           0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, | ||||||
|             0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, |           0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, | ||||||
|             0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, |           0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, | ||||||
|             0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, |           0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, | ||||||
|             0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, |           0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, | ||||||
|             0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, |           0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, | ||||||
|             0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, |           0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, | ||||||
|             0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, |           0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, | ||||||
|             0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, |           0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, | ||||||
|             0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, |           0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, | ||||||
|             0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, |           0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, | ||||||
|             0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, |           0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, | ||||||
|             0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, |           0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, | ||||||
|             0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, |           0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, | ||||||
|             0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, |           0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, | ||||||
|             0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, |           0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, | ||||||
|             0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, |           0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, | ||||||
|             0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, |           0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, | ||||||
|             0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, |           0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, | ||||||
|             0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, |           0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, | ||||||
|             0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, |           0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, | ||||||
|             0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D |           0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|     mz_uint32 crc32 = (mz_uint32)crc ^ 0xFFFFFFFF; |     mz_uint32 crc32 = (mz_uint32)crc ^ 0xFFFFFFFF; | ||||||
| @@ -320,7 +320,7 @@ int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char | |||||||
|     stream.next_in = pSource; |     stream.next_in = pSource; | ||||||
|     stream.avail_in = (mz_uint32)source_len; |     stream.avail_in = (mz_uint32)source_len; | ||||||
|     stream.next_out = pDest; |     stream.next_out = pDest; | ||||||
|     stream.avail_out = (mz_uint32) * pDest_len; |     stream.avail_out = (mz_uint32)*pDest_len; | ||||||
|  |  | ||||||
|     status = mz_deflateInit(&stream, level); |     status = mz_deflateInit(&stream, level); | ||||||
|     if (status != MZ_OK) |     if (status != MZ_OK) | ||||||
| @@ -534,7 +534,7 @@ int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char | |||||||
|     stream.next_in = pSource; |     stream.next_in = pSource; | ||||||
|     stream.avail_in = (mz_uint32)source_len; |     stream.avail_in = (mz_uint32)source_len; | ||||||
|     stream.next_out = pDest; |     stream.next_out = pDest; | ||||||
|     stream.avail_out = (mz_uint32) * pDest_len; |     stream.avail_out = (mz_uint32)*pDest_len; | ||||||
|  |  | ||||||
|     status = mz_inflateInit(&stream); |     status = mz_inflateInit(&stream); | ||||||
|     if (status != MZ_OK) |     if (status != MZ_OK) | ||||||
| @@ -558,10 +558,9 @@ const char *mz_error(int err) | |||||||
|         int m_err; |         int m_err; | ||||||
|         const char *m_pDesc; |         const char *m_pDesc; | ||||||
|     } s_error_descs[] = |     } s_error_descs[] = | ||||||
|           { |         { | ||||||
|               { MZ_OK, "" }, { MZ_STREAM_END, "stream end" }, { MZ_NEED_DICT, "need dictionary" }, { MZ_ERRNO, "file error" }, { MZ_STREAM_ERROR, "stream error" }, |           { 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" } | ||||||
|               { 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" } |         }; | ||||||
|           }; |  | ||||||
|     mz_uint i; |     mz_uint i; | ||||||
|     for (i = 0; i < sizeof(s_error_descs) / sizeof(s_error_descs[0]); ++i) |     for (i = 0; i < sizeof(s_error_descs) / sizeof(s_error_descs[0]); ++i) | ||||||
|         if (s_error_descs[i].m_err == err) |         if (s_error_descs[i].m_err == err) | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								miniz.h
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								miniz.h
									
									
									
									
									
								
							| @@ -212,18 +212,18 @@ enum | |||||||
| /* Heap allocation callbacks. | /* Heap allocation callbacks. | ||||||
| Note that mz_alloc_func parameter types purpsosely differ from zlib's: items/size is size_t, not unsigned long. */ | Note that mz_alloc_func parameter types purpsosely differ from zlib's: items/size is size_t, not unsigned long. */ | ||||||
| typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size); | 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_free_func)(void *opaque, void *address); | ||||||
| typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size); | typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size); | ||||||
|  |  | ||||||
| /* Compression levels: 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow), MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL. */ | /* Compression levels: 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow), MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL. */ | ||||||
| enum | enum | ||||||
| { | { | ||||||
| 	MZ_NO_COMPRESSION = 0, |     MZ_NO_COMPRESSION = 0, | ||||||
| 	MZ_BEST_SPEED = 1, |     MZ_BEST_SPEED = 1, | ||||||
| 	MZ_BEST_COMPRESSION = 9, |     MZ_BEST_COMPRESSION = 9, | ||||||
| 	MZ_UBER_COMPRESSION = 10, |     MZ_UBER_COMPRESSION = 10, | ||||||
| 	MZ_DEFAULT_LEVEL = 6, |     MZ_DEFAULT_LEVEL = 6, | ||||||
| 	MZ_DEFAULT_COMPRESSION = -1 |     MZ_DEFAULT_COMPRESSION = -1 | ||||||
| }; | }; | ||||||
|  |  | ||||||
| #define MZ_VERSION "10.0.0" | #define MZ_VERSION "10.0.0" | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| #pragma once | #pragma once | ||||||
| #include <assert.h> | #include <assert.h> | ||||||
|  | #include <stdint.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
| #include <stdint.h> |  | ||||||
|  |  | ||||||
| /* ------------------- Types and macros */ | /* ------------------- Types and macros */ | ||||||
| typedef unsigned char mz_uint8; | typedef unsigned char mz_uint8; | ||||||
| @@ -45,7 +45,7 @@ typedef struct mz_dummy_time_t_tag | |||||||
|  |  | ||||||
| #ifdef MINIZ_NO_MALLOC | #ifdef MINIZ_NO_MALLOC | ||||||
| #define MZ_MALLOC(x) NULL | #define MZ_MALLOC(x) NULL | ||||||
| #define MZ_FREE(x) (void) x, ((void)0) | #define MZ_FREE(x) (void)x, ((void)0) | ||||||
| #define MZ_REALLOC(p, x) NULL | #define MZ_REALLOC(p, x) NULL | ||||||
| #else | #else | ||||||
| #define MZ_MALLOC(x) malloc(x) | #define MZ_MALLOC(x) malloc(x) | ||||||
| @@ -57,7 +57,7 @@ typedef struct mz_dummy_time_t_tag | |||||||
| #define MZ_MIN(a, b) (((a) < (b)) ? (a) : (b)) | #define MZ_MIN(a, b) (((a) < (b)) ? (a) : (b)) | ||||||
| #define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj)) | #define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj)) | ||||||
|  |  | ||||||
| #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES &&MINIZ_LITTLE_ENDIAN | #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN | ||||||
| #define MZ_READ_LE16(p) *((const mz_uint16 *)(p)) | #define MZ_READ_LE16(p) *((const mz_uint16 *)(p)) | ||||||
| #define MZ_READ_LE32(p) *((const mz_uint32 *)(p)) | #define MZ_READ_LE32(p) *((const mz_uint32 *)(p)) | ||||||
| #else | #else | ||||||
|   | |||||||
							
								
								
									
										118
									
								
								miniz_tdef.c
									
									
									
									
									
								
							
							
						
						
									
										118
									
								
								miniz_tdef.c
									
									
									
									
									
								
							| @@ -36,64 +36,64 @@ extern "C" { | |||||||
| /* Purposely making these tables static for faster init and thread safety. */ | /* Purposely making these tables static for faster init and thread safety. */ | ||||||
| static const mz_uint16 s_tdefl_len_sym[256] = | static const mz_uint16 s_tdefl_len_sym[256] = | ||||||
|     { |     { | ||||||
|         257, 258, 259, 260, 261, 262, 263, 264, 265, 265, 266, 266, 267, 267, 268, 268, 269, 269, 269, 269, 270, 270, 270, 270, 271, 271, 271, 271, 272, 272, 272, 272, |       257, 258, 259, 260, 261, 262, 263, 264, 265, 265, 266, 266, 267, 267, 268, 268, 269, 269, 269, 269, 270, 270, 270, 270, 271, 271, 271, 271, 272, 272, 272, 272, | ||||||
|         273, 273, 273, 273, 273, 273, 273, 273, 274, 274, 274, 274, 274, 274, 274, 274, 275, 275, 275, 275, 275, 275, 275, 275, 276, 276, 276, 276, 276, 276, 276, 276, |       273, 273, 273, 273, 273, 273, 273, 273, 274, 274, 274, 274, 274, 274, 274, 274, 275, 275, 275, 275, 275, 275, 275, 275, 276, 276, 276, 276, 276, 276, 276, 276, | ||||||
|         277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, |       277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, | ||||||
|         279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, |       279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, | ||||||
|         281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, |       281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, | ||||||
|         282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, |       282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, | ||||||
|         283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, |       283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, | ||||||
|         284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 285 |       284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 285 | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| static const mz_uint8 s_tdefl_len_extra[256] = | static const mz_uint8 s_tdefl_len_extra[256] = | ||||||
|     { |     { | ||||||
|         0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |       0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | ||||||
|         4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |       4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||||||
|         5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |       5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||||||
|         5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0 |       5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0 | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| static const mz_uint8 s_tdefl_small_dist_sym[512] = | static const mz_uint8 s_tdefl_small_dist_sym[512] = | ||||||
|     { |     { | ||||||
|         0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, |       0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, | ||||||
|         11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, |       11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, | ||||||
|         13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, |       13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, | ||||||
|         14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, |       14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, | ||||||
|         14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, |       14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, | ||||||
|         15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, |       15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, | ||||||
|         16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, |       16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, | ||||||
|         16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, |       16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, | ||||||
|         16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, |       16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, | ||||||
|         17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, |       17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, | ||||||
|         17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, |       17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, | ||||||
|         17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 |       17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| static const mz_uint8 s_tdefl_small_dist_extra[512] = | static const mz_uint8 s_tdefl_small_dist_extra[512] = | ||||||
|     { |     { | ||||||
|         0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, |       0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, | ||||||
|         5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, |       5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||||||
|         6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, |       6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||||||
|         6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |       6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||||||
|         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |       7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||||||
|         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |       7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||||||
|         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |       7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||||||
|         7, 7, 7, 7, 7, 7, 7, 7 |       7, 7, 7, 7, 7, 7, 7, 7 | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| static const mz_uint8 s_tdefl_large_dist_sym[128] = | static const mz_uint8 s_tdefl_large_dist_sym[128] = | ||||||
|     { |     { | ||||||
|         0, 0, 18, 19, 20, 20, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, |       0, 0, 18, 19, 20, 20, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, | ||||||
|         26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, |       26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, | ||||||
|         28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 |       28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| static const mz_uint8 s_tdefl_large_dist_extra[128] = | static const mz_uint8 s_tdefl_large_dist_extra[128] = | ||||||
|     { |     { | ||||||
|         0, 0, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, |       0, 0, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||||||
|         12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, |       12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||||||
|         13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 |       13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| /* Radix sorts tdefl_sym_freq[] array by 16-bit key m_key. Returns ptr to sorted values. */ | /* Radix sorts tdefl_sym_freq[] array by 16-bit key m_key. Returns ptr to sorted values. */ | ||||||
| @@ -449,7 +449,7 @@ static void tdefl_start_static_block(tdefl_compressor *d) | |||||||
|  |  | ||||||
| static const mz_uint mz_bitmasks[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; | static const mz_uint mz_bitmasks[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; | ||||||
|  |  | ||||||
| #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES &&MINIZ_LITTLE_ENDIAN &&MINIZ_HAS_64BIT_REGISTERS | #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS | ||||||
| static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) | static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) | ||||||
| { | { | ||||||
|     mz_uint flags; |     mz_uint flags; | ||||||
| @@ -836,7 +836,7 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe | |||||||
| } | } | ||||||
| #endif /* #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES */ | #endif /* #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES */ | ||||||
|  |  | ||||||
| #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES &&MINIZ_LITTLE_ENDIAN | #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN | ||||||
| static mz_bool tdefl_compress_fast(tdefl_compressor *d) | static mz_bool tdefl_compress_fast(tdefl_compressor *d) | ||||||
| { | { | ||||||
|     /* Faster, minimally featured LZRW1-style match+parse loop with better register utilization. Intended for applications where raw throughput is valued more highly than ratio. */ |     /* Faster, minimally featured LZRW1-style match+parse loop with better register utilization. Intended for applications where raw throughput is valued more highly than ratio. */ | ||||||
| @@ -1250,7 +1250,7 @@ tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pI | |||||||
|     if ((d->m_output_flush_remaining) || (d->m_finished)) |     if ((d->m_output_flush_remaining) || (d->m_finished)) | ||||||
|         return (d->m_prev_return_status = tdefl_flush_output_buffer(d)); |         return (d->m_prev_return_status = tdefl_flush_output_buffer(d)); | ||||||
|  |  | ||||||
| #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES &&MINIZ_LITTLE_ENDIAN | #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN | ||||||
|     if (((d->m_flags & TDEFL_MAX_PROBES_MASK) == 1) && |     if (((d->m_flags & TDEFL_MAX_PROBES_MASK) == 1) && | ||||||
|         ((d->m_flags & TDEFL_GREEDY_PARSING_FLAG) != 0) && |         ((d->m_flags & TDEFL_GREEDY_PARSING_FLAG) != 0) && | ||||||
|         ((d->m_flags & (TDEFL_FILTER_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS | TDEFL_RLE_MATCHES)) == 0)) |         ((d->m_flags & (TDEFL_FILTER_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS | TDEFL_RLE_MATCHES)) == 0)) | ||||||
| @@ -1478,24 +1478,24 @@ void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int | |||||||
|     *pLen_out = out_buf.m_size - 41; |     *pLen_out = out_buf.m_size - 41; | ||||||
|     { |     { | ||||||
|         static const mz_uint8 chans[] = { 0x00, 0x00, 0x04, 0x02, 0x06 }; |         static const mz_uint8 chans[] = { 0x00, 0x00, 0x04, 0x02, 0x06 }; | ||||||
|         mz_uint8 pnghdr[41] = { 0x89, 0x50, 0x4e, 0x47, 0x0d,  |         mz_uint8 pnghdr[41] = { 0x89, 0x50, 0x4e, 0x47, 0x0d, | ||||||
| 								0x0a, 0x1a, 0x0a, 0x00, 0x00,  |                                 0x0a, 0x1a, 0x0a, 0x00, 0x00, | ||||||
| 								0x00, 0x0d, 0x49, 0x48, 0x44,  |                                 0x00, 0x0d, 0x49, 0x48, 0x44, | ||||||
| 								0x52, 0x00, 0x00, 0x00, 0x00,  |                                 0x52, 0x00, 0x00, 0x00, 0x00, | ||||||
| 								0x00, 0x00, 0x00, 0x00, 0x08,  |                                 0x00, 0x00, 0x00, 0x00, 0x08, | ||||||
| 								0x00, 0x00, 0x00, 0x00, 0x00,  |                                 0x00, 0x00, 0x00, 0x00, 0x00, | ||||||
| 								0x00, 0x00, 0x00, 0x00, 0x00,  |                                 0x00, 0x00, 0x00, 0x00, 0x00, | ||||||
| 								0x00, 0x00, 0x49, 0x44, 0x41,  |                                 0x00, 0x00, 0x49, 0x44, 0x41, | ||||||
| 								0x54 }; |                                 0x54 }; | ||||||
| 		pnghdr[18] = (mz_uint8)(w >> 8); |         pnghdr[18] = (mz_uint8)(w >> 8); | ||||||
| 		pnghdr[19] = (mz_uint8)w; |         pnghdr[19] = (mz_uint8)w; | ||||||
| 		pnghdr[22] = (mz_uint8)(h >> 8); |         pnghdr[22] = (mz_uint8)(h >> 8); | ||||||
| 		pnghdr[22] = (mz_uint8)h; |         pnghdr[22] = (mz_uint8)h; | ||||||
| 		pnghdr[25] = chans[num_chans]; |         pnghdr[25] = chans[num_chans]; | ||||||
| 		pnghdr[33] = (mz_uint8)(*pLen_out >> 24); |         pnghdr[33] = (mz_uint8)(*pLen_out >> 24); | ||||||
| 		pnghdr[34] = (mz_uint8)(*pLen_out >> 16); |         pnghdr[34] = (mz_uint8)(*pLen_out >> 16); | ||||||
| 		pnghdr[35] = (mz_uint8)(*pLen_out >> 8); |         pnghdr[35] = (mz_uint8)(*pLen_out >> 8); | ||||||
| 		pnghdr[36] = (mz_uint8)*pLen_out; |         pnghdr[36] = (mz_uint8)*pLen_out; | ||||||
|         c = (mz_uint32)mz_crc32(MZ_CRC32_INIT, pnghdr + 12, 17); |         c = (mz_uint32)mz_crc32(MZ_CRC32_INIT, pnghdr + 12, 17); | ||||||
|         for (i = 0; i < 4; ++i, c <<= 8) |         for (i = 0; i < 4; ++i, c <<= 8) | ||||||
|             ((mz_uint8 *)(pnghdr + 29))[i] = (mz_uint8)(c >> 24); |             ((mz_uint8 *)(pnghdr + 29))[i] = (mz_uint8)(c >> 24); | ||||||
|   | |||||||
| @@ -111,8 +111,7 @@ enum | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* The low-level tdefl functions below may be used directly if the above helper functions aren't flexible enough. The low-level functions don't make any heap allocations, unlike the above helper functions. */ | /* The low-level tdefl functions below may be used directly if the above helper functions aren't flexible enough. The low-level functions don't make any heap allocations, unlike the above helper functions. */ | ||||||
| typedef enum | typedef enum { | ||||||
| { |  | ||||||
|     TDEFL_STATUS_BAD_PARAM = -2, |     TDEFL_STATUS_BAD_PARAM = -2, | ||||||
|     TDEFL_STATUS_PUT_BUF_FAILED = -1, |     TDEFL_STATUS_PUT_BUF_FAILED = -1, | ||||||
|     TDEFL_STATUS_OKAY = 0, |     TDEFL_STATUS_OKAY = 0, | ||||||
| @@ -120,8 +119,7 @@ typedef enum | |||||||
| } tdefl_status; | } tdefl_status; | ||||||
|  |  | ||||||
| /* Must map to MZ_NO_FLUSH, MZ_SYNC_FLUSH, etc. enums */ | /* Must map to MZ_NO_FLUSH, MZ_SYNC_FLUSH, etc. enums */ | ||||||
| typedef enum | typedef enum { | ||||||
| { |  | ||||||
|     TDEFL_NO_FLUSH = 0, |     TDEFL_NO_FLUSH = 0, | ||||||
|     TDEFL_SYNC_FLUSH = 2, |     TDEFL_SYNC_FLUSH = 2, | ||||||
|     TDEFL_FULL_FLUSH = 3, |     TDEFL_FULL_FLUSH = 3, | ||||||
|   | |||||||
| @@ -45,8 +45,7 @@ extern "C" { | |||||||
|         status = result;                     \ |         status = result;                     \ | ||||||
|         r->m_state = state_index;            \ |         r->m_state = state_index;            \ | ||||||
|         goto common_exit;                    \ |         goto common_exit;                    \ | ||||||
|         case state_index:                    \ |         case state_index:;                   \ | ||||||
|             ;                                \ |  | ||||||
|     }                                        \ |     }                                        \ | ||||||
|     MZ_MACRO_END |     MZ_MACRO_END | ||||||
| #define TINFL_CR_RETURN_FOREVER(state_index, result) \ | #define TINFL_CR_RETURN_FOREVER(state_index, result) \ | ||||||
| @@ -60,15 +59,15 @@ extern "C" { | |||||||
|     MZ_MACRO_END |     MZ_MACRO_END | ||||||
| #define TINFL_CR_FINISH } | #define TINFL_CR_FINISH } | ||||||
|  |  | ||||||
| #define TINFL_GET_BYTE(state_index, c)                                                                                                                          \ | #define TINFL_GET_BYTE(state_index, c)                                                                                                                           \ | ||||||
|     do                                                                                                                                                          \ |     do                                                                                                                                                           \ | ||||||
|     {                                                                                                                                                           \ |     {                                                                                                                                                            \ | ||||||
|         while (pIn_buf_cur >= pIn_buf_end)                                                                                                                      \ |         while (pIn_buf_cur >= pIn_buf_end)                                                                                                                       \ | ||||||
|         {                                                                                                                                                       \ |         {                                                                                                                                                        \ | ||||||
|             TINFL_CR_RETURN(state_index, (decomp_flags &TINFL_FLAG_HAS_MORE_INPUT) ? TINFL_STATUS_NEEDS_MORE_INPUT : TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS); \ |             TINFL_CR_RETURN(state_index, (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) ? TINFL_STATUS_NEEDS_MORE_INPUT : TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS); \ | ||||||
|         }                                                                                                                                                       \ |         }                                                                                                                                                        \ | ||||||
|         c = *pIn_buf_cur++;                                                                                                                                     \ |         c = *pIn_buf_cur++;                                                                                                                                      \ | ||||||
|     }                                                                                                                                                           \ |     }                                                                                                                                                            \ | ||||||
|     MZ_MACRO_END |     MZ_MACRO_END | ||||||
|  |  | ||||||
| #define TINFL_NEED_BITS(state_index, n)                \ | #define TINFL_NEED_BITS(state_index, n)                \ | ||||||
| @@ -186,7 +185,7 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex | |||||||
|     tinfl_bit_buf_t bit_buf; |     tinfl_bit_buf_t bit_buf; | ||||||
|     const mz_uint8 *pIn_buf_cur = pIn_buf_next, *const pIn_buf_end = pIn_buf_next + *pIn_buf_size; |     const mz_uint8 *pIn_buf_cur = pIn_buf_next, *const pIn_buf_end = pIn_buf_next + *pIn_buf_size; | ||||||
|     mz_uint8 *pOut_buf_cur = pOut_buf_next, *const pOut_buf_end = pOut_buf_next + *pOut_buf_size; |     mz_uint8 *pOut_buf_cur = pOut_buf_next, *const pOut_buf_end = pOut_buf_next + *pOut_buf_size; | ||||||
|     size_t out_buf_size_mask = (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) ? (size_t) - 1 : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, dist_from_out_buf_start; |     size_t out_buf_size_mask = (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) ? (size_t)-1 : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, dist_from_out_buf_start; | ||||||
|  |  | ||||||
|     /* Ensure the output buffer's size is a power of 2, unless the output buffer is large enough to hold the entire output file (in which case it doesn't matter). */ |     /* Ensure the output buffer's size is a power of 2, unless the output buffer is large enough to hold the entire output file (in which case it doesn't matter). */ | ||||||
|     if (((out_buf_size_mask + 1) & out_buf_size_mask) || (pOut_buf_next < pOut_buf_start)) |     if (((out_buf_size_mask + 1) & out_buf_size_mask) || (pOut_buf_next < pOut_buf_start)) | ||||||
| @@ -568,7 +567,7 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex | |||||||
|         --pIn_buf_cur; |         --pIn_buf_cur; | ||||||
|         num_bits -= 8; |         num_bits -= 8; | ||||||
|     } |     } | ||||||
|     bit_buf &= (tinfl_bit_buf_t)(( ((mz_uint64)1) << num_bits) - (mz_uint64)1); |     bit_buf &= (tinfl_bit_buf_t)((((mz_uint64)1) << num_bits) - (mz_uint64)1); | ||||||
|     MZ_ASSERT(!num_bits); /* if this assert fires then we've read beyond the end of non-deflate/zlib streams with following data (such as gzip streams). */ |     MZ_ASSERT(!num_bits); /* if this assert fires then we've read beyond the end of non-deflate/zlib streams with following data (such as gzip streams). */ | ||||||
|  |  | ||||||
|     if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) |     if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) | ||||||
| @@ -600,7 +599,7 @@ common_exit: | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     r->m_num_bits = num_bits; |     r->m_num_bits = num_bits; | ||||||
|     r->m_bit_buf = bit_buf & (tinfl_bit_buf_t)(( ((mz_uint64)1) << num_bits) - (mz_uint64)1); |     r->m_bit_buf = bit_buf & (tinfl_bit_buf_t)((((mz_uint64)1) << num_bits) - (mz_uint64)1); | ||||||
|     r->m_dist = dist; |     r->m_dist = dist; | ||||||
|     r->m_counter = counter; |     r->m_counter = counter; | ||||||
|     r->m_num_extra = num_extra; |     r->m_num_extra = num_extra; | ||||||
|   | |||||||
| @@ -52,8 +52,7 @@ void tinfl_decompressor_free(tinfl_decompressor *pDecomp); | |||||||
| #define TINFL_LZ_DICT_SIZE 32768 | #define TINFL_LZ_DICT_SIZE 32768 | ||||||
|  |  | ||||||
| /* Return status. */ | /* Return status. */ | ||||||
| typedef enum | typedef enum { | ||||||
| { |  | ||||||
|     /* This flags indicates the inflator needs 1 or more input bytes to make forward progress, but the caller is indicating that no more are available. The compressed data */ |     /* This flags indicates the inflator needs 1 or more input bytes to make forward progress, but the caller is indicating that no more are available. The compressed data */ | ||||||
|     /* is probably corrupted. If you call the inflator again with more bytes it'll try to continue processing the input but this is a BAD sign (either the data is corrupted or you called it incorrectly). */ |     /* is probably corrupted. If you call the inflator again with more bytes it'll try to continue processing the input but this is a BAD sign (either the data is corrupted or you called it incorrectly). */ | ||||||
|     /* If you call it again with no input you'll just get TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS again. */ |     /* If you call it again with no input you'll just get TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS again. */ | ||||||
|   | |||||||
							
								
								
									
										121
									
								
								miniz_zip.c
									
									
									
									
									
								
							
							
						
						
									
										121
									
								
								miniz_zip.c
									
									
									
									
									
								
							| @@ -137,12 +137,12 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream) | |||||||
| #define MZ_FCLOSE fclose | #define MZ_FCLOSE fclose | ||||||
| #define MZ_FREAD fread | #define MZ_FREAD fread | ||||||
| #define MZ_FWRITE fwrite | #define MZ_FWRITE fwrite | ||||||
| #ifdef __STRICT_ANSI__ | #ifdef __STRICT_ANSI__ | ||||||
| #define MZ_FTELL64 ftell | #define MZ_FTELL64 ftell | ||||||
| #define MZ_FSEEK64 fseek | #define MZ_FSEEK64 fseek | ||||||
| #else | #else | ||||||
| #define MZ_FTELL64 ftello | #define MZ_FTELL64 ftello | ||||||
| #define MZ_FSEEK64 fseeko | #define MZ_FSEEK64 fseeko | ||||||
| #endif | #endif | ||||||
| #define MZ_FILE_STAT_STRUCT stat | #define MZ_FILE_STAT_STRUCT stat | ||||||
| #define MZ_FILE_STAT stat | #define MZ_FILE_STAT stat | ||||||
| @@ -752,8 +752,8 @@ static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint flag | |||||||
|  |  | ||||||
|                     do |                     do | ||||||
|                     { |                     { | ||||||
| 						mz_uint32 field_id; |                         mz_uint32 field_id; | ||||||
| 						mz_uint32 field_data_size; |                         mz_uint32 field_data_size; | ||||||
|  |  | ||||||
|                         if (extra_size_remaining < (sizeof(mz_uint16) * 2)) |                         if (extra_size_remaining < (sizeof(mz_uint16) * 2)) | ||||||
|                             return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED); |                             return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED); | ||||||
| @@ -913,7 +913,7 @@ mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t si | |||||||
|     pZip->m_archive_size = size; |     pZip->m_archive_size = size; | ||||||
|     pZip->m_pRead = mz_zip_mem_read_func; |     pZip->m_pRead = mz_zip_mem_read_func; | ||||||
|     pZip->m_pIO_opaque = pZip; |     pZip->m_pIO_opaque = pZip; | ||||||
| 	pZip->m_pNeeds_keepalive = NULL; |     pZip->m_pNeeds_keepalive = NULL; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
|     pZip->m_pState->m_pMem = const_cast<void *>(pMem); |     pZip->m_pState->m_pMem = const_cast<void *>(pMem); | ||||||
| @@ -953,8 +953,8 @@ mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_ | |||||||
|  |  | ||||||
| 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) | 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) | ||||||
| { | { | ||||||
| 	mz_uint64 file_size; |     mz_uint64 file_size; | ||||||
| 	MZ_FILE *pFile; |     MZ_FILE *pFile; | ||||||
|  |  | ||||||
|     if ((!pZip) || (!pFilename) || ((archive_size) && (archive_size < MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE))) |     if ((!pZip) || (!pFilename) || ((archive_size) && (archive_size < MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE))) | ||||||
|         return mz_zip_set_error(pZip, MZ_ZIP_INVALID_PARAMETER); |         return mz_zip_set_error(pZip, MZ_ZIP_INVALID_PARAMETER); | ||||||
| @@ -1191,8 +1191,8 @@ static mz_bool mz_zip_file_stat_internal(mz_zip_archive *pZip, mz_uint file_inde | |||||||
|  |  | ||||||
|             do |             do | ||||||
|             { |             { | ||||||
| 				mz_uint32 field_id; |                 mz_uint32 field_id; | ||||||
| 				mz_uint32 field_data_size; |                 mz_uint32 field_data_size; | ||||||
|  |  | ||||||
|                 if (extra_size_remaining < (sizeof(mz_uint16) * 2)) |                 if (extra_size_remaining < (sizeof(mz_uint16) * 2)) | ||||||
|                     return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED); |                     return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED); | ||||||
| @@ -1989,8 +1989,8 @@ mz_bool mz_zip_validate_file(mz_zip_archive *pZip, mz_uint file_index, mz_uint f | |||||||
|  |  | ||||||
|     if ((local_header_extra_len) && ((local_header_comp_size == MZ_UINT32_MAX) || (local_header_uncomp_size == MZ_UINT32_MAX))) |     if ((local_header_extra_len) && ((local_header_comp_size == MZ_UINT32_MAX) || (local_header_uncomp_size == MZ_UINT32_MAX))) | ||||||
|     { |     { | ||||||
| 		mz_uint32 extra_size_remaining = local_header_extra_len; |         mz_uint32 extra_size_remaining = local_header_extra_len; | ||||||
| 		const mz_uint8 *pExtra_data = (const mz_uint8 *)file_data_array.m_p; |         const mz_uint8 *pExtra_data = (const mz_uint8 *)file_data_array.m_p; | ||||||
|  |  | ||||||
|         if (pZip->m_pRead(pZip->m_pIO_opaque, local_header_ofs + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + local_header_filename_len, file_data_array.m_p, local_header_extra_len) != local_header_extra_len) |         if (pZip->m_pRead(pZip->m_pIO_opaque, local_header_ofs + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + local_header_filename_len, file_data_array.m_p, local_header_extra_len) != local_header_extra_len) | ||||||
|         { |         { | ||||||
| @@ -2039,10 +2039,10 @@ mz_bool mz_zip_validate_file(mz_zip_archive *pZip, mz_uint file_index, mz_uint f | |||||||
|     if ((has_data_descriptor) && (!local_header_comp_size) && (!local_header_crc32)) |     if ((has_data_descriptor) && (!local_header_comp_size) && (!local_header_crc32)) | ||||||
|     { |     { | ||||||
|         mz_uint8 descriptor_buf[32]; |         mz_uint8 descriptor_buf[32]; | ||||||
| 		mz_bool has_id; |         mz_bool has_id; | ||||||
| 		const mz_uint8 *pSrc; |         const mz_uint8 *pSrc; | ||||||
| 		mz_uint32 file_crc32; |         mz_uint32 file_crc32; | ||||||
| 		mz_uint64 comp_size = 0, uncomp_size = 0; |         mz_uint64 comp_size = 0, uncomp_size = 0; | ||||||
|  |  | ||||||
|         mz_uint32 num_descriptor_uint32s = ((pState->m_zip64) || (found_zip64_ext_data_in_ldir)) ? 6 : 4; |         mz_uint32 num_descriptor_uint32s = ((pState->m_zip64) || (found_zip64_ext_data_in_ldir)) ? 6 : 4; | ||||||
|  |  | ||||||
| @@ -2053,9 +2053,9 @@ mz_bool mz_zip_validate_file(mz_zip_archive *pZip, mz_uint file_index, mz_uint f | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         has_id = (MZ_READ_LE32(descriptor_buf) == MZ_ZIP_DATA_DESCRIPTOR_ID); |         has_id = (MZ_READ_LE32(descriptor_buf) == MZ_ZIP_DATA_DESCRIPTOR_ID); | ||||||
| 		pSrc = has_id ? (descriptor_buf + sizeof(mz_uint32)) : descriptor_buf; |         pSrc = has_id ? (descriptor_buf + sizeof(mz_uint32)) : descriptor_buf; | ||||||
|  |  | ||||||
|         file_crc32 = MZ_READ_LE32(pSrc);         |         file_crc32 = MZ_READ_LE32(pSrc); | ||||||
|  |  | ||||||
|         if ((pState->m_zip64) || (found_zip64_ext_data_in_ldir)) |         if ((pState->m_zip64) || (found_zip64_ext_data_in_ldir)) | ||||||
|         { |         { | ||||||
| @@ -2409,7 +2409,7 @@ mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size) | |||||||
| 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) | 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) | ||||||
| { | { | ||||||
|     pZip->m_pWrite = mz_zip_heap_write_func; |     pZip->m_pWrite = mz_zip_heap_write_func; | ||||||
| 	pZip->m_pNeeds_keepalive = NULL; |     pZip->m_pNeeds_keepalive = NULL; | ||||||
|  |  | ||||||
|     if (flags & MZ_ZIP_FLAG_WRITE_ALLOW_READING) |     if (flags & MZ_ZIP_FLAG_WRITE_ALLOW_READING) | ||||||
|         pZip->m_pRead = mz_zip_mem_read_func; |         pZip->m_pRead = mz_zip_mem_read_func; | ||||||
| @@ -2466,7 +2466,7 @@ mz_bool mz_zip_writer_init_file_v2(mz_zip_archive *pZip, const char *pFilename, | |||||||
|     MZ_FILE *pFile; |     MZ_FILE *pFile; | ||||||
|  |  | ||||||
|     pZip->m_pWrite = mz_zip_file_write_func; |     pZip->m_pWrite = mz_zip_file_write_func; | ||||||
| 	pZip->m_pNeeds_keepalive = NULL; |     pZip->m_pNeeds_keepalive = NULL; | ||||||
|  |  | ||||||
|     if (flags & MZ_ZIP_FLAG_WRITE_ALLOW_READING) |     if (flags & MZ_ZIP_FLAG_WRITE_ALLOW_READING) | ||||||
|         pZip->m_pRead = mz_zip_file_read_func; |         pZip->m_pRead = mz_zip_file_read_func; | ||||||
| @@ -2511,7 +2511,7 @@ mz_bool mz_zip_writer_init_file_v2(mz_zip_archive *pZip, const char *pFilename, | |||||||
| mz_bool mz_zip_writer_init_cfile(mz_zip_archive *pZip, MZ_FILE *pFile, mz_uint flags) | mz_bool mz_zip_writer_init_cfile(mz_zip_archive *pZip, MZ_FILE *pFile, mz_uint flags) | ||||||
| { | { | ||||||
|     pZip->m_pWrite = mz_zip_file_write_func; |     pZip->m_pWrite = mz_zip_file_write_func; | ||||||
| 	pZip->m_pNeeds_keepalive = NULL; |     pZip->m_pNeeds_keepalive = NULL; | ||||||
|  |  | ||||||
|     if (flags & MZ_ZIP_FLAG_WRITE_ALLOW_READING) |     if (flags & MZ_ZIP_FLAG_WRITE_ALLOW_READING) | ||||||
|         pZip->m_pRead = mz_zip_file_read_func; |         pZip->m_pRead = mz_zip_file_read_func; | ||||||
| @@ -2584,7 +2584,7 @@ mz_bool mz_zip_writer_init_from_reader_v2(mz_zip_archive *pZip, const char *pFil | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         pZip->m_pWrite = mz_zip_file_write_func; |         pZip->m_pWrite = mz_zip_file_write_func; | ||||||
| 		pZip->m_pNeeds_keepalive = NULL; |         pZip->m_pNeeds_keepalive = NULL; | ||||||
| #endif /* #ifdef MINIZ_NO_STDIO */ | #endif /* #ifdef MINIZ_NO_STDIO */ | ||||||
|     } |     } | ||||||
|     else if (pState->m_pMem) |     else if (pState->m_pMem) | ||||||
| @@ -2595,7 +2595,7 @@ mz_bool mz_zip_writer_init_from_reader_v2(mz_zip_archive *pZip, const char *pFil | |||||||
|  |  | ||||||
|         pState->m_mem_capacity = pState->m_mem_size; |         pState->m_mem_capacity = pState->m_mem_size; | ||||||
|         pZip->m_pWrite = mz_zip_heap_write_func; |         pZip->m_pWrite = mz_zip_heap_write_func; | ||||||
| 		pZip->m_pNeeds_keepalive = NULL; |         pZip->m_pNeeds_keepalive = NULL; | ||||||
|     } |     } | ||||||
|     /* Archive is being read via a user provided read function - make sure the user has specified a write function too. */ |     /* Archive is being read via a user provided read function - make sure the user has specified a write function too. */ | ||||||
|     else if (!pZip->m_pWrite) |     else if (!pZip->m_pWrite) | ||||||
| @@ -2650,7 +2650,7 @@ static mz_bool mz_zip_writer_add_put_buf_callback(const void *pBuf, int len, voi | |||||||
| static mz_uint32 mz_zip_writer_create_zip64_extra_data(mz_uint8 *pBuf, mz_uint64 *pUncomp_size, mz_uint64 *pComp_size, mz_uint64 *pLocal_header_ofs) | static mz_uint32 mz_zip_writer_create_zip64_extra_data(mz_uint8 *pBuf, mz_uint64 *pUncomp_size, mz_uint64 *pComp_size, mz_uint64 *pLocal_header_ofs) | ||||||
| { | { | ||||||
|     mz_uint8 *pDst = pBuf; |     mz_uint8 *pDst = pBuf; | ||||||
| 	mz_uint32 field_size = 0; |     mz_uint32 field_size = 0; | ||||||
|  |  | ||||||
|     MZ_WRITE_LE16(pDst + 0, MZ_ZIP64_EXTENDED_INFORMATION_FIELD_HEADER_ID); |     MZ_WRITE_LE16(pDst + 0, MZ_ZIP64_EXTENDED_INFORMATION_FIELD_HEADER_ID); | ||||||
|     MZ_WRITE_LE16(pDst + 2, 0); |     MZ_WRITE_LE16(pDst + 2, 0); | ||||||
| @@ -2878,9 +2878,9 @@ mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_n | |||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| 		MZ_TIME_T cur_time; |         MZ_TIME_T cur_time; | ||||||
| 		time(&cur_time); |         time(&cur_time); | ||||||
| 		mz_zip_time_t_to_dos_time(cur_time, &dos_time, &dos_date); |         mz_zip_time_t_to_dos_time(cur_time, &dos_time, &dos_date); | ||||||
|     } |     } | ||||||
| #endif /* #ifndef MINIZ_NO_TIME */ | #endif /* #ifndef MINIZ_NO_TIME */ | ||||||
|  |  | ||||||
| @@ -3050,8 +3050,8 @@ mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_n | |||||||
|  |  | ||||||
|     if (uncomp_size) |     if (uncomp_size) | ||||||
|     { |     { | ||||||
| 		mz_uint8 local_dir_footer[MZ_ZIP_DATA_DESCRIPTER_SIZE64]; |         mz_uint8 local_dir_footer[MZ_ZIP_DATA_DESCRIPTER_SIZE64]; | ||||||
| 		mz_uint32 local_dir_footer_size = MZ_ZIP_DATA_DESCRIPTER_SIZE32; |         mz_uint32 local_dir_footer_size = MZ_ZIP_DATA_DESCRIPTER_SIZE32; | ||||||
|  |  | ||||||
|         MZ_ASSERT(bit_flags & MZ_ZIP_LDH_BIT_FLAG_HAS_LOCATOR); |         MZ_ASSERT(bit_flags & MZ_ZIP_LDH_BIT_FLAG_HAS_LOCATOR); | ||||||
|  |  | ||||||
| @@ -3308,7 +3308,7 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name, | |||||||
|             { |             { | ||||||
|                 size_t in_buf_size = (mz_uint32)MZ_MIN(uncomp_remaining, (mz_uint64)MZ_ZIP_MAX_IO_BUF_SIZE); |                 size_t in_buf_size = (mz_uint32)MZ_MIN(uncomp_remaining, (mz_uint64)MZ_ZIP_MAX_IO_BUF_SIZE); | ||||||
|                 tdefl_status status; |                 tdefl_status status; | ||||||
| 				tdefl_flush flush = TDEFL_NO_FLUSH; |                 tdefl_flush flush = TDEFL_NO_FLUSH; | ||||||
|  |  | ||||||
|                 if (MZ_FREAD(pRead_buf, 1, in_buf_size, pSrc_file) != in_buf_size) |                 if (MZ_FREAD(pRead_buf, 1, in_buf_size, pSrc_file) != in_buf_size) | ||||||
|                 { |                 { | ||||||
| @@ -3319,8 +3319,8 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name, | |||||||
|                 uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, in_buf_size); |                 uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, in_buf_size); | ||||||
|                 uncomp_remaining -= in_buf_size; |                 uncomp_remaining -= in_buf_size; | ||||||
|  |  | ||||||
| 				if (pZip->m_pNeeds_keepalive != NULL && pZip->m_pNeeds_keepalive(pZip->m_pIO_opaque)) |                 if (pZip->m_pNeeds_keepalive != NULL && pZip->m_pNeeds_keepalive(pZip->m_pIO_opaque)) | ||||||
| 					flush = TDEFL_FULL_FLUSH; |                     flush = TDEFL_FULL_FLUSH; | ||||||
|  |  | ||||||
|                 status = tdefl_compress_buffer(pComp, pRead_buf, in_buf_size, uncomp_remaining ? flush : TDEFL_FINISH); |                 status = tdefl_compress_buffer(pComp, pRead_buf, in_buf_size, uncomp_remaining ? flush : TDEFL_FINISH); | ||||||
|                 if (status == TDEFL_STATUS_DONE) |                 if (status == TDEFL_STATUS_DONE) | ||||||
| @@ -3350,32 +3350,32 @@ mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name, | |||||||
|         pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); |         pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| 	{ |     { | ||||||
| 		mz_uint8 local_dir_footer[MZ_ZIP_DATA_DESCRIPTER_SIZE64]; |         mz_uint8 local_dir_footer[MZ_ZIP_DATA_DESCRIPTER_SIZE64]; | ||||||
| 		mz_uint32 local_dir_footer_size = MZ_ZIP_DATA_DESCRIPTER_SIZE32; |         mz_uint32 local_dir_footer_size = MZ_ZIP_DATA_DESCRIPTER_SIZE32; | ||||||
|  |  | ||||||
| 		MZ_WRITE_LE32(local_dir_footer + 0, MZ_ZIP_DATA_DESCRIPTOR_ID); |         MZ_WRITE_LE32(local_dir_footer + 0, MZ_ZIP_DATA_DESCRIPTOR_ID); | ||||||
| 		MZ_WRITE_LE32(local_dir_footer + 4, uncomp_crc32); |         MZ_WRITE_LE32(local_dir_footer + 4, uncomp_crc32); | ||||||
| 		if (pExtra_data == NULL) |         if (pExtra_data == NULL) | ||||||
| 		{ |         { | ||||||
| 			if (comp_size > MZ_UINT32_MAX) |             if (comp_size > MZ_UINT32_MAX) | ||||||
| 				return mz_zip_set_error(pZip, MZ_ZIP_ARCHIVE_TOO_LARGE); |                 return mz_zip_set_error(pZip, MZ_ZIP_ARCHIVE_TOO_LARGE); | ||||||
|  |  | ||||||
| 			MZ_WRITE_LE32(local_dir_footer + 8, comp_size); |             MZ_WRITE_LE32(local_dir_footer + 8, comp_size); | ||||||
| 			MZ_WRITE_LE32(local_dir_footer + 12, uncomp_size); |             MZ_WRITE_LE32(local_dir_footer + 12, uncomp_size); | ||||||
| 		} |         } | ||||||
| 		else |         else | ||||||
| 		{ |         { | ||||||
| 			MZ_WRITE_LE64(local_dir_footer + 8, comp_size); |             MZ_WRITE_LE64(local_dir_footer + 8, comp_size); | ||||||
| 			MZ_WRITE_LE64(local_dir_footer + 16, uncomp_size); |             MZ_WRITE_LE64(local_dir_footer + 16, uncomp_size); | ||||||
| 			local_dir_footer_size = MZ_ZIP_DATA_DESCRIPTER_SIZE64; |             local_dir_footer_size = MZ_ZIP_DATA_DESCRIPTER_SIZE64; | ||||||
| 		} |         } | ||||||
|  |  | ||||||
| 		if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, local_dir_footer, local_dir_footer_size) != local_dir_footer_size) |         if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, local_dir_footer, local_dir_footer_size) != local_dir_footer_size) | ||||||
| 			return MZ_FALSE; |             return MZ_FALSE; | ||||||
|  |  | ||||||
| 		cur_archive_file_ofs += local_dir_footer_size; |         cur_archive_file_ofs += local_dir_footer_size; | ||||||
| 	} |     } | ||||||
|  |  | ||||||
|     if (pExtra_data != NULL) |     if (pExtra_data != NULL) | ||||||
|     { |     { | ||||||
| @@ -3400,7 +3400,7 @@ mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, | |||||||
|     mz_uint64 uncomp_size = 0; |     mz_uint64 uncomp_size = 0; | ||||||
|     MZ_TIME_T file_modified_time; |     MZ_TIME_T file_modified_time; | ||||||
|     MZ_TIME_T *pFile_time = NULL; |     MZ_TIME_T *pFile_time = NULL; | ||||||
| 	mz_bool status; |     mz_bool status; | ||||||
|  |  | ||||||
|     memset(&file_modified_time, 0, sizeof(file_modified_time)); |     memset(&file_modified_time, 0, sizeof(file_modified_time)); | ||||||
|  |  | ||||||
| @@ -3590,8 +3590,8 @@ mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive * | |||||||
|     if ((local_header_extra_len) && ((local_header_comp_size == MZ_UINT32_MAX) || (local_header_uncomp_size == MZ_UINT32_MAX))) |     if ((local_header_extra_len) && ((local_header_comp_size == MZ_UINT32_MAX) || (local_header_uncomp_size == MZ_UINT32_MAX))) | ||||||
|     { |     { | ||||||
|         mz_zip_array file_data_array; |         mz_zip_array file_data_array; | ||||||
| 		const mz_uint8 *pExtra_data; |         const mz_uint8 *pExtra_data; | ||||||
| 		mz_uint32 extra_size_remaining = local_header_extra_len; |         mz_uint32 extra_size_remaining = local_header_extra_len; | ||||||
|  |  | ||||||
|         mz_zip_array_init(&file_data_array, 1); |         mz_zip_array_init(&file_data_array, 1); | ||||||
|         if (!mz_zip_array_resize(pZip, &file_data_array, local_header_extra_len, MZ_FALSE)) |         if (!mz_zip_array_resize(pZip, &file_data_array, local_header_extra_len, MZ_FALSE)) | ||||||
| @@ -4356,4 +4356,3 @@ mz_bool mz_zip_end(mz_zip_archive *pZip) | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #endif /*#ifndef MINIZ_NO_ARCHIVE_APIS*/ | #endif /*#ifndef MINIZ_NO_ARCHIVE_APIS*/ | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								miniz_zip.h
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								miniz_zip.h
									
									
									
									
									
								
							| @@ -81,16 +81,14 @@ typedef mz_bool (*mz_file_needs_keepalive)(void *pOpaque); | |||||||
| struct mz_zip_internal_state_tag; | struct mz_zip_internal_state_tag; | ||||||
| typedef struct mz_zip_internal_state_tag mz_zip_internal_state; | typedef struct mz_zip_internal_state_tag mz_zip_internal_state; | ||||||
|  |  | ||||||
| typedef enum | typedef enum { | ||||||
| { |  | ||||||
|     MZ_ZIP_MODE_INVALID = 0, |     MZ_ZIP_MODE_INVALID = 0, | ||||||
|     MZ_ZIP_MODE_READING = 1, |     MZ_ZIP_MODE_READING = 1, | ||||||
|     MZ_ZIP_MODE_WRITING = 2, |     MZ_ZIP_MODE_WRITING = 2, | ||||||
|     MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3 |     MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3 | ||||||
| } mz_zip_mode; | } mz_zip_mode; | ||||||
|  |  | ||||||
| typedef enum | typedef enum { | ||||||
| { |  | ||||||
|     MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100, |     MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100, | ||||||
|     MZ_ZIP_FLAG_IGNORE_PATH = 0x0200, |     MZ_ZIP_FLAG_IGNORE_PATH = 0x0200, | ||||||
|     MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400, |     MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400, | ||||||
| @@ -102,8 +100,7 @@ typedef enum | |||||||
|     MZ_ZIP_FLAG_ASCII_FILENAME = 0x10000 |     MZ_ZIP_FLAG_ASCII_FILENAME = 0x10000 | ||||||
| } mz_zip_flags; | } mz_zip_flags; | ||||||
|  |  | ||||||
| typedef enum | typedef enum { | ||||||
| { |  | ||||||
|     MZ_ZIP_TYPE_INVALID = 0, |     MZ_ZIP_TYPE_INVALID = 0, | ||||||
|     MZ_ZIP_TYPE_USER, |     MZ_ZIP_TYPE_USER, | ||||||
|     MZ_ZIP_TYPE_MEMORY, |     MZ_ZIP_TYPE_MEMORY, | ||||||
| @@ -114,8 +111,7 @@ typedef enum | |||||||
| } mz_zip_type; | } mz_zip_type; | ||||||
|  |  | ||||||
| /* miniz error codes. Be sure to update mz_zip_get_error_string() if you add or modify this enum. */ | /* miniz error codes. Be sure to update mz_zip_get_error_string() if you add or modify this enum. */ | ||||||
| typedef enum | typedef enum { | ||||||
| { |  | ||||||
|     MZ_ZIP_NO_ERROR = 0, |     MZ_ZIP_NO_ERROR = 0, | ||||||
|     MZ_ZIP_UNDEFINED_ERROR, |     MZ_ZIP_UNDEFINED_ERROR, | ||||||
|     MZ_ZIP_TOO_MANY_FILES, |     MZ_ZIP_TOO_MANY_FILES, | ||||||
| @@ -171,7 +167,7 @@ typedef struct | |||||||
|  |  | ||||||
|     mz_file_read_func m_pRead; |     mz_file_read_func m_pRead; | ||||||
|     mz_file_write_func m_pWrite; |     mz_file_write_func m_pWrite; | ||||||
| 	mz_file_needs_keepalive m_pNeeds_keepalive; |     mz_file_needs_keepalive m_pNeeds_keepalive; | ||||||
|     void *m_pIO_opaque; |     void *m_pIO_opaque; | ||||||
|  |  | ||||||
|     mz_zip_internal_state *m_pState; |     mz_zip_internal_state *m_pState; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user