Fix slicing warning in tar_object::save_directory
This commit is contained in:
@@ -606,7 +606,7 @@ void tar_object::save_directory(const std::string& target_path, utils::serial& a
|
||||
ar.breathe();
|
||||
};
|
||||
|
||||
fs::stat_t stat{};
|
||||
fs::dir_entry stat{};
|
||||
|
||||
if (src_dir_pos == umax)
|
||||
{
|
||||
@@ -642,14 +642,14 @@ void tar_object::save_directory(const std::string& target_path, utils::serial& a
|
||||
// Optimization: avoid saving to list if this is not an evaluation call
|
||||
if (is_null)
|
||||
{
|
||||
static_cast<fs::stat_t&>(entries.emplace_back()) = stat;
|
||||
entries.push_back(stat);
|
||||
entries.back().name = target_path;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stat = entries.back();
|
||||
save_header(stat, entries.back().name);
|
||||
save_header(stat, stat.name);
|
||||
}
|
||||
|
||||
if (stat.is_directory)
|
||||
@@ -694,11 +694,7 @@ void tar_object::save_directory(const std::string& target_path, utils::serial& a
|
||||
}
|
||||
else
|
||||
{
|
||||
fs::dir_entry entry{};
|
||||
entry.name = target_path;
|
||||
static_cast<fs::stat_t&>(entry) = stat;
|
||||
|
||||
save_file(entry, entry.name);
|
||||
save_file(stat, target_path);
|
||||
}
|
||||
|
||||
ar.breathe();
|
||||
|
||||
Reference in New Issue
Block a user