archive_r_ruby 0.1.3 → 0.1.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.
- checksums.yaml +4 -4
- data/{LICENSE → LICENSE.txt} +77 -77
- data/README.md +103 -103
- data/ext/archive_r/Makefile +48 -45
- data/ext/archive_r/archive_r-x64-mingw-ucrt.def +2 -0
- data/ext/archive_r/archive_r_ext.cc +1106 -1106
- data/ext/archive_r/archive_r_ext.o +0 -0
- data/ext/archive_r/extconf.rb +120 -120
- data/ext/archive_r/mkmf.log +23 -18
- data/ext/archive_r/vendor/archive_r/LICENSE.txt +77 -77
- data/ext/archive_r/vendor/archive_r/include/archive_r/data_stream.h +52 -52
- data/ext/archive_r/vendor/archive_r/include/archive_r/entry.h +166 -166
- data/ext/archive_r/vendor/archive_r/include/archive_r/entry_fault.h +34 -34
- data/ext/archive_r/vendor/archive_r/include/archive_r/entry_metadata.h +56 -56
- data/ext/archive_r/vendor/archive_r/include/archive_r/multi_volume_stream_base.h +46 -46
- data/ext/archive_r/vendor/archive_r/include/archive_r/path_hierarchy.h +109 -109
- data/ext/archive_r/vendor/archive_r/include/archive_r/path_hierarchy_utils.h +37 -37
- data/ext/archive_r/vendor/archive_r/include/archive_r/platform_compat.h +19 -19
- data/ext/archive_r/vendor/archive_r/include/archive_r/traverser.h +122 -122
- data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.cc +330 -330
- data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.h +97 -97
- data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.cc +162 -162
- data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.h +54 -54
- data/ext/archive_r/vendor/archive_r/src/archive_type.cc +552 -552
- data/ext/archive_r/vendor/archive_r/src/archive_type.h +77 -77
- data/ext/archive_r/vendor/archive_r/src/data_stream.cc +35 -35
- data/ext/archive_r/vendor/archive_r/src/entry.cc +253 -253
- data/ext/archive_r/vendor/archive_r/src/entry_fault.cc +26 -26
- data/ext/archive_r/vendor/archive_r/src/entry_fault_error.cc +54 -54
- data/ext/archive_r/vendor/archive_r/src/entry_fault_error.h +32 -32
- data/ext/archive_r/vendor/archive_r/src/entry_impl.h +57 -57
- data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.cc +81 -81
- data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.h +41 -41
- data/ext/archive_r/vendor/archive_r/src/multi_volume_stream_base.cc +199 -199
- data/ext/archive_r/vendor/archive_r/src/path_hierarchy.cc +151 -151
- data/ext/archive_r/vendor/archive_r/src/path_hierarchy_utils.cc +304 -304
- data/ext/archive_r/vendor/archive_r/src/simple_profiler.h +120 -120
- data/ext/archive_r/vendor/archive_r/src/system_file_stream.cc +295 -295
- data/ext/archive_r/vendor/archive_r/src/system_file_stream.h +46 -46
- data/ext/archive_r/vendor/archive_r/src/traverser.cc +314 -314
- data/lib/archive_r.rb +105 -105
- metadata +11 -8
- data/ext/archive_r/archive_r.bundle +0 -0
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
// Copyright (c) 2025 archive_r Team
|
|
3
|
-
|
|
4
|
-
#pragma once
|
|
5
|
-
|
|
6
|
-
#include "archive_r/entry_metadata.h"
|
|
7
|
-
#include "entry_fault_error.h"
|
|
8
|
-
#include <archive.h>
|
|
9
|
-
#include <archive_entry.h>
|
|
10
|
-
#include <functional>
|
|
11
|
-
#include <memory>
|
|
12
|
-
#include <stdexcept>
|
|
13
|
-
#include <string>
|
|
14
|
-
#include <unordered_set>
|
|
15
|
-
#include <vector>
|
|
16
|
-
|
|
17
|
-
#include "archive_r/platform_compat.h"
|
|
18
|
-
|
|
19
|
-
namespace archive_r {
|
|
20
|
-
|
|
21
|
-
struct archive_deleter {
|
|
22
|
-
void operator()(struct archive *a) const;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
using archive_ptr = std::unique_ptr<struct archive, archive_deleter>;
|
|
26
|
-
using open_delegate = std::function<int(struct archive *ar)>;
|
|
27
|
-
|
|
28
|
-
struct ArchiveOption {
|
|
29
|
-
std::vector<std::string> passphrases; ///< Passphrases for encrypted archives
|
|
30
|
-
std::vector<std::string> formats; ///< Specific format names to enable (empty = all)
|
|
31
|
-
std::vector<std::string> metadata_keys; ///< Metadata keys to capture (empty = none)
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
archive_ptr new_read_archive_common(const std::vector<std::string> &passphrases, const std::vector<std::string> &format_names, open_delegate archive_open);
|
|
35
|
-
|
|
36
|
-
struct Archive {
|
|
37
|
-
Archive();
|
|
38
|
-
virtual ~Archive();
|
|
39
|
-
|
|
40
|
-
Archive(const Archive &) = delete;
|
|
41
|
-
Archive &operator=(const Archive &) = delete;
|
|
42
|
-
|
|
43
|
-
virtual void open_archive() = 0;
|
|
44
|
-
virtual void close_archive();
|
|
45
|
-
virtual void rewind();
|
|
46
|
-
|
|
47
|
-
bool skip_to_next_header();
|
|
48
|
-
bool skip_data();
|
|
49
|
-
bool skip_to_entry(const std::string &entryname);
|
|
50
|
-
bool skip_to_eof();
|
|
51
|
-
|
|
52
|
-
std::string current_entryname;
|
|
53
|
-
struct archive_entry *current_entry;
|
|
54
|
-
ssize_t read_current(void *buff, size_t len);
|
|
55
|
-
|
|
56
|
-
// Get current entry metadata
|
|
57
|
-
uint64_t current_entry_size() const;
|
|
58
|
-
mode_t current_entry_filetype() const;
|
|
59
|
-
EntryMetadataMap current_entry_metadata(const std::unordered_set<std::string> &allowed_keys) const;
|
|
60
|
-
|
|
61
|
-
struct archive *_ar;
|
|
62
|
-
bool _at_eof;
|
|
63
|
-
|
|
64
|
-
protected:
|
|
65
|
-
bool _current_entry_content_ready;
|
|
66
|
-
|
|
67
|
-
public:
|
|
68
|
-
bool current_entry_content_ready() const { return _current_entry_content_ready; }
|
|
69
|
-
|
|
70
|
-
private:
|
|
71
|
-
[[noreturn]] void raise_archive_error(const std::string &message);
|
|
72
|
-
|
|
73
|
-
bool search_forward_until_eof(const std::string &entryname);
|
|
74
|
-
bool search_until_position(const std::string &entryname, const std::string &stop_position);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
} // namespace archive_r
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2025 archive_r Team
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include "archive_r/entry_metadata.h"
|
|
7
|
+
#include "entry_fault_error.h"
|
|
8
|
+
#include <archive.h>
|
|
9
|
+
#include <archive_entry.h>
|
|
10
|
+
#include <functional>
|
|
11
|
+
#include <memory>
|
|
12
|
+
#include <stdexcept>
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <unordered_set>
|
|
15
|
+
#include <vector>
|
|
16
|
+
|
|
17
|
+
#include "archive_r/platform_compat.h"
|
|
18
|
+
|
|
19
|
+
namespace archive_r {
|
|
20
|
+
|
|
21
|
+
struct archive_deleter {
|
|
22
|
+
void operator()(struct archive *a) const;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
using archive_ptr = std::unique_ptr<struct archive, archive_deleter>;
|
|
26
|
+
using open_delegate = std::function<int(struct archive *ar)>;
|
|
27
|
+
|
|
28
|
+
struct ArchiveOption {
|
|
29
|
+
std::vector<std::string> passphrases; ///< Passphrases for encrypted archives
|
|
30
|
+
std::vector<std::string> formats; ///< Specific format names to enable (empty = all)
|
|
31
|
+
std::vector<std::string> metadata_keys; ///< Metadata keys to capture (empty = none)
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
archive_ptr new_read_archive_common(const std::vector<std::string> &passphrases, const std::vector<std::string> &format_names, open_delegate archive_open);
|
|
35
|
+
|
|
36
|
+
struct Archive {
|
|
37
|
+
Archive();
|
|
38
|
+
virtual ~Archive();
|
|
39
|
+
|
|
40
|
+
Archive(const Archive &) = delete;
|
|
41
|
+
Archive &operator=(const Archive &) = delete;
|
|
42
|
+
|
|
43
|
+
virtual void open_archive() = 0;
|
|
44
|
+
virtual void close_archive();
|
|
45
|
+
virtual void rewind();
|
|
46
|
+
|
|
47
|
+
bool skip_to_next_header();
|
|
48
|
+
bool skip_data();
|
|
49
|
+
bool skip_to_entry(const std::string &entryname);
|
|
50
|
+
bool skip_to_eof();
|
|
51
|
+
|
|
52
|
+
std::string current_entryname;
|
|
53
|
+
struct archive_entry *current_entry;
|
|
54
|
+
ssize_t read_current(void *buff, size_t len);
|
|
55
|
+
|
|
56
|
+
// Get current entry metadata
|
|
57
|
+
uint64_t current_entry_size() const;
|
|
58
|
+
mode_t current_entry_filetype() const;
|
|
59
|
+
EntryMetadataMap current_entry_metadata(const std::unordered_set<std::string> &allowed_keys) const;
|
|
60
|
+
|
|
61
|
+
struct archive *_ar;
|
|
62
|
+
bool _at_eof;
|
|
63
|
+
|
|
64
|
+
protected:
|
|
65
|
+
bool _current_entry_content_ready;
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
bool current_entry_content_ready() const { return _current_entry_content_ready; }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
[[noreturn]] void raise_archive_error(const std::string &message);
|
|
72
|
+
|
|
73
|
+
bool search_forward_until_eof(const std::string &entryname);
|
|
74
|
+
bool search_until_position(const std::string &entryname, const std::string &stop_position);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace archive_r
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
// Copyright (c) 2025 archive_r Team
|
|
3
|
-
|
|
4
|
-
#include "archive_r/data_stream.h"
|
|
5
|
-
|
|
6
|
-
#include <mutex>
|
|
7
|
-
#include <utility>
|
|
8
|
-
|
|
9
|
-
namespace archive_r {
|
|
10
|
-
|
|
11
|
-
namespace {
|
|
12
|
-
|
|
13
|
-
RootStreamFactory &factory_storage() {
|
|
14
|
-
static RootStreamFactory factory;
|
|
15
|
-
return factory;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
std::mutex &factory_mutex() {
|
|
19
|
-
static std::mutex mutex;
|
|
20
|
-
return mutex;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
} // namespace
|
|
24
|
-
|
|
25
|
-
void set_root_stream_factory(RootStreamFactory factory) {
|
|
26
|
-
std::lock_guard<std::mutex> lock(factory_mutex());
|
|
27
|
-
factory_storage() = std::move(factory);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
RootStreamFactory get_root_stream_factory() {
|
|
31
|
-
std::lock_guard<std::mutex> lock(factory_mutex());
|
|
32
|
-
return factory_storage();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
} // namespace archive_r
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2025 archive_r Team
|
|
3
|
+
|
|
4
|
+
#include "archive_r/data_stream.h"
|
|
5
|
+
|
|
6
|
+
#include <mutex>
|
|
7
|
+
#include <utility>
|
|
8
|
+
|
|
9
|
+
namespace archive_r {
|
|
10
|
+
|
|
11
|
+
namespace {
|
|
12
|
+
|
|
13
|
+
RootStreamFactory &factory_storage() {
|
|
14
|
+
static RootStreamFactory factory;
|
|
15
|
+
return factory;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
std::mutex &factory_mutex() {
|
|
19
|
+
static std::mutex mutex;
|
|
20
|
+
return mutex;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
} // namespace
|
|
24
|
+
|
|
25
|
+
void set_root_stream_factory(RootStreamFactory factory) {
|
|
26
|
+
std::lock_guard<std::mutex> lock(factory_mutex());
|
|
27
|
+
factory_storage() = std::move(factory);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
RootStreamFactory get_root_stream_factory() {
|
|
31
|
+
std::lock_guard<std::mutex> lock(factory_mutex());
|
|
32
|
+
return factory_storage();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
} // namespace archive_r
|