Initialize the variables where they're needed.
This commit is contained in:
parent
354583bcbd
commit
a941bcced3
11
src/zip.cpp
11
src/zip.cpp
|
@ -35,22 +35,19 @@ using fmt::format;
|
|||
|
||||
std::vector<std::string> list(const fs::path &filepath)
|
||||
{
|
||||
struct archive *zipfile{};
|
||||
struct archive_entry *entry{};
|
||||
int result{};
|
||||
std::vector<std::string> toc;
|
||||
|
||||
zipfile = archive_read_new();
|
||||
auto *zipfile{archive_read_new()};
|
||||
archive_read_support_filter_all(zipfile);
|
||||
archive_read_support_format_all(zipfile);
|
||||
|
||||
result = archive_read_open_filename(zipfile, filepath.c_str(), 10240);
|
||||
auto result{archive_read_open_filename(zipfile, filepath.c_str(), 10240)};
|
||||
if (result != ARCHIVE_OK)
|
||||
{
|
||||
throw exception{format(translate("Could not open {0:s}.").str(),
|
||||
filepath.string())};
|
||||
}
|
||||
|
||||
struct archive_entry *entry{};
|
||||
std::vector<std::string> toc;
|
||||
while (archive_read_next_header(zipfile, &entry) == ARCHIVE_OK)
|
||||
{
|
||||
toc.emplace_back(archive_entry_pathname(entry));
|
||||
|
|
Loading…
Reference in New Issue
Block a user