| 1 | /* mz.h -- Errors codes, zip flags and magic |
| 2 | part of the minizip-ng project |
| 3 | |
| 4 | Copyright (C) Nathan Moinvaziri |
| 5 | https://github.com/zlib-ng/minizip-ng |
| 6 | |
| 7 | This program is distributed under the terms of the same license as zlib. |
| 8 | See the accompanying LICENSE file for the full text of the license. |
| 9 | */ |
| 10 | |
| 11 | #ifndef MZ_H |
| 12 | #define MZ_Hcxx . . $ `mz.h:12:9`! |
| 13 | |
| 14 | /***************************************************************************/ |
| 15 | |
| 16 | /* MZ_VERSION */ |
| 17 | #define MZ_VERSIONcxx . . $ `mz.h:17:9`! ("4.0.10") |
| 18 | #define MZ_VERSION_BUILDcxx . . $ `mz.h:18:9`! (0x04000A) |
| 19 | |
| 20 | /* MZ_ERROR */ |
| 21 | #define MZ_OKcxx . . $ `mz.h:21:9`! (0) /* zlib */ |
| 22 | #define MZ_STREAM_ERRORcxx . . $ `mz.h:22:9`! (-1) /* zlib */ |
| 23 | #define MZ_DATA_ERRORcxx . . $ `mz.h:23:9`! (-3) /* zlib */ |
| 24 | #define MZ_MEM_ERRORcxx . . $ `mz.h:24:9`! (-4) /* zlib */ |
| 25 | #define MZ_BUF_ERRORcxx . . $ `mz.h:25:9`! (-5) /* zlib */ |
| 26 | #define MZ_VERSION_ERRORcxx . . $ `mz.h:26:9`! (-6) /* zlib */ |
| 27 | |
| 28 | #define MZ_END_OF_LISTcxx . . $ `mz.h:28:9`! (-100) |
| 29 | #define MZ_END_OF_STREAMcxx . . $ `mz.h:29:9`! (-101) |
| 30 | |
| 31 | #define MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`! (-102) |
| 32 | #define MZ_FORMAT_ERRORcxx . . $ `mz.h:32:9`! (-103) |
| 33 | #define MZ_INTERNAL_ERRORcxx . . $ `mz.h:33:9`! (-104) |
| 34 | #define MZ_CRC_ERRORcxx . . $ `mz.h:34:9`! (-105) |
| 35 | #define MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`! (-106) |
| 36 | #define MZ_EXIST_ERRORcxx . . $ `mz.h:36:9`! (-107) |
| 37 | #define MZ_PASSWORD_ERRORcxx . . $ `mz.h:37:9`! (-108) |
| 38 | #define MZ_SUPPORT_ERRORcxx . . $ `mz.h:38:9`! (-109) |
| 39 | #define MZ_HASH_ERRORcxx . . $ `mz.h:39:9`! (-110) |
| 40 | #define MZ_OPEN_ERRORcxx . . $ `mz.h:40:9`! (-111) |
| 41 | #define MZ_CLOSE_ERRORcxx . . $ `mz.h:41:9`! (-112) |
| 42 | #define MZ_SEEK_ERRORcxx . . $ `mz.h:42:9`! (-113) |
| 43 | #define MZ_TELL_ERRORcxx . . $ `mz.h:43:9`! (-114) |
| 44 | #define MZ_READ_ERRORcxx . . $ `mz.h:44:9`! (-115) |
| 45 | #define MZ_WRITE_ERRORcxx . . $ `mz.h:45:9`! (-116) |
| 46 | #define MZ_SIGN_ERRORcxx . . $ `mz.h:46:9`! (-117) |
| 47 | #define MZ_SYMLINK_ERRORcxx . . $ `mz.h:47:9`! (-118) |
| 48 | |
| 49 | /* MZ_OPEN */ |
| 50 | #define MZ_OPEN_MODE_READcxx . . $ `mz.h:50:9`! (0x01) |
| 51 | #define MZ_OPEN_MODE_WRITEcxx . . $ `mz.h:51:9`! (0x02) |
| 52 | #define MZ_OPEN_MODE_READWRITEcxx . . $ `mz.h:52:9`! (MZ_OPEN_MODE_READ | MZ_OPEN_MODE_WRITE) |
| 53 | #define MZ_OPEN_MODE_APPENDcxx . . $ `mz.h:53:9`! (0x04) |
| 54 | #define MZ_OPEN_MODE_CREATEcxx . . $ `mz.h:54:9`! (0x08) |
| 55 | #define MZ_OPEN_MODE_EXISTINGcxx . . $ `mz.h:55:9`! (0x10) |
| 56 | |
| 57 | /* MZ_SEEK */ |
| 58 | #define MZ_SEEK_SETcxx . . $ `mz.h:58:9`! (0) |
| 59 | #define MZ_SEEK_CURcxx . . $ `mz.h:59:9`! (1) |
| 60 | #define MZ_SEEK_ENDcxx . . $ `mz.h:60:9`! (2) |
| 61 | |
| 62 | /* MZ_COMPRESS */ |
| 63 | #define MZ_COMPRESS_METHOD_STOREcxx . . $ `mz.h:63:9`! (0) |
| 64 | #define MZ_COMPRESS_METHOD_DEFLATEcxx . . $ `mz.h:64:9`! (8) |
| 65 | #define MZ_COMPRESS_METHOD_BZIP2cxx . . $ `mz.h:65:9`! (12) |
| 66 | #define MZ_COMPRESS_METHOD_LZMAcxx . . $ `mz.h:66:9`! (14) |
| 67 | #define MZ_COMPRESS_METHOD_ZSTDcxx . . $ `mz.h:67:9`! (93) |
| 68 | #define MZ_COMPRESS_METHOD_XZcxx . . $ `mz.h:68:9`! (95) |
| 69 | #define MZ_COMPRESS_METHOD_AEScxx . . $ `mz.h:69:9`! (99) |
| 70 | |
| 71 | #define MZ_COMPRESS_LEVEL_DEFAULTcxx . . $ `mz.h:71:9`! (-1) |
| 72 | #define MZ_COMPRESS_LEVEL_FASTcxx . . $ `mz.h:72:9`! (2) |
| 73 | #define MZ_COMPRESS_LEVEL_NORMALcxx . . $ `mz.h:73:9`! (6) |
| 74 | #define MZ_COMPRESS_LEVEL_BESTcxx . . $ `mz.h:74:9`! (9) |
| 75 | |
| 76 | /* MZ_ZIP_FLAG */ |
| 77 | #define MZ_ZIP_FLAG_ENCRYPTEDcxx . . $ `mz.h:77:9`! (1 << 0) |
| 78 | #define MZ_ZIP_FLAG_LZMA_EOS_MARKERcxx . . $ `mz.h:78:9`! (1 << 1) |
| 79 | #define MZ_ZIP_FLAG_DEFLATE_MAXcxx . . $ `mz.h:79:9`! (1 << 1) |
| 80 | #define MZ_ZIP_FLAG_DEFLATE_NORMALcxx . . $ `mz.h:80:9`! (0) |
| 81 | #define MZ_ZIP_FLAG_DEFLATE_FASTcxx . . $ `mz.h:81:9`! (1 << 2) |
| 82 | #define MZ_ZIP_FLAG_DEFLATE_SUPER_FASTcxx . . $ `mz.h:82:9`! (MZ_ZIP_FLAG_DEFLATE_FAST | MZ_ZIP_FLAG_DEFLATE_MAX) |
| 83 | #define MZ_ZIP_FLAG_DATA_DESCRIPTORcxx . . $ `mz.h:83:9`! (1 << 3) |
| 84 | #define MZ_ZIP_FLAG_UTF8cxx . . $ `mz.h:84:9`! (1 << 11) |
| 85 | #define MZ_ZIP_FLAG_MASK_LOCAL_INFOcxx . . $ `mz.h:85:9`! (1 << 13) |
| 86 | |
| 87 | /* MZ_ZIP_EXTENSION */ |
| 88 | #define MZ_ZIP_EXTENSION_ZIP64cxx . . $ `mz.h:88:9`! (0x0001) |
| 89 | #define MZ_ZIP_EXTENSION_NTFScxx . . $ `mz.h:89:9`! (0x000a) |
| 90 | #define MZ_ZIP_EXTENSION_AEScxx . . $ `mz.h:90:9`! (0x9901) |
| 91 | #define MZ_ZIP_EXTENSION_UNIX1cxx . . $ `mz.h:91:9`! (0x000d) |
| 92 | #define MZ_ZIP_EXTENSION_SIGNcxx . . $ `mz.h:92:9`! (0x10c5) |
| 93 | #define MZ_ZIP_EXTENSION_HASHcxx . . $ `mz.h:93:9`! (0x1a51) |
| 94 | #define MZ_ZIP_EXTENSION_CDCDcxx . . $ `mz.h:94:9`! (0xcdcd) |
| 95 | |
| 96 | /* MZ_ZIP64 */ |
| 97 | #define MZ_ZIP64_AUTOcxx . . $ `mz.h:97:9`! (0) |
| 98 | #define MZ_ZIP64_FORCEcxx . . $ `mz.h:98:9`! (1) |
| 99 | #define MZ_ZIP64_DISABLEcxx . . $ `mz.h:99:9`! (2) |
| 100 | |
| 101 | /* MZ_HOST_SYSTEM */ |
| 102 | #define MZ_HOST_SYSTEMcxx . . $ `mz.h:102:9`!(VERSION_MADEBY) ((uint8_t)(VERSION_MADEBY >> 8)) |
| 103 | #define MZ_HOST_SYSTEM_MSDOScxx . . $ `mz.h:103:9`! (0) |
| 104 | #define MZ_HOST_SYSTEM_UNIXcxx . . $ `mz.h:104:9`! (3) |
| 105 | #define MZ_HOST_SYSTEM_WINDOWS_NTFScxx . . $ `mz.h:105:9`! (10) |
| 106 | #define MZ_HOST_SYSTEM_RISCOScxx . . $ `mz.h:106:9`! (13) |
| 107 | #define MZ_HOST_SYSTEM_OSX_DARWINcxx . . $ `mz.h:107:9`! (19) |
| 108 | |
| 109 | /* MZ_PKCRYPT */ |
| 110 | #define MZ_PKCRYPT_HEADER_SIZEcxx . . $ `mz.h:110:9`! (12) |
| 111 | |
| 112 | /* MZ_AES */ |
| 113 | #define MZ_AES_VERSIONcxx . . $ `mz.h:113:9`! (1) |
| 114 | #define MZ_AES_MODE_ECBcxx . . $ `mz.h:114:9`! (0) |
| 115 | #define MZ_AES_MODE_CBCcxx . . $ `mz.h:115:9`! (1) |
| 116 | #define MZ_AES_MODE_GCMcxx . . $ `mz.h:116:9`! (2) |
| 117 | #define MZ_AES_STRENGTH_128cxx . . $ `mz.h:117:9`! (1) |
| 118 | #define MZ_AES_STRENGTH_192cxx . . $ `mz.h:118:9`! (2) |
| 119 | #define MZ_AES_STRENGTH_256cxx . . $ `mz.h:119:9`! (3) |
| 120 | #define MZ_AES_KEY_LENGTH_MAXcxx . . $ `mz.h:120:9`! (32) |
| 121 | #define MZ_AES_BLOCK_SIZEcxx . . $ `mz.h:121:9`! (16) |
| 122 | #define MZ_AES_FOOTER_SIZEcxx . . $ `mz.h:122:9`! (10) |
| 123 | |
| 124 | /* MZ_HASH */ |
| 125 | #define MZ_HASH_MD5cxx . . $ `mz.h:125:9`! (10) |
| 126 | #define MZ_HASH_MD5_SIZEcxx . . $ `mz.h:126:9`! (16) |
| 127 | #define MZ_HASH_SHA1cxx . . $ `mz.h:127:9`! (20) |
| 128 | #define MZ_HASH_SHA1_SIZEcxx . . $ `mz.h:128:9`! (20) |
| 129 | #define MZ_HASH_SHA224cxx . . $ `mz.h:129:9`! (22) |
| 130 | #define MZ_HASH_SHA224_SIZEcxx . . $ `mz.h:130:9`! (28) |
| 131 | #define MZ_HASH_SHA256cxx . . $ `mz.h:131:9`! (23) |
| 132 | #define MZ_HASH_SHA256_SIZEcxx . . $ `mz.h:132:9`! (32) |
| 133 | #define MZ_HASH_SHA384cxx . . $ `mz.h:133:9`! (24) |
| 134 | #define MZ_HASH_SHA384_SIZEcxx . . $ `mz.h:134:9`! (48) |
| 135 | #define MZ_HASH_SHA512cxx . . $ `mz.h:135:9`! (25) |
| 136 | #define MZ_HASH_SHA512_SIZEcxx . . $ `mz.h:136:9`! (64) |
| 137 | #define MZ_HASH_MAX_SIZEcxx . . $ `mz.h:137:9`! (256) |
| 138 | |
| 139 | /* MZ_ENCODING */ |
| 140 | #define MZ_ENCODING_CODEPAGE_437cxx . . $ `mz.h:140:9`! (437) |
| 141 | #define MZ_ENCODING_CODEPAGE_932cxx . . $ `mz.h:141:9`! (932) |
| 142 | #define MZ_ENCODING_CODEPAGE_936cxx . . $ `mz.h:142:9`! (936) |
| 143 | #define MZ_ENCODING_CODEPAGE_950cxx . . $ `mz.h:143:9`! (950) |
| 144 | #define MZ_ENCODING_UTF8cxx . . $ `mz.h:144:9`! (65001) |
| 145 | |
| 146 | /* MZ_UTILITY */ |
| 147 | #define MZ_UNUSEDcxx . . $ `mz.h:147:9`!(SYMBOL) ((void)SYMBOL) |
| 148 | |
| 149 | #if defined(_WIN32) && defined(MZ_EXPORTS) |
| 150 | # define MZ_EXPORT __declspec(dllexport) |
| 151 | #else |
| 152 | # define MZ_EXPORTcxx . . $ `mz.h:152:11`! |
| 153 | #endif |
| 154 | |
| 155 | /***************************************************************************/ |
| 156 | |
| 157 | #include <stdlib.h> /* size_t, NULL, malloc */ |
| 158 | #include <time.h> /* time_t, time() */ |
| 159 | #include <string.h> /* memset, strncpy, strlen */ |
| 160 | #include <limits.h> |
| 161 | |
| 162 | #if defined(HAVE_STDINT_Hcxx . . $ `<built-in>:415:9`!) |
| 163 | # include <stdint.h> |
| 164 | #elif defined(__has_include) |
| 165 | # if __has_include(<stdint.h>) |
| 166 | # include <stdint.h> |
| 167 | # endif |
| 168 | #endif |
| 169 | |
| 170 | #ifndef INT8_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:110:10`! |
| 171 | typedef signed char int8_t; |
| 172 | #endif |
| 173 | #ifndef INT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:111:10`! |
| 174 | typedef short int16_t; |
| 175 | #endif |
| 176 | #ifndef INT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:112:10`! |
| 177 | typedef int int32_t; |
| 178 | #endif |
| 179 | #ifndef INT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:113:10`! |
| 180 | typedef long long int64_t; |
| 181 | #endif |
| 182 | #ifndef UINT8_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:116:10`! |
| 183 | typedef unsigned char uint8_t; |
| 184 | #endif |
| 185 | #ifndef UINT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:117:10`! |
| 186 | typedef unsigned short uint16_t; |
| 187 | #endif |
| 188 | #ifndef UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`! |
| 189 | typedef unsigned int uint32_t; |
| 190 | #endif |
| 191 | #ifndef UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`! |
| 192 | typedef unsigned long long uint64_t; |
| 193 | #endif |
| 194 | |
| 195 | #if defined(HAVE_INTTYPES_Hcxx . . $ `<built-in>:413:9`!) |
| 196 | # include <inttypes.h> |
| 197 | #elif defined(__has_include) |
| 198 | # if __has_include(<inttypes.h>) |
| 199 | # include <inttypes.h> |
| 200 | # endif |
| 201 | #endif |
| 202 | |
| 203 | #ifndef PRId8cxx . . $ `<external>/15933738808807975373/inttypes.h:54:10`! |
| 204 | # define PRId8 "hhd" |
| 205 | #endif |
| 206 | #ifndef PRIu8cxx . . $ `<external>/15933738808807975373/inttypes.h:102:10`! |
| 207 | # define PRIu8 "hhu" |
| 208 | #endif |
| 209 | #ifndef PRIx8cxx . . $ `<external>/15933738808807975373/inttypes.h:118:10`! |
| 210 | # define PRIx8 "hhx" |
| 211 | #endif |
| 212 | #ifndef PRId16cxx . . $ `<external>/15933738808807975373/inttypes.h:55:10`! |
| 213 | # define PRId16 "hd" |
| 214 | #endif |
| 215 | #ifndef PRIu16cxx . . $ `<external>/15933738808807975373/inttypes.h:103:10`! |
| 216 | # define PRIu16 "hu" |
| 217 | #endif |
| 218 | #ifndef PRIx16cxx . . $ `<external>/15933738808807975373/inttypes.h:119:10`! |
| 219 | # define PRIx16 "hx" |
| 220 | #endif |
| 221 | #ifndef PRId32cxx . . $ `<external>/15933738808807975373/inttypes.h:56:10`! |
| 222 | # define PRId32 "d" |
| 223 | #endif |
| 224 | #ifndef PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:104:10`! |
| 225 | # define PRIu32 "u" |
| 226 | #endif |
| 227 | #ifndef PRIx32cxx . . $ `<external>/15933738808807975373/inttypes.h:120:10`! |
| 228 | # define PRIx32 "x" |
| 229 | #endif |
| 230 | #if ULONG_MAXcxx . . $ `<external>/67164224788392828/limits.h:135:9`! == 0xfffffffful |
| 231 | # ifndef PRId64 |
| 232 | # define PRId64 "ld" |
| 233 | # endif |
| 234 | # ifndef PRIu64 |
| 235 | # define PRIu64 "lu" |
| 236 | # endif |
| 237 | # ifndef PRIx64 |
| 238 | # define PRIx64 "lx" |
| 239 | # endif |
| 240 | #else |
| 241 | # ifndef PRId64cxx . . $ `<external>/15933738808807975373/inttypes.h:57:10`! |
| 242 | # define PRId64 "lld" |
| 243 | # endif |
| 244 | # ifndef PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! |
| 245 | # define PRIu64 "llu" |
| 246 | # endif |
| 247 | # ifndef PRIx64cxx . . $ `<external>/15933738808807975373/inttypes.h:121:10`! |
| 248 | # define PRIx64 "llx" |
| 249 | # endif |
| 250 | #endif |
| 251 | |
| 252 | #ifndef INT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:111:10`! |
| 253 | # define INT16_MAX 32767 |
| 254 | #endif |
| 255 | #ifndef INT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:112:10`! |
| 256 | # define INT32_MAX 2147483647L |
| 257 | #endif |
| 258 | #ifndef INT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:113:10`! |
| 259 | # define INT64_MAX 9223372036854775807LL |
| 260 | #endif |
| 261 | #ifndef UINT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:117:10`! |
| 262 | # define UINT16_MAX 65535U |
| 263 | #endif |
| 264 | #ifndef UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`! |
| 265 | # define UINT32_MAX 4294967295UL |
| 266 | #endif |
| 267 | #ifndef UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`! |
| 268 | # define UINT64_MAX 18446744073709551615ULL |
| 269 | #endif |
| 270 | |
| 271 | /***************************************************************************/ |
| 272 | |
| 273 | #endif |