libarchive-static 1.0.6 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/ext/extconf.rb +2 -9
  3. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +6 -6
  4. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.o +0 -0
  5. data/ext/libarchive-0.1.1/ext/archive_read_support_format.o +0 -0
  6. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +1 -1
  7. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.o +0 -0
  8. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +5 -5
  9. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.o +0 -0
  10. data/ext/libarchive-0.1.1/ext/config.h +23 -0
  11. data/ext/libarchive-0.1.1/ext/config.log +230 -0
  12. data/ext/libarchive-0.1.1/ext/config.status +671 -0
  13. data/ext/libarchive-0.1.1/ext/libarchive.c +1 -1
  14. data/ext/libarchive-0.1.1/ext/libarchive.o +0 -0
  15. data/ext/libarchive-0.1.1/ext/libarchive_archive.c +7 -7
  16. data/ext/libarchive-0.1.1/ext/libarchive_archive.o +0 -0
  17. data/ext/libarchive-0.1.1/ext/libarchive_entry.c +6 -0
  18. data/ext/libarchive-0.1.1/ext/libarchive_entry.o +0 -0
  19. data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
  20. data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
  21. data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
  22. data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
  23. data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
  24. data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
  25. data/ext/libarchive-3.6.2/Makefile.in +16892 -0
  26. data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
  27. data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
  28. data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
  29. data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
  30. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
  31. data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
  32. data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
  33. data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
  34. data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
  35. data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
  36. data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
  37. data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
  38. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
  39. data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
  40. data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
  41. data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
  42. data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
  43. data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
  44. data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
  45. data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
  46. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
  47. data/ext/libarchive-3.6.2/config.h.in +1504 -0
  48. data/ext/libarchive-3.6.2/configure +25558 -0
  49. data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
  50. data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
  51. data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
  52. data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
  53. data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
  54. data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
  55. data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
  56. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
  57. data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
  58. data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
  59. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
  60. data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
  61. data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
  62. data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
  63. data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
  64. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
  65. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
  66. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
  67. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
  68. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
  69. data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
  70. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
  71. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
  72. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
  73. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
  74. data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
  75. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
  76. data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
  77. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
  78. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
  79. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
  80. data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
  81. data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
  82. data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
  83. data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
  84. data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
  85. data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
  86. data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
  87. data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
  88. data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
  89. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
  90. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
  91. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
  92. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
  93. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
  94. data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
  95. data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
  96. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
  97. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
  98. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
  99. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
  100. data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
  101. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
  102. data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
  103. data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
  104. data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
  105. data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
  106. data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
  107. data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
  108. data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
  109. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
  110. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  111. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
  112. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
  113. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
  114. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
  115. data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
  116. data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
  117. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
  118. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
  119. data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
  120. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
  121. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
  122. data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
  123. data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
  124. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_all.c → libarchive-3.6.2/libarchive/archive_read_support_filter_all.c} +35 -10
  125. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
  126. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c → libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c} +38 -26
  127. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c → libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c} +52 -44
  128. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
  129. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c → libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c} +108 -37
  130. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
  131. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
  132. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
  133. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_none.c → libarchive-3.6.2/libarchive/archive_read_support_filter_none.c} +15 -3
  134. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_program.c → libarchive-3.6.2/libarchive/archive_read_support_filter_program.c} +114 -77
  135. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c → libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c} +31 -31
  136. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c → libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c} +141 -85
  137. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c → libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c} +369 -284
  138. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
  139. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
  140. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
  141. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
  142. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
  143. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
  144. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
  145. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
  146. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
  147. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
  148. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
  149. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
  150. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
  151. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
  152. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
  153. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
  154. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
  155. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
  156. data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
  157. data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
  158. data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
  159. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
  160. data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
  161. data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
  162. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
  163. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
  164. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
  165. data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
  166. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
  167. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
  168. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
  169. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
  170. data/ext/{libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c → libarchive-3.6.2/libarchive/archive_write_add_filter_compress.c} +86 -131
  171. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
  172. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
  173. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
  174. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
  175. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
  176. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_format_all.c → libarchive-3.6.2/libarchive/archive_write_add_filter_none.c} +11 -11
  177. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
  178. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
  179. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
  180. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
  181. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
  182. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
  183. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
  184. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
  185. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
  186. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
  187. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
  188. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
  189. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
  190. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
  191. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
  192. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
  193. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
  194. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
  195. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
  196. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  197. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
  198. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
  199. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
  200. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
  201. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
  202. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
  203. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
  204. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
  205. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
  206. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
  207. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
  208. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
  209. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
  210. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
  211. data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
  212. data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
  213. data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
  214. data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
  215. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
  216. data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
  217. data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
  218. data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
  219. data/ext/libarchive-static-makefile +144 -80
  220. data/ext/libarchive-static-wrapper-makefile +1 -1
  221. data/ext/zlib-1.2.13/Makefile.in +404 -0
  222. data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
  223. data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
  224. data/ext/zlib-1.2.13/configure +922 -0
  225. data/ext/zlib-1.2.13/crc32.c +1125 -0
  226. data/ext/zlib-1.2.13/crc32.h +9446 -0
  227. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
  228. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
  229. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
  230. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
  231. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
  232. data/ext/zlib-1.2.13/gzread.c +650 -0
  233. data/ext/zlib-1.2.13/gzwrite.c +677 -0
  234. data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
  235. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
  236. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
  237. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
  238. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
  239. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
  240. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
  241. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
  242. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
  243. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
  244. data/ext/zlib-1.2.13/uncompr.c +93 -0
  245. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
  246. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
  247. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
  248. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
  249. metadata +241 -133
  250. data/ext/libarchive-0.1.1/libarchive.c +0 -1762
  251. data/ext/libarchive-2.8.4/Makefile.in +0 -7076
  252. data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
  253. data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
  254. data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
  255. data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
  256. data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
  257. data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
  258. data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
  259. data/ext/libarchive-2.8.4/config.h.in +0 -772
  260. data/ext/libarchive-2.8.4/configure +0 -17916
  261. data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
  262. data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
  263. data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
  264. data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
  265. data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
  266. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
  267. data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
  268. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
  269. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
  270. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
  271. data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
  272. data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
  273. data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
  274. data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
  275. data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
  276. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
  277. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
  278. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
  279. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
  280. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
  281. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
  282. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
  283. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
  284. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
  285. data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
  286. data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
  287. data/ext/zlib-1.2.5/Makefile.in +0 -257
  288. data/ext/zlib-1.2.5/configure +0 -596
  289. data/ext/zlib-1.2.5/crc32.c +0 -442
  290. data/ext/zlib-1.2.5/crc32.h +0 -441
  291. data/ext/zlib-1.2.5/example.c +0 -565
  292. data/ext/zlib-1.2.5/gzread.c +0 -653
  293. data/ext/zlib-1.2.5/gzwrite.c +0 -531
  294. data/ext/zlib-1.2.5/minigzip.c +0 -440
  295. data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -1,5 +1,5 @@
1
1
  /* trees.c -- output deflated data using Huffman coding
2
- * Copyright (C) 1995-2010 Jean-loup Gailly
2
+ * Copyright (C) 1995-2021 Jean-loup Gailly
3
3
  * detect_data_type() function provided freely by Cosmin Truta, 2006
4
4
  * For conditions of distribution and use, see copyright notice in zlib.h
5
5
  */
@@ -36,7 +36,7 @@
36
36
 
37
37
  #include "deflate.h"
38
38
 
39
- #ifdef DEBUG
39
+ #ifdef ZLIB_DEBUG
40
40
  # include <ctype.h>
41
41
  #endif
42
42
 
@@ -74,11 +74,6 @@ local const uch bl_order[BL_CODES]
74
74
  * probability, to avoid transmitting the lengths for unused bit length codes.
75
75
  */
76
76
 
77
- #define Buf_size (8 * 2*sizeof(char))
78
- /* Number of bits used within bi_buf. (bi_buf might be implemented on
79
- * more than 16 bits on some systems.)
80
- */
81
-
82
77
  /* ===========================================================================
83
78
  * Local data. These are initialized only once.
84
79
  */
@@ -127,13 +122,13 @@ struct static_tree_desc_s {
127
122
  int max_length; /* max bit length for the codes */
128
123
  };
129
124
 
130
- local static_tree_desc static_l_desc =
125
+ local const static_tree_desc static_l_desc =
131
126
  {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
132
127
 
133
- local static_tree_desc static_d_desc =
128
+ local const static_tree_desc static_d_desc =
134
129
  {static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
135
130
 
136
- local static_tree_desc static_bl_desc =
131
+ local const static_tree_desc static_bl_desc =
137
132
  {(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
138
133
 
139
134
  /* ===========================================================================
@@ -151,24 +146,22 @@ local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
151
146
  local int build_bl_tree OF((deflate_state *s));
152
147
  local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
153
148
  int blcodes));
154
- local void compress_block OF((deflate_state *s, ct_data *ltree,
155
- ct_data *dtree));
149
+ local void compress_block OF((deflate_state *s, const ct_data *ltree,
150
+ const ct_data *dtree));
156
151
  local int detect_data_type OF((deflate_state *s));
157
- local unsigned bi_reverse OF((unsigned value, int length));
152
+ local unsigned bi_reverse OF((unsigned code, int len));
158
153
  local void bi_windup OF((deflate_state *s));
159
154
  local void bi_flush OF((deflate_state *s));
160
- local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
161
- int header));
162
155
 
163
156
  #ifdef GEN_TREES_H
164
157
  local void gen_trees_header OF((void));
165
158
  #endif
166
159
 
167
- #ifndef DEBUG
160
+ #ifndef ZLIB_DEBUG
168
161
  # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
169
162
  /* Send a code of the given tree. c and tree must not have side effects */
170
163
 
171
- #else /* DEBUG */
164
+ #else /* !ZLIB_DEBUG */
172
165
  # define send_code(s, c, tree) \
173
166
  { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
174
167
  send_bits(s, tree[c].Code, tree[c].Len); }
@@ -187,7 +180,7 @@ local void gen_trees_header OF((void));
187
180
  * Send a value on a given number of bits.
188
181
  * IN assertion: length <= 16 and value fits in length bits.
189
182
  */
190
- #ifdef DEBUG
183
+ #ifdef ZLIB_DEBUG
191
184
  local void send_bits OF((deflate_state *s, int value, int length));
192
185
 
193
186
  local void send_bits(s, value, length)
@@ -200,7 +193,7 @@ local void send_bits(s, value, length)
200
193
  s->bits_sent += (ulg)length;
201
194
 
202
195
  /* If not enough room in bi_buf, use (valid) bits from bi_buf and
203
- * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
196
+ * (16 - bi_valid) bits from value, leaving (width - (16 - bi_valid))
204
197
  * unused bits in value.
205
198
  */
206
199
  if (s->bi_valid > (int)Buf_size - length) {
@@ -213,12 +206,12 @@ local void send_bits(s, value, length)
213
206
  s->bi_valid += length;
214
207
  }
215
208
  }
216
- #else /* !DEBUG */
209
+ #else /* !ZLIB_DEBUG */
217
210
 
218
211
  #define send_bits(s, value, length) \
219
212
  { int len = length;\
220
213
  if (s->bi_valid > (int)Buf_size - len) {\
221
- int val = value;\
214
+ int val = (int)value;\
222
215
  s->bi_buf |= (ush)val << s->bi_valid;\
223
216
  put_short(s, s->bi_buf);\
224
217
  s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
@@ -228,7 +221,7 @@ local void send_bits(s, value, length)
228
221
  s->bi_valid += len;\
229
222
  }\
230
223
  }
231
- #endif /* DEBUG */
224
+ #endif /* ZLIB_DEBUG */
232
225
 
233
226
 
234
227
  /* the arguments must not have side effects */
@@ -263,7 +256,7 @@ local void tr_static_init()
263
256
  length = 0;
264
257
  for (code = 0; code < LENGTH_CODES-1; code++) {
265
258
  base_length[code] = length;
266
- for (n = 0; n < (1<<extra_lbits[code]); n++) {
259
+ for (n = 0; n < (1 << extra_lbits[code]); n++) {
267
260
  _length_code[length++] = (uch)code;
268
261
  }
269
262
  }
@@ -272,13 +265,13 @@ local void tr_static_init()
272
265
  * in two different ways: code 284 + 5 bits or code 285, so we
273
266
  * overwrite length_code[255] to use the best encoding:
274
267
  */
275
- _length_code[length-1] = (uch)code;
268
+ _length_code[length - 1] = (uch)code;
276
269
 
277
270
  /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
278
271
  dist = 0;
279
272
  for (code = 0 ; code < 16; code++) {
280
273
  base_dist[code] = dist;
281
- for (n = 0; n < (1<<extra_dbits[code]); n++) {
274
+ for (n = 0; n < (1 << extra_dbits[code]); n++) {
282
275
  _dist_code[dist++] = (uch)code;
283
276
  }
284
277
  }
@@ -286,11 +279,11 @@ local void tr_static_init()
286
279
  dist >>= 7; /* from now on, all distances are divided by 128 */
287
280
  for ( ; code < D_CODES; code++) {
288
281
  base_dist[code] = dist << 7;
289
- for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
282
+ for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {
290
283
  _dist_code[256 + dist++] = (uch)code;
291
284
  }
292
285
  }
293
- Assert (dist == 256, "tr_static_init: 256+dist != 512");
286
+ Assert (dist == 256, "tr_static_init: 256 + dist != 512");
294
287
 
295
288
  /* Construct the codes of the static literal tree */
296
289
  for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
@@ -319,16 +312,16 @@ local void tr_static_init()
319
312
  }
320
313
 
321
314
  /* ===========================================================================
322
- * Genererate the file trees.h describing the static trees.
315
+ * Generate the file trees.h describing the static trees.
323
316
  */
324
317
  #ifdef GEN_TREES_H
325
- # ifndef DEBUG
318
+ # ifndef ZLIB_DEBUG
326
319
  # include <stdio.h>
327
320
  # endif
328
321
 
329
322
  # define SEPARATOR(i, last, width) \
330
323
  ((i) == (last)? "\n};\n\n" : \
331
- ((i) % (width) == (width)-1 ? ",\n" : ", "))
324
+ ((i) % (width) == (width) - 1 ? ",\n" : ", "))
332
325
 
333
326
  void gen_trees_header()
334
327
  {
@@ -399,8 +392,7 @@ void ZLIB_INTERNAL _tr_init(s)
399
392
 
400
393
  s->bi_buf = 0;
401
394
  s->bi_valid = 0;
402
- s->last_eob_len = 8; /* enough lookahead for inflate */
403
- #ifdef DEBUG
395
+ #ifdef ZLIB_DEBUG
404
396
  s->compressed_len = 0L;
405
397
  s->bits_sent = 0L;
406
398
  #endif
@@ -424,7 +416,7 @@ local void init_block(s)
424
416
 
425
417
  s->dyn_ltree[END_BLOCK].Freq = 1;
426
418
  s->opt_len = s->static_len = 0L;
427
- s->last_lit = s->matches = 0;
419
+ s->sym_next = s->matches = 0;
428
420
  }
429
421
 
430
422
  #define SMALLEST 1
@@ -466,7 +458,7 @@ local void pqdownheap(s, tree, k)
466
458
  while (j <= s->heap_len) {
467
459
  /* Set j to the smallest of the two sons: */
468
460
  if (j < s->heap_len &&
469
- smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
461
+ smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) {
470
462
  j++;
471
463
  }
472
464
  /* Exit if v is smaller than both sons */
@@ -515,7 +507,7 @@ local void gen_bitlen(s, desc)
515
507
  */
516
508
  tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
517
509
 
518
- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
510
+ for (h = s->heap_max + 1; h < HEAP_SIZE; h++) {
519
511
  n = s->heap[h];
520
512
  bits = tree[tree[n].Dad].Len + 1;
521
513
  if (bits > max_length) bits = max_length, overflow++;
@@ -526,22 +518,22 @@ local void gen_bitlen(s, desc)
526
518
 
527
519
  s->bl_count[bits]++;
528
520
  xbits = 0;
529
- if (n >= base) xbits = extra[n-base];
521
+ if (n >= base) xbits = extra[n - base];
530
522
  f = tree[n].Freq;
531
- s->opt_len += (ulg)f * (bits + xbits);
532
- if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
523
+ s->opt_len += (ulg)f * (unsigned)(bits + xbits);
524
+ if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits);
533
525
  }
534
526
  if (overflow == 0) return;
535
527
 
536
- Trace((stderr,"\nbit length overflow\n"));
528
+ Tracev((stderr,"\nbit length overflow\n"));
537
529
  /* This happens for example on obj2 and pic of the Calgary corpus */
538
530
 
539
531
  /* Find the first bit length which could increase: */
540
532
  do {
541
- bits = max_length-1;
533
+ bits = max_length - 1;
542
534
  while (s->bl_count[bits] == 0) bits--;
543
- s->bl_count[bits]--; /* move one leaf down the tree */
544
- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
535
+ s->bl_count[bits]--; /* move one leaf down the tree */
536
+ s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */
545
537
  s->bl_count[max_length]--;
546
538
  /* The brother of the overflow item also moves one step up,
547
539
  * but this does not affect bl_count[max_length]
@@ -560,9 +552,8 @@ local void gen_bitlen(s, desc)
560
552
  m = s->heap[--h];
561
553
  if (m > max_code) continue;
562
554
  if ((unsigned) tree[m].Len != (unsigned) bits) {
563
- Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
564
- s->opt_len += ((long)bits - (long)tree[m].Len)
565
- *(long)tree[m].Freq;
555
+ Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
556
+ s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq;
566
557
  tree[m].Len = (ush)bits;
567
558
  }
568
559
  n--;
@@ -578,13 +569,13 @@ local void gen_bitlen(s, desc)
578
569
  * OUT assertion: the field code is set for all tree elements of non
579
570
  * zero code length.
580
571
  */
581
- local void gen_codes (tree, max_code, bl_count)
572
+ local void gen_codes(tree, max_code, bl_count)
582
573
  ct_data *tree; /* the tree to decorate */
583
574
  int max_code; /* largest code with non zero frequency */
584
575
  ushf *bl_count; /* number of codes at each bit length */
585
576
  {
586
577
  ush next_code[MAX_BITS+1]; /* next code value for each bit length */
587
- ush code = 0; /* running code value */
578
+ unsigned code = 0; /* running code value */
588
579
  int bits; /* bit index */
589
580
  int n; /* code index */
590
581
 
@@ -592,12 +583,13 @@ local void gen_codes (tree, max_code, bl_count)
592
583
  * without bit reversal.
593
584
  */
594
585
  for (bits = 1; bits <= MAX_BITS; bits++) {
595
- next_code[bits] = code = (code + bl_count[bits-1]) << 1;
586
+ code = (code + bl_count[bits - 1]) << 1;
587
+ next_code[bits] = (ush)code;
596
588
  }
597
589
  /* Check that the bit counts in bl_count are consistent. The last code
598
590
  * must be all ones.
599
591
  */
600
- Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
592
+ Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
601
593
  "inconsistent bit counts");
602
594
  Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
603
595
 
@@ -605,10 +597,10 @@ local void gen_codes (tree, max_code, bl_count)
605
597
  int len = tree[n].Len;
606
598
  if (len == 0) continue;
607
599
  /* Now reverse the bits */
608
- tree[n].Code = bi_reverse(next_code[len]++, len);
600
+ tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
609
601
 
610
602
  Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
611
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
603
+ n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
612
604
  }
613
605
  }
614
606
 
@@ -632,7 +624,7 @@ local void build_tree(s, desc)
632
624
  int node; /* new node being created */
633
625
 
634
626
  /* Construct the initial heap, with least frequent element in
635
- * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
627
+ * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1].
636
628
  * heap[0] is not used.
637
629
  */
638
630
  s->heap_len = 0, s->heap_max = HEAP_SIZE;
@@ -660,7 +652,7 @@ local void build_tree(s, desc)
660
652
  }
661
653
  desc->max_code = max_code;
662
654
 
663
- /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
655
+ /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree,
664
656
  * establish sub-heaps of increasing lengths:
665
657
  */
666
658
  for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
@@ -708,7 +700,7 @@ local void build_tree(s, desc)
708
700
  * Scan a literal or distance tree to determine the frequencies of the codes
709
701
  * in the bit length tree.
710
702
  */
711
- local void scan_tree (s, tree, max_code)
703
+ local void scan_tree(s, tree, max_code)
712
704
  deflate_state *s;
713
705
  ct_data *tree; /* the tree to be scanned */
714
706
  int max_code; /* and its largest code of non zero frequency */
@@ -722,10 +714,10 @@ local void scan_tree (s, tree, max_code)
722
714
  int min_count = 4; /* min repeat count */
723
715
 
724
716
  if (nextlen == 0) max_count = 138, min_count = 3;
725
- tree[max_code+1].Len = (ush)0xffff; /* guard */
717
+ tree[max_code + 1].Len = (ush)0xffff; /* guard */
726
718
 
727
719
  for (n = 0; n <= max_code; n++) {
728
- curlen = nextlen; nextlen = tree[n+1].Len;
720
+ curlen = nextlen; nextlen = tree[n + 1].Len;
729
721
  if (++count < max_count && curlen == nextlen) {
730
722
  continue;
731
723
  } else if (count < min_count) {
@@ -753,7 +745,7 @@ local void scan_tree (s, tree, max_code)
753
745
  * Send a literal or distance tree in compressed form, using the codes in
754
746
  * bl_tree.
755
747
  */
756
- local void send_tree (s, tree, max_code)
748
+ local void send_tree(s, tree, max_code)
757
749
  deflate_state *s;
758
750
  ct_data *tree; /* the tree to be scanned */
759
751
  int max_code; /* and its largest code of non zero frequency */
@@ -766,11 +758,11 @@ local void send_tree (s, tree, max_code)
766
758
  int max_count = 7; /* max repeat count */
767
759
  int min_count = 4; /* min repeat count */
768
760
 
769
- /* tree[max_code+1].Len = -1; */ /* guard already set */
761
+ /* tree[max_code + 1].Len = -1; */ /* guard already set */
770
762
  if (nextlen == 0) max_count = 138, min_count = 3;
771
763
 
772
764
  for (n = 0; n <= max_code; n++) {
773
- curlen = nextlen; nextlen = tree[n+1].Len;
765
+ curlen = nextlen; nextlen = tree[n + 1].Len;
774
766
  if (++count < max_count && curlen == nextlen) {
775
767
  continue;
776
768
  } else if (count < min_count) {
@@ -781,13 +773,13 @@ local void send_tree (s, tree, max_code)
781
773
  send_code(s, curlen, s->bl_tree); count--;
782
774
  }
783
775
  Assert(count >= 3 && count <= 6, " 3_6?");
784
- send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
776
+ send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2);
785
777
 
786
778
  } else if (count <= 10) {
787
- send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
779
+ send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3);
788
780
 
789
781
  } else {
790
- send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
782
+ send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7);
791
783
  }
792
784
  count = 0; prevlen = curlen;
793
785
  if (nextlen == 0) {
@@ -815,8 +807,8 @@ local int build_bl_tree(s)
815
807
 
816
808
  /* Build the bit length tree: */
817
809
  build_tree(s, (tree_desc *)(&(s->bl_desc)));
818
- /* opt_len now includes the length of the tree representations, except
819
- * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
810
+ /* opt_len now includes the length of the tree representations, except the
811
+ * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts.
820
812
  */
821
813
 
822
814
  /* Determine the number of bit length codes to send. The pkzip format
@@ -827,7 +819,7 @@ local int build_bl_tree(s)
827
819
  if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
828
820
  }
829
821
  /* Update opt_len to include the bit length tree and counts */
830
- s->opt_len += 3*(max_blindex+1) + 5+5+4;
822
+ s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4;
831
823
  Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
832
824
  s->opt_len, s->static_len));
833
825
 
@@ -849,19 +841,19 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
849
841
  Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
850
842
  "too many codes");
851
843
  Tracev((stderr, "\nbl counts: "));
852
- send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
853
- send_bits(s, dcodes-1, 5);
854
- send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
844
+ send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */
845
+ send_bits(s, dcodes - 1, 5);
846
+ send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */
855
847
  for (rank = 0; rank < blcodes; rank++) {
856
848
  Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
857
849
  send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
858
850
  }
859
851
  Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
860
852
 
861
- send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
853
+ send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */
862
854
  Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
863
855
 
864
- send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
856
+ send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */
865
857
  Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
866
858
  }
867
859
 
@@ -874,53 +866,48 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
874
866
  ulg stored_len; /* length of input block */
875
867
  int last; /* one if this is the last block for a file */
876
868
  {
877
- send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
878
- #ifdef DEBUG
869
+ send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */
870
+ bi_windup(s); /* align on byte boundary */
871
+ put_short(s, (ush)stored_len);
872
+ put_short(s, (ush)~stored_len);
873
+ if (stored_len)
874
+ zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
875
+ s->pending += stored_len;
876
+ #ifdef ZLIB_DEBUG
879
877
  s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
880
878
  s->compressed_len += (stored_len + 4) << 3;
879
+ s->bits_sent += 2*16;
880
+ s->bits_sent += stored_len << 3;
881
881
  #endif
882
- copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
882
+ }
883
+
884
+ /* ===========================================================================
885
+ * Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
886
+ */
887
+ void ZLIB_INTERNAL _tr_flush_bits(s)
888
+ deflate_state *s;
889
+ {
890
+ bi_flush(s);
883
891
  }
884
892
 
885
893
  /* ===========================================================================
886
894
  * Send one empty static block to give enough lookahead for inflate.
887
895
  * This takes 10 bits, of which 7 may remain in the bit buffer.
888
- * The current inflate code requires 9 bits of lookahead. If the
889
- * last two codes for the previous block (real code plus EOB) were coded
890
- * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
891
- * the last real code. In this case we send two empty static blocks instead
892
- * of one. (There are no problems if the previous block is stored or fixed.)
893
- * To simplify the code, we assume the worst case of last real code encoded
894
- * on one bit only.
895
896
  */
896
897
  void ZLIB_INTERNAL _tr_align(s)
897
898
  deflate_state *s;
898
899
  {
899
900
  send_bits(s, STATIC_TREES<<1, 3);
900
901
  send_code(s, END_BLOCK, static_ltree);
901
- #ifdef DEBUG
902
+ #ifdef ZLIB_DEBUG
902
903
  s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
903
904
  #endif
904
905
  bi_flush(s);
905
- /* Of the 10 bits for the empty block, we have already sent
906
- * (10 - bi_valid) bits. The lookahead for the last real code (before
907
- * the EOB of the previous block) was thus at least one plus the length
908
- * of the EOB plus what we have just sent of the empty static block.
909
- */
910
- if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
911
- send_bits(s, STATIC_TREES<<1, 3);
912
- send_code(s, END_BLOCK, static_ltree);
913
- #ifdef DEBUG
914
- s->compressed_len += 10L;
915
- #endif
916
- bi_flush(s);
917
- }
918
- s->last_eob_len = 7;
919
906
  }
920
907
 
921
908
  /* ===========================================================================
922
909
  * Determine the best encoding for the current block: dynamic trees, static
923
- * trees or store, and output the encoded block to the zip file.
910
+ * trees or store, and write out the encoded block.
924
911
  */
925
912
  void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
926
913
  deflate_state *s;
@@ -956,14 +943,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
956
943
  max_blindex = build_bl_tree(s);
957
944
 
958
945
  /* Determine the best encoding. Compute the block lengths in bytes. */
959
- opt_lenb = (s->opt_len+3+7)>>3;
960
- static_lenb = (s->static_len+3+7)>>3;
946
+ opt_lenb = (s->opt_len + 3 + 7) >> 3;
947
+ static_lenb = (s->static_len + 3 + 7) >> 3;
961
948
 
962
949
  Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
963
950
  opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
964
- s->last_lit));
951
+ s->sym_next / 3));
965
952
 
966
- if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
953
+ #ifndef FORCE_STATIC
954
+ if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
955
+ #endif
956
+ opt_lenb = static_lenb;
967
957
 
968
958
  } else {
969
959
  Assert(buf != (char*)0, "lost buf");
@@ -973,7 +963,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
973
963
  #ifdef FORCE_STORED
974
964
  if (buf != (char*)0) { /* force stored block */
975
965
  #else
976
- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
966
+ if (stored_len + 4 <= opt_lenb && buf != (char*)0) {
977
967
  /* 4: two words for the lengths */
978
968
  #endif
979
969
  /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
@@ -984,22 +974,20 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
984
974
  */
985
975
  _tr_stored_block(s, buf, stored_len, last);
986
976
 
987
- #ifdef FORCE_STATIC
988
- } else if (static_lenb >= 0) { /* force static trees */
989
- #else
990
- } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
991
- #endif
992
- send_bits(s, (STATIC_TREES<<1)+last, 3);
993
- compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
994
- #ifdef DEBUG
977
+ } else if (static_lenb == opt_lenb) {
978
+ send_bits(s, (STATIC_TREES<<1) + last, 3);
979
+ compress_block(s, (const ct_data *)static_ltree,
980
+ (const ct_data *)static_dtree);
981
+ #ifdef ZLIB_DEBUG
995
982
  s->compressed_len += 3 + s->static_len;
996
983
  #endif
997
984
  } else {
998
- send_bits(s, (DYN_TREES<<1)+last, 3);
999
- send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
1000
- max_blindex+1);
1001
- compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
1002
- #ifdef DEBUG
985
+ send_bits(s, (DYN_TREES<<1) + last, 3);
986
+ send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1,
987
+ max_blindex + 1);
988
+ compress_block(s, (const ct_data *)s->dyn_ltree,
989
+ (const ct_data *)s->dyn_dtree);
990
+ #ifdef ZLIB_DEBUG
1003
991
  s->compressed_len += 3 + s->opt_len;
1004
992
  #endif
1005
993
  }
@@ -1011,25 +999,26 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
1011
999
 
1012
1000
  if (last) {
1013
1001
  bi_windup(s);
1014
- #ifdef DEBUG
1002
+ #ifdef ZLIB_DEBUG
1015
1003
  s->compressed_len += 7; /* align on byte boundary */
1016
1004
  #endif
1017
1005
  }
1018
- Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
1019
- s->compressed_len-7*last));
1006
+ Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3,
1007
+ s->compressed_len - 7*last));
1020
1008
  }
1021
1009
 
1022
1010
  /* ===========================================================================
1023
1011
  * Save the match info and tally the frequency counts. Return true if
1024
1012
  * the current block must be flushed.
1025
1013
  */
1026
- int ZLIB_INTERNAL _tr_tally (s, dist, lc)
1014
+ int ZLIB_INTERNAL _tr_tally(s, dist, lc)
1027
1015
  deflate_state *s;
1028
1016
  unsigned dist; /* distance of matched string */
1029
- unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
1017
+ unsigned lc; /* match length - MIN_MATCH or unmatched char (dist==0) */
1030
1018
  {
1031
- s->d_buf[s->last_lit] = (ush)dist;
1032
- s->l_buf[s->last_lit++] = (uch)lc;
1019
+ s->sym_buf[s->sym_next++] = (uch)dist;
1020
+ s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
1021
+ s->sym_buf[s->sym_next++] = (uch)lc;
1033
1022
  if (dist == 0) {
1034
1023
  /* lc is the unmatched char */
1035
1024
  s->dyn_ltree[lc].Freq++;
@@ -1041,33 +1030,10 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
1041
1030
  (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
1042
1031
  (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
1043
1032
 
1044
- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
1033
+ s->dyn_ltree[_length_code[lc] + LITERALS + 1].Freq++;
1045
1034
  s->dyn_dtree[d_code(dist)].Freq++;
1046
1035
  }
1047
-
1048
- #ifdef TRUNCATE_BLOCK
1049
- /* Try to guess if it is profitable to stop the current block here */
1050
- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
1051
- /* Compute an upper bound for the compressed length */
1052
- ulg out_length = (ulg)s->last_lit*8L;
1053
- ulg in_length = (ulg)((long)s->strstart - s->block_start);
1054
- int dcode;
1055
- for (dcode = 0; dcode < D_CODES; dcode++) {
1056
- out_length += (ulg)s->dyn_dtree[dcode].Freq *
1057
- (5L+extra_dbits[dcode]);
1058
- }
1059
- out_length >>= 3;
1060
- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
1061
- s->last_lit, in_length, out_length,
1062
- 100L - out_length*100L/in_length));
1063
- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
1064
- }
1065
- #endif
1066
- return (s->last_lit == s->lit_bufsize-1);
1067
- /* We avoid equality with lit_bufsize because of wraparound at 64K
1068
- * on 16 bit machines and because stored blocks are restricted to
1069
- * 64K-1 bytes.
1070
- */
1036
+ return (s->sym_next == s->sym_end);
1071
1037
  }
1072
1038
 
1073
1039
  /* ===========================================================================
@@ -1075,25 +1041,26 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
1075
1041
  */
1076
1042
  local void compress_block(s, ltree, dtree)
1077
1043
  deflate_state *s;
1078
- ct_data *ltree; /* literal tree */
1079
- ct_data *dtree; /* distance tree */
1044
+ const ct_data *ltree; /* literal tree */
1045
+ const ct_data *dtree; /* distance tree */
1080
1046
  {
1081
1047
  unsigned dist; /* distance of matched string */
1082
1048
  int lc; /* match length or unmatched char (if dist == 0) */
1083
- unsigned lx = 0; /* running index in l_buf */
1049
+ unsigned sx = 0; /* running index in sym_buf */
1084
1050
  unsigned code; /* the code to send */
1085
1051
  int extra; /* number of extra bits to send */
1086
1052
 
1087
- if (s->last_lit != 0) do {
1088
- dist = s->d_buf[lx];
1089
- lc = s->l_buf[lx++];
1053
+ if (s->sym_next != 0) do {
1054
+ dist = s->sym_buf[sx++] & 0xff;
1055
+ dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
1056
+ lc = s->sym_buf[sx++];
1090
1057
  if (dist == 0) {
1091
1058
  send_code(s, lc, ltree); /* send a literal byte */
1092
1059
  Tracecv(isgraph(lc), (stderr," '%c' ", lc));
1093
1060
  } else {
1094
1061
  /* Here, lc is the match length - MIN_MATCH */
1095
1062
  code = _length_code[lc];
1096
- send_code(s, code+LITERALS+1, ltree); /* send the length code */
1063
+ send_code(s, code + LITERALS + 1, ltree); /* send length code */
1097
1064
  extra = extra_lbits[code];
1098
1065
  if (extra != 0) {
1099
1066
  lc -= base_length[code];
@@ -1106,28 +1073,26 @@ local void compress_block(s, ltree, dtree)
1106
1073
  send_code(s, code, dtree); /* send the distance code */
1107
1074
  extra = extra_dbits[code];
1108
1075
  if (extra != 0) {
1109
- dist -= base_dist[code];
1076
+ dist -= (unsigned)base_dist[code];
1110
1077
  send_bits(s, dist, extra); /* send the extra distance bits */
1111
1078
  }
1112
1079
  } /* literal or match pair ? */
1113
1080
 
1114
- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
1115
- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
1116
- "pendingBuf overflow");
1081
+ /* Check that the overlay between pending_buf and sym_buf is ok: */
1082
+ Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
1117
1083
 
1118
- } while (lx < s->last_lit);
1084
+ } while (sx < s->sym_next);
1119
1085
 
1120
1086
  send_code(s, END_BLOCK, ltree);
1121
- s->last_eob_len = ltree[END_BLOCK].Len;
1122
1087
  }
1123
1088
 
1124
1089
  /* ===========================================================================
1125
1090
  * Check if the data type is TEXT or BINARY, using the following algorithm:
1126
1091
  * - TEXT if the two conditions below are satisfied:
1127
1092
  * a) There are no non-portable control characters belonging to the
1128
- * "black list" (0..6, 14..25, 28..31).
1093
+ * "block list" (0..6, 14..25, 28..31).
1129
1094
  * b) There is at least one printable character belonging to the
1130
- * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
1095
+ * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
1131
1096
  * - BINARY otherwise.
1132
1097
  * - The following partially-portable control characters form a
1133
1098
  * "gray list" that is ignored in this detection algorithm:
@@ -1137,19 +1102,19 @@ local void compress_block(s, ltree, dtree)
1137
1102
  local int detect_data_type(s)
1138
1103
  deflate_state *s;
1139
1104
  {
1140
- /* black_mask is the bit mask of black-listed bytes
1105
+ /* block_mask is the bit mask of block-listed bytes
1141
1106
  * set bits 0..6, 14..25, and 28..31
1142
1107
  * 0xf3ffc07f = binary 11110011111111111100000001111111
1143
1108
  */
1144
- unsigned long black_mask = 0xf3ffc07fUL;
1109
+ unsigned long block_mask = 0xf3ffc07fUL;
1145
1110
  int n;
1146
1111
 
1147
- /* Check for non-textual ("black-listed") bytes. */
1148
- for (n = 0; n <= 31; n++, black_mask >>= 1)
1149
- if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
1112
+ /* Check for non-textual ("block-listed") bytes. */
1113
+ for (n = 0; n <= 31; n++, block_mask >>= 1)
1114
+ if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
1150
1115
  return Z_BINARY;
1151
1116
 
1152
- /* Check for textual ("white-listed") bytes. */
1117
+ /* Check for textual ("allow-listed") bytes. */
1153
1118
  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
1154
1119
  || s->dyn_ltree[13].Freq != 0)
1155
1120
  return Z_TEXT;
@@ -1157,7 +1122,7 @@ local int detect_data_type(s)
1157
1122
  if (s->dyn_ltree[n].Freq != 0)
1158
1123
  return Z_TEXT;
1159
1124
 
1160
- /* There are no "black-listed" or "white-listed" bytes:
1125
+ /* There are no "block-listed" or "allow-listed" bytes:
1161
1126
  * this stream either is empty or has tolerated ("gray-listed") bytes only.
1162
1127
  */
1163
1128
  return Z_BINARY;
@@ -1210,35 +1175,7 @@ local void bi_windup(s)
1210
1175
  }
1211
1176
  s->bi_buf = 0;
1212
1177
  s->bi_valid = 0;
1213
- #ifdef DEBUG
1214
- s->bits_sent = (s->bits_sent+7) & ~7;
1215
- #endif
1216
- }
1217
-
1218
- /* ===========================================================================
1219
- * Copy a stored block, storing first the length and its
1220
- * one's complement if requested.
1221
- */
1222
- local void copy_block(s, buf, len, header)
1223
- deflate_state *s;
1224
- charf *buf; /* the input data */
1225
- unsigned len; /* its length */
1226
- int header; /* true if block header must be written */
1227
- {
1228
- bi_windup(s); /* align on byte boundary */
1229
- s->last_eob_len = 8; /* enough lookahead for inflate */
1230
-
1231
- if (header) {
1232
- put_short(s, (ush)len);
1233
- put_short(s, (ush)~len);
1234
- #ifdef DEBUG
1235
- s->bits_sent += 2*16;
1236
- #endif
1237
- }
1238
- #ifdef DEBUG
1239
- s->bits_sent += (ulg)len<<3;
1178
+ #ifdef ZLIB_DEBUG
1179
+ s->bits_sent = (s->bits_sent + 7) & ~7;
1240
1180
  #endif
1241
- while (len--) {
1242
- put_byte(s, *buf++);
1243
- }
1244
1181
  }