summaryrefslogtreecommitdiffstats
path: root/libs/androidfw/ZipFileRO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/androidfw/ZipFileRO.cpp')
-rw-r--r--libs/androidfw/ZipFileRO.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index 1ab18ad..ef0d072 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -34,14 +34,6 @@
#include <assert.h>
#include <unistd.h>
-/*
- * We must open binary files using open(path, ... | O_BINARY) under Windows.
- * Otherwise strange read errors will happen.
- */
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
using namespace android;
class _ZipEntryRO {
@@ -50,7 +42,10 @@ public:
ZipEntryName name;
void *cookie;
- _ZipEntryRO() : cookie(NULL) {
+ _ZipEntryRO() : cookie(NULL) {}
+
+ ~_ZipEntryRO() {
+ EndIteration(cookie);
}
private:
@@ -83,15 +78,15 @@ ZipFileRO::~ZipFileRO() {
ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const
{
_ZipEntryRO* data = new _ZipEntryRO;
- const int32_t error = FindEntry(mHandle, entryName, &(data->entry));
+
+ data->name = ZipEntryName(entryName);
+
+ const int32_t error = FindEntry(mHandle, data->name, &(data->entry));
if (error) {
delete data;
return NULL;
}
- data->name.name = entryName;
- data->name.name_length = strlen(entryName);
-
return (ZipEntryRO) data;
}