archive_r_ruby 0.1.8 → 0.1.10
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.
- checksums.yaml +4 -4
- data/NOTICE +51 -6
- data/VERSION +1 -0
- data/ext/archive_r/archive_r_ext.cc +6 -8
- data/ext/archive_r/vendor/archive_r/NOTICE +51 -6
- data/ext/archive_r/vendor/archive_r/include/archive_r/data_stream.h +2 -2
- data/ext/archive_r/vendor/archive_r/include/archive_r/entry.h +8 -8
- data/ext/archive_r/vendor/archive_r/include/archive_r/multi_volume_stream_base.h +2 -2
- data/ext/archive_r/vendor/archive_r/include/archive_r/path_hierarchy_utils.h +0 -1
- data/ext/archive_r/vendor/archive_r/include/archive_r/platform_compat.h +8 -8
- data/ext/archive_r/vendor/archive_r/include/archive_r/traverser.h +2 -2
- data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.cc +10 -34
- data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.h +1 -3
- data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.cc +4 -5
- data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.h +1 -1
- data/ext/archive_r/vendor/archive_r/src/archive_type.cc +4 -13
- data/ext/archive_r/vendor/archive_r/src/archive_type.h +2 -2
- data/ext/archive_r/vendor/archive_r/src/entry.cc +2 -17
- data/ext/archive_r/vendor/archive_r/src/entry_fault_error.cc +23 -23
- data/ext/archive_r/vendor/archive_r/src/entry_impl.h +1 -2
- data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.cc +3 -8
- data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.h +2 -4
- data/ext/archive_r/vendor/archive_r/src/multi_volume_stream_base.cc +23 -14
- data/ext/archive_r/vendor/archive_r/src/path_hierarchy.cc +1 -4
- data/ext/archive_r/vendor/archive_r/src/path_hierarchy_utils.cc +14 -36
- data/ext/archive_r/vendor/archive_r/src/simple_profiler.h +64 -75
- data/ext/archive_r/vendor/archive_r/src/system_file_stream.cc +13 -26
- data/ext/archive_r/vendor/archive_r/src/system_file_stream.h +2 -2
- data/ext/archive_r/vendor/archive_r/src/traverser.cc +17 -41
- data/lib/archive_r.rb +5 -1
- metadata +7 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ba8f5cf2fe8e7cd48b68d39a195c5fb1b5763e7d1f27a2b607bb418ae990a3d9
|
|
4
|
+
data.tar.gz: 424e4bbfea38626098d19a52cd8448fe1d0d65e52f511d3ae00837e820f27cf2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a2a4c3782c566edc00f75f30fb48390d1f3d589bf218c008c612e9d0af7a7ae7a2f8f78736afb1dcacdcf2bc2c06dd86629b3f769e750150b8e8575fb0b5691
|
|
7
|
+
data.tar.gz: 042c4148f07ca084b290444f08d118e8c52dee941050a50d56b0f5f64d1ac3e607434c8c95131d97d0c42fbe5eace7994058e83396c8e4bd11c0c7c1f106bb0b
|
data/NOTICE
CHANGED
|
@@ -3,48 +3,67 @@ archive_r Notices
|
|
|
3
3
|
This file contains third-party notices and licensing information for bundled or
|
|
4
4
|
linked components. It does not replace the project license.
|
|
5
5
|
|
|
6
|
+
For full license texts, see the files under the LICENSES/ directory in this
|
|
7
|
+
repository. Python wheels include these texts under the *.dist-info/licenses/
|
|
8
|
+
directory.
|
|
9
|
+
|
|
6
10
|
----------------------------------------
|
|
7
11
|
Third-Party Notices
|
|
8
12
|
----------------------------------------
|
|
9
13
|
|
|
10
|
-
This distribution
|
|
11
|
-
components. Their respective license terms
|
|
12
|
-
License.
|
|
14
|
+
This distribution (notably the Python wheels) bundles and/or dynamically links
|
|
15
|
+
against the following third-party components. Their respective license terms
|
|
16
|
+
apply in addition to the MIT License.
|
|
13
17
|
|
|
14
18
|
1. libarchive
|
|
15
19
|
- Purpose: core archive reading and writing functionality for the C++
|
|
16
20
|
library and language bindings.
|
|
21
|
+
- Version (manylinux wheels): 3.7.5
|
|
17
22
|
- License: New BSD License (https://www.libarchive.org/)
|
|
23
|
+
- Full license text and notices: LICENSES/libarchive-COPYING
|
|
18
24
|
|
|
19
25
|
2. pybind11
|
|
20
26
|
- Purpose: header-only binding generator for the Python extension module.
|
|
21
27
|
- License: BSD-style License (https://github.com/pybind/pybind11)
|
|
28
|
+
- Notes: used at build time; not redistributed as a runtime library.
|
|
22
29
|
|
|
23
|
-
The following components are redistributed only because libarchive (bundled
|
|
30
|
+
The following components are redistributed only because libarchive (bundled in
|
|
31
|
+
some artifacts such as Python wheels) depends on them at runtime:
|
|
24
32
|
|
|
25
33
|
3. zlib
|
|
26
|
-
- Purpose: libarchive dependency providing DEFLATE compression
|
|
34
|
+
- Purpose: libarchive dependency providing DEFLATE compression.
|
|
27
35
|
- License: zlib License (https://zlib.net/zlib_license.html)
|
|
36
|
+
- Notes: typically provided by the platform runtime (not bundled in wheels).
|
|
28
37
|
|
|
29
38
|
4. bzip2
|
|
30
39
|
- Purpose: libarchive dependency providing bzip2 compression support; distributed with archive_r artifacts.
|
|
40
|
+
- Version (manylinux wheels): 1.0.8
|
|
31
41
|
- License: BSD-style license (https://sourceware.org/bzip2/)
|
|
42
|
+
- Full license text and notices: LICENSES/bzip2-LICENSE
|
|
32
43
|
|
|
33
44
|
5. liblzma (XZ Utils)
|
|
34
45
|
- Purpose: libarchive dependency providing LZMA/XZ compression; included with archive_r packages.
|
|
35
|
-
-
|
|
46
|
+
- Version (manylinux wheels): 5.6.2
|
|
47
|
+
- License: BSD Zero Clause License (0BSD) for liblzma (https://tukaani.org/xz/)
|
|
48
|
+
- Full license texts and notices: LICENSES/xz-COPYING, LICENSES/xz-COPYING.0BSD
|
|
36
49
|
|
|
37
50
|
6. libxml2
|
|
38
51
|
- Purpose: libarchive dependency used for archive formats such as xar; distributed alongside archive_r.
|
|
52
|
+
- Version (manylinux wheels): 2.13.4
|
|
39
53
|
- License: MIT-style License (http://xmlsoft.org/)
|
|
54
|
+
- Full license text and notices: LICENSES/libxml2-Copyright
|
|
40
55
|
|
|
41
56
|
7. zstd
|
|
42
57
|
- Purpose: libarchive dependency providing Zstandard compression; shipped within archive_r binaries.
|
|
58
|
+
- Version (manylinux wheels): 1.5.5
|
|
43
59
|
- License: BSD License (https://github.com/facebook/zstd)
|
|
60
|
+
- Full license text and notices: LICENSES/zstd-LICENSE
|
|
44
61
|
|
|
45
62
|
8. Nettle
|
|
46
63
|
- Purpose: libarchive dependency providing cryptographic support (macOS/Linux); bundled with archive_r binaries.
|
|
64
|
+
- Version (manylinux wheels): 3.9.1
|
|
47
65
|
- License: GNU LGPLv3+ or GNU GPLv2+ (https://www.lysator.liu.se/~nisse/nettle/)
|
|
66
|
+
- Full license texts and notices: LICENSES/nettle-COPYING.LESSERv3, LICENSES/nettle-COPYINGv2
|
|
48
67
|
|
|
49
68
|
9. mini-gmp
|
|
50
69
|
- Purpose: Nettle dependency for arithmetic operations (macOS/Linux); bundled with archive_r binaries.
|
|
@@ -56,16 +75,42 @@ The following components are redistributed only because libarchive (bundled with
|
|
|
56
75
|
|
|
57
76
|
11. lz4
|
|
58
77
|
- Purpose: libarchive dependency providing LZ4 compression; shipped with archive_r artifacts when required.
|
|
78
|
+
- Version (manylinux wheels): 1.10.0
|
|
59
79
|
- License: BSD 2-Clause (https://github.com/lz4/lz4)
|
|
80
|
+
- Full license text and notices: LICENSES/lz4-LICENSE
|
|
60
81
|
|
|
61
82
|
12. libb2 (BLAKE2)
|
|
62
83
|
- Purpose: libarchive dependency providing BLAKE2 hashing; bundled when archive formats require it.
|
|
84
|
+
- Version (manylinux wheels): 0.98.1
|
|
63
85
|
- License: CC0 1.0 Universal (https://github.com/BLAKE2/libb2)
|
|
86
|
+
- Full license text and notices: LICENSES/libb2-COPYING
|
|
64
87
|
|
|
65
88
|
13. libattr
|
|
66
89
|
- Purpose: libarchive dependency providing extended attribute support on POSIX platforms; included in POSIX builds only.
|
|
90
|
+
- Version (manylinux wheels): 2.5.2
|
|
67
91
|
- License: LGPL-2.1-or-later for the library (https://savannah.nongnu.org/projects/attr)
|
|
92
|
+
- Full license text and notices: LICENSES/attr-COPYING.LGPL
|
|
68
93
|
|
|
69
94
|
14. libacl
|
|
70
95
|
- Purpose: libarchive dependency providing POSIX ACL support; included in POSIX builds only.
|
|
96
|
+
- Version (manylinux wheels): 2.3.2
|
|
71
97
|
- License: LGPL-2.1-or-later for the library (https://savannah.nongnu.org/projects/acl)
|
|
98
|
+
- Full license text and notices: LICENSES/acl-COPYING.LGPL
|
|
99
|
+
|
|
100
|
+
15. LLVM OpenMP runtime (libomp)
|
|
101
|
+
- Purpose: runtime dependency that can be bundled into Linux wheels depending on toolchain and binary dependencies.
|
|
102
|
+
- License: Apache License 2.0 with LLVM Exceptions (https://llvm.org/)
|
|
103
|
+
- Full license text and notices: LICENSES/libomp-LICENSE.TXT
|
|
104
|
+
|
|
105
|
+
----------------------------------------
|
|
106
|
+
Source Availability
|
|
107
|
+
----------------------------------------
|
|
108
|
+
|
|
109
|
+
For the components redistributed in binary form, the corresponding source code
|
|
110
|
+
can be obtained from the upstream project release pages listed above.
|
|
111
|
+
|
|
112
|
+
For the manylinux wheel build, exact dependency versions are recorded in:
|
|
113
|
+
- bindings/python/tools/build-deps-manylinux.sh
|
|
114
|
+
|
|
115
|
+
Full license texts copied from upstream release archives are stored under:
|
|
116
|
+
- LICENSES/
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.10
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
#ifdef memcpy
|
|
16
16
|
#undef memcpy
|
|
17
17
|
#endif
|
|
18
|
+
#include <limits>
|
|
19
|
+
#include <optional>
|
|
18
20
|
#include <stdexcept>
|
|
19
21
|
#include <string>
|
|
20
22
|
#include <utility>
|
|
21
23
|
#include <variant>
|
|
22
24
|
#include <vector>
|
|
23
|
-
#include <limits>
|
|
24
|
-
#include <optional>
|
|
25
25
|
|
|
26
26
|
using namespace archive_r;
|
|
27
27
|
|
|
@@ -295,16 +295,14 @@ static void stream_wrapper_free(void *ptr) {
|
|
|
295
295
|
delete wrapper;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
static size_t stream_wrapper_memsize(const void *ptr) {
|
|
299
|
-
return sizeof(RubyStreamWrapper);
|
|
300
|
-
}
|
|
298
|
+
static size_t stream_wrapper_memsize(const void *ptr) { return sizeof(RubyStreamWrapper); }
|
|
301
299
|
|
|
302
300
|
static const rb_data_type_t stream_wrapper_type = {
|
|
303
301
|
"ArchiveR::Stream",
|
|
304
302
|
{
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
303
|
+
nullptr,
|
|
304
|
+
stream_wrapper_free,
|
|
305
|
+
stream_wrapper_memsize,
|
|
308
306
|
},
|
|
309
307
|
nullptr,
|
|
310
308
|
nullptr,
|
|
@@ -3,48 +3,67 @@ archive_r Notices
|
|
|
3
3
|
This file contains third-party notices and licensing information for bundled or
|
|
4
4
|
linked components. It does not replace the project license.
|
|
5
5
|
|
|
6
|
+
For full license texts, see the files under the LICENSES/ directory in this
|
|
7
|
+
repository. Python wheels include these texts under the *.dist-info/licenses/
|
|
8
|
+
directory.
|
|
9
|
+
|
|
6
10
|
----------------------------------------
|
|
7
11
|
Third-Party Notices
|
|
8
12
|
----------------------------------------
|
|
9
13
|
|
|
10
|
-
This distribution
|
|
11
|
-
components. Their respective license terms
|
|
12
|
-
License.
|
|
14
|
+
This distribution (notably the Python wheels) bundles and/or dynamically links
|
|
15
|
+
against the following third-party components. Their respective license terms
|
|
16
|
+
apply in addition to the MIT License.
|
|
13
17
|
|
|
14
18
|
1. libarchive
|
|
15
19
|
- Purpose: core archive reading and writing functionality for the C++
|
|
16
20
|
library and language bindings.
|
|
21
|
+
- Version (manylinux wheels): 3.7.5
|
|
17
22
|
- License: New BSD License (https://www.libarchive.org/)
|
|
23
|
+
- Full license text and notices: LICENSES/libarchive-COPYING
|
|
18
24
|
|
|
19
25
|
2. pybind11
|
|
20
26
|
- Purpose: header-only binding generator for the Python extension module.
|
|
21
27
|
- License: BSD-style License (https://github.com/pybind/pybind11)
|
|
28
|
+
- Notes: used at build time; not redistributed as a runtime library.
|
|
22
29
|
|
|
23
|
-
The following components are redistributed only because libarchive (bundled
|
|
30
|
+
The following components are redistributed only because libarchive (bundled in
|
|
31
|
+
some artifacts such as Python wheels) depends on them at runtime:
|
|
24
32
|
|
|
25
33
|
3. zlib
|
|
26
|
-
- Purpose: libarchive dependency providing DEFLATE compression
|
|
34
|
+
- Purpose: libarchive dependency providing DEFLATE compression.
|
|
27
35
|
- License: zlib License (https://zlib.net/zlib_license.html)
|
|
36
|
+
- Notes: typically provided by the platform runtime (not bundled in wheels).
|
|
28
37
|
|
|
29
38
|
4. bzip2
|
|
30
39
|
- Purpose: libarchive dependency providing bzip2 compression support; distributed with archive_r artifacts.
|
|
40
|
+
- Version (manylinux wheels): 1.0.8
|
|
31
41
|
- License: BSD-style license (https://sourceware.org/bzip2/)
|
|
42
|
+
- Full license text and notices: LICENSES/bzip2-LICENSE
|
|
32
43
|
|
|
33
44
|
5. liblzma (XZ Utils)
|
|
34
45
|
- Purpose: libarchive dependency providing LZMA/XZ compression; included with archive_r packages.
|
|
35
|
-
-
|
|
46
|
+
- Version (manylinux wheels): 5.6.2
|
|
47
|
+
- License: BSD Zero Clause License (0BSD) for liblzma (https://tukaani.org/xz/)
|
|
48
|
+
- Full license texts and notices: LICENSES/xz-COPYING, LICENSES/xz-COPYING.0BSD
|
|
36
49
|
|
|
37
50
|
6. libxml2
|
|
38
51
|
- Purpose: libarchive dependency used for archive formats such as xar; distributed alongside archive_r.
|
|
52
|
+
- Version (manylinux wheels): 2.13.4
|
|
39
53
|
- License: MIT-style License (http://xmlsoft.org/)
|
|
54
|
+
- Full license text and notices: LICENSES/libxml2-Copyright
|
|
40
55
|
|
|
41
56
|
7. zstd
|
|
42
57
|
- Purpose: libarchive dependency providing Zstandard compression; shipped within archive_r binaries.
|
|
58
|
+
- Version (manylinux wheels): 1.5.5
|
|
43
59
|
- License: BSD License (https://github.com/facebook/zstd)
|
|
60
|
+
- Full license text and notices: LICENSES/zstd-LICENSE
|
|
44
61
|
|
|
45
62
|
8. Nettle
|
|
46
63
|
- Purpose: libarchive dependency providing cryptographic support (macOS/Linux); bundled with archive_r binaries.
|
|
64
|
+
- Version (manylinux wheels): 3.9.1
|
|
47
65
|
- License: GNU LGPLv3+ or GNU GPLv2+ (https://www.lysator.liu.se/~nisse/nettle/)
|
|
66
|
+
- Full license texts and notices: LICENSES/nettle-COPYING.LESSERv3, LICENSES/nettle-COPYINGv2
|
|
48
67
|
|
|
49
68
|
9. mini-gmp
|
|
50
69
|
- Purpose: Nettle dependency for arithmetic operations (macOS/Linux); bundled with archive_r binaries.
|
|
@@ -56,16 +75,42 @@ The following components are redistributed only because libarchive (bundled with
|
|
|
56
75
|
|
|
57
76
|
11. lz4
|
|
58
77
|
- Purpose: libarchive dependency providing LZ4 compression; shipped with archive_r artifacts when required.
|
|
78
|
+
- Version (manylinux wheels): 1.10.0
|
|
59
79
|
- License: BSD 2-Clause (https://github.com/lz4/lz4)
|
|
80
|
+
- Full license text and notices: LICENSES/lz4-LICENSE
|
|
60
81
|
|
|
61
82
|
12. libb2 (BLAKE2)
|
|
62
83
|
- Purpose: libarchive dependency providing BLAKE2 hashing; bundled when archive formats require it.
|
|
84
|
+
- Version (manylinux wheels): 0.98.1
|
|
63
85
|
- License: CC0 1.0 Universal (https://github.com/BLAKE2/libb2)
|
|
86
|
+
- Full license text and notices: LICENSES/libb2-COPYING
|
|
64
87
|
|
|
65
88
|
13. libattr
|
|
66
89
|
- Purpose: libarchive dependency providing extended attribute support on POSIX platforms; included in POSIX builds only.
|
|
90
|
+
- Version (manylinux wheels): 2.5.2
|
|
67
91
|
- License: LGPL-2.1-or-later for the library (https://savannah.nongnu.org/projects/attr)
|
|
92
|
+
- Full license text and notices: LICENSES/attr-COPYING.LGPL
|
|
68
93
|
|
|
69
94
|
14. libacl
|
|
70
95
|
- Purpose: libarchive dependency providing POSIX ACL support; included in POSIX builds only.
|
|
96
|
+
- Version (manylinux wheels): 2.3.2
|
|
71
97
|
- License: LGPL-2.1-or-later for the library (https://savannah.nongnu.org/projects/acl)
|
|
98
|
+
- Full license text and notices: LICENSES/acl-COPYING.LGPL
|
|
99
|
+
|
|
100
|
+
15. LLVM OpenMP runtime (libomp)
|
|
101
|
+
- Purpose: runtime dependency that can be bundled into Linux wheels depending on toolchain and binary dependencies.
|
|
102
|
+
- License: Apache License 2.0 with LLVM Exceptions (https://llvm.org/)
|
|
103
|
+
- Full license text and notices: LICENSES/libomp-LICENSE.TXT
|
|
104
|
+
|
|
105
|
+
----------------------------------------
|
|
106
|
+
Source Availability
|
|
107
|
+
----------------------------------------
|
|
108
|
+
|
|
109
|
+
For the components redistributed in binary form, the corresponding source code
|
|
110
|
+
can be obtained from the upstream project release pages listed above.
|
|
111
|
+
|
|
112
|
+
For the manylinux wheel build, exact dependency versions are recorded in:
|
|
113
|
+
- bindings/python/tools/build-deps-manylinux.sh
|
|
114
|
+
|
|
115
|
+
Full license texts copied from upstream release archives are stored under:
|
|
116
|
+
- LICENSES/
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
#pragma once
|
|
5
5
|
|
|
6
|
-
#include "archive_r/platform_compat.h"
|
|
7
6
|
#include "archive_r/path_hierarchy.h"
|
|
7
|
+
#include "archive_r/platform_compat.h"
|
|
8
8
|
|
|
9
|
+
#include <cstdint>
|
|
9
10
|
#include <functional>
|
|
10
11
|
#include <memory>
|
|
11
|
-
#include <cstdint>
|
|
12
12
|
|
|
13
13
|
namespace archive_r {
|
|
14
14
|
|
|
@@ -97,8 +97,8 @@ public:
|
|
|
97
97
|
/**
|
|
98
98
|
* @brief Read data from the entry
|
|
99
99
|
*
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
* Each call uses an internal ArchiveStackOrchestrator so reads remain valid even
|
|
101
|
+
* if the owning iterator advances.
|
|
102
102
|
*
|
|
103
103
|
* @param buffer Buffer to read data into
|
|
104
104
|
* @param length Maximum number of bytes to read
|
|
@@ -109,9 +109,9 @@ public:
|
|
|
109
109
|
/**
|
|
110
110
|
* @brief Enable or disable automatic descent into this entry
|
|
111
111
|
* @param enabled true to descend (default), false to keep traversal at current level
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
*
|
|
113
|
+
* This control is only available for entries that are managed by a Traverser.
|
|
114
|
+
* Calling this on an Entry that is not traverser-managed reports a fault.
|
|
115
115
|
*/
|
|
116
116
|
void set_descent(bool enabled);
|
|
117
117
|
|
|
@@ -139,9 +139,9 @@ public:
|
|
|
139
139
|
* }
|
|
140
140
|
* }
|
|
141
141
|
* @endcode
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
*
|
|
143
|
+
* This control is only available for entries that are managed by a Traverser.
|
|
144
|
+
* Calling this on an Entry that is not traverser-managed reports a fault.
|
|
145
145
|
*/
|
|
146
146
|
void set_multi_volume_group(const std::string &base_name, const MultiVolumeGroupOptions &options = {});
|
|
147
147
|
|
|
@@ -30,8 +30,8 @@ protected:
|
|
|
30
30
|
virtual void open_single_part(const PathHierarchy &single_part) = 0;
|
|
31
31
|
virtual void close_single_part() = 0;
|
|
32
32
|
virtual ssize_t read_from_single_part(void *buffer, size_t size) = 0;
|
|
33
|
-
virtual int64_t seek_within_single_part(int64_t offset, int whence)
|
|
34
|
-
virtual int64_t size_of_single_part(const PathHierarchy &single_part)
|
|
33
|
+
virtual int64_t seek_within_single_part(int64_t offset, int whence);
|
|
34
|
+
virtual int64_t size_of_single_part(const PathHierarchy &single_part);
|
|
35
35
|
|
|
36
36
|
PathHierarchy _logical_path;
|
|
37
37
|
void deactivate_active_part();
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
#include <sys/types.h>
|
|
7
7
|
|
|
8
8
|
#if defined(_WIN32)
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
9
|
+
#include <BaseTsd.h>
|
|
10
|
+
#include <sys/stat.h>
|
|
11
|
+
#if !defined(_SSIZE_T_DEFINED)
|
|
12
12
|
using ssize_t = SSIZE_T;
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
13
|
+
#define _SSIZE_T_DEFINED
|
|
14
|
+
#endif
|
|
15
|
+
#if !defined(_MODE_T_DEFINED)
|
|
16
16
|
using mode_t = unsigned short; // MSVC does not expose POSIX mode_t by default
|
|
17
|
-
#
|
|
18
|
-
#
|
|
17
|
+
#define _MODE_T_DEFINED
|
|
18
|
+
#endif
|
|
19
19
|
#endif
|
|
20
20
|
|
|
21
21
|
namespace archive_r {
|
|
@@ -75,8 +75,8 @@ public:
|
|
|
75
75
|
* Provide one or more paths to traverse. Single-path traversal can be
|
|
76
76
|
* achieved by passing a container with one element:
|
|
77
77
|
* Traverser traverser({make_single_path("archive.tar.gz")});
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
*
|
|
79
|
+
* @throws std::invalid_argument if paths is empty or contains an empty hierarchy
|
|
80
80
|
*/
|
|
81
81
|
explicit Traverser(std::vector<PathHierarchy> paths, TraverserOptions options = {});
|
|
82
82
|
|
|
@@ -125,9 +125,7 @@ EntryPayloadStream::EntryPayloadStream(std::shared_ptr<StreamArchive> parent_arc
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
EntryPayloadStream::~EntryPayloadStream() {
|
|
129
|
-
deactivate_active_part();
|
|
130
|
-
}
|
|
128
|
+
EntryPayloadStream::~EntryPayloadStream() { deactivate_active_part(); }
|
|
131
129
|
|
|
132
130
|
std::shared_ptr<StreamArchive> EntryPayloadStream::parent_archive() const { return _parent_archive; }
|
|
133
131
|
|
|
@@ -154,19 +152,7 @@ void EntryPayloadStream::close_single_part() {
|
|
|
154
152
|
// so explicit skipping here is unnecessary and avoids potential exceptions in destructor.
|
|
155
153
|
}
|
|
156
154
|
|
|
157
|
-
ssize_t EntryPayloadStream::read_from_single_part(void *buffer, size_t size) {
|
|
158
|
-
if (size == 0) {
|
|
159
|
-
return 0;
|
|
160
|
-
}
|
|
161
|
-
return _parent_archive->read_current(buffer, size);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
int64_t EntryPayloadStream::seek_within_single_part(int64_t offset, int whence) { return -1; }
|
|
165
|
-
|
|
166
|
-
int64_t EntryPayloadStream::size_of_single_part(const PathHierarchy &single_part) {
|
|
167
|
-
(void)single_part;
|
|
168
|
-
return -1;
|
|
169
|
-
}
|
|
155
|
+
ssize_t EntryPayloadStream::read_from_single_part(void *buffer, size_t size) { return _parent_archive->read_current(buffer, size); }
|
|
170
156
|
|
|
171
157
|
// ============================================================================
|
|
172
158
|
// ArchiveStackCursor Implementation
|
|
@@ -177,9 +163,7 @@ ArchiveStackCursor::ArchiveStackCursor()
|
|
|
177
163
|
, _current_stream(nullptr)
|
|
178
164
|
, _current_archive(nullptr) {}
|
|
179
165
|
|
|
180
|
-
void ArchiveStackCursor::configure(const ArchiveOption &options) {
|
|
181
|
-
options_snapshot = options;
|
|
182
|
-
}
|
|
166
|
+
void ArchiveStackCursor::configure(const ArchiveOption &options) { options_snapshot = options; }
|
|
183
167
|
|
|
184
168
|
void ArchiveStackCursor::reset() {
|
|
185
169
|
options_snapshot = ArchiveOption{};
|
|
@@ -207,17 +191,12 @@ bool ArchiveStackCursor::descend() {
|
|
|
207
191
|
}
|
|
208
192
|
|
|
209
193
|
bool ArchiveStackCursor::ascend() {
|
|
210
|
-
if (
|
|
194
|
+
if (!_current_archive) {
|
|
211
195
|
return false;
|
|
212
196
|
}
|
|
213
197
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
_current_archive = _current_archive->parent_archive();
|
|
217
|
-
} else {
|
|
218
|
-
_current_stream = nullptr;
|
|
219
|
-
}
|
|
220
|
-
|
|
198
|
+
_current_stream = _current_archive->get_stream();
|
|
199
|
+
_current_archive = _current_archive->parent_archive();
|
|
221
200
|
return true;
|
|
222
201
|
}
|
|
223
202
|
|
|
@@ -250,8 +229,7 @@ bool ArchiveStackCursor::synchronize_to_hierarchy(const PathHierarchy &target_hi
|
|
|
250
229
|
// 1. Ascend until we find a common ancestor
|
|
251
230
|
while (depth() > 0) {
|
|
252
231
|
auto current_h = _current_archive->source_hierarchy();
|
|
253
|
-
if (current_h.size() <= target_hierarchy.size() &&
|
|
254
|
-
hierarchies_equal(current_h, pathhierarchy_prefix_until(target_hierarchy, current_h.size() - 1))) {
|
|
232
|
+
if (current_h.size() <= target_hierarchy.size() && hierarchies_equal(current_h, pathhierarchy_prefix_until(target_hierarchy, current_h.size() - 1))) {
|
|
255
233
|
break;
|
|
256
234
|
}
|
|
257
235
|
ascend();
|
|
@@ -289,12 +267,10 @@ ssize_t ArchiveStackCursor::read(void *buff, size_t len) {
|
|
|
289
267
|
return 0;
|
|
290
268
|
}
|
|
291
269
|
|
|
292
|
-
StreamArchive *ArchiveStackCursor::current_archive() {
|
|
293
|
-
return _current_archive.get();
|
|
294
|
-
}
|
|
270
|
+
StreamArchive *ArchiveStackCursor::current_archive() { return _current_archive.get(); }
|
|
295
271
|
|
|
296
272
|
PathHierarchy ArchiveStackCursor::current_entry_hierarchy() {
|
|
297
|
-
if (
|
|
273
|
+
if (!_current_stream && !_current_archive) {
|
|
298
274
|
return {};
|
|
299
275
|
}
|
|
300
276
|
|
|
@@ -306,7 +282,7 @@ PathHierarchy ArchiveStackCursor::current_entry_hierarchy() {
|
|
|
306
282
|
return path;
|
|
307
283
|
}
|
|
308
284
|
|
|
309
|
-
return _current_stream->source_hierarchy();
|
|
285
|
+
return _current_stream ? _current_stream->source_hierarchy() : PathHierarchy{};
|
|
310
286
|
}
|
|
311
287
|
|
|
312
288
|
std::shared_ptr<IDataStream> ArchiveStackCursor::create_stream(const PathHierarchy &hierarchy) {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
#pragma once
|
|
5
5
|
|
|
6
6
|
#include "archive_r/data_stream.h"
|
|
7
|
+
#include "archive_r/multi_volume_stream_base.h"
|
|
7
8
|
#include "archive_r/path_hierarchy.h"
|
|
8
9
|
#include "archive_type.h"
|
|
9
10
|
#include "entry_fault_error.h"
|
|
10
|
-
#include "archive_r/multi_volume_stream_base.h"
|
|
11
11
|
#include <array>
|
|
12
12
|
#include <cstddef>
|
|
13
13
|
#include <exception>
|
|
@@ -64,8 +64,6 @@ private:
|
|
|
64
64
|
void open_single_part(const PathHierarchy &single_part) override;
|
|
65
65
|
void close_single_part() override;
|
|
66
66
|
ssize_t read_from_single_part(void *buffer, size_t size) override;
|
|
67
|
-
int64_t seek_within_single_part(int64_t offset, int whence) override;
|
|
68
|
-
int64_t size_of_single_part(const PathHierarchy &single_part) override;
|
|
69
67
|
};
|
|
70
68
|
|
|
71
69
|
// ============================================================================
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright (c) 2025 archive_r Team
|
|
3
3
|
|
|
4
4
|
#include "archive_stack_orchestrator.h"
|
|
5
|
-
#include "archive_r/path_hierarchy_utils.h"
|
|
6
5
|
#include "archive_r/entry_fault.h"
|
|
6
|
+
#include "archive_r/path_hierarchy_utils.h"
|
|
7
7
|
#include "system_file_stream.h"
|
|
8
8
|
|
|
9
9
|
#include <algorithm>
|
|
@@ -19,8 +19,7 @@
|
|
|
19
19
|
namespace archive_r {
|
|
20
20
|
|
|
21
21
|
ArchiveStackOrchestrator::ArchiveStackOrchestrator(const ArchiveOption &options)
|
|
22
|
-
: _archive_options(options)
|
|
23
|
-
{
|
|
22
|
+
: _archive_options(options) {
|
|
24
23
|
_head.configure(_archive_options);
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -135,12 +134,12 @@ void ArchiveStackOrchestrator::mark_entry_as_multi_volume(const PathHierarchy &e
|
|
|
135
134
|
}
|
|
136
135
|
|
|
137
136
|
bool ArchiveStackOrchestrator::descend_pending_multi_volumes() {
|
|
138
|
-
const PathHierarchy current_hierarchy = _head.current_entry_hierarchy();
|
|
137
|
+
const PathHierarchy current_hierarchy = (depth() == 0) ? PathHierarchy{} : _head.current_entry_hierarchy();
|
|
139
138
|
PathHierarchy multi_volume_target;
|
|
140
139
|
if (!_multi_volume_manager.pop_multi_volume_group(current_hierarchy, multi_volume_target)) {
|
|
141
140
|
return false;
|
|
142
141
|
}
|
|
143
|
-
|
|
142
|
+
|
|
144
143
|
_head.synchronize_to_hierarchy(multi_volume_target);
|
|
145
144
|
_head.descend();
|
|
146
145
|
return true;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
#include "archive_r/path_hierarchy.h"
|
|
7
7
|
#include "archive_r/platform_compat.h"
|
|
8
|
-
#include "archive_type.h"
|
|
9
8
|
#include "archive_stack_cursor.h"
|
|
9
|
+
#include "archive_type.h"
|
|
10
10
|
#include "entry_fault_error.h"
|
|
11
11
|
#include "multi_volume_manager.h"
|
|
12
12
|
#include <limits>
|
|
@@ -232,9 +232,7 @@ bool Archive::search_forward_until_eof(const std::string &entryname) {
|
|
|
232
232
|
if (current_entryname == entryname) {
|
|
233
233
|
return true;
|
|
234
234
|
}
|
|
235
|
-
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
235
|
+
skip_data();
|
|
238
236
|
}
|
|
239
237
|
return false;
|
|
240
238
|
}
|
|
@@ -247,9 +245,7 @@ bool Archive::search_until_position(const std::string &entryname, const std::str
|
|
|
247
245
|
if (current_entryname == stop_position) {
|
|
248
246
|
break;
|
|
249
247
|
}
|
|
250
|
-
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
248
|
+
skip_data();
|
|
253
249
|
}
|
|
254
250
|
return false;
|
|
255
251
|
}
|
|
@@ -453,14 +449,9 @@ EntryMetadataMap Archive::current_entry_metadata(const std::unordered_set<std::s
|
|
|
453
449
|
}
|
|
454
450
|
}
|
|
455
451
|
|
|
456
|
-
|
|
457
|
-
char *acl_text = wants("acl_text") ? archive_entry_acl_to_text(current_entry, &acl_length, ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA) : nullptr;
|
|
452
|
+
char *acl_text = wants("acl_text") ? archive_entry_acl_to_text(current_entry, nullptr, ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA) : nullptr;
|
|
458
453
|
if (acl_text) {
|
|
459
|
-
|
|
460
|
-
metadata["acl_text"] = std::string(acl_text, static_cast<size_t>(acl_length));
|
|
461
|
-
} else {
|
|
462
|
-
metadata["acl_text"] = std::string(acl_text);
|
|
463
|
-
}
|
|
454
|
+
metadata["acl_text"] = std::string(acl_text);
|
|
464
455
|
std::free(acl_text);
|
|
465
456
|
}
|
|
466
457
|
|
|
@@ -26,8 +26,8 @@ using archive_ptr = std::unique_ptr<struct archive, archive_deleter>;
|
|
|
26
26
|
using open_delegate = std::function<int(struct archive *ar)>;
|
|
27
27
|
|
|
28
28
|
struct ArchiveOption {
|
|
29
|
-
std::vector<std::string> passphrases;
|
|
30
|
-
std::vector<std::string> formats;
|
|
29
|
+
std::vector<std::string> passphrases; ///< Passphrases for encrypted archives
|
|
30
|
+
std::vector<std::string> formats; ///< Specific format names to enable (empty = all)
|
|
31
31
|
std::unordered_set<std::string> metadata_keys; ///< Metadata keys to capture (empty = none)
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -32,24 +32,9 @@ Entry::Impl::Impl(const Impl &other)
|
|
|
32
32
|
, _descend_enabled(other._descend_enabled)
|
|
33
33
|
, _orchestrator(nullptr)
|
|
34
34
|
, _shares_traverser_orchestrator(false)
|
|
35
|
-
, _archive_options(other._archive_options) {
|
|
36
|
-
}
|
|
35
|
+
, _archive_options(other._archive_options) {}
|
|
37
36
|
|
|
38
37
|
// Copy assignment operator
|
|
39
|
-
Entry::Impl &Entry::Impl::operator=(const Impl &other) {
|
|
40
|
-
if (this != &other) {
|
|
41
|
-
_path_hierarchy = other._path_hierarchy;
|
|
42
|
-
_size = other._size;
|
|
43
|
-
_filetype = other._filetype;
|
|
44
|
-
_metadata = other._metadata;
|
|
45
|
-
_descend_enabled = other._descend_enabled;
|
|
46
|
-
_orchestrator.reset();
|
|
47
|
-
_shares_traverser_orchestrator = false;
|
|
48
|
-
_archive_options = other._archive_options;
|
|
49
|
-
}
|
|
50
|
-
return *this;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
38
|
Entry::Impl::Impl(const PathHierarchy &hierarchy, std::shared_ptr<ArchiveStackOrchestrator> data_source_orchestrator, bool default_descent)
|
|
54
39
|
: _path_hierarchy(hierarchy)
|
|
55
40
|
, _size(0)
|
|
@@ -199,7 +184,7 @@ ssize_t Entry::Impl::read(void *buffer, size_t length) {
|
|
|
199
184
|
// ============================================================================
|
|
200
185
|
|
|
201
186
|
Entry::Entry(const PathHierarchy &hierarchy, std::shared_ptr<ArchiveStackOrchestrator> data_source_orchestrator, bool default_descent)
|
|
202
|
-
|
|
187
|
+
: _impl(std::make_unique<Impl>(hierarchy, std::move(data_source_orchestrator), default_descent)) {}
|
|
203
188
|
|
|
204
189
|
Entry::Entry(Impl *impl)
|
|
205
190
|
: _impl(impl) {}
|