Loading libziparchive/Android.mk +0 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ LOCAL_MODULE:= libziparchive LOCAL_C_INCLUDES += ${includes} LOCAL_CFLAGS := -Werror include external/libcxx/libcxx.mk include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) Loading @@ -44,7 +43,6 @@ LOCAL_STATIC_LIBRARIES := libz libutils LOCAL_MODULE:= libziparchive-host LOCAL_CFLAGS := -Werror LOCAL_MULTILIB := both include external/libcxx/libcxx.mk include $(BUILD_HOST_STATIC_LIBRARY) include $(CLEAR_VARS) Loading libziparchive/zip_archive.cc +20 −10 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ #include <unistd.h> #include <utils/Compat.h> #include <utils/FileMap.h> #include <vector> #include <zlib.h> #include <JNIHelp.h> // TEMP_FAILURE_RETRY may or may not be in unistd Loading Loading @@ -889,8 +888,23 @@ static int32_t FindEntry(const ZipArchive* archive, const int ent, struct IterationHandle { uint32_t position; std::vector<uint8_t> prefix; const uint8_t* prefix; uint16_t prefix_len; ZipArchive* archive; IterationHandle() : prefix(NULL), prefix_len(0) {} 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)); prefix = prefix_copy; } ~IterationHandle() { delete [] prefix; } }; int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, Loading @@ -902,14 +916,10 @@ int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, return kInvalidHandle; } IterationHandle* cookie = new IterationHandle(); IterationHandle* cookie = optional_prefix != NULL ? new IterationHandle(*optional_prefix) : new IterationHandle(); cookie->position = 0; cookie->archive = archive; if (optional_prefix != NULL) { cookie->prefix.insert(cookie->prefix.begin(), optional_prefix->name, optional_prefix->name + optional_prefix->name_length); } *cookie_ptr = cookie ; return 0; Loading Loading @@ -956,8 +966,8 @@ int32_t Next(void* cookie, ZipEntry* data, ZipEntryName* name) { for (uint32_t i = currentOffset; i < hash_table_length; ++i) { if (hash_table[i].name != NULL && (handle->prefix.empty() || (memcmp(&(handle->prefix[0]), hash_table[i].name, handle->prefix.size()) == 0))) { (handle->prefix_len == 0 || (memcmp(handle->prefix, hash_table[i].name, handle->prefix_len) == 0))) { handle->position = (i + 1); const int error = FindEntry(archive, i, data); if (!error) { Loading Loading
libziparchive/Android.mk +0 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ LOCAL_MODULE:= libziparchive LOCAL_C_INCLUDES += ${includes} LOCAL_CFLAGS := -Werror include external/libcxx/libcxx.mk include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) Loading @@ -44,7 +43,6 @@ LOCAL_STATIC_LIBRARIES := libz libutils LOCAL_MODULE:= libziparchive-host LOCAL_CFLAGS := -Werror LOCAL_MULTILIB := both include external/libcxx/libcxx.mk include $(BUILD_HOST_STATIC_LIBRARY) include $(CLEAR_VARS) Loading
libziparchive/zip_archive.cc +20 −10 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ #include <unistd.h> #include <utils/Compat.h> #include <utils/FileMap.h> #include <vector> #include <zlib.h> #include <JNIHelp.h> // TEMP_FAILURE_RETRY may or may not be in unistd Loading Loading @@ -889,8 +888,23 @@ static int32_t FindEntry(const ZipArchive* archive, const int ent, struct IterationHandle { uint32_t position; std::vector<uint8_t> prefix; const uint8_t* prefix; uint16_t prefix_len; ZipArchive* archive; IterationHandle() : prefix(NULL), prefix_len(0) {} 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)); prefix = prefix_copy; } ~IterationHandle() { delete [] prefix; } }; int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, Loading @@ -902,14 +916,10 @@ int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, return kInvalidHandle; } IterationHandle* cookie = new IterationHandle(); IterationHandle* cookie = optional_prefix != NULL ? new IterationHandle(*optional_prefix) : new IterationHandle(); cookie->position = 0; cookie->archive = archive; if (optional_prefix != NULL) { cookie->prefix.insert(cookie->prefix.begin(), optional_prefix->name, optional_prefix->name + optional_prefix->name_length); } *cookie_ptr = cookie ; return 0; Loading Loading @@ -956,8 +966,8 @@ int32_t Next(void* cookie, ZipEntry* data, ZipEntryName* name) { for (uint32_t i = currentOffset; i < hash_table_length; ++i) { if (hash_table[i].name != NULL && (handle->prefix.empty() || (memcmp(&(handle->prefix[0]), hash_table[i].name, handle->prefix.size()) == 0))) { (handle->prefix_len == 0 || (memcmp(handle->prefix, hash_table[i].name, handle->prefix_len) == 0))) { handle->position = (i + 1); const int error = FindEntry(archive, i, data); if (!error) { Loading