@@ -51,8 +51,8 @@ namespace libevp {
51
51
static evp_result pack_impl (const evp::pack_input input, FILE_PATH evp,
52
52
evp_context_internal& context);
53
53
54
- static evp_result unpack_impl (FILE_PATH evp, DIR_PATH output,
55
- std::vector<evp_fd>* fds, evp_context_internal& context);
54
+ static evp_result unpack_impl (evp::unpack_input input , DIR_PATH output,
55
+ evp_context_internal& context);
56
56
};
57
57
}
58
58
@@ -73,10 +73,10 @@ evp_result evp::pack(const pack_input& input, const FILE_PATH& evp) {
73
73
}
74
74
}
75
75
76
- evp_result evp::unpack (const FILE_PATH& evp , const DIR_PATH& output_dir, std::vector<evp_fd>* fds ) {
76
+ evp_result evp::unpack (const unpack_input& input , const DIR_PATH& output ) {
77
77
try {
78
78
evp_context_internal context_internal (nullptr );
79
- return evp_impl::unpack_impl (evp, output_dir, fds , context_internal);
79
+ return evp_impl::unpack_impl (input, output , context_internal);
80
80
}
81
81
catch (const std::exception& e) {
82
82
evp_result result;
@@ -105,12 +105,12 @@ void evp::pack_async(const pack_input& input, const FILE_PATH& evp, evp_context*
105
105
t.detach ();
106
106
}
107
107
108
- void evp::unpack_async (const FILE_PATH& evp , const DIR_PATH& output_dir, std::vector<evp_fd>* fds , evp_context* context) {
109
- std::thread t ([evp, output_dir, fds , context] {
108
+ void evp::unpack_async (const unpack_input& input , const DIR_PATH& output , evp_context* context) {
109
+ std::thread t ([input, output , context] {
110
110
evp_context_internal context_internal (context);
111
111
112
112
try {
113
- evp_impl::unpack_impl (evp, output_dir, fds , context_internal);
113
+ evp_impl::unpack_impl (input, output , context_internal);
114
114
}
115
115
catch (const std::exception& e) {
116
116
evp_result result;
@@ -568,22 +568,22 @@ evp_result evp_impl::pack_impl(const evp::pack_input input, FILE_PATH evp,
568
568
return result;
569
569
}
570
570
571
- evp_result evp_impl::unpack_impl (FILE_PATH evp, DIR_PATH output,
572
- std::vector<evp_fd>* fds, evp_context_internal& context)
571
+ evp_result evp_impl::unpack_impl (evp::unpack_input input , DIR_PATH output,
572
+ evp_context_internal& context)
573
573
{
574
574
evp_result result, res;
575
575
result.status = evp_result::status::failure;
576
576
577
577
// /////////////////////////////////////////////////////////////////////////
578
578
// VERIFY
579
579
580
- if (!evp .is_absolute ())
581
- evp = std::filesystem::absolute (evp );
580
+ if (!input. archive .is_absolute ())
581
+ input. archive = std::filesystem::absolute (input. archive );
582
582
583
583
if (!output.is_absolute ())
584
584
output = std::filesystem::absolute (output);
585
585
586
- res = validate_evp_archive (evp , true );
586
+ res = validate_evp_archive (input. archive , true );
587
587
if (!res) {
588
588
result.message = EVP_STR_FORMAT (" Failed to validate input archive path. | {}" , res.message );
589
589
@@ -600,16 +600,14 @@ evp_result evp_impl::unpack_impl(FILE_PATH evp, DIR_PATH output,
600
600
}
601
601
602
602
std::unordered_set<uint32_t > requested_fds = {};
603
- if (fds) {
604
- for (evp_fd& fd : *fds) {
605
- requested_fds.insert (fd.data_offset );
606
- }
603
+ for (evp_fd& fd : input.files ) {
604
+ requested_fds.insert (fd.data_offset );
607
605
}
608
606
609
607
// /////////////////////////////////////////////////////////////////////////
610
608
// UNPACK
611
609
612
- fstream_read stream (evp );
610
+ fstream_read stream (input. archive );
613
611
if (!stream.is_valid ()) {
614
612
result.message = EVP_STR_FORMAT (" Failed to open input archive for reading." );
615
613
@@ -638,7 +636,7 @@ evp_result evp_impl::unpack_impl(FILE_PATH evp, DIR_PATH output,
638
636
return result;
639
637
}
640
638
641
- if (fds && !requested_fds.contains (fd.data_offset )) {
639
+ if (requested_fds. size () != 0 && !requested_fds.contains (fd.data_offset )) {
642
640
context.invoke_update (prog_change);
643
641
continue ;
644
642
}
0 commit comments