Skip to content

Commit

Permalink
Cleanup ziparchive
Browse files Browse the repository at this point in the history
Addressed review comments from 8e08536

Change-Id: If576e2d6cc5ad330a7dee66b09663e0c04ea3801
  • Loading branch information
Piotr Jastrzebski committed Aug 19, 2014
1 parent 7fb0ee0 commit 10aa9a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libziparchive/zip_archive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,8 @@ static int32_t FindEntry(const ZipArchive* archive, const int ent,

struct IterationHandle {
uint32_t position;
// We're not using vector here because this code is used in the Windows SDK
// where the STL is not available.
const uint8_t* prefix;
uint16_t prefix_len;
ZipArchive* archive;
Expand All @@ -897,13 +899,12 @@ struct IterationHandle {
IterationHandle(const ZipEntryName& prefix_name)
: prefix_len(prefix_name.name_length) {
uint8_t* prefix_copy = new uint8_t[prefix_len];
memcpy(reinterpret_cast<void*>(prefix_copy), prefix_name.name,
prefix_len * sizeof(uint8_t));
memcpy(prefix_copy, prefix_name.name, prefix_len);
prefix = prefix_copy;
}

~IterationHandle() {
delete [] prefix;
delete[] prefix;
}
};

Expand Down

0 comments on commit 10aa9a0

Please sign in to comment.