koffi 2.3.6-beta.6 → 2.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +2 -2
  3. package/src/cnoke/cnoke.js +3 -7
  4. package/src/cnoke/src/builder.js +9 -6
  5. package/src/cnoke/src/index.js +2 -2
  6. package/src/koffi/build/2.3.7/koffi_darwin_arm64/koffi.node +0 -0
  7. package/src/koffi/build/2.3.7/koffi_darwin_x64/koffi.node +0 -0
  8. package/src/koffi/build/2.3.7/koffi_freebsd_arm64/koffi.node +0 -0
  9. package/src/koffi/build/2.3.7/koffi_freebsd_ia32/koffi.node +0 -0
  10. package/src/koffi/build/2.3.7/koffi_freebsd_x64/koffi.node +0 -0
  11. package/src/koffi/build/2.3.7/koffi_linux_arm32hf/koffi.node +0 -0
  12. package/src/koffi/build/2.3.7/koffi_linux_arm64/koffi.node +0 -0
  13. package/src/koffi/build/2.3.7/koffi_linux_ia32/koffi.node +0 -0
  14. package/src/koffi/build/2.3.7/koffi_linux_riscv64hf64/koffi.node +0 -0
  15. package/src/koffi/build/2.3.7/koffi_linux_x64/koffi.node +0 -0
  16. package/src/koffi/build/2.3.7/koffi_openbsd_ia32/koffi.node +0 -0
  17. package/src/koffi/build/2.3.7/koffi_openbsd_x64/koffi.node +0 -0
  18. package/src/koffi/build/2.3.7/koffi_win32_arm64/koffi.node +0 -0
  19. package/src/koffi/build/2.3.7/koffi_win32_ia32/koffi.node +0 -0
  20. package/src/koffi/build/2.3.7/koffi_win32_x64/koffi.node +0 -0
  21. package/src/koffi/src/ffi.cc +2 -2
  22. package/src/koffi/src/index.d.ts +2 -2
  23. package/src/koffi/src/index.js +1 -0
  24. package/src/koffi/build/2.3.6-beta.6/koffi_darwin_arm64/koffi.node +0 -0
  25. package/src/koffi/build/2.3.6-beta.6/koffi_darwin_x64/koffi.node +0 -0
  26. package/src/koffi/build/2.3.6-beta.6/koffi_freebsd_arm64/koffi.node +0 -0
  27. package/src/koffi/build/2.3.6-beta.6/koffi_freebsd_ia32/koffi.node +0 -0
  28. package/src/koffi/build/2.3.6-beta.6/koffi_freebsd_x64/koffi.node +0 -0
  29. package/src/koffi/build/2.3.6-beta.6/koffi_linux_arm32hf/koffi.node +0 -0
  30. package/src/koffi/build/2.3.6-beta.6/koffi_linux_arm64/koffi.node +0 -0
  31. package/src/koffi/build/2.3.6-beta.6/koffi_linux_ia32/koffi.node +0 -0
  32. package/src/koffi/build/2.3.6-beta.6/koffi_linux_riscv64hf64/koffi.node +0 -0
  33. package/src/koffi/build/2.3.6-beta.6/koffi_linux_x64/koffi.node +0 -0
  34. package/src/koffi/build/2.3.6-beta.6/koffi_openbsd_ia32/koffi.node +0 -0
  35. package/src/koffi/build/2.3.6-beta.6/koffi_openbsd_x64/koffi.node +0 -0
  36. package/src/koffi/build/2.3.6-beta.6/koffi_win32_arm64/koffi.node +0 -0
  37. package/src/koffi/build/2.3.6-beta.6/koffi_win32_arm64/koffi.pdb +0 -0
  38. package/src/koffi/build/2.3.6-beta.6/koffi_win32_ia32/koffi.node +0 -0
  39. package/src/koffi/build/2.3.6-beta.6/koffi_win32_ia32/koffi.pdb +0 -0
  40. package/src/koffi/build/2.3.6-beta.6/koffi_win32_x64/koffi.node +0 -0
  41. package/src/koffi/build/2.3.6-beta.6/koffi_win32_x64/koffi.pdb +0 -0
  42. package/vendor/brotli/BUILD +0 -144
  43. package/vendor/brotli/CMakeLists.txt +0 -421
  44. package/vendor/brotli/CONTRIBUTING.md +0 -27
  45. package/vendor/brotli/LICENSE +0 -19
  46. package/vendor/brotli/MANIFEST.in +0 -17
  47. package/vendor/brotli/Makefile +0 -55
  48. package/vendor/brotli/Makefile.am +0 -38
  49. package/vendor/brotli/README +0 -15
  50. package/vendor/brotli/README.md +0 -104
  51. package/vendor/brotli/WORKSPACE +0 -21
  52. package/vendor/brotli/bootstrap +0 -35
  53. package/vendor/brotli/c/common/constants.c +0 -15
  54. package/vendor/brotli/c/common/constants.h +0 -200
  55. package/vendor/brotli/c/common/context.c +0 -156
  56. package/vendor/brotli/c/common/context.h +0 -113
  57. package/vendor/brotli/c/common/dictionary.c +0 -5914
  58. package/vendor/brotli/c/common/dictionary.h +0 -64
  59. package/vendor/brotli/c/common/platform.c +0 -22
  60. package/vendor/brotli/c/common/platform.h +0 -596
  61. package/vendor/brotli/c/common/transform.c +0 -291
  62. package/vendor/brotli/c/common/transform.h +0 -85
  63. package/vendor/brotli/c/common/version.h +0 -26
  64. package/vendor/brotli/c/dec/bit_reader.c +0 -76
  65. package/vendor/brotli/c/dec/bit_reader.h +0 -351
  66. package/vendor/brotli/c/dec/decode.c +0 -2608
  67. package/vendor/brotli/c/dec/huffman.c +0 -339
  68. package/vendor/brotli/c/dec/huffman.h +0 -121
  69. package/vendor/brotli/c/dec/prefix.h +0 -732
  70. package/vendor/brotli/c/dec/state.c +0 -159
  71. package/vendor/brotli/c/dec/state.h +0 -365
  72. package/vendor/brotli/c/enc/backward_references.c +0 -145
  73. package/vendor/brotli/c/enc/backward_references.h +0 -39
  74. package/vendor/brotli/c/enc/backward_references_hq.c +0 -843
  75. package/vendor/brotli/c/enc/backward_references_hq.h +0 -95
  76. package/vendor/brotli/c/enc/backward_references_inc.h +0 -163
  77. package/vendor/brotli/c/enc/bit_cost.c +0 -35
  78. package/vendor/brotli/c/enc/bit_cost.h +0 -63
  79. package/vendor/brotli/c/enc/bit_cost_inc.h +0 -127
  80. package/vendor/brotli/c/enc/block_encoder_inc.h +0 -34
  81. package/vendor/brotli/c/enc/block_splitter.c +0 -194
  82. package/vendor/brotli/c/enc/block_splitter.h +0 -51
  83. package/vendor/brotli/c/enc/block_splitter_inc.h +0 -440
  84. package/vendor/brotli/c/enc/brotli_bit_stream.c +0 -1314
  85. package/vendor/brotli/c/enc/brotli_bit_stream.h +0 -84
  86. package/vendor/brotli/c/enc/cluster.c +0 -56
  87. package/vendor/brotli/c/enc/cluster.h +0 -48
  88. package/vendor/brotli/c/enc/cluster_inc.h +0 -320
  89. package/vendor/brotli/c/enc/command.c +0 -28
  90. package/vendor/brotli/c/enc/command.h +0 -190
  91. package/vendor/brotli/c/enc/compress_fragment.c +0 -790
  92. package/vendor/brotli/c/enc/compress_fragment.h +0 -61
  93. package/vendor/brotli/c/enc/compress_fragment_two_pass.c +0 -645
  94. package/vendor/brotli/c/enc/compress_fragment_two_pass.h +0 -54
  95. package/vendor/brotli/c/enc/dictionary_hash.c +0 -1846
  96. package/vendor/brotli/c/enc/dictionary_hash.h +0 -25
  97. package/vendor/brotli/c/enc/encode.c +0 -1927
  98. package/vendor/brotli/c/enc/encoder_dict.c +0 -33
  99. package/vendor/brotli/c/enc/encoder_dict.h +0 -43
  100. package/vendor/brotli/c/enc/entropy_encode.c +0 -503
  101. package/vendor/brotli/c/enc/entropy_encode.h +0 -122
  102. package/vendor/brotli/c/enc/entropy_encode_static.h +0 -539
  103. package/vendor/brotli/c/enc/fast_log.c +0 -105
  104. package/vendor/brotli/c/enc/fast_log.h +0 -66
  105. package/vendor/brotli/c/enc/find_match_length.h +0 -79
  106. package/vendor/brotli/c/enc/hash.h +0 -488
  107. package/vendor/brotli/c/enc/hash_composite_inc.h +0 -125
  108. package/vendor/brotli/c/enc/hash_forgetful_chain_inc.h +0 -293
  109. package/vendor/brotli/c/enc/hash_longest_match64_inc.h +0 -267
  110. package/vendor/brotli/c/enc/hash_longest_match_inc.h +0 -262
  111. package/vendor/brotli/c/enc/hash_longest_match_quickly_inc.h +0 -266
  112. package/vendor/brotli/c/enc/hash_rolling_inc.h +0 -212
  113. package/vendor/brotli/c/enc/hash_to_binary_tree_inc.h +0 -329
  114. package/vendor/brotli/c/enc/histogram.c +0 -100
  115. package/vendor/brotli/c/enc/histogram.h +0 -63
  116. package/vendor/brotli/c/enc/histogram_inc.h +0 -51
  117. package/vendor/brotli/c/enc/literal_cost.c +0 -175
  118. package/vendor/brotli/c/enc/literal_cost.h +0 -30
  119. package/vendor/brotli/c/enc/memory.c +0 -170
  120. package/vendor/brotli/c/enc/memory.h +0 -114
  121. package/vendor/brotli/c/enc/metablock.c +0 -663
  122. package/vendor/brotli/c/enc/metablock.h +0 -105
  123. package/vendor/brotli/c/enc/metablock_inc.h +0 -183
  124. package/vendor/brotli/c/enc/params.h +0 -46
  125. package/vendor/brotli/c/enc/prefix.h +0 -53
  126. package/vendor/brotli/c/enc/quality.h +0 -165
  127. package/vendor/brotli/c/enc/ringbuffer.h +0 -167
  128. package/vendor/brotli/c/enc/static_dict.c +0 -486
  129. package/vendor/brotli/c/enc/static_dict.h +0 -40
  130. package/vendor/brotli/c/enc/static_dict_lut.h +0 -5864
  131. package/vendor/brotli/c/enc/utf8_util.c +0 -85
  132. package/vendor/brotli/c/enc/utf8_util.h +0 -32
  133. package/vendor/brotli/c/enc/write_bits.h +0 -87
  134. package/vendor/brotli/c/include/brotli/decode.h +0 -344
  135. package/vendor/brotli/c/include/brotli/encode.h +0 -448
  136. package/vendor/brotli/c/include/brotli/port.h +0 -288
  137. package/vendor/brotli/c/include/brotli/types.h +0 -83
  138. package/vendor/brotli/c/tools/brotli.c +0 -1116
  139. package/vendor/brotli/c/tools/brotli.md +0 -107
  140. package/vendor/brotli/compiler_config_setting.bzl +0 -28
  141. package/vendor/brotli/configure +0 -8
  142. package/vendor/brotli/configure-cmake +0 -318
  143. package/vendor/brotli/configure.ac +0 -14
  144. package/vendor/brotli/docs/brotli.1 +0 -132
  145. package/vendor/brotli/docs/constants.h.3 +0 -47
  146. package/vendor/brotli/docs/decode.h.3 +0 -415
  147. package/vendor/brotli/docs/encode.h.3 +0 -586
  148. package/vendor/brotli/docs/types.h.3 +0 -117
  149. package/vendor/brotli/premake5.lua +0 -78
  150. package/vendor/brotli/python/Makefile +0 -57
  151. package/vendor/brotli/python/README.md +0 -54
  152. package/vendor/brotli/python/_brotli.cc +0 -753
  153. package/vendor/brotli/python/bro.py +0 -160
  154. package/vendor/brotli/python/brotli.py +0 -56
  155. package/vendor/brotli/python/tests/__init__.py +0 -0
  156. package/vendor/brotli/python/tests/_test_utils.py +0 -112
  157. package/vendor/brotli/python/tests/bro_test.py +0 -102
  158. package/vendor/brotli/python/tests/compress_test.py +0 -41
  159. package/vendor/brotli/python/tests/compressor_test.py +0 -94
  160. package/vendor/brotli/python/tests/decompress_test.py +0 -42
  161. package/vendor/brotli/python/tests/decompressor_test.py +0 -59
  162. package/vendor/brotli/scripts/libbrotlicommon.pc.in +0 -11
  163. package/vendor/brotli/scripts/libbrotlidec.pc.in +0 -12
  164. package/vendor/brotli/scripts/libbrotlienc.pc.in +0 -12
  165. package/vendor/brotli/scripts/sources.lst +0 -104
  166. package/vendor/brotli/setup.cfg +0 -5
  167. package/vendor/brotli/setup.py +0 -293
  168. package/vendor/brotli/tests/Makefile +0 -17
  169. package/vendor/brotli/tests/compatibility_test.sh +0 -25
  170. package/vendor/brotli/tests/roundtrip_test.sh +0 -36
  171. package/vendor/brotli/tests/run-compatibility-test.cmake +0 -31
  172. package/vendor/brotli/tests/run-roundtrip-test.cmake +0 -36
  173. package/vendor/brotli/tests/testdata/empty +0 -0
  174. package/vendor/brotli/tests/testdata/empty.compressed +0 -1
  175. package/vendor/brotli/tests/testdata/ukkonooa +0 -1
  176. package/vendor/brotli/tests/testdata/ukkonooa.compressed +0 -0
  177. package/vendor/dragonbox/CMakeLists.txt +0 -123
  178. package/vendor/dragonbox/LICENSE-Apache2-LLVM +0 -218
  179. package/vendor/dragonbox/LICENSE-Boost +0 -23
  180. package/vendor/dragonbox/README.md +0 -277
  181. package/vendor/dragonbox/cmake/dragonboxConfig.cmake +0 -1
  182. package/vendor/dragonbox/include/dragonbox/dragonbox.h +0 -2674
  183. package/vendor/dragonbox/include/dragonbox/dragonbox_to_chars.h +0 -108
  184. package/vendor/dragonbox/other_files/Dragonbox.pdf +0 -0
  185. package/vendor/dragonbox/other_files/Dragonbox_old.pdf +0 -0
  186. package/vendor/dragonbox/other_files/milo_benchmark.png +0 -0
  187. package/vendor/dragonbox/other_files/unknown_win64_vc2019.html +0 -540
  188. package/vendor/dragonbox/other_files/unknown_win64_vc2019_randomdigit_time.png +0 -0
  189. package/vendor/dragonbox/source/dragonbox_to_chars.cpp +0 -303
  190. package/vendor/dragonbox/subproject/3rdparty/grisu_exact/CMakeLists.txt +0 -24
  191. package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.cpp +0 -238
  192. package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.h +0 -95
  193. package/vendor/dragonbox/subproject/3rdparty/grisu_exact/grisu_exact.h +0 -2666
  194. package/vendor/dragonbox/subproject/3rdparty/ryu/CMakeLists.txt +0 -16
  195. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/common.h +0 -114
  196. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s.c +0 -509
  197. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_full_table.h +0 -367
  198. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_intrinsics.h +0 -357
  199. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/digit_table.h +0 -35
  200. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s.c +0 -345
  201. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_full_table.h +0 -55
  202. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_intrinsics.h +0 -128
  203. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/ryu.h +0 -46
  204. package/vendor/dragonbox/subproject/3rdparty/schubfach/CMakeLists.txt +0 -22
  205. package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.cc +0 -699
  206. package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.h +0 -31
  207. package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.cc +0 -1354
  208. package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.h +0 -31
  209. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/example_shaded_plots.m +0 -68
  210. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/license.txt +0 -25
  211. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution.m +0 -92
  212. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution_prctile.m +0 -121
  213. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_histogram_shaded.m +0 -99
  214. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_shaded.m +0 -93
  215. package/vendor/dragonbox/subproject/benchmark/CMakeLists.txt +0 -65
  216. package/vendor/dragonbox/subproject/benchmark/include/benchmark.h +0 -40
  217. package/vendor/dragonbox/subproject/benchmark/matlab/plot_benchmarks.m +0 -22
  218. package/vendor/dragonbox/subproject/benchmark/matlab/plot_digit_benchmark.m +0 -78
  219. package/vendor/dragonbox/subproject/benchmark/matlab/plot_uniform_benchmark.m +0 -95
  220. package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_clang.png +0 -0
  221. package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_msvc.png +0 -0
  222. package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_clang.png +0 -0
  223. package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_msvc.png +0 -0
  224. package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_clang.png +0 -0
  225. package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_msvc.png +0 -0
  226. package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_clang.png +0 -0
  227. package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_msvc.png +0 -0
  228. package/vendor/dragonbox/subproject/benchmark/source/benchmark.cpp +0 -238
  229. package/vendor/dragonbox/subproject/benchmark/source/dragonbox.cpp +0 -30
  230. package/vendor/dragonbox/subproject/benchmark/source/grisu_exact.cpp +0 -36
  231. package/vendor/dragonbox/subproject/benchmark/source/ryu.cpp +0 -27
  232. package/vendor/dragonbox/subproject/benchmark/source/schubfach.cpp +0 -31
  233. package/vendor/dragonbox/subproject/common/CMakeLists.txt +0 -42
  234. package/vendor/dragonbox/subproject/common/include/best_rational_approx.h +0 -97
  235. package/vendor/dragonbox/subproject/common/include/big_uint.h +0 -218
  236. package/vendor/dragonbox/subproject/common/include/continued_fractions.h +0 -174
  237. package/vendor/dragonbox/subproject/common/include/good_rational_approx.h +0 -267
  238. package/vendor/dragonbox/subproject/common/include/random_float.h +0 -182
  239. package/vendor/dragonbox/subproject/common/include/rational_continued_fractions.h +0 -57
  240. package/vendor/dragonbox/subproject/common/source/big_uint.cpp +0 -602
  241. package/vendor/dragonbox/subproject/meta/CMakeLists.txt +0 -41
  242. package/vendor/dragonbox/subproject/meta/results/binary32_generated_cache.txt +0 -82
  243. package/vendor/dragonbox/subproject/meta/results/binary64_compressed_cache_error_table.txt +0 -10
  244. package/vendor/dragonbox/subproject/meta/results/binary64_generated_cache.txt +0 -623
  245. package/vendor/dragonbox/subproject/meta/source/generate_cache.cpp +0 -126
  246. package/vendor/dragonbox/subproject/meta/source/live_test.cpp +0 -81
  247. package/vendor/dragonbox/subproject/meta/source/perf_test.cpp +0 -104
  248. package/vendor/dragonbox/subproject/meta/source/sandbox.cpp +0 -20
  249. package/vendor/dragonbox/subproject/test/CMakeLists.txt +0 -70
  250. package/vendor/dragonbox/subproject/test/results/binary32.csv +0 -255
  251. package/vendor/dragonbox/subproject/test/results/binary64.csv +0 -2047
  252. package/vendor/dragonbox/subproject/test/results/plot_required_bits.m +0 -18
  253. package/vendor/dragonbox/subproject/test/source/test_all_shorter_interval_cases.cpp +0 -88
  254. package/vendor/dragonbox/subproject/test/source/uniform_random_test.cpp +0 -95
  255. package/vendor/dragonbox/subproject/test/source/verify_cache_precision.cpp +0 -338
  256. package/vendor/dragonbox/subproject/test/source/verify_compressed_cache.cpp +0 -154
  257. package/vendor/dragonbox/subproject/test/source/verify_fast_multiplication.cpp +0 -168
  258. package/vendor/dragonbox/subproject/test/source/verify_log_computation.cpp +0 -251
  259. package/vendor/dragonbox/subproject/test/source/verify_magic_division.cpp +0 -113
  260. package/vendor/miniz/ChangeLog.md +0 -239
  261. package/vendor/miniz/LICENSE +0 -22
  262. package/vendor/miniz/examples/example1.c +0 -105
  263. package/vendor/miniz/examples/example2.c +0 -164
  264. package/vendor/miniz/examples/example3.c +0 -269
  265. package/vendor/miniz/examples/example4.c +0 -102
  266. package/vendor/miniz/examples/example5.c +0 -327
  267. package/vendor/miniz/examples/example6.c +0 -166
  268. package/vendor/miniz/miniz.c +0 -7835
  269. package/vendor/miniz/miniz.h +0 -1422
  270. package/vendor/miniz/readme.md +0 -46
  271. /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_arm64/koffi.exp +0 -0
  272. /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_arm64/koffi.lib +0 -0
  273. /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_ia32/koffi.exp +0 -0
  274. /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_ia32/koffi.lib +0 -0
  275. /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_x64/koffi.exp +0 -0
  276. /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_x64/koffi.lib +0 -0
@@ -1,239 +0,0 @@
1
- ## Changelog
2
-
3
- ### 3.0.2
4
-
5
- - Fix buffer overrun in mz_utf8z_to_widechar on Windows
6
-
7
- ### 3.0.1
8
-
9
- - Fix compilation error with MINIZ_USE_UNALIGNED_LOADS_AND_STORES=1
10
-
11
- ### 3.0.0
12
-
13
- - Reduce memory usage for inflate. This changes `struct tinfl_decompressor_tag` and therefore requires a major version bump (breaks ABI compatibility)
14
- - Add padding to structures so it continues to work if features differ. This also changes some structures
15
- - Use _ftelli64, _fseeki64 and stat with MinGW32 and OpenWatcom
16
- - Fix varios warnings with OpenWatcom compiler
17
- - Avoid using unaligned memory access in UBSan builds
18
- - Set MINIZ_LITTLE_ENDIAN only if not set
19
- - Add MINIZ_NO_DEFLATE_APIS and MINIZ_NO_INFLATE_APIS
20
- - Fix use of uninitialized memory in tinfl_decompress_mem_to_callback()
21
- - Use wfopen on windows
22
- - Use _wstat64 instead _stat64 on windows
23
- - Use level_and_flags after MZ_DEFAULT_COMPRESSION has been handled
24
- - Improve endianess detection
25
- - Don't use unaligned stores and loads per default
26
- - Fix function declaration if MINIZ_NO_STDIO is used
27
- - Fix MZ_ZIP_GENERAL_PURPOSE_BIT_FLAG_UTF8 not being set
28
- - Remove total files check (its 32-bit uint)
29
- - tinfl_decompress: avoid NULL ptr arithmetic UB
30
- - miniz_zip: fix mz_zip_reader_extract_to_heap to read correct sizes
31
- - Eliminate 64-bit operations on 32-bit machines
32
- - Disable treating warnings as error with MSVC
33
- - Disable building shared lib via CMake by default
34
- - Fixed alignment problems on MacOS
35
- - Fixed get error string for MZ_ZIP_TOTAL_ERRORS
36
- - Write correct FLEVEL 2-bit value in zlib header
37
- - miniz.pc.in: fix include path not containing the "miniz" suffix
38
- - Fix compatibility with FreeBSD
39
- - pkg-config tweaks
40
- - Fix integer overflow in header corruption check
41
- - Fix some warnings
42
- - tdefl_compress_normal: Avoid NULL ptr arithmetic UB
43
- - replace use of stdint.h types with mz_ variants
44
-
45
-
46
- ### 2.2.0
47
-
48
- - Fix examples with amalgamation
49
- - Modified cmake script to support shared library mode and find_package
50
- - Fix for misleading doc comment on `mz_zip_reader_init_cfile` function
51
- - Add include location tolerance and stop forcing `_GNU_SOURCE`
52
- - Fix: mz_zip_reader_locate_file_v2 returns an mz_bool
53
- - Fix large file system checks
54
- - Add #elif to enable an external mz_crc32() to be linked in
55
- - Write with dynamic size (size of file/data to be added not known before adding)
56
- - Added uncompress2 for zlib compatibility
57
- - Add support for building as a Meson subproject
58
- - Added OSSFuzz support; Integrate with CIFuzz
59
- - Add pkg-config file
60
- - Fixed use-of-uninitialized value msan error when copying dist bytes with no output bytes written.
61
- - mz_zip_validate_file(): fix memory leak on errors
62
- - Fixed MSAN use-of-uninitialized in tinfl_decompress when invalid dist is decoded. In this instance dist was 31 which s_dist_base translates as 0
63
- - Add flag to set (compressed) size in local file header
64
- - avoid use of uninitialized value in tdefl_record_literal
65
-
66
- ### 2.1.0
67
-
68
- - More instances of memcpy instead of cast and use memcpy per default
69
- - Remove inline for c90 support
70
- - New function to read files via callback functions when adding them
71
- - Fix out of bounds read while reading Zip64 extended information
72
- - guard memcpy when n == 0 because buffer may be NULL
73
- - Implement inflateReset() function
74
- - Move comp/decomp alloc/free prototypes under guarding #ifndef MZ_NO_MALLOC
75
- - Fix large file support under Windows
76
- - Don't warn if _LARGEFILE64_SOURCE is not defined to 1
77
- - Fixes for MSVC warnings
78
- - Remove check that path of file added to archive contains ':' or '\'
79
- - Add !defined check on MINIZ_USE_ALIGNED_LOADS_AND_STORES
80
-
81
- ### 2.0.8
82
-
83
- - Remove unimplemented functions (mz_zip_locate_file and mz_zip_locate_file_v2)
84
- - Add license, changelog, readme and example files to release zip
85
- - Fix heap overflow to user buffer in tinfl_status tinfl_decompress
86
- - Fix corrupt archive if uncompressed file smaller than 4 byte and the file is added by mz_zip_writer_add_mem*
87
-
88
- ### 2.0.7
89
-
90
- - Removed need in C++ compiler in cmake build
91
- - Fixed a lot of uninitialized value errors found with Valgrind by memsetting m_dict to 0 in tdefl_init
92
- - Fix resource leak in mz_zip_reader_init_file_v2
93
- - Fix assert with mz_zip_writer_add_mem* w/MZ_DEFAULT_COMPRESSION
94
- - cmake build: install library and headers
95
- - Remove _LARGEFILE64_SOURCE requirement from apple defines for large files
96
-
97
- ### 2.0.6
98
-
99
- - Improve MZ_ZIP_FLAG_WRITE_ZIP64 documentation
100
- - Remove check for cur_archive_file_ofs > UINT_MAX because cur_archive_file_ofs is not used after this point
101
- - Add cmake debug configuration
102
- - Fix PNG height when creating png files
103
- - Add "iterative" file extraction method based on mz_zip_reader_extract_to_callback.
104
- - Option to use memcpy for unaligned data access
105
- - Define processor/arch macros as zero if not set to one
106
-
107
- ### 2.0.4/2.0.5
108
-
109
- - Fix compilation with the various omission compile definitions
110
-
111
- ### 2.0.3
112
-
113
- - Fix GCC/clang compile warnings
114
- - Added callback for periodic flushes (for ZIP file streaming)
115
- - Use UTF-8 for file names in ZIP files per default
116
-
117
- ### 2.0.2
118
-
119
- - Fix source backwards compatibility with 1.x
120
- - Fix a ZIP bit not being set correctly
121
-
122
- ### 2.0.1
123
-
124
- - Added some tests
125
- - Added CI
126
- - Make source code ANSI C compatible
127
-
128
- ### 2.0.0 beta
129
-
130
- - Matthew Sitton merged miniz 1.x to Rich Geldreich's vogl ZIP64 changes. Miniz is now licensed as MIT since the vogl code base is MIT licensed
131
- - Miniz is now split into several files
132
- - Miniz does now not seek backwards when creating ZIP files. That is the ZIP files can be streamed
133
- - Miniz automatically switches to the ZIP64 format when the created ZIP files goes over ZIP file limits
134
- - Similar to [SQLite](https://www.sqlite.org/amalgamation.html) the Miniz source code is amalgamated into one miniz.c/miniz.h pair in a build step (amalgamate.sh). Please use miniz.c/miniz.h in your projects
135
- - Miniz 2 is only source back-compatible with miniz 1.x. It breaks binary compatibility because structures changed
136
-
137
- ### v1.16 BETA Oct 19, 2013
138
-
139
- Still testing, this release is downloadable from [here](http://www.tenacioussoftware.com/miniz_v116_beta_r1.7z). Two key inflator-only robustness and streaming related changes. Also merged in tdefl_compressor_alloc(), tdefl_compressor_free() helpers to make script bindings easier for rustyzip. I would greatly appreciate any help with testing or any feedback.
140
-
141
- The inflator in raw (non-zlib) mode is now usable on gzip or similar streams that have a bunch of bytes following the raw deflate data (problem discovered by rustyzip author williamw520). This version should never read beyond the last byte of the raw deflate data independent of how many bytes you pass into the input buffer.
142
-
143
- The inflator now has a new failure status TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS (-4). Previously, if the inflator was starved of bytes and could not make progress (because the input buffer was empty and the caller did not set the TINFL_FLAG_HAS_MORE_INPUT flag - say on truncated or corrupted compressed data stream) it would append all 0's to the input and try to soldier on. This is scary behavior if the caller didn't know when to stop accepting output (because it didn't know how much uncompressed data was expected, or didn't enforce a sane maximum). v1.16 will instead return TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS immediately if it needs 1 or more bytes to make progress, the input buf is empty, and the caller has indicated that no more input is available. This is a "soft" failure, so you can call the inflator again with more input and it will try to continue, or you can give up and fail. This could be very useful in network streaming scenarios.
144
-
145
- - The inflator coroutine func. is subtle and complex so I'm being cautious about this release. I would greatly appreciate any help with testing or any feedback.
146
- I feel good about these changes, and they've been through several hours of automated testing, but they will probably not fix anything for the majority of prev. users so I'm
147
- going to mark this release as beta for a few weeks and continue testing it at work/home on various things.
148
- - The inflator in raw (non-zlib) mode is now usable on gzip or similar data streams that have a bunch of bytes following the raw deflate data (problem discovered by rustyzip author williamw520).
149
- This version should *never* read beyond the last byte of the raw deflate data independent of how many bytes you pass into the input buffer. This issue was caused by the various Huffman bitbuffer lookahead optimizations, and
150
- would not be an issue if the caller knew and enforced the precise size of the raw compressed data *or* if the compressed data was in zlib format (i.e. always followed by the byte aligned zlib adler32).
151
- So in other words, you can now call the inflator on deflate streams that are followed by arbitrary amounts of data and it's guaranteed that decompression will stop exactly on the last byte.
152
- - The inflator now has a new failure status: TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS (-4). Previously, if the inflator was starved of bytes and could not make progress (because the input buffer was empty and the
153
- caller did not set the TINFL_FLAG_HAS_MORE_INPUT flag - say on truncated or corrupted compressed data stream) it would append all 0's to the input and try to soldier on.
154
- This is scary, because in the worst case, I believe it was possible for the prev. inflator to start outputting large amounts of literal data. If the caller didn't know when to stop accepting output
155
- (because it didn't know how much uncompressed data was expected, or didn't enforce a sane maximum) it could continue forever. v1.16 cannot fall into this failure mode, instead it'll return
156
- TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS immediately if it needs 1 or more bytes to make progress, the input buf is empty, and the caller has indicated that no more input is available. This is a "soft"
157
- failure, so you can call the inflator again with more input and it will try to continue, or you can give up and fail. This could be very useful in network streaming scenarios.
158
- - Added documentation to all the tinfl return status codes, fixed miniz_tester so it accepts double minus params for Linux, tweaked example1.c, added a simple "follower bytes" test to miniz_tester.cpp.
159
- ### v1.15 r4 STABLE - Oct 13, 2013
160
-
161
- Merged over a few very minor bug fixes that I fixed in the zip64 branch. This is downloadable from [here](http://code.google.com/p/miniz/downloads/list) and also in SVN head (as of 10/19/13).
162
-
163
-
164
- ### v1.15 - Oct. 13, 2013
165
-
166
- Interim bugfix release while I work on the next major release with zip64 and streaming compression/decompression support. Fixed the MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY bug (thanks kahmyong.moon@hp.com), which could cause the locate files func to not find files when this flag was specified. Also fixed a bug in mz_zip_reader_extract_to_mem_no_alloc() with user provided read buffers (thanks kymoon). I also merged lots of compiler fixes from various github repo branches and Google Code issue reports. I finally added cmake support (only tested under for Linux so far), compiled and tested with clang v3.3 and gcc 4.6 (under Linux), added defl_write_image_to_png_file_in_memory_ex() (supports Y flipping for OpenGL use, real-time compression), added a new PNG example (example6.c - Mandelbrot), and I added 64-bit file I/O support (stat64(), etc.) for glibc.
167
-
168
- - Critical fix for the MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY bug (thanks kahmyong.moon@hp.com) which could cause locate files to not find files. This bug
169
- would only have occurred in earlier versions if you explicitly used this flag, OR if you used mz_zip_extract_archive_file_to_heap() or mz_zip_add_mem_to_archive_file_in_place()
170
- (which used this flag). If you can't switch to v1.15 but want to fix this bug, just remove the uses of this flag from both helper funcs (and of course don't use the flag).
171
- - Bugfix in mz_zip_reader_extract_to_mem_no_alloc() from kymoon when pUser_read_buf is not NULL and compressed size is > uncompressed size
172
- - Fixing mz_zip_reader_extract_*() funcs so they don't try to extract compressed data from directory entries, to account for weird zipfiles which contain zero-size compressed data on dir entries.
173
- Hopefully this fix won't cause any issues on weird zip archives, because it assumes the low 16-bits of zip external attributes are DOS attributes (which I believe they always are in practice).
174
- - Fixing mz_zip_reader_is_file_a_directory() so it doesn't check the internal attributes, just the filename and external attributes
175
- - mz_zip_reader_init_file() - missing MZ_FCLOSE() call if the seek failed
176
- - Added cmake support for Linux builds which builds all the examples, tested with clang v3.3 and gcc v4.6.
177
- - Clang fix for tdefl_write_image_to_png_file_in_memory() from toffaletti
178
- - Merged MZ_FORCEINLINE fix from hdeanclark
179
- - Fix <time.h> include before config #ifdef, thanks emil.brink
180
- - Added tdefl_write_image_to_png_file_in_memory_ex(): supports Y flipping (super useful for OpenGL apps), and explicit control over the compression level (so you can
181
- set it to 1 for real-time compression).
182
- - Merged in some compiler fixes from paulharris's github repro.
183
- - Retested this build under Windows (VS 2010, including static analysis), tcc 0.9.26, gcc v4.6 and clang v3.3.
184
- - Added example6.c, which dumps an image of the mandelbrot set to a PNG file.
185
- - Modified example2 to help test the MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY flag more.
186
- - In r3: Bugfix to mz_zip_writer_add_file() found during merge: Fix possible src file fclose() leak if alignment bytes+local header file write faiiled
187
- - In r4: Minor bugfix to mz_zip_writer_add_from_zip_reader(): Was pushing the wrong central dir header offset, appears harmless in this release, but it became a problem in the zip64 branch
188
-
189
- ### v1.14 - May 20, 2012
190
-
191
- (SVN Only) Minor tweaks to get miniz.c compiling with the Tiny C Compiler, added #ifndef MINIZ_NO_TIME guards around utime.h includes. Adding mz_free() function, so the caller can free heap blocks returned by miniz using whatever heap functions it has been configured to use, MSVC specific fixes to use "safe" variants of several functions (localtime_s, fopen_s, freopen_s).
192
-
193
- MinGW32/64 GCC 4.6.1 compiler fixes: added MZ_FORCEINLINE, #include <time.h> (thanks fermtect).
194
-
195
- Compiler specific fixes, some from fermtect. I upgraded to TDM GCC 4.6.1 and now static __forceinline is giving it fits, so I'm changing all usage of __forceinline to MZ_FORCEINLINE and forcing gcc to use __attribute__((__always_inline__)) (and MSVC to use __forceinline). Also various fixes from fermtect for MinGW32: added #include , 64-bit ftell/fseek fixes.
196
-
197
- ### v1.13 - May 19, 2012
198
-
199
- From jason@cornsyrup.org and kelwert@mtu.edu - Most importantly, fixed mz_crc32() so it doesn't compute the wrong CRC-32's when mz_ulong is 64-bits. Temporarily/locally slammed in "typedef unsigned long mz_ulong" and re-ran a randomized regression test on ~500k files. Other stuff:
200
-
201
- Eliminated a bunch of warnings when compiling with GCC 32-bit/64. Ran all examples, miniz.c, and tinfl.c through MSVC 2008's /analyze (static analysis) option and fixed all warnings (except for the silly "Use of the comma-operator in a tested expression.." analysis warning, which I purposely use to work around a MSVC compiler warning).
202
-
203
- Created 32-bit and 64-bit Codeblocks projects/workspace. Built and tested Linux executables. The codeblocks workspace is compatible with Linux+Win32/x64. Added miniz_tester solution/project, which is a useful little app derived from LZHAM's tester app that I use as part of the regression test. Ran miniz.c and tinfl.c through another series of regression testing on ~500,000 files and archives. Modified example5.c so it purposely disables a bunch of high-level functionality (MINIZ_NO_STDIO, etc.). (Thanks to corysama for the MINIZ_NO_STDIO bug report.)
204
-
205
- Fix ftell() usage in a few of the examples so they exit with an error on files which are too large (a limitation of the examples, not miniz itself). Fix fail logic handling in mz_zip_add_mem_to_archive_file_in_place() so it always calls mz_zip_writer_finalize_archive() and mz_zip_writer_end(), even if the file add fails.
206
-
207
- - From jason@cornsyrup.org and kelwert@mtu.edu - Fix mz_crc32() so it doesn't compute the wrong CRC-32's when mz_ulong is 64-bit.
208
- - Temporarily/locally slammed in "typedef unsigned long mz_ulong" and re-ran a randomized regression test on ~500k files.
209
- - Eliminated a bunch of warnings when compiling with GCC 32-bit/64.
210
- - Ran all examples, miniz.c, and tinfl.c through MSVC 2008's /analyze (static analysis) option and fixed all warnings (except for the silly
211
- "Use of the comma-operator in a tested expression.." analysis warning, which I purposely use to work around a MSVC compiler warning).
212
- - Created 32-bit and 64-bit Codeblocks projects/workspace. Built and tested Linux executables. The codeblocks workspace is compatible with Linux+Win32/x64.
213
- - Added miniz_tester solution/project, which is a useful little app derived from LZHAM's tester app that I use as part of the regression test.
214
- - Ran miniz.c and tinfl.c through another series of regression testing on ~500,000 files and archives.
215
- - Modified example5.c so it purposely disables a bunch of high-level functionality (MINIZ_NO_STDIO, etc.). (Thanks to corysama for the MINIZ_NO_STDIO bug report.)
216
- - Fix ftell() usage in examples so they exit with an error on files which are too large (a limitation of the examples, not miniz itself).
217
-
218
- ### v1.12 - 4/12/12
219
-
220
- More comments, added low-level example5.c, fixed a couple minor level_and_flags issues in the archive API's.
221
- level_and_flags can now be set to MZ_DEFAULT_COMPRESSION. Thanks to Bruce Dawson <bruced@valvesoftware.com> for the feedback/bug report.
222
-
223
- ### v1.11 - 5/28/11
224
-
225
- Added statement from unlicense.org
226
-
227
- ### v1.10 - 5/27/11
228
-
229
- - Substantial compressor optimizations:
230
- - Level 1 is now ~4x faster than before. The L1 compressor's throughput now varies between 70-110MB/sec. on a Core i7 (actual throughput varies depending on the type of data, and x64 vs. x86).
231
- - Improved baseline L2-L9 compression perf. Also, greatly improved compression perf. issues on some file types.
232
- - Refactored the compression code for better readability and maintainability.
233
- - Added level 10 compression level (L10 has slightly better ratio than level 9, but could have a potentially large drop in throughput on some files).
234
-
235
- ### v1.09 - 5/15/11
236
-
237
- Initial stable release.
238
-
239
-
@@ -1,22 +0,0 @@
1
- Copyright 2013-2014 RAD Game Tools and Valve Software
2
- Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
3
-
4
- All Rights Reserved.
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
@@ -1,105 +0,0 @@
1
- // example1.c - Demonstrates miniz.c's compress() and uncompress() functions (same as zlib's).
2
- // Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c.
3
- #include <stdio.h>
4
- #include "miniz.h"
5
- typedef unsigned char uint8;
6
- typedef unsigned short uint16;
7
- typedef unsigned int uint;
8
-
9
- // The string to compress.
10
- static const char *s_pStr = "Good morning Dr. Chandra. This is Hal. I am ready for my first lesson." \
11
- "Good morning Dr. Chandra. This is Hal. I am ready for my first lesson." \
12
- "Good morning Dr. Chandra. This is Hal. I am ready for my first lesson." \
13
- "Good morning Dr. Chandra. This is Hal. I am ready for my first lesson." \
14
- "Good morning Dr. Chandra. This is Hal. I am ready for my first lesson." \
15
- "Good morning Dr. Chandra. This is Hal. I am ready for my first lesson." \
16
- "Good morning Dr. Chandra. This is Hal. I am ready for my first lesson.";
17
-
18
- int main(int argc, char *argv[])
19
- {
20
- uint step = 0;
21
- int cmp_status;
22
- uLong src_len = (uLong)strlen(s_pStr);
23
- uLong cmp_len = compressBound(src_len);
24
- uLong uncomp_len = src_len;
25
- uint8 *pCmp, *pUncomp;
26
- uint total_succeeded = 0;
27
- (void)argc, (void)argv;
28
-
29
- printf("miniz.c version: %s\n", MZ_VERSION);
30
-
31
- do
32
- {
33
- // Allocate buffers to hold compressed and uncompressed data.
34
- pCmp = (mz_uint8 *)malloc((size_t)cmp_len);
35
- pUncomp = (mz_uint8 *)malloc((size_t)src_len);
36
- if ((!pCmp) || (!pUncomp))
37
- {
38
- printf("Out of memory!\n");
39
- return EXIT_FAILURE;
40
- }
41
-
42
- // Compress the string.
43
- cmp_status = compress(pCmp, &cmp_len, (const unsigned char *)s_pStr, src_len);
44
- if (cmp_status != Z_OK)
45
- {
46
- printf("compress() failed!\n");
47
- free(pCmp);
48
- free(pUncomp);
49
- return EXIT_FAILURE;
50
- }
51
-
52
- printf("Compressed from %u to %u bytes\n", (mz_uint32)src_len, (mz_uint32)cmp_len);
53
-
54
- if (step)
55
- {
56
- // Purposely corrupt the compressed data if fuzzy testing (this is a very crude fuzzy test).
57
- uint n = 1 + (rand() % 3);
58
- while (n--)
59
- {
60
- uint i = rand() % cmp_len;
61
- pCmp[i] ^= (rand() & 0xFF);
62
- }
63
- }
64
-
65
- // Decompress.
66
- cmp_status = uncompress(pUncomp, &uncomp_len, pCmp, cmp_len);
67
- total_succeeded += (cmp_status == Z_OK);
68
-
69
- if (step)
70
- {
71
- printf("Simple fuzzy test: step %u total_succeeded: %u\n", step, total_succeeded);
72
- }
73
- else
74
- {
75
- if (cmp_status != Z_OK)
76
- {
77
- printf("uncompress failed!\n");
78
- free(pCmp);
79
- free(pUncomp);
80
- return EXIT_FAILURE;
81
- }
82
-
83
- printf("Decompressed from %u to %u bytes\n", (mz_uint32)cmp_len, (mz_uint32)uncomp_len);
84
-
85
- // Ensure uncompress() returned the expected data.
86
- if ((uncomp_len != src_len) || (memcmp(pUncomp, s_pStr, (size_t)src_len)))
87
- {
88
- printf("Decompression failed!\n");
89
- free(pCmp);
90
- free(pUncomp);
91
- return EXIT_FAILURE;
92
- }
93
- }
94
-
95
- free(pCmp);
96
- free(pUncomp);
97
-
98
- step++;
99
-
100
- // Keep on fuzzy testing if there's a non-empty command line.
101
- } while (argc >= 2);
102
-
103
- printf("Success.\n");
104
- return EXIT_SUCCESS;
105
- }
@@ -1,164 +0,0 @@
1
- // example2.c - Simple demonstration of miniz.c's ZIP archive API's.
2
- // Note this test deletes the test archive file "__mz_example2_test__.zip" in the current directory, then creates a new one with test data.
3
- // Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c.
4
-
5
- #if defined(__GNUC__)
6
- // Ensure we get the 64-bit variants of the CRT's file I/O calls
7
- #ifndef _FILE_OFFSET_BITS
8
- #define _FILE_OFFSET_BITS 64
9
- #endif
10
- #ifndef _LARGEFILE64_SOURCE
11
- #define _LARGEFILE64_SOURCE 1
12
- #endif
13
- #endif
14
-
15
- #include <stdio.h>
16
- #include "miniz.h"
17
-
18
- typedef unsigned char uint8;
19
- typedef unsigned short uint16;
20
- typedef unsigned int uint;
21
-
22
- // The string to compress.
23
- static const char *s_pTest_str =
24
- "MISSION CONTROL I wouldn't worry too much about the computer. First of all, there is still a chance that he is right, despite your tests, and" \
25
- "if it should happen again, we suggest eliminating this possibility by allowing the unit to remain in place and seeing whether or not it" \
26
- "actually fails. If the computer should turn out to be wrong, the situation is still not alarming. The type of obsessional error he may be" \
27
- "guilty of is not unknown among the latest generation of HAL 9000 computers. It has almost always revolved around a single detail, such as" \
28
- "the one you have described, and it has never interfered with the integrity or reliability of the computer's performance in other areas." \
29
- "No one is certain of the cause of this kind of malfunctioning. It may be over-programming, but it could also be any number of reasons. In any" \
30
- "event, it is somewhat analogous to human neurotic behavior. Does this answer your query? Zero-five-three-Zero, MC, transmission concluded.";
31
-
32
- static const char *s_pComment = "This is a comment";
33
-
34
- int main(int argc, char *argv[])
35
- {
36
- int i, sort_iter;
37
- mz_bool status;
38
- size_t uncomp_size;
39
- mz_zip_archive zip_archive;
40
- void *p;
41
- const int N = 50;
42
- char data[2048];
43
- char archive_filename[64];
44
- static const char *s_Test_archive_filename = "__mz_example2_test__.zip";
45
-
46
- assert((strlen(s_pTest_str) + 64) < sizeof(data));
47
-
48
- printf("miniz.c version: %s\n", MZ_VERSION);
49
-
50
- (void)argc, (void)argv;
51
-
52
- // Delete the test archive, so it doesn't keep growing as we run this test
53
- remove(s_Test_archive_filename);
54
-
55
- // Append a bunch of text files to the test archive
56
- for (i = (N - 1); i >= 0; --i)
57
- {
58
- sprintf(archive_filename, "%u.txt", i);
59
- sprintf(data, "%u %s %u", (N - 1) - i, s_pTest_str, i);
60
-
61
- // Add a new file to the archive. Note this is an IN-PLACE operation, so if it fails your archive is probably hosed (its central directory may not be complete) but it should be recoverable using zip -F or -FF. So use caution with this guy.
62
- // A more robust way to add a file to an archive would be to read it into memory, perform the operation, then write a new archive out to a temp file and then delete/rename the files.
63
- // Or, write a new archive to disk to a temp file, then delete/rename the files. For this test this API is fine.
64
- status = mz_zip_add_mem_to_archive_file_in_place(s_Test_archive_filename, archive_filename, data, strlen(data) + 1, s_pComment, (uint16)strlen(s_pComment), MZ_BEST_COMPRESSION);
65
- if (!status)
66
- {
67
- printf("mz_zip_add_mem_to_archive_file_in_place failed!\n");
68
- return EXIT_FAILURE;
69
- }
70
- }
71
-
72
- // Add a directory entry for testing
73
- status = mz_zip_add_mem_to_archive_file_in_place(s_Test_archive_filename, "directory/", NULL, 0, "no comment", (uint16)strlen("no comment"), MZ_BEST_COMPRESSION);
74
- if (!status)
75
- {
76
- printf("mz_zip_add_mem_to_archive_file_in_place failed!\n");
77
- return EXIT_FAILURE;
78
- }
79
-
80
- // Now try to open the archive.
81
- memset(&zip_archive, 0, sizeof(zip_archive));
82
-
83
- status = mz_zip_reader_init_file(&zip_archive, s_Test_archive_filename, 0);
84
- if (!status)
85
- {
86
- printf("mz_zip_reader_init_file() failed!\n");
87
- return EXIT_FAILURE;
88
- }
89
-
90
- // Get and print information about each file in the archive.
91
- for (i = 0; i < (int)mz_zip_reader_get_num_files(&zip_archive); i++)
92
- {
93
- mz_zip_archive_file_stat file_stat;
94
- if (!mz_zip_reader_file_stat(&zip_archive, i, &file_stat))
95
- {
96
- printf("mz_zip_reader_file_stat() failed!\n");
97
- mz_zip_reader_end(&zip_archive);
98
- return EXIT_FAILURE;
99
- }
100
-
101
- printf("Filename: \"%s\", Comment: \"%s\", Uncompressed size: %u, Compressed size: %u, Is Dir: %u\n", file_stat.m_filename, file_stat.m_comment, (uint)file_stat.m_uncomp_size, (uint)file_stat.m_comp_size, mz_zip_reader_is_file_a_directory(&zip_archive, i));
102
-
103
- if (!strcmp(file_stat.m_filename, "directory/"))
104
- {
105
- if (!mz_zip_reader_is_file_a_directory(&zip_archive, i))
106
- {
107
- printf("mz_zip_reader_is_file_a_directory() didn't return the expected results!\n");
108
- mz_zip_reader_end(&zip_archive);
109
- return EXIT_FAILURE;
110
- }
111
- }
112
- }
113
-
114
- // Close the archive, freeing any resources it was using
115
- mz_zip_reader_end(&zip_archive);
116
-
117
- // Now verify the compressed data
118
- for (sort_iter = 0; sort_iter < 2; sort_iter++)
119
- {
120
- memset(&zip_archive, 0, sizeof(zip_archive));
121
- status = mz_zip_reader_init_file(&zip_archive, s_Test_archive_filename, sort_iter ? MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY : 0);
122
- if (!status)
123
- {
124
- printf("mz_zip_reader_init_file() failed!\n");
125
- return EXIT_FAILURE;
126
- }
127
-
128
- for (i = 0; i < N; i++)
129
- {
130
- sprintf(archive_filename, "%u.txt", i);
131
- sprintf(data, "%u %s %u", (N - 1) - i, s_pTest_str, i);
132
-
133
- // Try to extract all the files to the heap.
134
- p = mz_zip_reader_extract_file_to_heap(&zip_archive, archive_filename, &uncomp_size, 0);
135
- if (!p)
136
- {
137
- printf("mz_zip_reader_extract_file_to_heap() failed!\n");
138
- mz_zip_reader_end(&zip_archive);
139
- return EXIT_FAILURE;
140
- }
141
-
142
- // Make sure the extraction really succeeded.
143
- if ((uncomp_size != (strlen(data) + 1)) || (memcmp(p, data, strlen(data))))
144
- {
145
- printf("mz_zip_reader_extract_file_to_heap() failed to extract the proper data\n");
146
- mz_free(p);
147
- mz_zip_reader_end(&zip_archive);
148
- return EXIT_FAILURE;
149
- }
150
-
151
- printf("Successfully extracted file \"%s\", size %u\n", archive_filename, (uint)uncomp_size);
152
- printf("File data: \"%s\"\n", (const char *)p);
153
-
154
- // We're done.
155
- mz_free(p);
156
- }
157
-
158
- // Close the archive, freeing any resources it was using
159
- mz_zip_reader_end(&zip_archive);
160
- }
161
-
162
- printf("Success.\n");
163
- return EXIT_SUCCESS;
164
- }