libarchive-static 1.0.5 → 1.1.0

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 (296) hide show
  1. checksums.yaml +5 -5
  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_internal.h +0 -1
  20. data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
  21. data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
  22. data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
  23. data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
  24. data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
  25. data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
  26. data/ext/libarchive-3.6.2/Makefile.in +16892 -0
  27. data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
  28. data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
  29. data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
  30. data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
  31. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
  32. data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
  33. data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
  34. data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
  35. data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
  36. data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
  37. data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
  38. data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
  39. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
  40. data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
  41. data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
  42. data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
  43. data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
  44. data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
  45. data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
  46. data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
  47. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
  48. data/ext/libarchive-3.6.2/config.h.in +1504 -0
  49. data/ext/libarchive-3.6.2/configure +25558 -0
  50. data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
  51. data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
  52. data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
  53. data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
  54. data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
  55. data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
  56. data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
  57. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
  58. data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
  59. data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
  60. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
  61. data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
  62. data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
  63. data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
  64. data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
  65. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
  66. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
  67. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
  68. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
  69. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
  70. data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
  71. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
  72. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
  73. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
  74. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
  75. data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
  76. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
  77. data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
  78. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
  79. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
  80. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
  81. data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
  82. data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
  83. data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
  84. data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
  85. data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
  86. data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
  87. data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
  88. data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
  89. data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
  90. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
  91. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
  92. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
  93. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
  94. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
  95. data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
  96. data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
  97. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
  98. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
  99. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
  100. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
  101. data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
  102. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
  103. data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
  104. data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
  105. data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
  106. data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
  107. data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
  108. data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
  109. data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
  110. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
  111. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  112. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
  113. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
  114. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
  115. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
  116. data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
  117. data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
  118. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
  119. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
  120. data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
  121. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
  122. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
  123. data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
  124. data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
  125. 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
  126. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
  127. 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
  128. 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
  129. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
  130. 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
  131. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
  132. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
  133. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
  134. 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
  135. 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
  136. 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
  137. 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
  138. 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
  139. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
  140. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
  141. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
  142. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
  143. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
  144. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
  145. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
  146. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
  147. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
  148. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
  149. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
  150. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
  151. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
  152. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
  153. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
  154. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
  155. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
  156. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
  157. data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
  158. data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
  159. data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
  160. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
  161. data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
  162. data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
  163. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
  164. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
  165. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
  166. data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
  167. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
  168. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
  169. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
  170. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
  171. 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
  172. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
  173. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
  174. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
  175. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
  176. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
  177. 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
  178. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
  179. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
  180. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
  181. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
  182. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
  183. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
  184. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
  185. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
  186. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
  187. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
  188. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
  189. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
  190. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
  191. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
  192. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
  193. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
  194. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
  195. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
  196. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
  197. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  198. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
  199. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
  200. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
  201. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
  202. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
  203. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
  204. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
  205. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
  206. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
  207. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
  208. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
  209. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
  210. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
  211. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
  212. data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
  213. data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
  214. data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
  215. data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
  216. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
  217. data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
  218. data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
  219. data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
  220. data/ext/libarchive-static-makefile +144 -80
  221. data/ext/libarchive-static-wrapper-makefile +1 -1
  222. data/ext/zlib-1.2.13/Makefile.in +404 -0
  223. data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
  224. data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
  225. data/ext/zlib-1.2.13/configure +922 -0
  226. data/ext/zlib-1.2.13/crc32.c +1125 -0
  227. data/ext/zlib-1.2.13/crc32.h +9446 -0
  228. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
  229. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
  230. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
  231. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
  232. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
  233. data/ext/zlib-1.2.13/gzread.c +650 -0
  234. data/ext/zlib-1.2.13/gzwrite.c +677 -0
  235. data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
  236. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
  237. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
  238. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
  239. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
  240. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
  241. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
  242. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
  243. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
  244. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
  245. data/ext/zlib-1.2.13/uncompr.c +93 -0
  246. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
  247. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
  248. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
  249. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
  250. metadata +244 -137
  251. data/ext/libarchive-0.1.1/libarchive.c +0 -1762
  252. data/ext/libarchive-2.8.4/Makefile.in +0 -7076
  253. data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
  254. data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
  255. data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
  256. data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
  257. data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
  258. data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
  259. data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
  260. data/ext/libarchive-2.8.4/config.h.in +0 -772
  261. data/ext/libarchive-2.8.4/configure +0 -17916
  262. data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
  263. data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
  264. data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
  265. data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
  266. data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
  267. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
  268. data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
  269. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
  270. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
  271. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
  272. data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
  273. data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
  274. data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
  275. data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
  276. data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
  277. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
  278. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
  279. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
  280. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
  281. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
  282. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
  283. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
  284. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
  285. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
  286. data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
  287. data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
  288. data/ext/zlib-1.2.5/Makefile.in +0 -257
  289. data/ext/zlib-1.2.5/configure +0 -596
  290. data/ext/zlib-1.2.5/crc32.c +0 -442
  291. data/ext/zlib-1.2.5/crc32.h +0 -441
  292. data/ext/zlib-1.2.5/example.c +0 -565
  293. data/ext/zlib-1.2.5/gzread.c +0 -653
  294. data/ext/zlib-1.2.5/gzwrite.c +0 -531
  295. data/ext/zlib-1.2.5/minigzip.c +0 -440
  296. data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -1,653 +0,0 @@
1
- /* gzread.c -- zlib functions for reading gzip files
2
- * Copyright (C) 2004, 2005, 2010 Mark Adler
3
- * For conditions of distribution and use, see copyright notice in zlib.h
4
- */
5
-
6
- #include "gzguts.h"
7
-
8
- /* Local functions */
9
- local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
10
- local int gz_avail OF((gz_statep));
11
- local int gz_next4 OF((gz_statep, unsigned long *));
12
- local int gz_head OF((gz_statep));
13
- local int gz_decomp OF((gz_statep));
14
- local int gz_make OF((gz_statep));
15
- local int gz_skip OF((gz_statep, z_off64_t));
16
-
17
- /* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
18
- state->fd, and update state->eof, state->err, and state->msg as appropriate.
19
- This function needs to loop on read(), since read() is not guaranteed to
20
- read the number of bytes requested, depending on the type of descriptor. */
21
- local int gz_load(state, buf, len, have)
22
- gz_statep state;
23
- unsigned char *buf;
24
- unsigned len;
25
- unsigned *have;
26
- {
27
- int ret;
28
-
29
- *have = 0;
30
- do {
31
- ret = read(state->fd, buf + *have, len - *have);
32
- if (ret <= 0)
33
- break;
34
- *have += ret;
35
- } while (*have < len);
36
- if (ret < 0) {
37
- gz_error(state, Z_ERRNO, zstrerror());
38
- return -1;
39
- }
40
- if (ret == 0)
41
- state->eof = 1;
42
- return 0;
43
- }
44
-
45
- /* Load up input buffer and set eof flag if last data loaded -- return -1 on
46
- error, 0 otherwise. Note that the eof flag is set when the end of the input
47
- file is reached, even though there may be unused data in the buffer. Once
48
- that data has been used, no more attempts will be made to read the file.
49
- gz_avail() assumes that strm->avail_in == 0. */
50
- local int gz_avail(state)
51
- gz_statep state;
52
- {
53
- z_streamp strm = &(state->strm);
54
-
55
- if (state->err != Z_OK)
56
- return -1;
57
- if (state->eof == 0) {
58
- if (gz_load(state, state->in, state->size,
59
- (unsigned *)&(strm->avail_in)) == -1)
60
- return -1;
61
- strm->next_in = state->in;
62
- }
63
- return 0;
64
- }
65
-
66
- /* Get next byte from input, or -1 if end or error. */
67
- #define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \
68
- (strm->avail_in == 0 ? -1 : \
69
- (strm->avail_in--, *(strm->next_in)++)))
70
-
71
- /* Get a four-byte little-endian integer and return 0 on success and the value
72
- in *ret. Otherwise -1 is returned and *ret is not modified. */
73
- local int gz_next4(state, ret)
74
- gz_statep state;
75
- unsigned long *ret;
76
- {
77
- int ch;
78
- unsigned long val;
79
- z_streamp strm = &(state->strm);
80
-
81
- val = NEXT();
82
- val += (unsigned)NEXT() << 8;
83
- val += (unsigned long)NEXT() << 16;
84
- ch = NEXT();
85
- if (ch == -1)
86
- return -1;
87
- val += (unsigned long)ch << 24;
88
- *ret = val;
89
- return 0;
90
- }
91
-
92
- /* Look for gzip header, set up for inflate or copy. state->have must be zero.
93
- If this is the first time in, allocate required memory. state->how will be
94
- left unchanged if there is no more input data available, will be set to COPY
95
- if there is no gzip header and direct copying will be performed, or it will
96
- be set to GZIP for decompression, and the gzip header will be skipped so
97
- that the next available input data is the raw deflate stream. If direct
98
- copying, then leftover input data from the input buffer will be copied to
99
- the output buffer. In that case, all further file reads will be directly to
100
- either the output buffer or a user buffer. If decompressing, the inflate
101
- state and the check value will be initialized. gz_head() will return 0 on
102
- success or -1 on failure. Failures may include read errors or gzip header
103
- errors. */
104
- local int gz_head(state)
105
- gz_statep state;
106
- {
107
- z_streamp strm = &(state->strm);
108
- int flags;
109
- unsigned len;
110
-
111
- /* allocate read buffers and inflate memory */
112
- if (state->size == 0) {
113
- /* allocate buffers */
114
- state->in = malloc(state->want);
115
- state->out = malloc(state->want << 1);
116
- if (state->in == NULL || state->out == NULL) {
117
- if (state->out != NULL)
118
- free(state->out);
119
- if (state->in != NULL)
120
- free(state->in);
121
- gz_error(state, Z_MEM_ERROR, "out of memory");
122
- return -1;
123
- }
124
- state->size = state->want;
125
-
126
- /* allocate inflate memory */
127
- state->strm.zalloc = Z_NULL;
128
- state->strm.zfree = Z_NULL;
129
- state->strm.opaque = Z_NULL;
130
- state->strm.avail_in = 0;
131
- state->strm.next_in = Z_NULL;
132
- if (inflateInit2(&(state->strm), -15) != Z_OK) { /* raw inflate */
133
- free(state->out);
134
- free(state->in);
135
- state->size = 0;
136
- gz_error(state, Z_MEM_ERROR, "out of memory");
137
- return -1;
138
- }
139
- }
140
-
141
- /* get some data in the input buffer */
142
- if (strm->avail_in == 0) {
143
- if (gz_avail(state) == -1)
144
- return -1;
145
- if (strm->avail_in == 0)
146
- return 0;
147
- }
148
-
149
- /* look for the gzip magic header bytes 31 and 139 */
150
- if (strm->next_in[0] == 31) {
151
- strm->avail_in--;
152
- strm->next_in++;
153
- if (strm->avail_in == 0 && gz_avail(state) == -1)
154
- return -1;
155
- if (strm->avail_in && strm->next_in[0] == 139) {
156
- /* we have a gzip header, woo hoo! */
157
- strm->avail_in--;
158
- strm->next_in++;
159
-
160
- /* skip rest of header */
161
- if (NEXT() != 8) { /* compression method */
162
- gz_error(state, Z_DATA_ERROR, "unknown compression method");
163
- return -1;
164
- }
165
- flags = NEXT();
166
- if (flags & 0xe0) { /* reserved flag bits */
167
- gz_error(state, Z_DATA_ERROR, "unknown header flags set");
168
- return -1;
169
- }
170
- NEXT(); /* modification time */
171
- NEXT();
172
- NEXT();
173
- NEXT();
174
- NEXT(); /* extra flags */
175
- NEXT(); /* operating system */
176
- if (flags & 4) { /* extra field */
177
- len = (unsigned)NEXT();
178
- len += (unsigned)NEXT() << 8;
179
- while (len--)
180
- if (NEXT() < 0)
181
- break;
182
- }
183
- if (flags & 8) /* file name */
184
- while (NEXT() > 0)
185
- ;
186
- if (flags & 16) /* comment */
187
- while (NEXT() > 0)
188
- ;
189
- if (flags & 2) { /* header crc */
190
- NEXT();
191
- NEXT();
192
- }
193
- /* an unexpected end of file is not checked for here -- it will be
194
- noticed on the first request for uncompressed data */
195
-
196
- /* set up for decompression */
197
- inflateReset(strm);
198
- strm->adler = crc32(0L, Z_NULL, 0);
199
- state->how = GZIP;
200
- state->direct = 0;
201
- return 0;
202
- }
203
- else {
204
- /* not a gzip file -- save first byte (31) and fall to raw i/o */
205
- state->out[0] = 31;
206
- state->have = 1;
207
- }
208
- }
209
-
210
- /* doing raw i/o, save start of raw data for seeking, copy any leftover
211
- input to output -- this assumes that the output buffer is larger than
212
- the input buffer, which also assures space for gzungetc() */
213
- state->raw = state->pos;
214
- state->next = state->out;
215
- if (strm->avail_in) {
216
- memcpy(state->next + state->have, strm->next_in, strm->avail_in);
217
- state->have += strm->avail_in;
218
- strm->avail_in = 0;
219
- }
220
- state->how = COPY;
221
- state->direct = 1;
222
- return 0;
223
- }
224
-
225
- /* Decompress from input to the provided next_out and avail_out in the state.
226
- If the end of the compressed data is reached, then verify the gzip trailer
227
- check value and length (modulo 2^32). state->have and state->next are set
228
- to point to the just decompressed data, and the crc is updated. If the
229
- trailer is verified, state->how is reset to LOOK to look for the next gzip
230
- stream or raw data, once state->have is depleted. Returns 0 on success, -1
231
- on failure. Failures may include invalid compressed data or a failed gzip
232
- trailer verification. */
233
- local int gz_decomp(state)
234
- gz_statep state;
235
- {
236
- int ret;
237
- unsigned had;
238
- unsigned long crc, len;
239
- z_streamp strm = &(state->strm);
240
-
241
- /* fill output buffer up to end of deflate stream */
242
- had = strm->avail_out;
243
- do {
244
- /* get more input for inflate() */
245
- if (strm->avail_in == 0 && gz_avail(state) == -1)
246
- return -1;
247
- if (strm->avail_in == 0) {
248
- gz_error(state, Z_DATA_ERROR, "unexpected end of file");
249
- return -1;
250
- }
251
-
252
- /* decompress and handle errors */
253
- ret = inflate(strm, Z_NO_FLUSH);
254
- if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
255
- gz_error(state, Z_STREAM_ERROR,
256
- "internal error: inflate stream corrupt");
257
- return -1;
258
- }
259
- if (ret == Z_MEM_ERROR) {
260
- gz_error(state, Z_MEM_ERROR, "out of memory");
261
- return -1;
262
- }
263
- if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
264
- gz_error(state, Z_DATA_ERROR,
265
- strm->msg == NULL ? "compressed data error" : strm->msg);
266
- return -1;
267
- }
268
- } while (strm->avail_out && ret != Z_STREAM_END);
269
-
270
- /* update available output and crc check value */
271
- state->have = had - strm->avail_out;
272
- state->next = strm->next_out - state->have;
273
- strm->adler = crc32(strm->adler, state->next, state->have);
274
-
275
- /* check gzip trailer if at end of deflate stream */
276
- if (ret == Z_STREAM_END) {
277
- if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) {
278
- gz_error(state, Z_DATA_ERROR, "unexpected end of file");
279
- return -1;
280
- }
281
- if (crc != strm->adler) {
282
- gz_error(state, Z_DATA_ERROR, "incorrect data check");
283
- return -1;
284
- }
285
- if (len != (strm->total_out & 0xffffffffL)) {
286
- gz_error(state, Z_DATA_ERROR, "incorrect length check");
287
- return -1;
288
- }
289
- state->how = LOOK; /* ready for next stream, once have is 0 (leave
290
- state->direct unchanged to remember how) */
291
- }
292
-
293
- /* good decompression */
294
- return 0;
295
- }
296
-
297
- /* Make data and put in the output buffer. Assumes that state->have == 0.
298
- Data is either copied from the input file or decompressed from the input
299
- file depending on state->how. If state->how is LOOK, then a gzip header is
300
- looked for (and skipped if found) to determine wither to copy or decompress.
301
- Returns -1 on error, otherwise 0. gz_make() will leave state->have as COPY
302
- or GZIP unless the end of the input file has been reached and all data has
303
- been processed. */
304
- local int gz_make(state)
305
- gz_statep state;
306
- {
307
- z_streamp strm = &(state->strm);
308
-
309
- if (state->how == LOOK) { /* look for gzip header */
310
- if (gz_head(state) == -1)
311
- return -1;
312
- if (state->have) /* got some data from gz_head() */
313
- return 0;
314
- }
315
- if (state->how == COPY) { /* straight copy */
316
- if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1)
317
- return -1;
318
- state->next = state->out;
319
- }
320
- else if (state->how == GZIP) { /* decompress */
321
- strm->avail_out = state->size << 1;
322
- strm->next_out = state->out;
323
- if (gz_decomp(state) == -1)
324
- return -1;
325
- }
326
- return 0;
327
- }
328
-
329
- /* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
330
- local int gz_skip(state, len)
331
- gz_statep state;
332
- z_off64_t len;
333
- {
334
- unsigned n;
335
-
336
- /* skip over len bytes or reach end-of-file, whichever comes first */
337
- while (len)
338
- /* skip over whatever is in output buffer */
339
- if (state->have) {
340
- n = GT_OFF(state->have) || (z_off64_t)state->have > len ?
341
- (unsigned)len : state->have;
342
- state->have -= n;
343
- state->next += n;
344
- state->pos += n;
345
- len -= n;
346
- }
347
-
348
- /* output buffer empty -- return if we're at the end of the input */
349
- else if (state->eof && state->strm.avail_in == 0)
350
- break;
351
-
352
- /* need more data to skip -- load up output buffer */
353
- else {
354
- /* get more output, looking for header if required */
355
- if (gz_make(state) == -1)
356
- return -1;
357
- }
358
- return 0;
359
- }
360
-
361
- /* -- see zlib.h -- */
362
- int ZEXPORT gzread(file, buf, len)
363
- gzFile file;
364
- voidp buf;
365
- unsigned len;
366
- {
367
- unsigned got, n;
368
- gz_statep state;
369
- z_streamp strm;
370
-
371
- /* get internal structure */
372
- if (file == NULL)
373
- return -1;
374
- state = (gz_statep)file;
375
- strm = &(state->strm);
376
-
377
- /* check that we're reading and that there's no error */
378
- if (state->mode != GZ_READ || state->err != Z_OK)
379
- return -1;
380
-
381
- /* since an int is returned, make sure len fits in one, otherwise return
382
- with an error (this avoids the flaw in the interface) */
383
- if ((int)len < 0) {
384
- gz_error(state, Z_BUF_ERROR, "requested length does not fit in int");
385
- return -1;
386
- }
387
-
388
- /* if len is zero, avoid unnecessary operations */
389
- if (len == 0)
390
- return 0;
391
-
392
- /* process a skip request */
393
- if (state->seek) {
394
- state->seek = 0;
395
- if (gz_skip(state, state->skip) == -1)
396
- return -1;
397
- }
398
-
399
- /* get len bytes to buf, or less than len if at the end */
400
- got = 0;
401
- do {
402
- /* first just try copying data from the output buffer */
403
- if (state->have) {
404
- n = state->have > len ? len : state->have;
405
- memcpy(buf, state->next, n);
406
- state->next += n;
407
- state->have -= n;
408
- }
409
-
410
- /* output buffer empty -- return if we're at the end of the input */
411
- else if (state->eof && strm->avail_in == 0)
412
- break;
413
-
414
- /* need output data -- for small len or new stream load up our output
415
- buffer */
416
- else if (state->how == LOOK || len < (state->size << 1)) {
417
- /* get more output, looking for header if required */
418
- if (gz_make(state) == -1)
419
- return -1;
420
- continue; /* no progress yet -- go back to memcpy() above */
421
- /* the copy above assures that we will leave with space in the
422
- output buffer, allowing at least one gzungetc() to succeed */
423
- }
424
-
425
- /* large len -- read directly into user buffer */
426
- else if (state->how == COPY) { /* read directly */
427
- if (gz_load(state, buf, len, &n) == -1)
428
- return -1;
429
- }
430
-
431
- /* large len -- decompress directly into user buffer */
432
- else { /* state->how == GZIP */
433
- strm->avail_out = len;
434
- strm->next_out = buf;
435
- if (gz_decomp(state) == -1)
436
- return -1;
437
- n = state->have;
438
- state->have = 0;
439
- }
440
-
441
- /* update progress */
442
- len -= n;
443
- buf = (char *)buf + n;
444
- got += n;
445
- state->pos += n;
446
- } while (len);
447
-
448
- /* return number of bytes read into user buffer (will fit in int) */
449
- return (int)got;
450
- }
451
-
452
- /* -- see zlib.h -- */
453
- int ZEXPORT gzgetc(file)
454
- gzFile file;
455
- {
456
- int ret;
457
- unsigned char buf[1];
458
- gz_statep state;
459
-
460
- /* get internal structure */
461
- if (file == NULL)
462
- return -1;
463
- state = (gz_statep)file;
464
-
465
- /* check that we're reading and that there's no error */
466
- if (state->mode != GZ_READ || state->err != Z_OK)
467
- return -1;
468
-
469
- /* try output buffer (no need to check for skip request) */
470
- if (state->have) {
471
- state->have--;
472
- state->pos++;
473
- return *(state->next)++;
474
- }
475
-
476
- /* nothing there -- try gzread() */
477
- ret = gzread(file, buf, 1);
478
- return ret < 1 ? -1 : buf[0];
479
- }
480
-
481
- /* -- see zlib.h -- */
482
- int ZEXPORT gzungetc(c, file)
483
- int c;
484
- gzFile file;
485
- {
486
- gz_statep state;
487
-
488
- /* get internal structure */
489
- if (file == NULL)
490
- return -1;
491
- state = (gz_statep)file;
492
-
493
- /* check that we're reading and that there's no error */
494
- if (state->mode != GZ_READ || state->err != Z_OK)
495
- return -1;
496
-
497
- /* process a skip request */
498
- if (state->seek) {
499
- state->seek = 0;
500
- if (gz_skip(state, state->skip) == -1)
501
- return -1;
502
- }
503
-
504
- /* can't push EOF */
505
- if (c < 0)
506
- return -1;
507
-
508
- /* if output buffer empty, put byte at end (allows more pushing) */
509
- if (state->have == 0) {
510
- state->have = 1;
511
- state->next = state->out + (state->size << 1) - 1;
512
- state->next[0] = c;
513
- state->pos--;
514
- return c;
515
- }
516
-
517
- /* if no room, give up (must have already done a gzungetc()) */
518
- if (state->have == (state->size << 1)) {
519
- gz_error(state, Z_BUF_ERROR, "out of room to push characters");
520
- return -1;
521
- }
522
-
523
- /* slide output data if needed and insert byte before existing data */
524
- if (state->next == state->out) {
525
- unsigned char *src = state->out + state->have;
526
- unsigned char *dest = state->out + (state->size << 1);
527
- while (src > state->out)
528
- *--dest = *--src;
529
- state->next = dest;
530
- }
531
- state->have++;
532
- state->next--;
533
- state->next[0] = c;
534
- state->pos--;
535
- return c;
536
- }
537
-
538
- /* -- see zlib.h -- */
539
- char * ZEXPORT gzgets(file, buf, len)
540
- gzFile file;
541
- char *buf;
542
- int len;
543
- {
544
- unsigned left, n;
545
- char *str;
546
- unsigned char *eol;
547
- gz_statep state;
548
-
549
- /* check parameters and get internal structure */
550
- if (file == NULL || buf == NULL || len < 1)
551
- return NULL;
552
- state = (gz_statep)file;
553
-
554
- /* check that we're reading and that there's no error */
555
- if (state->mode != GZ_READ || state->err != Z_OK)
556
- return NULL;
557
-
558
- /* process a skip request */
559
- if (state->seek) {
560
- state->seek = 0;
561
- if (gz_skip(state, state->skip) == -1)
562
- return NULL;
563
- }
564
-
565
- /* copy output bytes up to new line or len - 1, whichever comes first --
566
- append a terminating zero to the string (we don't check for a zero in
567
- the contents, let the user worry about that) */
568
- str = buf;
569
- left = (unsigned)len - 1;
570
- if (left) do {
571
- /* assure that something is in the output buffer */
572
- if (state->have == 0) {
573
- if (gz_make(state) == -1)
574
- return NULL; /* error */
575
- if (state->have == 0) { /* end of file */
576
- if (buf == str) /* got bupkus */
577
- return NULL;
578
- break; /* got something -- return it */
579
- }
580
- }
581
-
582
- /* look for end-of-line in current output buffer */
583
- n = state->have > left ? left : state->have;
584
- eol = memchr(state->next, '\n', n);
585
- if (eol != NULL)
586
- n = (unsigned)(eol - state->next) + 1;
587
-
588
- /* copy through end-of-line, or remainder if not found */
589
- memcpy(buf, state->next, n);
590
- state->have -= n;
591
- state->next += n;
592
- state->pos += n;
593
- left -= n;
594
- buf += n;
595
- } while (left && eol == NULL);
596
-
597
- /* found end-of-line or out of space -- terminate string and return it */
598
- buf[0] = 0;
599
- return str;
600
- }
601
-
602
- /* -- see zlib.h -- */
603
- int ZEXPORT gzdirect(file)
604
- gzFile file;
605
- {
606
- gz_statep state;
607
-
608
- /* get internal structure */
609
- if (file == NULL)
610
- return 0;
611
- state = (gz_statep)file;
612
-
613
- /* check that we're reading */
614
- if (state->mode != GZ_READ)
615
- return 0;
616
-
617
- /* if the state is not known, but we can find out, then do so (this is
618
- mainly for right after a gzopen() or gzdopen()) */
619
- if (state->how == LOOK && state->have == 0)
620
- (void)gz_head(state);
621
-
622
- /* return 1 if reading direct, 0 if decompressing a gzip stream */
623
- return state->direct;
624
- }
625
-
626
- /* -- see zlib.h -- */
627
- int ZEXPORT gzclose_r(file)
628
- gzFile file;
629
- {
630
- int ret;
631
- gz_statep state;
632
-
633
- /* get internal structure */
634
- if (file == NULL)
635
- return Z_STREAM_ERROR;
636
- state = (gz_statep)file;
637
-
638
- /* check that we're reading */
639
- if (state->mode != GZ_READ)
640
- return Z_STREAM_ERROR;
641
-
642
- /* free memory and close file */
643
- if (state->size) {
644
- inflateEnd(&(state->strm));
645
- free(state->out);
646
- free(state->in);
647
- }
648
- gz_error(state, Z_OK, NULL);
649
- free(state->path);
650
- ret = close(state->fd);
651
- free(state);
652
- return ret ? Z_ERRNO : Z_OK;
653
- }