@papyrus-sdk/engine-native 0.2.22-beta.8 → 0.2.22-beta.9.epub.2

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 (274) hide show
  1. package/android/build.gradle +0 -1
  2. package/android/src/main/cpp/CMakeLists.txt +0 -137
  3. package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +35 -305
  4. package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +1 -3
  5. package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +5 -195
  6. package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerViewManager.java +1 -20
  7. package/dist/index.d.mts +4 -608
  8. package/dist/index.d.ts +4 -608
  9. package/dist/index.js +8 -463
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +7 -456
  12. package/dist/index.mjs.map +1 -1
  13. package/ios/PapyrusEngineStore.h +0 -3
  14. package/ios/PapyrusEngineStore.m +6 -32
  15. package/ios/PapyrusNativeEngine.m +5 -684
  16. package/ios/PapyrusNativeEngine.podspec +15 -0
  17. package/ios/PapyrusPageView.m +11 -38
  18. package/package.json +4 -6
  19. package/react-native.config.js +1 -1
  20. package/PapyrusNativeEngine.podspec +0 -45
  21. package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +0 -68
  22. package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +0 -55
  23. package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +0 -14
  24. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +0 -491
  25. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +0 -32
  26. package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +0 -38
  27. package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +0 -195
  28. package/android/src/main/java/com/papyrus/engine/PapyrusSelectionMenuIcon.java +0 -48
  29. package/android/src/main/java/com/papyrus/engine/PapyrusTextAnnotationModel.java +0 -22
  30. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +0 -661
  31. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +0 -49
  32. package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +0 -43
  33. package/ios/PapyrusComicDocumentView.h +0 -21
  34. package/ios/PapyrusComicDocumentView.m +0 -547
  35. package/ios/PapyrusComicDocumentViewManager.m +0 -23
  36. package/ios/PapyrusPageRotationRegistry.h +0 -29
  37. package/ios/PapyrusPageRotationRegistry.m +0 -179
  38. package/ios/PapyrusPdfDocumentView.h +0 -55
  39. package/ios/PapyrusPdfDocumentView.m +0 -2338
  40. package/ios/PapyrusPdfDocumentViewManager.m +0 -61
  41. package/ios/PapyrusPdfPageTheme.h +0 -15
  42. package/ios/PapyrusPdfPageTheme.m +0 -218
  43. package/ios/PapyrusSelectionMenu.h +0 -27
  44. package/ios/PapyrusTextAnnotationRange.h +0 -2
  45. package/ios/PapyrusTextAnnotationRange.m +0 -29
  46. package/ios/PapyrusTextDocumentView.h +0 -32
  47. package/ios/PapyrusTextDocumentView.m +0 -518
  48. package/ios/PapyrusTextDocumentViewManager.m +0 -34
  49. package/ios/PapyrusTextStore.h +0 -13
  50. package/ios/PapyrusTextStore.m +0 -73
  51. package/third_party_licenses/BLAKE2-NOTICE.txt +0 -11
  52. package/third_party_licenses/libarchive-COPYING +0 -65
  53. package/vendor/libarchive/PapyrusComicArchive.cpp +0 -376
  54. package/vendor/libarchive/PapyrusComicArchive.h +0 -30
  55. package/vendor/libarchive/README.papyrus.md +0 -15
  56. package/vendor/libarchive/android.h +0 -192
  57. package/vendor/libarchive/config/PapyrusArchiveConfig.h +0 -71
  58. package/vendor/libarchive/libarchive/CMakeLists.txt +0 -293
  59. package/vendor/libarchive/libarchive/android_lf.h +0 -36
  60. package/vendor/libarchive/libarchive/archive.h +0 -1266
  61. package/vendor/libarchive/libarchive/archive_acl.c +0 -2025
  62. package/vendor/libarchive/libarchive/archive_acl_private.h +0 -85
  63. package/vendor/libarchive/libarchive/archive_blake2.h +0 -197
  64. package/vendor/libarchive/libarchive/archive_blake2_impl.h +0 -161
  65. package/vendor/libarchive/libarchive/archive_blake2s_ref.c +0 -369
  66. package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +0 -361
  67. package/vendor/libarchive/libarchive/archive_check_magic.c +0 -183
  68. package/vendor/libarchive/libarchive/archive_cmdline.c +0 -211
  69. package/vendor/libarchive/libarchive/archive_cmdline_private.h +0 -45
  70. package/vendor/libarchive/libarchive/archive_crc32.h +0 -123
  71. package/vendor/libarchive/libarchive/archive_cryptor.c +0 -534
  72. package/vendor/libarchive/libarchive/archive_cryptor_private.h +0 -199
  73. package/vendor/libarchive/libarchive/archive_digest.c +0 -1584
  74. package/vendor/libarchive/libarchive/archive_digest_private.h +0 -431
  75. package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +0 -558
  76. package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +0 -712
  77. package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +0 -760
  78. package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +0 -824
  79. package/vendor/libarchive/libarchive/archive_endian.h +0 -234
  80. package/vendor/libarchive/libarchive/archive_entry.3 +0 -147
  81. package/vendor/libarchive/libarchive/archive_entry.c +0 -2297
  82. package/vendor/libarchive/libarchive/archive_entry.h +0 -763
  83. package/vendor/libarchive/libarchive/archive_entry_acl.3 +0 -458
  84. package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +0 -55
  85. package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +0 -82
  86. package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +0 -472
  87. package/vendor/libarchive/libarchive/archive_entry_linkify.3 +0 -224
  88. package/vendor/libarchive/libarchive/archive_entry_locale.h +0 -90
  89. package/vendor/libarchive/libarchive/archive_entry_misc.3 +0 -63
  90. package/vendor/libarchive/libarchive/archive_entry_paths.3 +0 -153
  91. package/vendor/libarchive/libarchive/archive_entry_perms.3 +0 -210
  92. package/vendor/libarchive/libarchive/archive_entry_private.h +0 -205
  93. package/vendor/libarchive/libarchive/archive_entry_sparse.c +0 -156
  94. package/vendor/libarchive/libarchive/archive_entry_stat.3 +0 -274
  95. package/vendor/libarchive/libarchive/archive_entry_stat.c +0 -121
  96. package/vendor/libarchive/libarchive/archive_entry_strmode.c +0 -69
  97. package/vendor/libarchive/libarchive/archive_entry_time.3 +0 -127
  98. package/vendor/libarchive/libarchive/archive_entry_xattr.c +0 -155
  99. package/vendor/libarchive/libarchive/archive_hmac.c +0 -345
  100. package/vendor/libarchive/libarchive/archive_hmac_private.h +0 -119
  101. package/vendor/libarchive/libarchive/archive_integer.h +0 -267
  102. package/vendor/libarchive/libarchive/archive_match.c +0 -1869
  103. package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +0 -54
  104. package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +0 -54
  105. package/vendor/libarchive/libarchive/archive_options.c +0 -219
  106. package/vendor/libarchive/libarchive/archive_options_private.h +0 -49
  107. package/vendor/libarchive/libarchive/archive_pack_dev.c +0 -330
  108. package/vendor/libarchive/libarchive/archive_pack_dev.h +0 -49
  109. package/vendor/libarchive/libarchive/archive_parse_date.c +0 -1173
  110. package/vendor/libarchive/libarchive/archive_pathmatch.c +0 -480
  111. package/vendor/libarchive/libarchive/archive_pathmatch.h +0 -50
  112. package/vendor/libarchive/libarchive/archive_platform.h +0 -213
  113. package/vendor/libarchive/libarchive/archive_platform_acl.h +0 -53
  114. package/vendor/libarchive/libarchive/archive_platform_stat.h +0 -45
  115. package/vendor/libarchive/libarchive/archive_platform_xattr.h +0 -45
  116. package/vendor/libarchive/libarchive/archive_ppmd7.c +0 -1173
  117. package/vendor/libarchive/libarchive/archive_ppmd7_private.h +0 -119
  118. package/vendor/libarchive/libarchive/archive_ppmd8.c +0 -1293
  119. package/vendor/libarchive/libarchive/archive_ppmd8_private.h +0 -123
  120. package/vendor/libarchive/libarchive/archive_ppmd_private.h +0 -159
  121. package/vendor/libarchive/libarchive/archive_private.h +0 -209
  122. package/vendor/libarchive/libarchive/archive_random.c +0 -274
  123. package/vendor/libarchive/libarchive/archive_random_private.h +0 -36
  124. package/vendor/libarchive/libarchive/archive_rb.c +0 -709
  125. package/vendor/libarchive/libarchive/archive_rb.h +0 -113
  126. package/vendor/libarchive/libarchive/archive_read.3 +0 -250
  127. package/vendor/libarchive/libarchive/archive_read.c +0 -1814
  128. package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +0 -72
  129. package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +0 -189
  130. package/vendor/libarchive/libarchive/archive_read_append_filter.c +0 -209
  131. package/vendor/libarchive/libarchive/archive_read_data.3 +0 -128
  132. package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +0 -207
  133. package/vendor/libarchive/libarchive/archive_read_disk.3 +0 -422
  134. package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +0 -1086
  135. package/vendor/libarchive/libarchive/archive_read_disk_posix.c +0 -2639
  136. package/vendor/libarchive/libarchive/archive_read_disk_private.h +0 -97
  137. package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +0 -315
  138. package/vendor/libarchive/libarchive/archive_read_disk_windows.c +0 -2603
  139. package/vendor/libarchive/libarchive/archive_read_extract.3 +0 -135
  140. package/vendor/libarchive/libarchive/archive_read_extract.c +0 -59
  141. package/vendor/libarchive/libarchive/archive_read_extract2.c +0 -154
  142. package/vendor/libarchive/libarchive/archive_read_filter.3 +0 -163
  143. package/vendor/libarchive/libarchive/archive_read_format.3 +0 -190
  144. package/vendor/libarchive/libarchive/archive_read_free.3 +0 -91
  145. package/vendor/libarchive/libarchive/archive_read_header.3 +0 -89
  146. package/vendor/libarchive/libarchive/archive_read_new.3 +0 -57
  147. package/vendor/libarchive/libarchive/archive_read_open.3 +0 -247
  148. package/vendor/libarchive/libarchive/archive_read_open_fd.c +0 -236
  149. package/vendor/libarchive/libarchive/archive_read_open_file.c +0 -257
  150. package/vendor/libarchive/libarchive/archive_read_open_filename.c +0 -652
  151. package/vendor/libarchive/libarchive/archive_read_open_memory.c +0 -188
  152. package/vendor/libarchive/libarchive/archive_read_private.h +0 -274
  153. package/vendor/libarchive/libarchive/archive_read_set_format.c +0 -116
  154. package/vendor/libarchive/libarchive/archive_read_set_options.3 +0 -290
  155. package/vendor/libarchive/libarchive/archive_read_set_options.c +0 -132
  156. package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +0 -84
  157. package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +0 -68
  158. package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +0 -360
  159. package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +0 -457
  160. package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +0 -108
  161. package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +0 -538
  162. package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +0 -119
  163. package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +0 -829
  164. package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +0 -493
  165. package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +0 -51
  166. package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +0 -497
  167. package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +0 -249
  168. package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +0 -739
  169. package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +0 -792
  170. package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +0 -356
  171. package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +0 -4650
  172. package/vendor/libarchive/libarchive/archive_read_support_format_all.c +0 -88
  173. package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +0 -597
  174. package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +0 -76
  175. package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +0 -3410
  176. package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +0 -1152
  177. package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +0 -95
  178. package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +0 -3516
  179. package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +0 -2931
  180. package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +0 -2113
  181. package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +0 -3932
  182. package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +0 -4501
  183. package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +0 -194
  184. package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +0 -3785
  185. package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +0 -875
  186. package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +0 -3770
  187. package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +0 -4710
  188. package/vendor/libarchive/libarchive/archive_string.c +0 -4391
  189. package/vendor/libarchive/libarchive/archive_string.h +0 -244
  190. package/vendor/libarchive/libarchive/archive_string_composition.h +0 -2289
  191. package/vendor/libarchive/libarchive/archive_string_sprintf.c +0 -200
  192. package/vendor/libarchive/libarchive/archive_time.c +0 -168
  193. package/vendor/libarchive/libarchive/archive_time_private.h +0 -47
  194. package/vendor/libarchive/libarchive/archive_util.3 +0 -239
  195. package/vendor/libarchive/libarchive/archive_util.c +0 -668
  196. package/vendor/libarchive/libarchive/archive_version_details.c +0 -516
  197. package/vendor/libarchive/libarchive/archive_virtual.c +0 -162
  198. package/vendor/libarchive/libarchive/archive_windows.c +0 -1035
  199. package/vendor/libarchive/libarchive/archive_windows.h +0 -332
  200. package/vendor/libarchive/libarchive/archive_write.3 +0 -266
  201. package/vendor/libarchive/libarchive/archive_write.c +0 -896
  202. package/vendor/libarchive/libarchive/archive_write_add_filter.c +0 -71
  203. package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +0 -329
  204. package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +0 -76
  205. package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +0 -411
  206. package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +0 -459
  207. package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +0 -143
  208. package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +0 -493
  209. package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +0 -214
  210. package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +0 -710
  211. package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +0 -500
  212. package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +0 -42
  213. package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +0 -398
  214. package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +0 -320
  215. package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +0 -547
  216. package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +0 -608
  217. package/vendor/libarchive/libarchive/archive_write_blocksize.3 +0 -112
  218. package/vendor/libarchive/libarchive/archive_write_data.3 +0 -88
  219. package/vendor/libarchive/libarchive/archive_write_disk.3 +0 -360
  220. package/vendor/libarchive/libarchive/archive_write_disk_posix.c +0 -4789
  221. package/vendor/libarchive/libarchive/archive_write_disk_private.h +0 -43
  222. package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +0 -265
  223. package/vendor/libarchive/libarchive/archive_write_disk_windows.c +0 -2952
  224. package/vendor/libarchive/libarchive/archive_write_filter.3 +0 -140
  225. package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +0 -77
  226. package/vendor/libarchive/libarchive/archive_write_format.3 +0 -187
  227. package/vendor/libarchive/libarchive/archive_write_free.3 +0 -94
  228. package/vendor/libarchive/libarchive/archive_write_header.3 +0 -71
  229. package/vendor/libarchive/libarchive/archive_write_new.3 +0 -56
  230. package/vendor/libarchive/libarchive/archive_write_open.3 +0 -270
  231. package/vendor/libarchive/libarchive/archive_write_open_fd.c +0 -141
  232. package/vendor/libarchive/libarchive/archive_write_open_file.c +0 -102
  233. package/vendor/libarchive/libarchive/archive_write_open_filename.c +0 -272
  234. package/vendor/libarchive/libarchive/archive_write_open_memory.c +0 -110
  235. package/vendor/libarchive/libarchive/archive_write_private.h +0 -166
  236. package/vendor/libarchive/libarchive/archive_write_set_format.c +0 -124
  237. package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +0 -2571
  238. package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +0 -540
  239. package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +0 -93
  240. package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +0 -11
  241. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +0 -618
  242. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +0 -457
  243. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +0 -508
  244. package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +0 -141
  245. package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +0 -790
  246. package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +0 -8216
  247. package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +0 -2307
  248. package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +0 -2249
  249. package/vendor/libarchive/libarchive/archive_write_set_format_private.h +0 -40
  250. package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +0 -123
  251. package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +0 -650
  252. package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +0 -768
  253. package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +0 -648
  254. package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +0 -491
  255. package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +0 -3799
  256. package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +0 -2548
  257. package/vendor/libarchive/libarchive/archive_write_set_options.3 +0 -779
  258. package/vendor/libarchive/libarchive/archive_write_set_options.c +0 -129
  259. package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +0 -72
  260. package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +0 -95
  261. package/vendor/libarchive/libarchive/archive_xxhash.h +0 -48
  262. package/vendor/libarchive/libarchive/config_freebsd.h +0 -275
  263. package/vendor/libarchive/libarchive/cpio.5 +0 -389
  264. package/vendor/libarchive/libarchive/filter_fork.h +0 -44
  265. package/vendor/libarchive/libarchive/filter_fork_posix.c +0 -269
  266. package/vendor/libarchive/libarchive/filter_fork_windows.c +0 -270
  267. package/vendor/libarchive/libarchive/libarchive-formats.5 +0 -478
  268. package/vendor/libarchive/libarchive/libarchive.3 +0 -297
  269. package/vendor/libarchive/libarchive/libarchive_changes.3 +0 -339
  270. package/vendor/libarchive/libarchive/libarchive_internals.3 +0 -363
  271. package/vendor/libarchive/libarchive/module.modulemap +0 -34
  272. package/vendor/libarchive/libarchive/mtree.5 +0 -323
  273. package/vendor/libarchive/libarchive/tar.5 +0 -947
  274. package/vendor/libarchive/libarchive/xxhash.c +0 -531
@@ -1,459 +0,0 @@
1
- /*-
2
- * Copyright (c) 2008 Joerg Sonnenberger
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- * 1. Redistributions of source code must retain the above copyright
9
- * notice, this list of conditions and the following disclaimer.
10
- * 2. Redistributions in binary form must reproduce the above copyright
11
- * notice, this list of conditions and the following disclaimer in the
12
- * documentation and/or other materials provided with the distribution.
13
- *
14
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
- * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
- */
25
-
26
- /*-
27
- * Copyright (c) 1985, 1986, 1992, 1993
28
- * The Regents of the University of California. All rights reserved.
29
- *
30
- * This code is derived from software contributed to Berkeley by
31
- * Diomidis Spinellis and James A. Woods, derived from original
32
- * work by Spencer Thomas and Joseph Orost.
33
- *
34
- * Redistribution and use in source and binary forms, with or without
35
- * modification, are permitted provided that the following conditions
36
- * are met:
37
- * 1. Redistributions of source code must retain the above copyright
38
- * notice, this list of conditions and the following disclaimer.
39
- * 2. Redistributions in binary form must reproduce the above copyright
40
- * notice, this list of conditions and the following disclaimer in the
41
- * documentation and/or other materials provided with the distribution.
42
- * 3. Neither the name of the University nor the names of its contributors
43
- * may be used to endorse or promote products derived from this software
44
- * without specific prior written permission.
45
- *
46
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56
- * SUCH DAMAGE.
57
- */
58
-
59
- #include "archive_platform.h"
60
-
61
- #ifdef HAVE_ERRNO_H
62
- #include <errno.h>
63
- #endif
64
- #ifdef HAVE_STDLIB_H
65
- #include <stdlib.h>
66
- #endif
67
- #ifdef HAVE_STRING_H
68
- #include <string.h>
69
- #endif
70
-
71
- #include "archive.h"
72
- #include "archive_private.h"
73
- #include "archive_write_private.h"
74
-
75
- #define HSIZE 69001 /* 95% occupancy */
76
- #define HSHIFT 8 /* 8 - trunc(log2(HSIZE / 65536)) */
77
- #define CHECK_GAP 10000 /* Ratio check interval. */
78
-
79
- #define MAXCODE(bits) ((1 << (bits)) - 1)
80
-
81
- /*
82
- * the next two codes should not be changed lightly, as they must not
83
- * lie within the contiguous general code space.
84
- */
85
- #define FIRST 257 /* First free entry. */
86
- #define CLEAR 256 /* Table clear output code. */
87
-
88
- struct compress {
89
- int64_t in_count, out_count, checkpoint;
90
-
91
- int code_len; /* Number of bits/code. */
92
- int cur_maxcode; /* Maximum code, given n_bits. */
93
- int max_maxcode; /* Should NEVER generate this code. */
94
- int hashtab [HSIZE];
95
- unsigned short codetab [HSIZE];
96
- int first_free; /* First unused entry. */
97
- int compress_ratio;
98
-
99
- int cur_code, cur_fcode;
100
-
101
- int bit_offset;
102
- unsigned char bit_buf;
103
-
104
- unsigned char *compressed;
105
- size_t compressed_buffer_size;
106
- size_t compressed_offset;
107
- };
108
-
109
- static int archive_compressor_compress_open(struct archive_write_filter *);
110
- static int archive_compressor_compress_write(struct archive_write_filter *,
111
- const void *, size_t);
112
- static int archive_compressor_compress_close(struct archive_write_filter *);
113
- static int archive_compressor_compress_free(struct archive_write_filter *);
114
- static void free_data(struct compress *);
115
-
116
- #if ARCHIVE_VERSION_NUMBER < 4000000
117
- int
118
- archive_write_set_compression_compress(struct archive *a)
119
- {
120
- __archive_write_filters_free(a);
121
- return (archive_write_add_filter_compress(a));
122
- }
123
- #endif
124
-
125
- /*
126
- * Add a compress filter to this write handle.
127
- */
128
- int
129
- archive_write_add_filter_compress(struct archive *a)
130
- {
131
- struct archive_write_filter *f;
132
- struct compress *compress;
133
-
134
- archive_check_magic(a, ARCHIVE_WRITE_MAGIC,
135
- ARCHIVE_STATE_NEW, "archive_write_add_filter_compress");
136
-
137
- compress = calloc(1, sizeof(*compress));
138
- if (compress == NULL)
139
- goto memerr;
140
-
141
- f = __archive_write_allocate_filter(a);
142
- if (f == NULL)
143
- goto memerr;
144
- f->name = "compress";
145
- f->code = ARCHIVE_FILTER_COMPRESS;
146
- f->data = compress;
147
- f->open = archive_compressor_compress_open;
148
- f->write = archive_compressor_compress_write;
149
- f->close = archive_compressor_compress_close;
150
- f->free = archive_compressor_compress_free;
151
-
152
- return (ARCHIVE_OK);
153
- memerr:
154
- free_data(compress);
155
- archive_set_error(a, ENOMEM,
156
- "Can't allocate data for compression");
157
- return (ARCHIVE_FATAL);
158
- }
159
-
160
- /*
161
- * Setup callback.
162
- */
163
- static int
164
- archive_compressor_compress_open(struct archive_write_filter *f)
165
- {
166
- struct compress *compress = f->data;
167
- size_t bs = 65536, bpb;
168
-
169
- if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
170
- /* Buffer size should be a multiple number of the bytes
171
- * per block for performance. */
172
- bpb = archive_write_get_bytes_per_block(f->archive);
173
- if (bpb > bs)
174
- bs = bpb;
175
- else if (bpb != 0)
176
- bs -= bs % bpb;
177
- }
178
- compress->compressed_buffer_size = bs;
179
- compress->compressed = malloc(compress->compressed_buffer_size);
180
-
181
- if (compress->compressed == NULL) {
182
- archive_set_error(f->archive, ENOMEM,
183
- "Can't allocate data for compression buffer");
184
- return (ARCHIVE_FATAL);
185
- }
186
-
187
- /* Should NEVER generate this code. */
188
- compress->max_maxcode = 0x10000;
189
- /* Length of input. */
190
- compress->in_count = 0;
191
- compress->bit_buf = 0;
192
- compress->bit_offset = 0;
193
- /* Includes 3-byte header mojo. */
194
- compress->out_count = 3;
195
- compress->compress_ratio = 0;
196
- compress->checkpoint = CHECK_GAP;
197
- compress->code_len = 9;
198
- compress->cur_maxcode = MAXCODE(compress->code_len);
199
- compress->first_free = FIRST;
200
-
201
- memset(compress->hashtab, 0xff, sizeof(compress->hashtab));
202
-
203
- /* Prime output buffer with a gzip header. */
204
- compress->compressed[0] = 0x1f; /* Compress */
205
- compress->compressed[1] = 0x9d;
206
- compress->compressed[2] = 0x90; /* Block mode, 16bit max */
207
- compress->compressed_offset = 3;
208
-
209
- return (ARCHIVE_OK);
210
- }
211
-
212
- /*-
213
- * Output the given code.
214
- * Inputs:
215
- * code: A n_bits-bit integer. If == -1, then EOF. This assumes
216
- * that n_bits <= (long)wordsize - 1.
217
- * Outputs:
218
- * Outputs code to the file.
219
- * Assumptions:
220
- * Chars are 8 bits long.
221
- * Algorithm:
222
- * Maintain a BITS character long buffer (so that 8 codes will
223
- * fit in it exactly). Use the VAX insv instruction to insert each
224
- * code in turn. When the buffer fills up empty it and start over.
225
- */
226
-
227
- static const unsigned char rmask[9] =
228
- {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
229
-
230
- static int
231
- output_byte(struct archive_write_filter *f, unsigned char c)
232
- {
233
- struct compress *compress = f->data;
234
-
235
- compress->compressed[compress->compressed_offset++] = c;
236
- ++compress->out_count;
237
-
238
- if (compress->compressed_buffer_size == compress->compressed_offset) {
239
- int ret = __archive_write_filter(f->next_filter,
240
- compress->compressed, compress->compressed_buffer_size);
241
- if (ret != ARCHIVE_OK)
242
- return ARCHIVE_FATAL;
243
- compress->compressed_offset = 0;
244
- }
245
-
246
- return ARCHIVE_OK;
247
- }
248
-
249
- static int
250
- output_code(struct archive_write_filter *f, int ocode)
251
- {
252
- struct compress *compress = f->data;
253
- int bits, ret, clear_flg, bit_offset;
254
-
255
- clear_flg = ocode == CLEAR;
256
-
257
- /*
258
- * Since ocode is always >= 8 bits, only need to mask the first
259
- * hunk on the left.
260
- */
261
- bit_offset = compress->bit_offset % 8;
262
- compress->bit_buf |= (ocode << bit_offset) & 0xff;
263
- output_byte(f, compress->bit_buf);
264
-
265
- bits = compress->code_len - (8 - bit_offset);
266
- ocode >>= 8 - bit_offset;
267
- /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */
268
- if (bits >= 8) {
269
- output_byte(f, ocode & 0xff);
270
- ocode >>= 8;
271
- bits -= 8;
272
- }
273
- /* Last bits. */
274
- compress->bit_offset += compress->code_len;
275
- compress->bit_buf = ocode & rmask[bits];
276
- if (compress->bit_offset == compress->code_len * 8)
277
- compress->bit_offset = 0;
278
-
279
- /*
280
- * If the next entry is going to be too big for the ocode size,
281
- * then increase it, if possible.
282
- */
283
- if (clear_flg || compress->first_free > compress->cur_maxcode) {
284
- /*
285
- * Write the whole buffer, because the input side won't
286
- * discover the size increase until after it has read it.
287
- */
288
- if (compress->bit_offset > 0) {
289
- while (compress->bit_offset < compress->code_len * 8) {
290
- ret = output_byte(f, compress->bit_buf);
291
- if (ret != ARCHIVE_OK)
292
- return ret;
293
- compress->bit_offset += 8;
294
- compress->bit_buf = 0;
295
- }
296
- }
297
- compress->bit_buf = 0;
298
- compress->bit_offset = 0;
299
-
300
- if (clear_flg) {
301
- compress->code_len = 9;
302
- compress->cur_maxcode = MAXCODE(compress->code_len);
303
- } else {
304
- compress->code_len++;
305
- if (compress->code_len == 16)
306
- compress->cur_maxcode = compress->max_maxcode;
307
- else
308
- compress->cur_maxcode = MAXCODE(compress->code_len);
309
- }
310
- }
311
-
312
- return (ARCHIVE_OK);
313
- }
314
-
315
- static int
316
- output_flush(struct archive_write_filter *f)
317
- {
318
- struct compress *compress = f->data;
319
- int ret;
320
-
321
- /* At EOF, write the rest of the buffer. */
322
- if (compress->bit_offset % 8) {
323
- compress->code_len = (compress->bit_offset % 8 + 7) / 8;
324
- ret = output_byte(f, compress->bit_buf);
325
- if (ret != ARCHIVE_OK)
326
- return ret;
327
- }
328
-
329
- return (ARCHIVE_OK);
330
- }
331
-
332
- /*
333
- * Write data to the compressed stream.
334
- */
335
- static int
336
- archive_compressor_compress_write(struct archive_write_filter *f,
337
- const void *buff, size_t length)
338
- {
339
- struct compress *compress = f->data;
340
- int i;
341
- int ratio;
342
- int c, disp, ret;
343
- const unsigned char *bp;
344
-
345
- if (length == 0)
346
- return ARCHIVE_OK;
347
-
348
- bp = buff;
349
-
350
- if (compress->in_count == 0) {
351
- compress->cur_code = *bp++;
352
- ++compress->in_count;
353
- --length;
354
- }
355
-
356
- while (length--) {
357
- c = *bp++;
358
- compress->in_count++;
359
- compress->cur_fcode = (c << 16) | compress->cur_code;
360
- /* Xor hashing. */
361
- i = ((c << HSHIFT) ^ compress->cur_code);
362
-
363
- if (compress->hashtab[i] == compress->cur_fcode) {
364
- compress->cur_code = compress->codetab[i];
365
- continue;
366
- }
367
- if (compress->hashtab[i] < 0) /* Empty slot. */
368
- goto nomatch;
369
- /* Secondary hash (after G. Knott). */
370
- if (i == 0)
371
- disp = 1;
372
- else
373
- disp = HSIZE - i;
374
- probe:
375
- if ((i -= disp) < 0)
376
- i += HSIZE;
377
-
378
- if (compress->hashtab[i] == compress->cur_fcode) {
379
- compress->cur_code = compress->codetab[i];
380
- continue;
381
- }
382
- if (compress->hashtab[i] >= 0)
383
- goto probe;
384
- nomatch:
385
- ret = output_code(f, compress->cur_code);
386
- if (ret != ARCHIVE_OK)
387
- return ret;
388
- compress->cur_code = c;
389
- if (compress->first_free < compress->max_maxcode) {
390
- compress->codetab[i] = compress->first_free++; /* code -> hashtable */
391
- compress->hashtab[i] = compress->cur_fcode;
392
- continue;
393
- }
394
- if (compress->in_count < compress->checkpoint)
395
- continue;
396
-
397
- compress->checkpoint = compress->in_count + CHECK_GAP;
398
-
399
- if (compress->in_count <= 0x007fffff && compress->out_count != 0)
400
- ratio = (int)(compress->in_count * 256 / compress->out_count);
401
- else if ((ratio = (int)(compress->out_count / 256)) == 0)
402
- ratio = 0x7fffffff;
403
- else
404
- ratio = (int)(compress->in_count / ratio);
405
-
406
- if (ratio > compress->compress_ratio)
407
- compress->compress_ratio = ratio;
408
- else {
409
- compress->compress_ratio = 0;
410
- memset(compress->hashtab, 0xff, sizeof(compress->hashtab));
411
- compress->first_free = FIRST;
412
- ret = output_code(f, CLEAR);
413
- if (ret != ARCHIVE_OK)
414
- return ret;
415
- }
416
- }
417
-
418
- return (ARCHIVE_OK);
419
- }
420
-
421
-
422
- /*
423
- * Finish the compression...
424
- */
425
- static int
426
- archive_compressor_compress_close(struct archive_write_filter *f)
427
- {
428
- struct compress *compress = f->data;
429
- int ret;
430
-
431
- ret = output_code(f, compress->cur_code);
432
- if (ret != ARCHIVE_OK)
433
- return ret;
434
- ret = output_flush(f);
435
- if (ret != ARCHIVE_OK)
436
- return ret;
437
-
438
- /* Write the last block */
439
- ret = __archive_write_filter(f->next_filter,
440
- compress->compressed, compress->compressed_offset);
441
- return (ret);
442
- }
443
-
444
- static int
445
- archive_compressor_compress_free(struct archive_write_filter *f)
446
- {
447
- free_data(f->data);
448
- f->data = NULL;
449
- return (ARCHIVE_OK);
450
- }
451
-
452
- static void
453
- free_data(struct compress *compress)
454
- {
455
- if (compress != NULL) {
456
- free(compress->compressed);
457
- free(compress);
458
- }
459
- }
@@ -1,143 +0,0 @@
1
- /*-
2
- * Copyright (c) 2003-2007 Tim Kientzle
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- * 1. Redistributions of source code must retain the above copyright
9
- * notice, this list of conditions and the following disclaimer.
10
- * 2. Redistributions in binary form must reproduce the above copyright
11
- * notice, this list of conditions and the following disclaimer in the
12
- * documentation and/or other materials provided with the distribution.
13
- *
14
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
- * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
- */
25
-
26
- #include "archive_platform.h"
27
-
28
- #ifdef HAVE_ERRNO_H
29
- #include <errno.h>
30
- #endif
31
- #ifdef HAVE_STDLIB_H
32
- #include <stdlib.h>
33
- #endif
34
-
35
- #include "archive.h"
36
- #include "archive_write_private.h"
37
-
38
- struct grzip {
39
- struct archive_write_program_data *pdata;
40
- };
41
-
42
- static int archive_write_grzip_open(struct archive_write_filter *);
43
- static int archive_write_grzip_options(struct archive_write_filter *,
44
- const char *, const char *);
45
- static int archive_write_grzip_write(struct archive_write_filter *,
46
- const void *, size_t);
47
- static int archive_write_grzip_close(struct archive_write_filter *);
48
- static int archive_write_grzip_free(struct archive_write_filter *);
49
- static void free_data(struct grzip *);
50
-
51
- int
52
- archive_write_add_filter_grzip(struct archive *a)
53
- {
54
- struct archive_write_filter *f;
55
- struct grzip *grzip;
56
-
57
- archive_check_magic(a, ARCHIVE_WRITE_MAGIC,
58
- ARCHIVE_STATE_NEW, "archive_write_add_filter_grzip");
59
-
60
- grzip = calloc(1, sizeof(*grzip));
61
- if (grzip == NULL)
62
- goto memerr;
63
- grzip->pdata = __archive_write_program_allocate("grzip");
64
- if (grzip->pdata == NULL)
65
- goto memerr;
66
-
67
- f = __archive_write_allocate_filter(a);
68
- if (f == NULL)
69
- goto memerr;
70
- f->name = "grzip";
71
- f->code = ARCHIVE_FILTER_GRZIP;
72
- f->data = grzip;
73
- f->options = archive_write_grzip_options;
74
- f->open = archive_write_grzip_open;
75
- f->write = archive_write_grzip_write;
76
- f->close = archive_write_grzip_close;
77
- f->free = archive_write_grzip_free;
78
-
79
- /* Note: This filter always uses an external program, so we
80
- * return "warn" to inform of the fact. */
81
- archive_set_error(a, ARCHIVE_ERRNO_MISC,
82
- "Using external grzip program for grzip compression");
83
- return (ARCHIVE_WARN);
84
- memerr:
85
- free_data(grzip);
86
- archive_set_error(a, ENOMEM, "Can't allocate memory");
87
- return (ARCHIVE_FATAL);
88
- }
89
-
90
- static int
91
- archive_write_grzip_options(struct archive_write_filter *f, const char *key,
92
- const char *value)
93
- {
94
- (void)f; /* UNUSED */
95
- (void)key; /* UNUSED */
96
- (void)value; /* UNUSED */
97
- /* Note: The "warn" return is just to inform the options
98
- * supervisor that we didn't handle it. It will generate
99
- * a suitable error if no one used this option. */
100
- return (ARCHIVE_WARN);
101
- }
102
-
103
- static int
104
- archive_write_grzip_open(struct archive_write_filter *f)
105
- {
106
- struct grzip *grzip = f->data;
107
-
108
- return __archive_write_program_open(f, grzip->pdata, "grzip");
109
- }
110
-
111
- static int
112
- archive_write_grzip_write(struct archive_write_filter *f,
113
- const void *buff, size_t length)
114
- {
115
- struct grzip *grzip = f->data;
116
-
117
- return __archive_write_program_write(f, grzip->pdata, buff, length);
118
- }
119
-
120
- static int
121
- archive_write_grzip_close(struct archive_write_filter *f)
122
- {
123
- struct grzip *grzip = f->data;
124
-
125
- return __archive_write_program_close(f, grzip->pdata);
126
- }
127
-
128
- static int
129
- archive_write_grzip_free(struct archive_write_filter *f)
130
- {
131
- free_data(f->data);
132
- f->data = NULL;
133
- return (ARCHIVE_OK);
134
- }
135
-
136
- static void
137
- free_data(struct grzip *grzip)
138
- {
139
- if (grzip != NULL) {
140
- __archive_write_program_free(grzip->pdata);
141
- free(grzip);
142
- }
143
- }