diff --git a/src/zip.cpp b/src/zip.cpp index b340178..17134c2 100644 --- a/src/zip.cpp +++ b/src/zip.cpp @@ -35,22 +35,19 @@ using fmt::format; std::vector list(const fs::path &filepath) { - struct archive *zipfile{}; - struct archive_entry *entry{}; - int result{}; - std::vector 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 toc; while (archive_read_next_header(zipfile, &entry) == ARCHIVE_OK) { toc.emplace_back(archive_entry_pathname(entry));