@papyrus-sdk/engine-native 0.2.22-beta.9.epub.2 → 0.2.22
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.
- package/PapyrusNativeEngine.podspec +45 -0
- package/android/build.gradle +1 -0
- package/android/src/main/cpp/CMakeLists.txt +137 -0
- package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +68 -0
- package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +55 -0
- package/android/src/main/cpp/papyrus_outline_loader_test.cpp +240 -0
- package/android/src/main/cpp/papyrus_text_word_test.cpp +72 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +14 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +491 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +32 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +38 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +305 -35
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +195 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +3 -1
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +195 -5
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerViewManager.java +20 -1
- package/android/src/main/java/com/papyrus/engine/PapyrusSelectionMenuIcon.java +48 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextAnnotationModel.java +22 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +661 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +49 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +43 -0
- package/dist/index.d.mts +614 -4
- package/dist/index.d.ts +614 -4
- package/dist/index.js +484 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +477 -7
- package/dist/index.mjs.map +1 -1
- package/ios/PapyrusComicDocumentView.h +21 -0
- package/ios/PapyrusComicDocumentView.m +554 -0
- package/ios/PapyrusComicDocumentViewManager.m +23 -0
- package/ios/PapyrusEngineStore.h +3 -0
- package/ios/PapyrusEngineStore.m +32 -6
- package/ios/PapyrusNativeEngine.m +684 -5
- package/ios/PapyrusPageRotationRegistry.h +29 -0
- package/ios/PapyrusPageRotationRegistry.m +179 -0
- package/ios/PapyrusPageView.m +38 -11
- package/ios/PapyrusPdfDocumentView.h +55 -0
- package/ios/PapyrusPdfDocumentView.m +2370 -0
- package/ios/PapyrusPdfDocumentViewManager.m +61 -0
- package/ios/PapyrusPdfPageTheme.h +15 -0
- package/ios/PapyrusPdfPageTheme.m +218 -0
- package/ios/PapyrusSelectionMenu.h +27 -0
- package/ios/PapyrusTextAnnotationRange.h +2 -0
- package/ios/PapyrusTextAnnotationRange.m +29 -0
- package/ios/PapyrusTextDocumentView.h +32 -0
- package/ios/PapyrusTextDocumentView.m +518 -0
- package/ios/PapyrusTextDocumentViewManager.m +34 -0
- package/ios/PapyrusTextStore.h +13 -0
- package/ios/PapyrusTextStore.m +73 -0
- package/package.json +10 -8
- package/react-native.config.js +1 -1
- package/third_party_licenses/BLAKE2-NOTICE.txt +11 -0
- package/third_party_licenses/libarchive-COPYING +65 -0
- package/vendor/libarchive/PapyrusComicArchive.cpp +376 -0
- package/vendor/libarchive/PapyrusComicArchive.h +30 -0
- package/vendor/libarchive/README.papyrus.md +15 -0
- package/vendor/libarchive/android.h +192 -0
- package/vendor/libarchive/config/PapyrusArchiveConfig.h +71 -0
- package/vendor/libarchive/libarchive/CMakeLists.txt +293 -0
- package/vendor/libarchive/libarchive/android_lf.h +36 -0
- package/vendor/libarchive/libarchive/archive.h +1266 -0
- package/vendor/libarchive/libarchive/archive_acl.c +2025 -0
- package/vendor/libarchive/libarchive/archive_acl_private.h +85 -0
- package/vendor/libarchive/libarchive/archive_blake2.h +197 -0
- package/vendor/libarchive/libarchive/archive_blake2_impl.h +161 -0
- package/vendor/libarchive/libarchive/archive_blake2s_ref.c +369 -0
- package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +361 -0
- package/vendor/libarchive/libarchive/archive_check_magic.c +183 -0
- package/vendor/libarchive/libarchive/archive_cmdline.c +211 -0
- package/vendor/libarchive/libarchive/archive_cmdline_private.h +45 -0
- package/vendor/libarchive/libarchive/archive_crc32.h +123 -0
- package/vendor/libarchive/libarchive/archive_cryptor.c +534 -0
- package/vendor/libarchive/libarchive/archive_cryptor_private.h +199 -0
- package/vendor/libarchive/libarchive/archive_digest.c +1584 -0
- package/vendor/libarchive/libarchive/archive_digest_private.h +431 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +558 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +712 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +760 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +824 -0
- package/vendor/libarchive/libarchive/archive_endian.h +234 -0
- package/vendor/libarchive/libarchive/archive_entry.3 +147 -0
- package/vendor/libarchive/libarchive/archive_entry.c +2297 -0
- package/vendor/libarchive/libarchive/archive_entry.h +763 -0
- package/vendor/libarchive/libarchive/archive_entry_acl.3 +458 -0
- package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +55 -0
- package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +82 -0
- package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +472 -0
- package/vendor/libarchive/libarchive/archive_entry_linkify.3 +224 -0
- package/vendor/libarchive/libarchive/archive_entry_locale.h +90 -0
- package/vendor/libarchive/libarchive/archive_entry_misc.3 +63 -0
- package/vendor/libarchive/libarchive/archive_entry_paths.3 +153 -0
- package/vendor/libarchive/libarchive/archive_entry_perms.3 +210 -0
- package/vendor/libarchive/libarchive/archive_entry_private.h +205 -0
- package/vendor/libarchive/libarchive/archive_entry_sparse.c +156 -0
- package/vendor/libarchive/libarchive/archive_entry_stat.3 +274 -0
- package/vendor/libarchive/libarchive/archive_entry_stat.c +121 -0
- package/vendor/libarchive/libarchive/archive_entry_strmode.c +69 -0
- package/vendor/libarchive/libarchive/archive_entry_time.3 +127 -0
- package/vendor/libarchive/libarchive/archive_entry_xattr.c +155 -0
- package/vendor/libarchive/libarchive/archive_hmac.c +345 -0
- package/vendor/libarchive/libarchive/archive_hmac_private.h +119 -0
- package/vendor/libarchive/libarchive/archive_integer.h +267 -0
- package/vendor/libarchive/libarchive/archive_match.c +1869 -0
- package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +54 -0
- package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +54 -0
- package/vendor/libarchive/libarchive/archive_options.c +219 -0
- package/vendor/libarchive/libarchive/archive_options_private.h +49 -0
- package/vendor/libarchive/libarchive/archive_pack_dev.c +330 -0
- package/vendor/libarchive/libarchive/archive_pack_dev.h +49 -0
- package/vendor/libarchive/libarchive/archive_parse_date.c +1173 -0
- package/vendor/libarchive/libarchive/archive_pathmatch.c +480 -0
- package/vendor/libarchive/libarchive/archive_pathmatch.h +50 -0
- package/vendor/libarchive/libarchive/archive_platform.h +213 -0
- package/vendor/libarchive/libarchive/archive_platform_acl.h +53 -0
- package/vendor/libarchive/libarchive/archive_platform_stat.h +45 -0
- package/vendor/libarchive/libarchive/archive_platform_xattr.h +45 -0
- package/vendor/libarchive/libarchive/archive_ppmd7.c +1173 -0
- package/vendor/libarchive/libarchive/archive_ppmd7_private.h +119 -0
- package/vendor/libarchive/libarchive/archive_ppmd8.c +1293 -0
- package/vendor/libarchive/libarchive/archive_ppmd8_private.h +123 -0
- package/vendor/libarchive/libarchive/archive_ppmd_private.h +159 -0
- package/vendor/libarchive/libarchive/archive_private.h +209 -0
- package/vendor/libarchive/libarchive/archive_random.c +274 -0
- package/vendor/libarchive/libarchive/archive_random_private.h +36 -0
- package/vendor/libarchive/libarchive/archive_rb.c +709 -0
- package/vendor/libarchive/libarchive/archive_rb.h +113 -0
- package/vendor/libarchive/libarchive/archive_read.3 +250 -0
- package/vendor/libarchive/libarchive/archive_read.c +1814 -0
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +72 -0
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +189 -0
- package/vendor/libarchive/libarchive/archive_read_append_filter.c +209 -0
- package/vendor/libarchive/libarchive/archive_read_data.3 +128 -0
- package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +207 -0
- package/vendor/libarchive/libarchive/archive_read_disk.3 +422 -0
- package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +1086 -0
- package/vendor/libarchive/libarchive/archive_read_disk_posix.c +2639 -0
- package/vendor/libarchive/libarchive/archive_read_disk_private.h +97 -0
- package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +315 -0
- package/vendor/libarchive/libarchive/archive_read_disk_windows.c +2603 -0
- package/vendor/libarchive/libarchive/archive_read_extract.3 +135 -0
- package/vendor/libarchive/libarchive/archive_read_extract.c +59 -0
- package/vendor/libarchive/libarchive/archive_read_extract2.c +154 -0
- package/vendor/libarchive/libarchive/archive_read_filter.3 +163 -0
- package/vendor/libarchive/libarchive/archive_read_format.3 +190 -0
- package/vendor/libarchive/libarchive/archive_read_free.3 +91 -0
- package/vendor/libarchive/libarchive/archive_read_header.3 +89 -0
- package/vendor/libarchive/libarchive/archive_read_new.3 +57 -0
- package/vendor/libarchive/libarchive/archive_read_open.3 +247 -0
- package/vendor/libarchive/libarchive/archive_read_open_fd.c +236 -0
- package/vendor/libarchive/libarchive/archive_read_open_file.c +257 -0
- package/vendor/libarchive/libarchive/archive_read_open_filename.c +652 -0
- package/vendor/libarchive/libarchive/archive_read_open_memory.c +188 -0
- package/vendor/libarchive/libarchive/archive_read_private.h +274 -0
- package/vendor/libarchive/libarchive/archive_read_set_format.c +116 -0
- package/vendor/libarchive/libarchive/archive_read_set_options.3 +290 -0
- package/vendor/libarchive/libarchive/archive_read_set_options.c +132 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +84 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +68 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +360 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +457 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +108 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +538 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +119 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +829 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +493 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +51 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +497 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +249 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +739 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +792 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +356 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +4650 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_all.c +88 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +597 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +76 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +3410 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +1152 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +95 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +3516 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +2931 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +2113 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +3932 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +4501 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +194 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +3785 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +875 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +3770 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +4710 -0
- package/vendor/libarchive/libarchive/archive_string.c +4391 -0
- package/vendor/libarchive/libarchive/archive_string.h +244 -0
- package/vendor/libarchive/libarchive/archive_string_composition.h +2289 -0
- package/vendor/libarchive/libarchive/archive_string_sprintf.c +200 -0
- package/vendor/libarchive/libarchive/archive_time.c +168 -0
- package/vendor/libarchive/libarchive/archive_time_private.h +47 -0
- package/vendor/libarchive/libarchive/archive_util.3 +239 -0
- package/vendor/libarchive/libarchive/archive_util.c +668 -0
- package/vendor/libarchive/libarchive/archive_version_details.c +516 -0
- package/vendor/libarchive/libarchive/archive_virtual.c +162 -0
- package/vendor/libarchive/libarchive/archive_windows.c +1035 -0
- package/vendor/libarchive/libarchive/archive_windows.h +332 -0
- package/vendor/libarchive/libarchive/archive_write.3 +266 -0
- package/vendor/libarchive/libarchive/archive_write.c +896 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter.c +71 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +329 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +76 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +411 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +459 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +143 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +493 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +214 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +710 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +500 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +42 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +398 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +320 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +547 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +608 -0
- package/vendor/libarchive/libarchive/archive_write_blocksize.3 +112 -0
- package/vendor/libarchive/libarchive/archive_write_data.3 +88 -0
- package/vendor/libarchive/libarchive/archive_write_disk.3 +360 -0
- package/vendor/libarchive/libarchive/archive_write_disk_posix.c +4789 -0
- package/vendor/libarchive/libarchive/archive_write_disk_private.h +43 -0
- package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +265 -0
- package/vendor/libarchive/libarchive/archive_write_disk_windows.c +2952 -0
- package/vendor/libarchive/libarchive/archive_write_filter.3 +140 -0
- package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +77 -0
- package/vendor/libarchive/libarchive/archive_write_format.3 +187 -0
- package/vendor/libarchive/libarchive/archive_write_free.3 +94 -0
- package/vendor/libarchive/libarchive/archive_write_header.3 +71 -0
- package/vendor/libarchive/libarchive/archive_write_new.3 +56 -0
- package/vendor/libarchive/libarchive/archive_write_open.3 +270 -0
- package/vendor/libarchive/libarchive/archive_write_open_fd.c +141 -0
- package/vendor/libarchive/libarchive/archive_write_open_file.c +102 -0
- package/vendor/libarchive/libarchive/archive_write_open_filename.c +272 -0
- package/vendor/libarchive/libarchive/archive_write_open_memory.c +110 -0
- package/vendor/libarchive/libarchive/archive_write_private.h +166 -0
- package/vendor/libarchive/libarchive/archive_write_set_format.c +124 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +2571 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +540 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +93 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +11 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +618 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +457 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +508 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +141 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +790 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +8216 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +2307 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +2249 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_private.h +40 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +123 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +650 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +768 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +648 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +491 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +3799 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +2548 -0
- package/vendor/libarchive/libarchive/archive_write_set_options.3 +779 -0
- package/vendor/libarchive/libarchive/archive_write_set_options.c +129 -0
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +72 -0
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +95 -0
- package/vendor/libarchive/libarchive/archive_xxhash.h +48 -0
- package/vendor/libarchive/libarchive/config_freebsd.h +275 -0
- package/vendor/libarchive/libarchive/cpio.5 +389 -0
- package/vendor/libarchive/libarchive/filter_fork.h +44 -0
- package/vendor/libarchive/libarchive/filter_fork_posix.c +269 -0
- package/vendor/libarchive/libarchive/filter_fork_windows.c +270 -0
- package/vendor/libarchive/libarchive/libarchive-formats.5 +478 -0
- package/vendor/libarchive/libarchive/libarchive.3 +297 -0
- package/vendor/libarchive/libarchive/libarchive_changes.3 +339 -0
- package/vendor/libarchive/libarchive/libarchive_internals.3 +363 -0
- package/vendor/libarchive/libarchive/module.modulemap +34 -0
- package/vendor/libarchive/libarchive/mtree.5 +323 -0
- package/vendor/libarchive/libarchive/tar.5 +947 -0
- package/vendor/libarchive/libarchive/xxhash.c +531 -0
- package/ios/PapyrusNativeEngine.podspec +0 -15
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright (c) 2003-2009 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
|
+
* in this position and unchanged.
|
|
11
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
|
14
|
+
*
|
|
15
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
|
16
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
17
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
18
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
19
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
20
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
21
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
22
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
24
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
#ifndef ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
|
|
28
|
+
#define ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
|
|
29
|
+
|
|
30
|
+
#ifndef __LIBARCHIVE_BUILD
|
|
31
|
+
#error This header is only to be used internally to libarchive.
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#include "archive_platform_acl.h"
|
|
35
|
+
|
|
36
|
+
struct tree;
|
|
37
|
+
struct archive_entry;
|
|
38
|
+
|
|
39
|
+
struct archive_read_disk {
|
|
40
|
+
struct archive archive;
|
|
41
|
+
|
|
42
|
+
/* Reused by archive_read_next_header() */
|
|
43
|
+
struct archive_entry *entry;
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* Symlink mode is one of 'L'ogical, 'P'hysical, or 'H'ybrid,
|
|
47
|
+
* following an old BSD convention. 'L' follows all symlinks,
|
|
48
|
+
* 'P' follows none, 'H' follows symlinks only for the first
|
|
49
|
+
* item.
|
|
50
|
+
*/
|
|
51
|
+
char symlink_mode;
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
* Since symlink interaction changes, we need to track whether
|
|
55
|
+
* we're following symlinks for the current item, governed by the above
|
|
56
|
+
* symlink_mode. 'L' sets this true, 'P' sets it false, 'H' changes it
|
|
57
|
+
* as we traverse.
|
|
58
|
+
*/
|
|
59
|
+
char follow_symlinks; /* Either 0 or 1. */
|
|
60
|
+
|
|
61
|
+
/* Directory traversals. */
|
|
62
|
+
struct tree *tree;
|
|
63
|
+
int (*open_on_current_dir)(struct tree*, const char *, int);
|
|
64
|
+
int (*tree_current_dir_fd)(struct tree*);
|
|
65
|
+
int (*tree_enter_working_dir)(struct tree*);
|
|
66
|
+
|
|
67
|
+
/* Bitfield with ARCHIVE_READDISK_* tunables */
|
|
68
|
+
int flags;
|
|
69
|
+
|
|
70
|
+
const char * (*lookup_gname)(void *private, int64_t gid);
|
|
71
|
+
void (*cleanup_gname)(void *private);
|
|
72
|
+
void *lookup_gname_data;
|
|
73
|
+
const char * (*lookup_uname)(void *private, int64_t uid);
|
|
74
|
+
void (*cleanup_uname)(void *private);
|
|
75
|
+
void *lookup_uname_data;
|
|
76
|
+
|
|
77
|
+
int (*metadata_filter_func)(struct archive *, void *,
|
|
78
|
+
struct archive_entry *);
|
|
79
|
+
void *metadata_filter_data;
|
|
80
|
+
|
|
81
|
+
/* ARCHIVE_MATCH object. */
|
|
82
|
+
struct archive *matching;
|
|
83
|
+
/* Callback function, this will be invoked when ARCHIVE_MATCH
|
|
84
|
+
* archive_match_*_excluded_ae return true. */
|
|
85
|
+
void (*excluded_cb_func)(struct archive *, void *,
|
|
86
|
+
struct archive_entry *);
|
|
87
|
+
void *excluded_cb_data;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const char *
|
|
91
|
+
archive_read_disk_entry_setup_path(struct archive_read_disk *,
|
|
92
|
+
struct archive_entry *, int *);
|
|
93
|
+
|
|
94
|
+
int
|
|
95
|
+
archive_read_disk_entry_setup_acls(struct archive_read_disk *,
|
|
96
|
+
struct archive_entry *, int *);
|
|
97
|
+
#endif
|
|
@@ -0,0 +1,315 @@
|
|
|
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_SYS_TYPES_H
|
|
29
|
+
#include <sys/types.h>
|
|
30
|
+
#endif
|
|
31
|
+
#ifdef HAVE_ERRNO_H
|
|
32
|
+
#include <errno.h>
|
|
33
|
+
#endif
|
|
34
|
+
#ifdef HAVE_GRP_H
|
|
35
|
+
#include <grp.h>
|
|
36
|
+
#endif
|
|
37
|
+
#ifdef HAVE_PWD_H
|
|
38
|
+
#include <pwd.h>
|
|
39
|
+
#endif
|
|
40
|
+
#ifdef HAVE_STDLIB_H
|
|
41
|
+
#include <stdlib.h>
|
|
42
|
+
#endif
|
|
43
|
+
#ifdef HAVE_STRING_H
|
|
44
|
+
#include <string.h>
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
#include "archive.h"
|
|
48
|
+
#include "archive_integer.h"
|
|
49
|
+
|
|
50
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
51
|
+
int
|
|
52
|
+
archive_read_disk_set_standard_lookup(struct archive *a)
|
|
53
|
+
{
|
|
54
|
+
archive_set_error(a, -1, "Standard lookups not available on Windows");
|
|
55
|
+
return (ARCHIVE_FATAL);
|
|
56
|
+
}
|
|
57
|
+
#else /* ! (_WIN32 && !__CYGWIN__) */
|
|
58
|
+
#define name_cache_size 127
|
|
59
|
+
|
|
60
|
+
static const char * const NO_NAME = "(noname)";
|
|
61
|
+
|
|
62
|
+
struct name_cache {
|
|
63
|
+
struct archive *archive;
|
|
64
|
+
char *buff;
|
|
65
|
+
size_t buff_size;
|
|
66
|
+
int probes;
|
|
67
|
+
int hits;
|
|
68
|
+
size_t size;
|
|
69
|
+
struct {
|
|
70
|
+
id_t id;
|
|
71
|
+
const char *name;
|
|
72
|
+
} cache[name_cache_size];
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
static const char * lookup_gname(void *, int64_t);
|
|
76
|
+
static const char * lookup_uname(void *, int64_t);
|
|
77
|
+
static void cleanup(void *);
|
|
78
|
+
static const char * lookup_gname_helper(struct name_cache *, id_t gid);
|
|
79
|
+
static const char * lookup_uname_helper(struct name_cache *, id_t uid);
|
|
80
|
+
|
|
81
|
+
/*
|
|
82
|
+
* Installs functions that use getpwuid()/getgrgid()---along with
|
|
83
|
+
* a simple cache to accelerate such lookups---into the archive_read_disk
|
|
84
|
+
* object. This is in a separate file because getpwuid()/getgrgid()
|
|
85
|
+
* can pull in a LOT of library code (including NIS/LDAP functions, which
|
|
86
|
+
* pull in DNS resolvers, etc). This can easily top 500kB, which makes
|
|
87
|
+
* it inappropriate for some space-constrained applications.
|
|
88
|
+
*
|
|
89
|
+
* Applications that are size-sensitive may want to just use the
|
|
90
|
+
* real default functions (defined in archive_read_disk.c) that just
|
|
91
|
+
* use the uid/gid without the lookup. Or define your own custom functions
|
|
92
|
+
* if you prefer.
|
|
93
|
+
*/
|
|
94
|
+
int
|
|
95
|
+
archive_read_disk_set_standard_lookup(struct archive *a)
|
|
96
|
+
{
|
|
97
|
+
struct name_cache *ucache = malloc(sizeof(struct name_cache));
|
|
98
|
+
struct name_cache *gcache = malloc(sizeof(struct name_cache));
|
|
99
|
+
|
|
100
|
+
if (ucache == NULL || gcache == NULL) {
|
|
101
|
+
archive_set_error(a, ENOMEM,
|
|
102
|
+
"Can't allocate uname/gname lookup cache");
|
|
103
|
+
free(ucache);
|
|
104
|
+
free(gcache);
|
|
105
|
+
return (ARCHIVE_FATAL);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
memset(ucache, 0, sizeof(*ucache));
|
|
109
|
+
ucache->archive = a;
|
|
110
|
+
ucache->size = name_cache_size;
|
|
111
|
+
memset(gcache, 0, sizeof(*gcache));
|
|
112
|
+
gcache->archive = a;
|
|
113
|
+
gcache->size = name_cache_size;
|
|
114
|
+
|
|
115
|
+
archive_read_disk_set_gname_lookup(a, gcache, lookup_gname, cleanup);
|
|
116
|
+
archive_read_disk_set_uname_lookup(a, ucache, lookup_uname, cleanup);
|
|
117
|
+
|
|
118
|
+
return (ARCHIVE_OK);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static void
|
|
122
|
+
cleanup(void *data)
|
|
123
|
+
{
|
|
124
|
+
struct name_cache *cache = (struct name_cache *)data;
|
|
125
|
+
size_t i;
|
|
126
|
+
|
|
127
|
+
if (cache != NULL) {
|
|
128
|
+
for (i = 0; i < cache->size; i++) {
|
|
129
|
+
if (cache->cache[i].name != NULL &&
|
|
130
|
+
cache->cache[i].name != NO_NAME)
|
|
131
|
+
free((void *)(uintptr_t)cache->cache[i].name);
|
|
132
|
+
}
|
|
133
|
+
free(cache->buff);
|
|
134
|
+
free(cache);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/*
|
|
139
|
+
* Lookup uid/gid from uname/gname, return NULL if no match.
|
|
140
|
+
*/
|
|
141
|
+
static const char *
|
|
142
|
+
lookup_name(struct name_cache *cache,
|
|
143
|
+
const char * (*lookup_fn)(struct name_cache *, id_t), id_t id)
|
|
144
|
+
{
|
|
145
|
+
const char *name;
|
|
146
|
+
int slot;
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
cache->probes++;
|
|
150
|
+
|
|
151
|
+
slot = id % cache->size;
|
|
152
|
+
if (cache->cache[slot].name != NULL) {
|
|
153
|
+
if (cache->cache[slot].id == id) {
|
|
154
|
+
cache->hits++;
|
|
155
|
+
if (cache->cache[slot].name == NO_NAME)
|
|
156
|
+
return (NULL);
|
|
157
|
+
return (cache->cache[slot].name);
|
|
158
|
+
}
|
|
159
|
+
if (cache->cache[slot].name != NO_NAME)
|
|
160
|
+
free((void *)(uintptr_t)cache->cache[slot].name);
|
|
161
|
+
cache->cache[slot].name = NULL;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
name = (lookup_fn)(cache, id);
|
|
165
|
+
if (name == NULL) {
|
|
166
|
+
/* Cache and return the negative response. */
|
|
167
|
+
cache->cache[slot].name = NO_NAME;
|
|
168
|
+
cache->cache[slot].id = id;
|
|
169
|
+
return (NULL);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
cache->cache[slot].name = name;
|
|
173
|
+
cache->cache[slot].id = id;
|
|
174
|
+
return (cache->cache[slot].name);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static const char *
|
|
178
|
+
lookup_uname(void *data, int64_t uid)
|
|
179
|
+
{
|
|
180
|
+
struct name_cache *uname_cache = (struct name_cache *)data;
|
|
181
|
+
return (lookup_name(uname_cache,
|
|
182
|
+
&lookup_uname_helper, (id_t)uid));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
#if HAVE_GETPWUID_R
|
|
186
|
+
static const char *
|
|
187
|
+
lookup_uname_helper(struct name_cache *cache, id_t id)
|
|
188
|
+
{
|
|
189
|
+
struct passwd pwent, *result;
|
|
190
|
+
char * nbuff;
|
|
191
|
+
size_t nbuff_size;
|
|
192
|
+
int r;
|
|
193
|
+
|
|
194
|
+
if (cache->buff_size == 0) {
|
|
195
|
+
cache->buff_size = 256;
|
|
196
|
+
cache->buff = malloc(cache->buff_size);
|
|
197
|
+
}
|
|
198
|
+
if (cache->buff == NULL)
|
|
199
|
+
return (NULL);
|
|
200
|
+
for (;;) {
|
|
201
|
+
result = &pwent; /* Old getpwuid_r ignores last arg. */
|
|
202
|
+
r = getpwuid_r((uid_t)id, &pwent,
|
|
203
|
+
cache->buff, cache->buff_size, &result);
|
|
204
|
+
if (r == 0)
|
|
205
|
+
break;
|
|
206
|
+
if (r != ERANGE)
|
|
207
|
+
break;
|
|
208
|
+
/* ERANGE means our buffer was too small, but POSIX
|
|
209
|
+
* doesn't tell us how big the buffer should be, so
|
|
210
|
+
* we just double it and try again. Because the buffer
|
|
211
|
+
* is kept around in the cache object, we shouldn't
|
|
212
|
+
* have to do this very often. */
|
|
213
|
+
if (archive_ckd_mul_size(&nbuff_size, cache->buff_size, 2))
|
|
214
|
+
break;
|
|
215
|
+
nbuff = realloc(cache->buff, nbuff_size);
|
|
216
|
+
if (nbuff == NULL)
|
|
217
|
+
break;
|
|
218
|
+
cache->buff = nbuff;
|
|
219
|
+
cache->buff_size = nbuff_size;
|
|
220
|
+
}
|
|
221
|
+
if (r != 0) {
|
|
222
|
+
archive_set_error(cache->archive, errno,
|
|
223
|
+
"Can't lookup user for id %d", (int)id);
|
|
224
|
+
return (NULL);
|
|
225
|
+
}
|
|
226
|
+
if (result == NULL)
|
|
227
|
+
return (NULL);
|
|
228
|
+
|
|
229
|
+
return strdup(result->pw_name);
|
|
230
|
+
}
|
|
231
|
+
#else
|
|
232
|
+
static const char *
|
|
233
|
+
lookup_uname_helper(struct name_cache *cache, id_t id)
|
|
234
|
+
{
|
|
235
|
+
struct passwd *result;
|
|
236
|
+
(void)cache; /* UNUSED */
|
|
237
|
+
|
|
238
|
+
result = getpwuid((uid_t)id);
|
|
239
|
+
|
|
240
|
+
if (result == NULL)
|
|
241
|
+
return (NULL);
|
|
242
|
+
|
|
243
|
+
return strdup(result->pw_name);
|
|
244
|
+
}
|
|
245
|
+
#endif
|
|
246
|
+
|
|
247
|
+
static const char *
|
|
248
|
+
lookup_gname(void *data, int64_t gid)
|
|
249
|
+
{
|
|
250
|
+
struct name_cache *gname_cache = (struct name_cache *)data;
|
|
251
|
+
return (lookup_name(gname_cache,
|
|
252
|
+
&lookup_gname_helper, (id_t)gid));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
#if HAVE_GETGRGID_R
|
|
256
|
+
static const char *
|
|
257
|
+
lookup_gname_helper(struct name_cache *cache, id_t id)
|
|
258
|
+
{
|
|
259
|
+
struct group grent, *result;
|
|
260
|
+
char * nbuff;
|
|
261
|
+
size_t nbuff_size;
|
|
262
|
+
int r;
|
|
263
|
+
|
|
264
|
+
if (cache->buff_size == 0) {
|
|
265
|
+
cache->buff_size = 256;
|
|
266
|
+
cache->buff = malloc(cache->buff_size);
|
|
267
|
+
}
|
|
268
|
+
if (cache->buff == NULL)
|
|
269
|
+
return (NULL);
|
|
270
|
+
for (;;) {
|
|
271
|
+
result = &grent; /* Old getgrgid_r ignores last arg. */
|
|
272
|
+
r = getgrgid_r((gid_t)id, &grent,
|
|
273
|
+
cache->buff, cache->buff_size, &result);
|
|
274
|
+
if (r == 0)
|
|
275
|
+
break;
|
|
276
|
+
if (r != ERANGE)
|
|
277
|
+
break;
|
|
278
|
+
/* ERANGE means our buffer was too small, but POSIX
|
|
279
|
+
* doesn't tell us how big the buffer should be, so
|
|
280
|
+
* we just double it and try again. */
|
|
281
|
+
if (archive_ckd_mul_size(&nbuff_size, cache->buff_size, 2))
|
|
282
|
+
break;
|
|
283
|
+
nbuff = realloc(cache->buff, nbuff_size);
|
|
284
|
+
if (nbuff == NULL)
|
|
285
|
+
break;
|
|
286
|
+
cache->buff = nbuff;
|
|
287
|
+
cache->buff_size = nbuff_size;
|
|
288
|
+
}
|
|
289
|
+
if (r != 0) {
|
|
290
|
+
archive_set_error(cache->archive, errno,
|
|
291
|
+
"Can't lookup group for id %d", (int)id);
|
|
292
|
+
return (NULL);
|
|
293
|
+
}
|
|
294
|
+
if (result == NULL)
|
|
295
|
+
return (NULL);
|
|
296
|
+
|
|
297
|
+
return strdup(result->gr_name);
|
|
298
|
+
}
|
|
299
|
+
#else
|
|
300
|
+
static const char *
|
|
301
|
+
lookup_gname_helper(struct name_cache *cache, id_t id)
|
|
302
|
+
{
|
|
303
|
+
struct group *result;
|
|
304
|
+
(void)cache; /* UNUSED */
|
|
305
|
+
|
|
306
|
+
result = getgrgid((gid_t)id);
|
|
307
|
+
|
|
308
|
+
if (result == NULL)
|
|
309
|
+
return (NULL);
|
|
310
|
+
|
|
311
|
+
return strdup(result->gr_name);
|
|
312
|
+
}
|
|
313
|
+
#endif
|
|
314
|
+
|
|
315
|
+
#endif /* ! (_WIN32 && !__CYGWIN__) */
|