summaryrefslogtreecommitdiff
path: root/src/support/archive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/archive.cpp')
-rw-r--r--src/support/archive.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/support/archive.cpp b/src/support/archive.cpp
index b394294c6..b9ca827e4 100644
--- a/src/support/archive.cpp
+++ b/src/support/archive.cpp
@@ -129,15 +129,11 @@ std::string Archive::Child::getRawName() const {
}
Archive::Child Archive::Child::getNext(bool& error) const {
- size_t toSkip = len;
- // Members are aligned to even byte boundaries.
- if (toSkip & 1) ++toSkip;
- const uint8_t* nextLoc = data + toSkip;
- if (nextLoc >= (uint8_t*)&*parent->data.end()) { // End of the archive.
+ uint32_t nextOffset = len + (len & 1); // Members are aligned to even byte boundaries.
+ if ((size_t)(data - (const uint8_t*)parent->data.data() + nextOffset) >= parent->data.size()) { // End of the archive.
return Child();
}
-
- return Child(parent, nextLoc, &error);
+ return Child(parent, data + nextOffset, &error);
}
std::string Archive::Child::getName() const {