summaryrefslogtreecommitdiff
path: root/src/archive.cpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-11-10 15:14:38 -0600
committerDominick Allen <djallen@librehumanitas.org>2024-11-10 15:14:38 -0600
commit2b641aa2f4f5b894ceed8bf2a46fcef35e930d56 (patch)
treeb5decb0fcd6a225c89d2ababb0fdf2d84b39a334 /src/archive.cpp
parent47e0ff88edd4660513f1d4f3d731008461532a13 (diff)
Refactorings from libfud.HEADmaster
Diffstat (limited to 'src/archive.cpp')
-rw-r--r--src/archive.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/archive.cpp b/src/archive.cpp
index b4bee29..f46f6a7 100644
--- a/src/archive.cpp
+++ b/src/archive.cpp
@@ -8,7 +8,7 @@ using fud::FudStatus;
ZipArchive::ZipArchive(const QString& filename)
{
auto filenameUtf8 = filename.toUtf8();
- int err;
+ int err{};
m_archive = zip_open(filenameUtf8.data(), 0, &err);
if (m_archive == nullptr) {
@@ -26,7 +26,7 @@ ZipArchive::ZipArchive(const QString& filename)
}
}
-ZipArchive::ZipArchive(ZipArchive&& rhs)
+ZipArchive::ZipArchive(ZipArchive&& rhs) noexcept
:m_archive{rhs.m_archive},
m_sortedIndices{std::move(rhs.m_sortedIndices)},
m_filenames{std::move(rhs.m_filenames)},
@@ -41,7 +41,7 @@ ZipArchive::~ZipArchive()
cleanup();
}
-ZipArchive& ZipArchive::operator=(ZipArchive&& rhs)
+ZipArchive& ZipArchive::operator=(ZipArchive&& rhs) noexcept
{
cleanup();
@@ -78,7 +78,7 @@ fud::FudStatus ZipArchive::populate()
if (numEntriesResult < 0) {
return FudStatus::Failure;
}
- size_t numEntries = static_cast<size_t>(numEntriesResult);
+ auto numEntries = static_cast<size_t>(numEntriesResult);
struct NameIndex {
std::string name;
@@ -91,7 +91,8 @@ fud::FudStatus ZipArchive::populate()
m_pages.reserve(numEntries);
for (size_t idx = 0; idx < numEntries; ++idx) {
- struct zip_stat stats;
+ using zipStat = struct zip_stat;
+ zipStat stats{};
auto status = zip_stat_index(m_archive, idx, 0, &stats);
if (status < 0) {