@papyrus-sdk/engine-native 0.2.22-beta.2 → 0.2.22-beta.4

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 (266) hide show
  1. package/android/build.gradle +1 -0
  2. package/android/src/main/cpp/CMakeLists.txt +137 -0
  3. package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +68 -0
  4. package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +55 -0
  5. package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +14 -0
  6. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +353 -0
  7. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +32 -0
  8. package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +17 -0
  9. package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +298 -34
  10. package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +195 -0
  11. package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +3 -1
  12. package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +24 -0
  13. package/android/src/main/java/com/papyrus/engine/PapyrusRenderMath.java +9 -0
  14. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +439 -0
  15. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +43 -0
  16. package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +43 -0
  17. package/dist/index.d.mts +439 -3
  18. package/dist/index.d.ts +439 -3
  19. package/dist/index.js +412 -4
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +404 -3
  22. package/dist/index.mjs.map +1 -1
  23. package/ios/PapyrusComicDocumentView.h +21 -0
  24. package/ios/PapyrusComicDocumentView.m +374 -0
  25. package/ios/PapyrusComicDocumentViewManager.m +23 -0
  26. package/ios/PapyrusEngineStore.m +4 -0
  27. package/ios/PapyrusNativeEngine.m +664 -0
  28. package/ios/PapyrusNativeEngine.podspec +26 -1
  29. package/ios/PapyrusPageRotationRegistry.h +29 -0
  30. package/ios/PapyrusPageRotationRegistry.m +179 -0
  31. package/ios/PapyrusPageView.m +38 -11
  32. package/ios/PapyrusPdfDocumentView.h +2 -0
  33. package/ios/PapyrusPdfDocumentView.m +116 -9
  34. package/ios/PapyrusPdfDocumentViewManager.m +2 -0
  35. package/ios/PapyrusPdfPageTheme.h +15 -0
  36. package/ios/PapyrusPdfPageTheme.m +218 -0
  37. package/ios/PapyrusTextDocumentView.h +27 -0
  38. package/ios/PapyrusTextDocumentView.m +299 -0
  39. package/ios/PapyrusTextDocumentViewManager.m +29 -0
  40. package/ios/PapyrusTextStore.h +13 -0
  41. package/ios/PapyrusTextStore.m +73 -0
  42. package/package.json +5 -3
  43. package/third_party_licenses/BLAKE2-NOTICE.txt +11 -0
  44. package/third_party_licenses/libarchive-COPYING +65 -0
  45. package/vendor/libarchive/PapyrusComicArchive.cpp +376 -0
  46. package/vendor/libarchive/PapyrusComicArchive.h +30 -0
  47. package/vendor/libarchive/README.papyrus.md +15 -0
  48. package/vendor/libarchive/android.h +192 -0
  49. package/vendor/libarchive/config/PapyrusArchiveConfig.h +65 -0
  50. package/vendor/libarchive/libarchive/CMakeLists.txt +293 -0
  51. package/vendor/libarchive/libarchive/android_lf.h +36 -0
  52. package/vendor/libarchive/libarchive/archive.h +1266 -0
  53. package/vendor/libarchive/libarchive/archive_acl.c +2025 -0
  54. package/vendor/libarchive/libarchive/archive_acl_private.h +85 -0
  55. package/vendor/libarchive/libarchive/archive_blake2.h +197 -0
  56. package/vendor/libarchive/libarchive/archive_blake2_impl.h +161 -0
  57. package/vendor/libarchive/libarchive/archive_blake2s_ref.c +369 -0
  58. package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +361 -0
  59. package/vendor/libarchive/libarchive/archive_check_magic.c +183 -0
  60. package/vendor/libarchive/libarchive/archive_cmdline.c +211 -0
  61. package/vendor/libarchive/libarchive/archive_cmdline_private.h +45 -0
  62. package/vendor/libarchive/libarchive/archive_crc32.h +123 -0
  63. package/vendor/libarchive/libarchive/archive_cryptor.c +534 -0
  64. package/vendor/libarchive/libarchive/archive_cryptor_private.h +199 -0
  65. package/vendor/libarchive/libarchive/archive_digest.c +1584 -0
  66. package/vendor/libarchive/libarchive/archive_digest_private.h +431 -0
  67. package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +558 -0
  68. package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +712 -0
  69. package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +760 -0
  70. package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +824 -0
  71. package/vendor/libarchive/libarchive/archive_endian.h +234 -0
  72. package/vendor/libarchive/libarchive/archive_entry.3 +147 -0
  73. package/vendor/libarchive/libarchive/archive_entry.c +2297 -0
  74. package/vendor/libarchive/libarchive/archive_entry.h +763 -0
  75. package/vendor/libarchive/libarchive/archive_entry_acl.3 +458 -0
  76. package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +55 -0
  77. package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +82 -0
  78. package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +472 -0
  79. package/vendor/libarchive/libarchive/archive_entry_linkify.3 +224 -0
  80. package/vendor/libarchive/libarchive/archive_entry_locale.h +90 -0
  81. package/vendor/libarchive/libarchive/archive_entry_misc.3 +63 -0
  82. package/vendor/libarchive/libarchive/archive_entry_paths.3 +153 -0
  83. package/vendor/libarchive/libarchive/archive_entry_perms.3 +210 -0
  84. package/vendor/libarchive/libarchive/archive_entry_private.h +205 -0
  85. package/vendor/libarchive/libarchive/archive_entry_sparse.c +156 -0
  86. package/vendor/libarchive/libarchive/archive_entry_stat.3 +274 -0
  87. package/vendor/libarchive/libarchive/archive_entry_stat.c +121 -0
  88. package/vendor/libarchive/libarchive/archive_entry_strmode.c +69 -0
  89. package/vendor/libarchive/libarchive/archive_entry_time.3 +127 -0
  90. package/vendor/libarchive/libarchive/archive_entry_xattr.c +155 -0
  91. package/vendor/libarchive/libarchive/archive_hmac.c +345 -0
  92. package/vendor/libarchive/libarchive/archive_hmac_private.h +119 -0
  93. package/vendor/libarchive/libarchive/archive_integer.h +267 -0
  94. package/vendor/libarchive/libarchive/archive_match.c +1869 -0
  95. package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +54 -0
  96. package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +54 -0
  97. package/vendor/libarchive/libarchive/archive_options.c +219 -0
  98. package/vendor/libarchive/libarchive/archive_options_private.h +49 -0
  99. package/vendor/libarchive/libarchive/archive_pack_dev.c +330 -0
  100. package/vendor/libarchive/libarchive/archive_pack_dev.h +49 -0
  101. package/vendor/libarchive/libarchive/archive_parse_date.c +1173 -0
  102. package/vendor/libarchive/libarchive/archive_pathmatch.c +480 -0
  103. package/vendor/libarchive/libarchive/archive_pathmatch.h +50 -0
  104. package/vendor/libarchive/libarchive/archive_platform.h +213 -0
  105. package/vendor/libarchive/libarchive/archive_platform_acl.h +53 -0
  106. package/vendor/libarchive/libarchive/archive_platform_stat.h +45 -0
  107. package/vendor/libarchive/libarchive/archive_platform_xattr.h +45 -0
  108. package/vendor/libarchive/libarchive/archive_ppmd7.c +1173 -0
  109. package/vendor/libarchive/libarchive/archive_ppmd7_private.h +119 -0
  110. package/vendor/libarchive/libarchive/archive_ppmd8.c +1293 -0
  111. package/vendor/libarchive/libarchive/archive_ppmd8_private.h +123 -0
  112. package/vendor/libarchive/libarchive/archive_ppmd_private.h +159 -0
  113. package/vendor/libarchive/libarchive/archive_private.h +209 -0
  114. package/vendor/libarchive/libarchive/archive_random.c +274 -0
  115. package/vendor/libarchive/libarchive/archive_random_private.h +36 -0
  116. package/vendor/libarchive/libarchive/archive_rb.c +709 -0
  117. package/vendor/libarchive/libarchive/archive_rb.h +113 -0
  118. package/vendor/libarchive/libarchive/archive_read.3 +250 -0
  119. package/vendor/libarchive/libarchive/archive_read.c +1814 -0
  120. package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +72 -0
  121. package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +189 -0
  122. package/vendor/libarchive/libarchive/archive_read_append_filter.c +209 -0
  123. package/vendor/libarchive/libarchive/archive_read_data.3 +128 -0
  124. package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +207 -0
  125. package/vendor/libarchive/libarchive/archive_read_disk.3 +422 -0
  126. package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  127. package/vendor/libarchive/libarchive/archive_read_disk_posix.c +2639 -0
  128. package/vendor/libarchive/libarchive/archive_read_disk_private.h +97 -0
  129. package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +315 -0
  130. package/vendor/libarchive/libarchive/archive_read_disk_windows.c +2603 -0
  131. package/vendor/libarchive/libarchive/archive_read_extract.3 +135 -0
  132. package/vendor/libarchive/libarchive/archive_read_extract.c +59 -0
  133. package/vendor/libarchive/libarchive/archive_read_extract2.c +154 -0
  134. package/vendor/libarchive/libarchive/archive_read_filter.3 +163 -0
  135. package/vendor/libarchive/libarchive/archive_read_format.3 +190 -0
  136. package/vendor/libarchive/libarchive/archive_read_free.3 +91 -0
  137. package/vendor/libarchive/libarchive/archive_read_header.3 +89 -0
  138. package/vendor/libarchive/libarchive/archive_read_new.3 +57 -0
  139. package/vendor/libarchive/libarchive/archive_read_open.3 +247 -0
  140. package/vendor/libarchive/libarchive/archive_read_open_fd.c +236 -0
  141. package/vendor/libarchive/libarchive/archive_read_open_file.c +257 -0
  142. package/vendor/libarchive/libarchive/archive_read_open_filename.c +652 -0
  143. package/vendor/libarchive/libarchive/archive_read_open_memory.c +188 -0
  144. package/vendor/libarchive/libarchive/archive_read_private.h +274 -0
  145. package/vendor/libarchive/libarchive/archive_read_set_format.c +116 -0
  146. package/vendor/libarchive/libarchive/archive_read_set_options.3 +290 -0
  147. package/vendor/libarchive/libarchive/archive_read_set_options.c +132 -0
  148. package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +84 -0
  149. package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +68 -0
  150. package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +360 -0
  151. package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +457 -0
  152. package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +108 -0
  153. package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +538 -0
  154. package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +119 -0
  155. package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +829 -0
  156. package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +493 -0
  157. package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +51 -0
  158. package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +497 -0
  159. package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +249 -0
  160. package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +739 -0
  161. package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +792 -0
  162. package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +356 -0
  163. package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +4650 -0
  164. package/vendor/libarchive/libarchive/archive_read_support_format_all.c +88 -0
  165. package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +597 -0
  166. package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +76 -0
  167. package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +3410 -0
  168. package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +1152 -0
  169. package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +95 -0
  170. package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +3516 -0
  171. package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +2931 -0
  172. package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +2113 -0
  173. package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +3932 -0
  174. package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +4501 -0
  175. package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +194 -0
  176. package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +3785 -0
  177. package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +875 -0
  178. package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +3770 -0
  179. package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +4710 -0
  180. package/vendor/libarchive/libarchive/archive_string.c +4391 -0
  181. package/vendor/libarchive/libarchive/archive_string.h +244 -0
  182. package/vendor/libarchive/libarchive/archive_string_composition.h +2289 -0
  183. package/vendor/libarchive/libarchive/archive_string_sprintf.c +200 -0
  184. package/vendor/libarchive/libarchive/archive_time.c +168 -0
  185. package/vendor/libarchive/libarchive/archive_time_private.h +47 -0
  186. package/vendor/libarchive/libarchive/archive_util.3 +239 -0
  187. package/vendor/libarchive/libarchive/archive_util.c +668 -0
  188. package/vendor/libarchive/libarchive/archive_version_details.c +516 -0
  189. package/vendor/libarchive/libarchive/archive_virtual.c +162 -0
  190. package/vendor/libarchive/libarchive/archive_windows.c +1035 -0
  191. package/vendor/libarchive/libarchive/archive_windows.h +332 -0
  192. package/vendor/libarchive/libarchive/archive_write.3 +266 -0
  193. package/vendor/libarchive/libarchive/archive_write.c +896 -0
  194. package/vendor/libarchive/libarchive/archive_write_add_filter.c +71 -0
  195. package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +329 -0
  196. package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +76 -0
  197. package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +411 -0
  198. package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +459 -0
  199. package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +143 -0
  200. package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +493 -0
  201. package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +214 -0
  202. package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +710 -0
  203. package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +500 -0
  204. package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +42 -0
  205. package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +398 -0
  206. package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +320 -0
  207. package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +547 -0
  208. package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +608 -0
  209. package/vendor/libarchive/libarchive/archive_write_blocksize.3 +112 -0
  210. package/vendor/libarchive/libarchive/archive_write_data.3 +88 -0
  211. package/vendor/libarchive/libarchive/archive_write_disk.3 +360 -0
  212. package/vendor/libarchive/libarchive/archive_write_disk_posix.c +4789 -0
  213. package/vendor/libarchive/libarchive/archive_write_disk_private.h +43 -0
  214. package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +265 -0
  215. package/vendor/libarchive/libarchive/archive_write_disk_windows.c +2952 -0
  216. package/vendor/libarchive/libarchive/archive_write_filter.3 +140 -0
  217. package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +77 -0
  218. package/vendor/libarchive/libarchive/archive_write_format.3 +187 -0
  219. package/vendor/libarchive/libarchive/archive_write_free.3 +94 -0
  220. package/vendor/libarchive/libarchive/archive_write_header.3 +71 -0
  221. package/vendor/libarchive/libarchive/archive_write_new.3 +56 -0
  222. package/vendor/libarchive/libarchive/archive_write_open.3 +270 -0
  223. package/vendor/libarchive/libarchive/archive_write_open_fd.c +141 -0
  224. package/vendor/libarchive/libarchive/archive_write_open_file.c +102 -0
  225. package/vendor/libarchive/libarchive/archive_write_open_filename.c +272 -0
  226. package/vendor/libarchive/libarchive/archive_write_open_memory.c +110 -0
  227. package/vendor/libarchive/libarchive/archive_write_private.h +166 -0
  228. package/vendor/libarchive/libarchive/archive_write_set_format.c +124 -0
  229. package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +2571 -0
  230. package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +540 -0
  231. package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +93 -0
  232. package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +11 -0
  233. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +618 -0
  234. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  235. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +508 -0
  236. package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +141 -0
  237. package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +790 -0
  238. package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +8216 -0
  239. package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +2307 -0
  240. package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +2249 -0
  241. package/vendor/libarchive/libarchive/archive_write_set_format_private.h +40 -0
  242. package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +123 -0
  243. package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +650 -0
  244. package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +768 -0
  245. package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +648 -0
  246. package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +491 -0
  247. package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +3799 -0
  248. package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +2548 -0
  249. package/vendor/libarchive/libarchive/archive_write_set_options.3 +779 -0
  250. package/vendor/libarchive/libarchive/archive_write_set_options.c +129 -0
  251. package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +72 -0
  252. package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +95 -0
  253. package/vendor/libarchive/libarchive/archive_xxhash.h +48 -0
  254. package/vendor/libarchive/libarchive/config_freebsd.h +275 -0
  255. package/vendor/libarchive/libarchive/cpio.5 +389 -0
  256. package/vendor/libarchive/libarchive/filter_fork.h +44 -0
  257. package/vendor/libarchive/libarchive/filter_fork_posix.c +269 -0
  258. package/vendor/libarchive/libarchive/filter_fork_windows.c +270 -0
  259. package/vendor/libarchive/libarchive/libarchive-formats.5 +478 -0
  260. package/vendor/libarchive/libarchive/libarchive.3 +297 -0
  261. package/vendor/libarchive/libarchive/libarchive_changes.3 +339 -0
  262. package/vendor/libarchive/libarchive/libarchive_internals.3 +363 -0
  263. package/vendor/libarchive/libarchive/module.modulemap +34 -0
  264. package/vendor/libarchive/libarchive/mtree.5 +323 -0
  265. package/vendor/libarchive/libarchive/tar.5 +947 -0
  266. package/vendor/libarchive/libarchive/xxhash.c +531 -0
@@ -0,0 +1,458 @@
1
+ .\" Copyright (c) 2010 Joerg Sonnenberger
2
+ .\" Copyright (c) 2016 Martin Matuska
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 AND CONTRIBUTORS ``AS IS'' AND
15
+ .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
+ .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
+ .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
+ .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
+ .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
+ .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
+ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
+ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
+ .\" SUCH DAMAGE.
25
+ .\"
26
+ .Dd February 15, 2017
27
+ .Dt ARCHIVE_ENTRY_ACL 3
28
+ .Os
29
+ .Sh NAME
30
+ .Nm archive_entry_acl_add_entry ,
31
+ .Nm archive_entry_acl_add_entry_w ,
32
+ .Nm archive_entry_acl_clear ,
33
+ .Nm archive_entry_acl_count ,
34
+ .Nm archive_entry_acl_from_text ,
35
+ .Nm archive_entry_acl_from_text_w ,
36
+ .Nm archive_entry_acl_next ,
37
+ .Nm archive_entry_acl_reset ,
38
+ .Nm archive_entry_acl_to_text ,
39
+ .Nm archive_entry_acl_to_text_w ,
40
+ .Nm archive_entry_acl_types
41
+ .Nd functions for manipulating Access Control Lists in archive entry descriptions
42
+ .Sh LIBRARY
43
+ Streaming Archive Library (libarchive, -larchive)
44
+ .Sh SYNOPSIS
45
+ .In archive_entry.h
46
+ .Ft void
47
+ .Fo archive_entry_acl_add_entry
48
+ .Fa "struct archive_entry *a"
49
+ .Fa "int type"
50
+ .Fa "int permset"
51
+ .Fa "int tag"
52
+ .Fa "int qualifier"
53
+ .Fa "const char *name"
54
+ .Fc
55
+ .Ft void
56
+ .Fo archive_entry_acl_add_entry_w
57
+ .Fa "struct archive_entry *a"
58
+ .Fa "int type"
59
+ .Fa "int permset"
60
+ .Fa "int tag"
61
+ .Fa "int qualifier"
62
+ .Fa "const wchar_t *name"
63
+ .Fc
64
+ .Ft void
65
+ .Fn archive_entry_acl_clear "struct archive_entry *a"
66
+ .Ft int
67
+ .Fn archive_entry_acl_count "struct archive_entry *a" "int type"
68
+ .Ft int
69
+ .Fo archive_entry_acl_from_text
70
+ .Fa "struct archive_entry *a"
71
+ .Fa "const char *text"
72
+ .Fa "int type"
73
+ .Fc
74
+ .Ft int
75
+ .Fo archive_entry_acl_from_text_w
76
+ .Fa "struct archive_entry *a"
77
+ .Fa "const wchar_t *text"
78
+ .Fa "int type"
79
+ .Fc
80
+ .Ft int
81
+ .Fo archive_entry_acl_next
82
+ .Fa "struct archive_entry *a"
83
+ .Fa "int type"
84
+ .Fa "int *ret_type"
85
+ .Fa "int *ret_permset"
86
+ .Fa "int *ret_tag"
87
+ .Fa "int *ret_qual"
88
+ .Fa "const char **ret_name"
89
+ .Fc
90
+ .Ft int
91
+ .Fn archive_entry_acl_reset "struct archive_entry *a" "int type"
92
+ .Ft char *
93
+ .Fo archive_entry_acl_to_text
94
+ .Fa "struct archive_entry *a"
95
+ .Fa "ssize_t *len_p"
96
+ .Fa "int flags"
97
+ .Fc
98
+ .Ft wchar_t *
99
+ .Fo archive_entry_acl_to_text_w
100
+ .Fa "struct archive_entry *a"
101
+ .Fa "ssize_t *len_p"
102
+ .Fa "int flags"
103
+ .Fc
104
+ .Ft int
105
+ .Fn archive_entry_acl_types "struct archive_entry *a"
106
+ .\" enum?
107
+ .Sh DESCRIPTION
108
+ The
109
+ .Dq Access Control Lists (ACLs)
110
+ extend the standard Unix permission model.
111
+ The ACL interface of
112
+ .Nm libarchive
113
+ supports both POSIX.1e and NFSv4 style ACLs.
114
+ Use of ACLs is restricted by
115
+ various levels of ACL support in operating systems, file systems and archive
116
+ formats.
117
+ .Ss POSIX.1e Access Control Lists
118
+ A POSIX.1e ACL consists of a number of independent entries.
119
+ Each entry specifies the permission set as a bitmask of basic permissions.
120
+ Valid permissions in the
121
+ .Fa permset
122
+ are:
123
+ .Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_EXECUTE"
124
+ .It Dv ARCHIVE_ENTRY_ACL_READ ( Sy r )
125
+ .It Dv ARCHIVE_ENTRY_ACL_WRITE ( Sy w )
126
+ .It Dv ARCHIVE_ENTRY_ACL_EXECUTE ( Sy x )
127
+ .El
128
+ The permissions correspond to the normal Unix permissions.
129
+ .Pp
130
+ The
131
+ .Fa tag
132
+ specifies the principal to which the permission applies.
133
+ Valid values are:
134
+ .Bl -hang -offset indent -compact -width "ARCHIVE_ENTRY_ACL_GROUP_OBJ"
135
+ .It Dv ARCHIVE_ENTRY_ACL_USER
136
+ The user specified by the name field.
137
+ .It Dv ARCHIVE_ENTRY_ACL_USER_OBJ
138
+ The owner of the file.
139
+ .It Dv ARCHIVE_ENTRY_ACL_GROUP
140
+ The group specified by the name field.
141
+ .It Dv ARCHIVE_ENTRY_ACL_GROUP_OBJ
142
+ The group which owns the file.
143
+ .It Dv ARCHIVE_ENTRY_ACL_MASK
144
+ The maximum permissions to be obtained via group permissions.
145
+ .It Dv ARCHIVE_ENTRY_ACL_OTHER
146
+ Any principal who is not the file owner or a member of the owning group.
147
+ .El
148
+ .Pp
149
+ The principals
150
+ .Dv ARCHIVE_ENTRY_ACL_USER_OBJ ,
151
+ .Dv ARCHIVE_ENTRY_ACL_GROUP_OBJ
152
+ and
153
+ .Dv ARCHIVE_ENTRY_ACL_OTHER
154
+ are equivalent to user, group and other in the classic Unix permission
155
+ model and specify non-extended ACL entries.
156
+ .Pp
157
+ All files have an access ACL
158
+ .Pq Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS .
159
+ This specifies the permissions required for access to the file itself.
160
+ Directories have an additional ACL
161
+ .Pq Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT ,
162
+ which controls the initial access ACL for newly-created directory entries.
163
+ .Ss NFSv4 Access Control Lists
164
+ A NFSv4 ACL consists of multiple individual entries called Access Control
165
+ Entries (ACEs).
166
+ .Pp
167
+ There are four possible types of a NFSv4 ACE:
168
+ .Bl -hang -offset indent -compact -width "ARCHIVE_ENTRY_ACL_TYE_ALLOW"
169
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_ALLOW
170
+ Allow principal to perform actions requiring given permissions.
171
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_DENY
172
+ Prevent principal from performing actions requiring given permissions.
173
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_AUDIT
174
+ Log access attempts by principal which require given permissions.
175
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_ALARM
176
+ Trigger a system alarm on access attempts by principal which require given
177
+ permissions.
178
+ .El
179
+ .Pp
180
+ The
181
+ .Fa tag
182
+ specifies the principal to which the permission applies.
183
+ Valid values are:
184
+ .Bl -hang -offset indent -compact -width "ARCHIVE_ENTRY_ACL_GROUP_OBJ"
185
+ .It Dv ARCHIVE_ENTRY_ACL_USER
186
+ The user specified by the name field.
187
+ .It Dv ARCHIVE_ENTRY_ACL_USER_OBJ
188
+ The owner of the file.
189
+ .It Dv ARCHIVE_ENTRY_ACL_GROUP
190
+ The group specified by the name field.
191
+ .It Dv ARCHIVE_ENTRY_ACL_GROUP_OBJ
192
+ The group which owns the file.
193
+ .It Dv ARCHIVE_ENTRY_ACL_EVERYONE
194
+ Any principal who is not the file owner or a member of the owning group.
195
+ .El
196
+ .Pp
197
+ Entries with the
198
+ .Dv ARCHIVE_ENTRY_ACL_USER
199
+ or
200
+ .Dv ARCHIVE_ENTRY_ACL_GROUP
201
+ tag store the user and group name in the
202
+ .Fa name
203
+ string and optionally the user or group ID in the
204
+ .Fa qualifier
205
+ integer.
206
+ .Pp
207
+ NFSv4 ACE permissions and flags are stored in the same
208
+ .Fa permset
209
+ bitfield.
210
+ Some permissions share the same constant and permission character
211
+ but have different effect on directories than on files.
212
+ The following ACE permissions are supported:
213
+ .Bl -tag -offset indent -compact -width ARCHIV
214
+ .It Dv ARCHIVE_ENTRY_ACL_READ_DATA ( Sy r )
215
+ Read data (file).
216
+ .It Dv ARCHIVE_ENTRY_ACL_LIST_DIRECTORY ( Sy r )
217
+ List entries (directory).
218
+ .It ARCHIVE_ENTRY_ACL_WRITE_DATA ( Sy w )
219
+ Write data (file).
220
+ .It ARCHIVE_ENTRY_ACL_ADD_FILE ( Sy w )
221
+ Create files (directory).
222
+ .It Dv ARCHIVE_ENTRY_ACL_EXECUTE ( Sy x )
223
+ Execute file or change into a directory.
224
+ .It Dv ARCHIVE_ENTRY_ACL_APPEND_DATA ( Sy p )
225
+ Append data (file).
226
+ .It Dv ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY ( Sy p )
227
+ Create subdirectories (directory).
228
+ .It Dv ARCHIVE_ENTRY_ACL_DELETE_CHILD ( Sy D )
229
+ Remove files and subdirectories inside a directory.
230
+ .It Dv ARCHIVE_ENTRY_ACL_DELETE ( Sy d )
231
+ Remove file or directory.
232
+ .It Dv ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES ( Sy a )
233
+ Read file or directory attributes.
234
+ .It Dv ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES ( Sy A )
235
+ Write file or directory attributes.
236
+ .It Dv ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS ( Sy R )
237
+ Read named file or directory attributes.
238
+ .It Dv ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS ( Sy W )
239
+ Write named file or directory attributes.
240
+ .It Dv ARCHIVE_ENTRY_ACL_READ_ACL ( Sy c )
241
+ Read file or directory ACL.
242
+ .It Dv ARCHIVE_ENTRY_ACL_WRITE_ACL ( Sy C )
243
+ Write file or directory ACL.
244
+ .It Dv ARCHIVE_ENTRY_ACL_WRITE_OWNER ( Sy o )
245
+ Change owner of a file or directory.
246
+ .It Dv ARCHIVE_ENTRY_ACL_SYNCHRONIZE ( Sy s )
247
+ Use synchronous I/O.
248
+ .El
249
+ .Pp
250
+ The following NFSv4 ACL inheritance flags are supported:
251
+ .Bl -tag -offset indent -compact -width ARCHIV
252
+ .It Dv ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT ( Sy f )
253
+ Inherit parent directory ACE to files.
254
+ .It Dv ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT ( Sy d )
255
+ Inherit parent directory ACE to subdirectories.
256
+ .It Dv ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY ( Sy i )
257
+ Only inherit, do not apply the permission on the directory itself.
258
+ .It Dv ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT ( Sy n )
259
+ Do not propagate inherit flags.
260
+ Only first-level entries inherit ACLs.
261
+ .It Dv ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS ( Sy S )
262
+ Trigger alarm or audit on successful access.
263
+ .It Dv ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS ( Sy F )
264
+ Trigger alarm or audit on failed access.
265
+ .It Dv ARCHIVE_ENTRY_ACL_ENTRY_INHERITED ( Sy I )
266
+ Mark that ACE was inherited.
267
+ .El
268
+ .Ss Functions
269
+ .Fn archive_entry_acl_add_entry
270
+ and
271
+ .Fn archive_entry_acl_add_entry_w
272
+ add a single ACL entry.
273
+ For the access ACL and non-extended principals, the classic Unix permissions
274
+ are updated.
275
+ An archive entry cannot contain both POSIX.1e and NFSv4 ACL entries.
276
+ .Pp
277
+ .Fn archive_entry_acl_clear
278
+ removes all ACL entries and resets the enumeration pointer.
279
+ .Pp
280
+ .Fn archive_entry_acl_count
281
+ counts the ACL entries that have the given type mask.
282
+ .Fa type
283
+ can be the bitwise-or of
284
+ .Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_TYPE_DEFAULT"
285
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
286
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
287
+ .El
288
+ for POSIX.1e ACLs and
289
+ .Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_TYPE_ALLOW"
290
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_ALLOW
291
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_DENY
292
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_AUDIT
293
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_ALARM
294
+ .El
295
+ for NFSv4 ACLs.
296
+ For POSIX.1e ACLs if
297
+ .Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
298
+ is included and at least one extended ACL entry is found,
299
+ the three non-extended ACLs are added.
300
+ .Pp
301
+ .Fn archive_entry_acl_from_text
302
+ and
303
+ .Fn archive_entry_acl_from_text_w
304
+ add new
305
+ .Pq or merge with existing
306
+ ACL entries from
307
+ .Pq wide
308
+ text.
309
+ The argument
310
+ .Fa type
311
+ may take one of the following values:
312
+ .Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_TYPE_DEFAULT"
313
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
314
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
315
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_NFS4
316
+ .El
317
+ Supports all formats that can be created with
318
+ .Fn archive_entry_acl_to_text
319
+ or respectively
320
+ .Fn archive_entry_acl_to_text_w .
321
+ Existing ACL entries are preserved.
322
+ To get a clean new ACL from text
323
+ .Fn archive_entry_acl_clear
324
+ must be called first.
325
+ Entries prefixed with
326
+ .Dq default:
327
+ are treated as
328
+ .Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
329
+ unless
330
+ .Fa type
331
+ is
332
+ .Dv ARCHIVE_ENTRY_ACL_TYPE_NFS4 .
333
+ Invalid entries, non-parseable ACL entries and entries beginning with
334
+ the
335
+ .Sq #
336
+ character
337
+ .Pq comments
338
+ are skipped.
339
+ .Pp
340
+ .Fn archive_entry_acl_next
341
+ return the next entry of the ACL list.
342
+ This functions may only be called after
343
+ .Fn archive_entry_acl_reset
344
+ has indicated the presence of extended ACL entries.
345
+ .Pp
346
+ .Fn archive_entry_acl_reset
347
+ prepare reading the list of ACL entries with
348
+ .Fn archive_entry_acl_next .
349
+ The function returns 0 if no non-extended ACLs are found.
350
+ In this case, the access permissions should be obtained by
351
+ .Xr archive_entry_mode 3
352
+ or set using
353
+ .Xr chmod 2 .
354
+ Otherwise, the function returns the same value as
355
+ .Fn archive_entry_acl_count .
356
+ .Pp
357
+ .Fn archive_entry_acl_to_text
358
+ and
359
+ .Fn archive_entry_acl_to_text_w
360
+ convert the ACL entries for the given type into a
361
+ .Pq wide
362
+ string of ACL entries separated by newline.
363
+ If the pointer
364
+ .Fa len_p
365
+ is not NULL, then the function shall return the length of the string
366
+ .Pq not including the NULL terminator
367
+ in the location pointed to by
368
+ .Fa len_p .
369
+ The
370
+ .Fa flag
371
+ argument is a bitwise-or.
372
+ .Pp
373
+ The following flags are effective only on POSIX.1e ACL:
374
+ .Bl -tag -offset indent -compact -width ARCHIV
375
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
376
+ Output access ACLs.
377
+ .It Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
378
+ Output POSIX.1e default ACLs.
379
+ .It Dv ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT
380
+ Prefix each default ACL entry with the word
381
+ .Dq default: .
382
+ .It Dv ARCHIVE_ENTRY_ACL_STYLE_SOLARIS
383
+ The mask and other ACLs don not contain a double colon.
384
+ .El
385
+ .Pp
386
+ The following flags are effective only on NFSv4 ACL:
387
+ .Bl -tag -offset indent -compact -width ARCHIV
388
+ .It Dv ARCHIVE_ENTRY_ACL_STYLE_COMPACT
389
+ Do not output minus characters for unset permissions and flags in NFSv4 ACL
390
+ permission and flag fields.
391
+ .El
392
+ .Pp
393
+ The following flags are effective on both POSIX.1e and NFSv4 ACL:
394
+ .Bl -tag -offset indent -compact -width ARCHIV
395
+ .It Dv ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID
396
+ Add an additional colon-separated field containing the user or group id.
397
+ .It Dv ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA
398
+ Separate ACL entries with comma instead of newline.
399
+ .El
400
+ .Pp
401
+ If the archive entry contains NFSv4 ACLs, all types of NFSv4 ACLs are returned.
402
+ It the entry contains POSIX.1e ACLs and none of the flags
403
+ .Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
404
+ or
405
+ .Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
406
+ are specified, both access and default entries are returned and default entries
407
+ are prefixed with
408
+ .Dq default: .
409
+ .Pp
410
+ .Fn archive_entry_acl_types
411
+ get ACL entry types contained in an archive entry's ACL.
412
+ As POSIX.1e and NFSv4
413
+ ACL entries cannot be mixed, this function is a very efficient way to detect if
414
+ an ACL already contains POSIX.1e or NFSv4 ACL entries.
415
+ .Sh RETURN VALUES
416
+ .Fn archive_entry_acl_count
417
+ and
418
+ .Fn archive_entry_acl_reset
419
+ returns the number of ACL entries that match the given type mask.
420
+ For POSIX.1e ACLS if the type mask includes
421
+ .Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
422
+ and at least one extended ACL entry exists, the three classic Unix
423
+ permissions are counted.
424
+ .Pp
425
+ .Fn archive_entry_acl_from_text
426
+ and
427
+ .Fn archive_entry_acl_from_text_w
428
+ return
429
+ .Dv ARCHIVE_OK
430
+ if all entries were successfully parsed and
431
+ .Dv ARCHIVE_WARN
432
+ if one or more entries were invalid or non-parseable.
433
+ .Pp
434
+ .Fn archive_entry_acl_next
435
+ returns
436
+ .Dv ARCHIVE_OK
437
+ on success,
438
+ .Dv ARCHIVE_EOF
439
+ if no more ACL entries exist
440
+ and
441
+ .Dv ARCHIVE_WARN
442
+ if
443
+ .Fn archive_entry_acl_reset
444
+ has not been called first.
445
+ .Pp
446
+ .Fn archive_entry_acl_to_text
447
+ returns a string representing the ACL entries matching the given type and
448
+ flags on success or NULL on error.
449
+ .Pp
450
+ .Fn archive_entry_acl_to_text_w
451
+ returns a wide string representing the ACL entries matching the given type
452
+ and flags on success or NULL on error.
453
+ .Pp
454
+ .Fn archive_entry_acl_types
455
+ returns a bitmask of ACL entry types or 0 if archive entry has no ACL entries.
456
+ .Sh SEE ALSO
457
+ .Xr archive_entry 3 ,
458
+ .Xr libarchive 3
@@ -0,0 +1,55 @@
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
+ #include "archive_time_private.h"
28
+ #include "archive_private.h"
29
+ #include "archive_entry.h"
30
+
31
+ #if defined(_WIN32) && !defined(__CYGWIN__)
32
+
33
+ void
34
+ archive_entry_copy_bhfi(struct archive_entry *entry,
35
+ BY_HANDLE_FILE_INFORMATION *bhfi)
36
+ {
37
+ int64_t secs;
38
+ uint32_t nsecs;
39
+
40
+ ntfs_to_unix(FILETIME_to_ntfs(&bhfi->ftLastAccessTime), &secs, &nsecs);
41
+ archive_entry_set_atime(entry, secs, nsecs);
42
+ ntfs_to_unix(FILETIME_to_ntfs(&bhfi->ftLastWriteTime), &secs, &nsecs);
43
+ archive_entry_set_mtime(entry, secs, nsecs);
44
+ ntfs_to_unix(FILETIME_to_ntfs(&bhfi->ftCreationTime), &secs, &nsecs);
45
+ archive_entry_set_birthtime(entry, secs, nsecs);
46
+ archive_entry_set_ctime(entry, secs, nsecs);
47
+ archive_entry_set_dev(entry, bhfi->dwVolumeSerialNumber);
48
+ archive_entry_set_ino64(entry, (((int64_t)bhfi->nFileIndexHigh) << 32)
49
+ + bhfi->nFileIndexLow);
50
+ archive_entry_set_nlink(entry, bhfi->nNumberOfLinks);
51
+ archive_entry_set_size(entry, (((int64_t)bhfi->nFileSizeHigh) << 32)
52
+ + bhfi->nFileSizeLow);
53
+ /* archive_entry_set_mode(entry, st->st_mode); */
54
+ }
55
+ #endif
@@ -0,0 +1,82 @@
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_STAT_H
29
+ #include <sys/stat.h>
30
+ #endif
31
+
32
+ #include "archive.h"
33
+ #include "archive_entry.h"
34
+
35
+ void
36
+ archive_entry_copy_stat(struct archive_entry *entry, const struct stat *st)
37
+ {
38
+ #if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
39
+ archive_entry_set_atime(entry, st->st_atime, st->st_atimespec.tv_nsec);
40
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_ctimespec.tv_nsec);
41
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_mtimespec.tv_nsec);
42
+ #elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
43
+ archive_entry_set_atime(entry, st->st_atime, st->st_atim.tv_nsec);
44
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_ctim.tv_nsec);
45
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec);
46
+ #elif HAVE_STRUCT_STAT_ST_MTIME_NSEC
47
+ archive_entry_set_atime(entry, st->st_atime, st->st_atime_nsec);
48
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_nsec);
49
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_nsec);
50
+ #elif HAVE_STRUCT_STAT_ST_MTIME_N
51
+ archive_entry_set_atime(entry, st->st_atime, st->st_atime_n);
52
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_n);
53
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_n);
54
+ #elif HAVE_STRUCT_STAT_ST_UMTIME
55
+ archive_entry_set_atime(entry, st->st_atime, st->st_uatime * 1000);
56
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_uctime * 1000);
57
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_umtime * 1000);
58
+ #elif HAVE_STRUCT_STAT_ST_MTIME_USEC
59
+ archive_entry_set_atime(entry, st->st_atime, st->st_atime_usec * 1000);
60
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_usec * 1000);
61
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_usec * 1000);
62
+ #else
63
+ archive_entry_set_atime(entry, st->st_atime, 0);
64
+ archive_entry_set_ctime(entry, st->st_ctime, 0);
65
+ archive_entry_set_mtime(entry, st->st_mtime, 0);
66
+ #endif
67
+ #if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
68
+ archive_entry_set_birthtime(entry, st->st_birthtime, st->st_birthtimespec.tv_nsec);
69
+ #elif HAVE_STRUCT_STAT_ST_BIRTHTIME
70
+ archive_entry_set_birthtime(entry, st->st_birthtime, 0);
71
+ #else
72
+ archive_entry_unset_birthtime(entry);
73
+ #endif
74
+ archive_entry_set_dev(entry, st->st_dev);
75
+ archive_entry_set_gid(entry, st->st_gid);
76
+ archive_entry_set_uid(entry, st->st_uid);
77
+ archive_entry_set_ino(entry, st->st_ino);
78
+ archive_entry_set_nlink(entry, st->st_nlink);
79
+ archive_entry_set_rdev(entry, st->st_rdev);
80
+ archive_entry_set_size(entry, st->st_size);
81
+ archive_entry_set_mode(entry, st->st_mode);
82
+ }