@papyrus-sdk/engine-native 0.2.22-beta.9.epub.1 → 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 (276) 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 -614
  8. package/dist/index.d.ts +4 -614
  9. package/dist/index.js +8 -484
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +7 -477
  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 +8 -10
  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/cpp/papyrus_outline_loader_test.cpp +0 -240
  24. package/android/src/main/cpp/papyrus_text_word_test.cpp +0 -72
  25. package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +0 -14
  26. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +0 -491
  27. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +0 -32
  28. package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +0 -38
  29. package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +0 -195
  30. package/android/src/main/java/com/papyrus/engine/PapyrusSelectionMenuIcon.java +0 -48
  31. package/android/src/main/java/com/papyrus/engine/PapyrusTextAnnotationModel.java +0 -22
  32. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +0 -661
  33. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +0 -49
  34. package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +0 -43
  35. package/ios/PapyrusComicDocumentView.h +0 -21
  36. package/ios/PapyrusComicDocumentView.m +0 -554
  37. package/ios/PapyrusComicDocumentViewManager.m +0 -23
  38. package/ios/PapyrusPageRotationRegistry.h +0 -29
  39. package/ios/PapyrusPageRotationRegistry.m +0 -179
  40. package/ios/PapyrusPdfDocumentView.h +0 -55
  41. package/ios/PapyrusPdfDocumentView.m +0 -2339
  42. package/ios/PapyrusPdfDocumentViewManager.m +0 -61
  43. package/ios/PapyrusPdfPageTheme.h +0 -15
  44. package/ios/PapyrusPdfPageTheme.m +0 -218
  45. package/ios/PapyrusSelectionMenu.h +0 -27
  46. package/ios/PapyrusTextAnnotationRange.h +0 -2
  47. package/ios/PapyrusTextAnnotationRange.m +0 -29
  48. package/ios/PapyrusTextDocumentView.h +0 -32
  49. package/ios/PapyrusTextDocumentView.m +0 -518
  50. package/ios/PapyrusTextDocumentViewManager.m +0 -34
  51. package/ios/PapyrusTextStore.h +0 -13
  52. package/ios/PapyrusTextStore.m +0 -73
  53. package/third_party_licenses/BLAKE2-NOTICE.txt +0 -11
  54. package/third_party_licenses/libarchive-COPYING +0 -65
  55. package/vendor/libarchive/PapyrusComicArchive.cpp +0 -376
  56. package/vendor/libarchive/PapyrusComicArchive.h +0 -30
  57. package/vendor/libarchive/README.papyrus.md +0 -15
  58. package/vendor/libarchive/android.h +0 -192
  59. package/vendor/libarchive/config/PapyrusArchiveConfig.h +0 -71
  60. package/vendor/libarchive/libarchive/CMakeLists.txt +0 -293
  61. package/vendor/libarchive/libarchive/android_lf.h +0 -36
  62. package/vendor/libarchive/libarchive/archive.h +0 -1266
  63. package/vendor/libarchive/libarchive/archive_acl.c +0 -2025
  64. package/vendor/libarchive/libarchive/archive_acl_private.h +0 -85
  65. package/vendor/libarchive/libarchive/archive_blake2.h +0 -197
  66. package/vendor/libarchive/libarchive/archive_blake2_impl.h +0 -161
  67. package/vendor/libarchive/libarchive/archive_blake2s_ref.c +0 -369
  68. package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +0 -361
  69. package/vendor/libarchive/libarchive/archive_check_magic.c +0 -183
  70. package/vendor/libarchive/libarchive/archive_cmdline.c +0 -211
  71. package/vendor/libarchive/libarchive/archive_cmdline_private.h +0 -45
  72. package/vendor/libarchive/libarchive/archive_crc32.h +0 -123
  73. package/vendor/libarchive/libarchive/archive_cryptor.c +0 -534
  74. package/vendor/libarchive/libarchive/archive_cryptor_private.h +0 -199
  75. package/vendor/libarchive/libarchive/archive_digest.c +0 -1584
  76. package/vendor/libarchive/libarchive/archive_digest_private.h +0 -431
  77. package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +0 -558
  78. package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +0 -712
  79. package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +0 -760
  80. package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +0 -824
  81. package/vendor/libarchive/libarchive/archive_endian.h +0 -234
  82. package/vendor/libarchive/libarchive/archive_entry.3 +0 -147
  83. package/vendor/libarchive/libarchive/archive_entry.c +0 -2297
  84. package/vendor/libarchive/libarchive/archive_entry.h +0 -763
  85. package/vendor/libarchive/libarchive/archive_entry_acl.3 +0 -458
  86. package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +0 -55
  87. package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +0 -82
  88. package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +0 -472
  89. package/vendor/libarchive/libarchive/archive_entry_linkify.3 +0 -224
  90. package/vendor/libarchive/libarchive/archive_entry_locale.h +0 -90
  91. package/vendor/libarchive/libarchive/archive_entry_misc.3 +0 -63
  92. package/vendor/libarchive/libarchive/archive_entry_paths.3 +0 -153
  93. package/vendor/libarchive/libarchive/archive_entry_perms.3 +0 -210
  94. package/vendor/libarchive/libarchive/archive_entry_private.h +0 -205
  95. package/vendor/libarchive/libarchive/archive_entry_sparse.c +0 -156
  96. package/vendor/libarchive/libarchive/archive_entry_stat.3 +0 -274
  97. package/vendor/libarchive/libarchive/archive_entry_stat.c +0 -121
  98. package/vendor/libarchive/libarchive/archive_entry_strmode.c +0 -69
  99. package/vendor/libarchive/libarchive/archive_entry_time.3 +0 -127
  100. package/vendor/libarchive/libarchive/archive_entry_xattr.c +0 -155
  101. package/vendor/libarchive/libarchive/archive_hmac.c +0 -345
  102. package/vendor/libarchive/libarchive/archive_hmac_private.h +0 -119
  103. package/vendor/libarchive/libarchive/archive_integer.h +0 -267
  104. package/vendor/libarchive/libarchive/archive_match.c +0 -1869
  105. package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +0 -54
  106. package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +0 -54
  107. package/vendor/libarchive/libarchive/archive_options.c +0 -219
  108. package/vendor/libarchive/libarchive/archive_options_private.h +0 -49
  109. package/vendor/libarchive/libarchive/archive_pack_dev.c +0 -330
  110. package/vendor/libarchive/libarchive/archive_pack_dev.h +0 -49
  111. package/vendor/libarchive/libarchive/archive_parse_date.c +0 -1173
  112. package/vendor/libarchive/libarchive/archive_pathmatch.c +0 -480
  113. package/vendor/libarchive/libarchive/archive_pathmatch.h +0 -50
  114. package/vendor/libarchive/libarchive/archive_platform.h +0 -213
  115. package/vendor/libarchive/libarchive/archive_platform_acl.h +0 -53
  116. package/vendor/libarchive/libarchive/archive_platform_stat.h +0 -45
  117. package/vendor/libarchive/libarchive/archive_platform_xattr.h +0 -45
  118. package/vendor/libarchive/libarchive/archive_ppmd7.c +0 -1173
  119. package/vendor/libarchive/libarchive/archive_ppmd7_private.h +0 -119
  120. package/vendor/libarchive/libarchive/archive_ppmd8.c +0 -1293
  121. package/vendor/libarchive/libarchive/archive_ppmd8_private.h +0 -123
  122. package/vendor/libarchive/libarchive/archive_ppmd_private.h +0 -159
  123. package/vendor/libarchive/libarchive/archive_private.h +0 -209
  124. package/vendor/libarchive/libarchive/archive_random.c +0 -274
  125. package/vendor/libarchive/libarchive/archive_random_private.h +0 -36
  126. package/vendor/libarchive/libarchive/archive_rb.c +0 -709
  127. package/vendor/libarchive/libarchive/archive_rb.h +0 -113
  128. package/vendor/libarchive/libarchive/archive_read.3 +0 -250
  129. package/vendor/libarchive/libarchive/archive_read.c +0 -1814
  130. package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +0 -72
  131. package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +0 -189
  132. package/vendor/libarchive/libarchive/archive_read_append_filter.c +0 -209
  133. package/vendor/libarchive/libarchive/archive_read_data.3 +0 -128
  134. package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +0 -207
  135. package/vendor/libarchive/libarchive/archive_read_disk.3 +0 -422
  136. package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +0 -1086
  137. package/vendor/libarchive/libarchive/archive_read_disk_posix.c +0 -2639
  138. package/vendor/libarchive/libarchive/archive_read_disk_private.h +0 -97
  139. package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +0 -315
  140. package/vendor/libarchive/libarchive/archive_read_disk_windows.c +0 -2603
  141. package/vendor/libarchive/libarchive/archive_read_extract.3 +0 -135
  142. package/vendor/libarchive/libarchive/archive_read_extract.c +0 -59
  143. package/vendor/libarchive/libarchive/archive_read_extract2.c +0 -154
  144. package/vendor/libarchive/libarchive/archive_read_filter.3 +0 -163
  145. package/vendor/libarchive/libarchive/archive_read_format.3 +0 -190
  146. package/vendor/libarchive/libarchive/archive_read_free.3 +0 -91
  147. package/vendor/libarchive/libarchive/archive_read_header.3 +0 -89
  148. package/vendor/libarchive/libarchive/archive_read_new.3 +0 -57
  149. package/vendor/libarchive/libarchive/archive_read_open.3 +0 -247
  150. package/vendor/libarchive/libarchive/archive_read_open_fd.c +0 -236
  151. package/vendor/libarchive/libarchive/archive_read_open_file.c +0 -257
  152. package/vendor/libarchive/libarchive/archive_read_open_filename.c +0 -652
  153. package/vendor/libarchive/libarchive/archive_read_open_memory.c +0 -188
  154. package/vendor/libarchive/libarchive/archive_read_private.h +0 -274
  155. package/vendor/libarchive/libarchive/archive_read_set_format.c +0 -116
  156. package/vendor/libarchive/libarchive/archive_read_set_options.3 +0 -290
  157. package/vendor/libarchive/libarchive/archive_read_set_options.c +0 -132
  158. package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +0 -84
  159. package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +0 -68
  160. package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +0 -360
  161. package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +0 -457
  162. package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +0 -108
  163. package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +0 -538
  164. package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +0 -119
  165. package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +0 -829
  166. package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +0 -493
  167. package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +0 -51
  168. package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +0 -497
  169. package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +0 -249
  170. package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +0 -739
  171. package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +0 -792
  172. package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +0 -356
  173. package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +0 -4650
  174. package/vendor/libarchive/libarchive/archive_read_support_format_all.c +0 -88
  175. package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +0 -597
  176. package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +0 -76
  177. package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +0 -3410
  178. package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +0 -1152
  179. package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +0 -95
  180. package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +0 -3516
  181. package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +0 -2931
  182. package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +0 -2113
  183. package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +0 -3932
  184. package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +0 -4501
  185. package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +0 -194
  186. package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +0 -3785
  187. package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +0 -875
  188. package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +0 -3770
  189. package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +0 -4710
  190. package/vendor/libarchive/libarchive/archive_string.c +0 -4391
  191. package/vendor/libarchive/libarchive/archive_string.h +0 -244
  192. package/vendor/libarchive/libarchive/archive_string_composition.h +0 -2289
  193. package/vendor/libarchive/libarchive/archive_string_sprintf.c +0 -200
  194. package/vendor/libarchive/libarchive/archive_time.c +0 -168
  195. package/vendor/libarchive/libarchive/archive_time_private.h +0 -47
  196. package/vendor/libarchive/libarchive/archive_util.3 +0 -239
  197. package/vendor/libarchive/libarchive/archive_util.c +0 -668
  198. package/vendor/libarchive/libarchive/archive_version_details.c +0 -516
  199. package/vendor/libarchive/libarchive/archive_virtual.c +0 -162
  200. package/vendor/libarchive/libarchive/archive_windows.c +0 -1035
  201. package/vendor/libarchive/libarchive/archive_windows.h +0 -332
  202. package/vendor/libarchive/libarchive/archive_write.3 +0 -266
  203. package/vendor/libarchive/libarchive/archive_write.c +0 -896
  204. package/vendor/libarchive/libarchive/archive_write_add_filter.c +0 -71
  205. package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +0 -329
  206. package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +0 -76
  207. package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +0 -411
  208. package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +0 -459
  209. package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +0 -143
  210. package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +0 -493
  211. package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +0 -214
  212. package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +0 -710
  213. package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +0 -500
  214. package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +0 -42
  215. package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +0 -398
  216. package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +0 -320
  217. package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +0 -547
  218. package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +0 -608
  219. package/vendor/libarchive/libarchive/archive_write_blocksize.3 +0 -112
  220. package/vendor/libarchive/libarchive/archive_write_data.3 +0 -88
  221. package/vendor/libarchive/libarchive/archive_write_disk.3 +0 -360
  222. package/vendor/libarchive/libarchive/archive_write_disk_posix.c +0 -4789
  223. package/vendor/libarchive/libarchive/archive_write_disk_private.h +0 -43
  224. package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +0 -265
  225. package/vendor/libarchive/libarchive/archive_write_disk_windows.c +0 -2952
  226. package/vendor/libarchive/libarchive/archive_write_filter.3 +0 -140
  227. package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +0 -77
  228. package/vendor/libarchive/libarchive/archive_write_format.3 +0 -187
  229. package/vendor/libarchive/libarchive/archive_write_free.3 +0 -94
  230. package/vendor/libarchive/libarchive/archive_write_header.3 +0 -71
  231. package/vendor/libarchive/libarchive/archive_write_new.3 +0 -56
  232. package/vendor/libarchive/libarchive/archive_write_open.3 +0 -270
  233. package/vendor/libarchive/libarchive/archive_write_open_fd.c +0 -141
  234. package/vendor/libarchive/libarchive/archive_write_open_file.c +0 -102
  235. package/vendor/libarchive/libarchive/archive_write_open_filename.c +0 -272
  236. package/vendor/libarchive/libarchive/archive_write_open_memory.c +0 -110
  237. package/vendor/libarchive/libarchive/archive_write_private.h +0 -166
  238. package/vendor/libarchive/libarchive/archive_write_set_format.c +0 -124
  239. package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +0 -2571
  240. package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +0 -540
  241. package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +0 -93
  242. package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +0 -11
  243. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +0 -618
  244. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +0 -457
  245. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +0 -508
  246. package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +0 -141
  247. package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +0 -790
  248. package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +0 -8216
  249. package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +0 -2307
  250. package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +0 -2249
  251. package/vendor/libarchive/libarchive/archive_write_set_format_private.h +0 -40
  252. package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +0 -123
  253. package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +0 -650
  254. package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +0 -768
  255. package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +0 -648
  256. package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +0 -491
  257. package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +0 -3799
  258. package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +0 -2548
  259. package/vendor/libarchive/libarchive/archive_write_set_options.3 +0 -779
  260. package/vendor/libarchive/libarchive/archive_write_set_options.c +0 -129
  261. package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +0 -72
  262. package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +0 -95
  263. package/vendor/libarchive/libarchive/archive_xxhash.h +0 -48
  264. package/vendor/libarchive/libarchive/config_freebsd.h +0 -275
  265. package/vendor/libarchive/libarchive/cpio.5 +0 -389
  266. package/vendor/libarchive/libarchive/filter_fork.h +0 -44
  267. package/vendor/libarchive/libarchive/filter_fork_posix.c +0 -269
  268. package/vendor/libarchive/libarchive/filter_fork_windows.c +0 -270
  269. package/vendor/libarchive/libarchive/libarchive-formats.5 +0 -478
  270. package/vendor/libarchive/libarchive/libarchive.3 +0 -297
  271. package/vendor/libarchive/libarchive/libarchive_changes.3 +0 -339
  272. package/vendor/libarchive/libarchive/libarchive_internals.3 +0 -363
  273. package/vendor/libarchive/libarchive/module.modulemap +0 -34
  274. package/vendor/libarchive/libarchive/mtree.5 +0 -323
  275. package/vendor/libarchive/libarchive/tar.5 +0 -947
  276. package/vendor/libarchive/libarchive/xxhash.c +0 -531
@@ -1,457 +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
- /*
27
- * This code borrows heavily from "compress" source code, which is
28
- * protected by the following copyright. (Clause 3 dropped by request
29
- * of the Regents.)
30
- */
31
-
32
- /*-
33
- * Copyright (c) 1985, 1986, 1992, 1993
34
- * The Regents of the University of California. All rights reserved.
35
- *
36
- * This code is derived from software contributed to Berkeley by
37
- * Diomidis Spinellis and James A. Woods, derived from original
38
- * work by Spencer Thomas and Joseph Orost.
39
- *
40
- * Redistribution and use in source and binary forms, with or without
41
- * modification, are permitted provided that the following conditions
42
- * are met:
43
- * 1. Redistributions of source code must retain the above copyright
44
- * notice, this list of conditions and the following disclaimer.
45
- * 2. Redistributions in binary form must reproduce the above copyright
46
- * notice, this list of conditions and the following disclaimer in the
47
- * documentation and/or other materials provided with the distribution.
48
- * 4. Neither the name of the University nor the names of its contributors
49
- * may be used to endorse or promote products derived from this software
50
- * without specific prior written permission.
51
- *
52
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62
- * SUCH DAMAGE.
63
- */
64
-
65
-
66
- #include "archive_platform.h"
67
-
68
- #ifdef HAVE_ERRNO_H
69
- #include <errno.h>
70
- #endif
71
- #ifdef HAVE_STDLIB_H
72
- #include <stdlib.h>
73
- #endif
74
- #ifdef HAVE_STRING_H
75
- #include <string.h>
76
- #endif
77
- #ifdef HAVE_UNISTD_H
78
- #include <unistd.h>
79
- #endif
80
-
81
- #include "archive.h"
82
- #include "archive_private.h"
83
- #include "archive_read_private.h"
84
-
85
- /*
86
- * Because LZW decompression is pretty simple, I've just implemented
87
- * the whole decompressor here (cribbing from "compress" source code,
88
- * of course), rather than relying on an external library. I have
89
- * made an effort to clarify and simplify the algorithm, so the
90
- * names and structure here don't exactly match those used by compress.
91
- */
92
-
93
- struct compress {
94
- /* Input variables. */
95
- const unsigned char *next_in;
96
- size_t avail_in;
97
- size_t consume_unnotified;
98
- int bit_buffer;
99
- int bits_avail;
100
- size_t bytes_in_section;
101
-
102
- /* Output variables. */
103
- size_t out_block_size;
104
- void *out_block;
105
-
106
- /* Decompression status variables. */
107
- int initialized;
108
- int use_reset_code;
109
- int end_of_stream; /* EOF status. */
110
- int maxcode; /* Largest code. */
111
- int maxcode_bits; /* Length of largest code. */
112
- int section_end_code; /* When to increase bits. */
113
- int bits; /* Current code length. */
114
- int oldcode; /* Previous code. */
115
- int finbyte; /* Last byte of prev code. */
116
-
117
- /* Dictionary. */
118
- int free_ent; /* Next dictionary entry. */
119
- unsigned char suffix[65536];
120
- uint16_t prefix[65536];
121
-
122
- /*
123
- * Scratch area for expanding dictionary entries. Note:
124
- * "worst" case here comes from compressing /dev/zero: the
125
- * last code in the dictionary will code a sequence of
126
- * 65536-256 zero bytes. Thus, we need stack space to expand
127
- * a 65280-byte dictionary entry. (Of course, 32640:1
128
- * compression could also be considered the "best" case. ;-)
129
- */
130
- unsigned char *stackp;
131
- unsigned char stack[65300];
132
- };
133
-
134
- static int compress_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *);
135
- static int compress_bidder_init(struct archive_read_filter *);
136
-
137
- static ssize_t compress_filter_read(struct archive_read_filter *, const void **);
138
- static int compress_filter_close(struct archive_read_filter *);
139
-
140
- static int getbits(struct archive_read_filter *, int n);
141
- static int next_code(struct archive_read_filter *);
142
-
143
- #if ARCHIVE_VERSION_NUMBER < 4000000
144
- /* Deprecated; remove in libarchive 4.0 */
145
- int
146
- archive_read_support_compression_compress(struct archive *a)
147
- {
148
- return archive_read_support_filter_compress(a);
149
- }
150
- #endif
151
-
152
- static const struct archive_read_filter_bidder_vtable
153
- compress_bidder_vtable = {
154
- .bid = compress_bidder_bid,
155
- .init = compress_bidder_init,
156
- };
157
-
158
- int
159
- archive_read_support_filter_compress(struct archive *_a)
160
- {
161
- struct archive_read *a = (struct archive_read *)_a;
162
-
163
- return __archive_read_register_bidder(a, NULL, "compress (.Z)",
164
- &compress_bidder_vtable);
165
- }
166
-
167
- /*
168
- * Test whether we can handle this data.
169
- * This logic returns zero if any part of the signature fails.
170
- */
171
- static int
172
- compress_bidder_bid(struct archive_read_filter_bidder *b,
173
- struct archive_read_filter *f)
174
- {
175
- const unsigned char *buffer;
176
- int bits_checked;
177
-
178
- (void)b; /* UNUSED */
179
-
180
- /* Shortest valid compress file is 3 bytes. */
181
- buffer = __archive_read_filter_ahead(f, 3, NULL);
182
-
183
- if (buffer == NULL)
184
- return (0);
185
-
186
- bits_checked = 0;
187
- /* First two bytes are the magic value */
188
- if (buffer[0] != 0x1F || buffer[1] != 0x9D)
189
- return (0);
190
- /* Third byte holds compression parameters. */
191
- if (buffer[2] & 0x20) /* Reserved bit, must be zero. */
192
- return (0);
193
- if (buffer[2] & 0x40) /* Reserved bit, must be zero. */
194
- return (0);
195
- bits_checked += 18;
196
-
197
- return (bits_checked);
198
- }
199
-
200
- static const struct archive_read_filter_vtable
201
- compress_reader_vtable = {
202
- .read = compress_filter_read,
203
- .close = compress_filter_close,
204
- };
205
-
206
- /*
207
- * Setup the callbacks.
208
- */
209
- static int
210
- compress_bidder_init(struct archive_read_filter *f)
211
- {
212
- struct compress *compress;
213
- static const size_t out_block_size = 64 * 1024;
214
- void *out_block;
215
-
216
- f->code = ARCHIVE_FILTER_COMPRESS;
217
- f->name = "compress (.Z)";
218
-
219
- compress = calloc(1, sizeof(*compress));
220
- out_block = malloc(out_block_size);
221
- if (compress == NULL || out_block == NULL) {
222
- free(out_block);
223
- free(compress);
224
- archive_set_error(&f->archive->archive, ENOMEM,
225
- "Can't allocate data for %s decompression",
226
- f->name);
227
- return (ARCHIVE_FATAL);
228
- }
229
-
230
- f->data = compress;
231
- compress->out_block_size = out_block_size;
232
- compress->out_block = out_block;
233
- f->vtable = &compress_reader_vtable;
234
-
235
- return (ARCHIVE_OK);
236
- }
237
-
238
- static int
239
- compress_filter_init(struct archive_read_filter *f)
240
- {
241
- struct compress *compress = f->data;
242
- int code;
243
-
244
- compress->initialized = 1;
245
-
246
- (void)getbits(f, 8); /* Skip first signature byte. */
247
- (void)getbits(f, 8); /* Skip second signature byte. */
248
-
249
- /* Get compression parameters. */
250
- code = getbits(f, 8);
251
- if (code < 0 || (code & 0x1f) > 16) {
252
- archive_set_error(&f->archive->archive, -1,
253
- "Invalid compressed data");
254
- return (ARCHIVE_FATAL);
255
- }
256
- compress->maxcode_bits = code & 0x1f;
257
- compress->maxcode = (1 << compress->maxcode_bits);
258
- compress->use_reset_code = code & 0x80;
259
-
260
- /* Initialize decompressor. */
261
- compress->free_ent = 256;
262
- compress->stackp = compress->stack;
263
- if (compress->use_reset_code)
264
- compress->free_ent++;
265
- compress->bits = 9;
266
- compress->section_end_code = (1<<compress->bits) - 1;
267
- compress->oldcode = -1;
268
- for (code = 255; code >= 0; code--) {
269
- compress->prefix[code] = 0;
270
- compress->suffix[code] = code;
271
- }
272
- next_code(f);
273
-
274
- return (ARCHIVE_OK);
275
- }
276
-
277
- /*
278
- * Return a block of data from the decompression buffer. Decompress more
279
- * as necessary.
280
- */
281
- static ssize_t
282
- compress_filter_read(struct archive_read_filter *f, const void **pblock)
283
- {
284
- struct compress *compress = f->data;
285
- unsigned char *p, *start, *end;
286
- int ret;
287
-
288
- if (!compress->initialized) {
289
- ret = compress_filter_init(f);
290
- if (ret != ARCHIVE_OK)
291
- return (ret);
292
- }
293
- if (compress->end_of_stream) {
294
- *pblock = NULL;
295
- return (0);
296
- }
297
- p = start = (unsigned char *)compress->out_block;
298
- end = start + compress->out_block_size;
299
-
300
- while (p < end && !compress->end_of_stream) {
301
- if (compress->stackp > compress->stack) {
302
- *p++ = *--compress->stackp;
303
- } else {
304
- ret = next_code(f);
305
- if (ret == -1)
306
- compress->end_of_stream = ret;
307
- else if (ret != ARCHIVE_OK)
308
- return (ret);
309
- }
310
- }
311
-
312
- *pblock = start;
313
- return (p - start);
314
- }
315
-
316
- /*
317
- * Close and release the filter.
318
- */
319
- static int
320
- compress_filter_close(struct archive_read_filter *f)
321
- {
322
- struct compress *compress = f->data;
323
-
324
- free(compress->out_block);
325
- free(compress);
326
- return (ARCHIVE_OK);
327
- }
328
-
329
- /*
330
- * Process the next code and fill the stack with the expansion
331
- * of the code. Returns ARCHIVE_FATAL if there is a fatal I/O or
332
- * format error, ARCHIVE_EOF if we hit end of data, ARCHIVE_OK otherwise.
333
- */
334
- static int
335
- next_code(struct archive_read_filter *f)
336
- {
337
- struct compress *compress = f->data;
338
- int code, newcode;
339
-
340
- again:
341
- code = newcode = getbits(f, compress->bits);
342
- if (code < 0)
343
- return (code);
344
-
345
- /* If it's a reset code, reset the dictionary. */
346
- if ((code == 256) && compress->use_reset_code) {
347
- /*
348
- * The original 'compress' implementation blocked its
349
- * I/O in a manner that resulted in junk bytes being
350
- * inserted after every reset. The next section skips
351
- * this junk. (Yes, the number of *bytes* to skip is
352
- * a function of the current *bit* length.)
353
- */
354
- int skip_bytes = compress->bits -
355
- (compress->bytes_in_section % compress->bits);
356
- skip_bytes %= compress->bits;
357
- compress->bits_avail = 0; /* Discard rest of this byte. */
358
- while (skip_bytes-- > 0) {
359
- code = getbits(f, 8);
360
- if (code < 0)
361
- return (code);
362
- }
363
- /* Now, actually do the reset. */
364
- compress->bytes_in_section = 0;
365
- compress->bits = 9;
366
- compress->section_end_code = (1 << compress->bits) - 1;
367
- compress->free_ent = 257;
368
- compress->oldcode = -1;
369
- goto again;
370
- }
371
-
372
- if (code > compress->free_ent
373
- || (code == compress->free_ent && compress->oldcode < 0)) {
374
- /* An invalid code is a fatal error. */
375
- archive_set_error(&(f->archive->archive), -1,
376
- "Invalid compressed data");
377
- return (ARCHIVE_FATAL);
378
- }
379
-
380
- /* Special case for KwKwK string. */
381
- if (code >= compress->free_ent) {
382
- *compress->stackp++ = compress->finbyte;
383
- code = compress->oldcode;
384
- }
385
-
386
- /* Generate output characters in reverse order. */
387
- while (code >= 256) {
388
- *compress->stackp++ = compress->suffix[code];
389
- code = compress->prefix[code];
390
- }
391
- *compress->stackp++ = compress->finbyte = code;
392
-
393
- /* Generate the new entry. */
394
- code = compress->free_ent;
395
- if (code < compress->maxcode && compress->oldcode >= 0) {
396
- compress->prefix[code] = compress->oldcode;
397
- compress->suffix[code] = compress->finbyte;
398
- ++compress->free_ent;
399
- }
400
- if (compress->free_ent > compress->section_end_code) {
401
- compress->bits++;
402
- compress->bytes_in_section = 0;
403
- if (compress->bits == compress->maxcode_bits)
404
- compress->section_end_code = compress->maxcode;
405
- else
406
- compress->section_end_code = (1 << compress->bits) - 1;
407
- }
408
-
409
- /* Remember previous code. */
410
- compress->oldcode = newcode;
411
- return (ARCHIVE_OK);
412
- }
413
-
414
- /*
415
- * Return next 'n' bits from stream.
416
- *
417
- * -1 indicates end of available data.
418
- */
419
- static int
420
- getbits(struct archive_read_filter *f, int n)
421
- {
422
- struct compress *compress = f->data;
423
- int code;
424
- ssize_t ret;
425
- static const int mask[] = {
426
- 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff,
427
- 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff, 0xffff
428
- };
429
-
430
- while (compress->bits_avail < n) {
431
- if (compress->avail_in <= 0) {
432
- if (compress->consume_unnotified) {
433
- __archive_read_filter_consume(f->upstream,
434
- compress->consume_unnotified);
435
- compress->consume_unnotified = 0;
436
- }
437
- compress->next_in
438
- = __archive_read_filter_ahead(f->upstream,
439
- 1, &ret);
440
- if (ret == 0)
441
- return (-1);
442
- if (compress->next_in == NULL)
443
- return (ARCHIVE_FATAL);
444
- compress->consume_unnotified = compress->avail_in = ret;
445
- }
446
- compress->bit_buffer |= *compress->next_in++ << compress->bits_avail;
447
- compress->avail_in--;
448
- compress->bits_avail += 8;
449
- compress->bytes_in_section++;
450
- }
451
-
452
- code = compress->bit_buffer;
453
- compress->bit_buffer >>= n;
454
- compress->bits_avail -= n;
455
-
456
- return (code & mask[n]);
457
- }
@@ -1,108 +0,0 @@
1
- /*-
2
- * Copyright (c) 2012 Michihiro NAKAJIMA
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
- #ifdef HAVE_STRING_H
35
- #include <string.h>
36
- #endif
37
- #ifdef HAVE_UNISTD_H
38
- #include <unistd.h>
39
- #endif
40
-
41
- #include "archive.h"
42
- #include "archive_private.h"
43
- #include "archive_read_private.h"
44
-
45
- static const unsigned char grzip_magic[] = {
46
- 0x47, 0x52, 0x5a, 0x69, 0x70, 0x49, 0x49, 0x00,
47
- 0x02, 0x04, 0x3a, 0x29 };
48
-
49
- static int grzip_bidder_bid(struct archive_read_filter_bidder *,
50
- struct archive_read_filter *);
51
- static int grzip_bidder_init(struct archive_read_filter *);
52
-
53
-
54
- static const struct archive_read_filter_bidder_vtable
55
- grzip_bidder_vtable = {
56
- .bid = grzip_bidder_bid,
57
- .init = grzip_bidder_init,
58
- };
59
-
60
- int
61
- archive_read_support_filter_grzip(struct archive *_a)
62
- {
63
- struct archive_read *a = (struct archive_read *)_a;
64
-
65
- if (__archive_read_register_bidder(a, NULL, "grzip",
66
- &grzip_bidder_vtable) != ARCHIVE_OK)
67
- return (ARCHIVE_FATAL);
68
-
69
- /* This filter always uses an external program. */
70
- archive_set_error(_a, ARCHIVE_ERRNO_MISC,
71
- "Using external grzip program for grzip decompression");
72
- return (ARCHIVE_WARN);
73
- }
74
-
75
- /*
76
- * Bidder just verifies the header and returns the number of verified bits.
77
- */
78
- static int
79
- grzip_bidder_bid(struct archive_read_filter_bidder *b,
80
- struct archive_read_filter *f)
81
- {
82
- const unsigned char *p;
83
-
84
- (void)b; /* UNUSED */
85
-
86
- p = __archive_read_filter_ahead(f, sizeof(grzip_magic), NULL);
87
- if (p == NULL)
88
- return (0);
89
-
90
- if (memcmp(p, grzip_magic, sizeof(grzip_magic)))
91
- return (0);
92
-
93
- return (sizeof(grzip_magic) * 8);
94
- }
95
-
96
- static int
97
- grzip_bidder_init(struct archive_read_filter *f)
98
- {
99
- int r;
100
-
101
- r = __archive_read_program(f, "grzip -d");
102
- /* Note: We set the format here even if __archive_read_program()
103
- * above fails. We do, after all, know what the format is
104
- * even if we weren't able to read it. */
105
- f->code = ARCHIVE_FILTER_GRZIP;
106
- f->name = "grzip";
107
- return (r);
108
- }