summaryrefslogtreecommitdiffstats
path: root/minzip/Zip.c
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2014-02-10 21:35:19 +0100
committerDoug Zongker <dougz@android.com>2014-02-13 17:30:41 +0100
commita9300301ce0bddb6f46e1e1a7499c13b615713c6 (patch)
treede91ee750f49aaf54aeb63751cb7cd9ba58804fa /minzip/Zip.c
parentam 2739ed96: am a5d105e2: Merge "recovery: fix building with pointer-to-int errors turned on" (diff)
downloadandroid_bootable_recovery-a9300301ce0bddb6f46e1e1a7499c13b615713c6.tar
android_bootable_recovery-a9300301ce0bddb6f46e1e1a7499c13b615713c6.tar.gz
android_bootable_recovery-a9300301ce0bddb6f46e1e1a7499c13b615713c6.tar.bz2
android_bootable_recovery-a9300301ce0bddb6f46e1e1a7499c13b615713c6.tar.lz
android_bootable_recovery-a9300301ce0bddb6f46e1e1a7499c13b615713c6.tar.xz
android_bootable_recovery-a9300301ce0bddb6f46e1e1a7499c13b615713c6.tar.zst
android_bootable_recovery-a9300301ce0bddb6f46e1e1a7499c13b615713c6.zip
Diffstat (limited to '')
-rw-r--r--minzip/Zip.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/minzip/Zip.c b/minzip/Zip.c
index 6785d4ea7..abc98901c 100644
--- a/minzip/Zip.c
+++ b/minzip/Zip.c
@@ -703,7 +703,7 @@ static bool writeProcessFunction(const unsigned char *data, int dataLen,
while (true) {
ssize_t n = write(fd, data+soFar, dataLen-soFar);
if (n <= 0) {
- LOGE("Error writing %ld bytes from zip file from %p: %s\n",
+ LOGE("Error writing %zd bytes from zip file from %p: %s\n",
dataLen-soFar, data+soFar, strerror(errno));
if (errno != EINTR) {
return false;
@@ -712,7 +712,7 @@ static bool writeProcessFunction(const unsigned char *data, int dataLen,
soFar += n;
if (soFar == dataLen) return true;
if (soFar > dataLen) {
- LOGE("write overrun? (%ld bytes instead of %d)\n",
+ LOGE("write overrun? (%zd bytes instead of %d)\n",
soFar, dataLen);
return false;
}
@@ -735,6 +735,23 @@ bool mzExtractZipEntryToFile(const ZipArchive *pArchive,
return true;
}
+/*
+ * Obtain a pointer to the in-memory representation of a stored entry.
+ */
+bool mzGetStoredEntry(const ZipArchive *pArchive,
+ const ZipEntry *pEntry, unsigned char **addr, size_t *length)
+{
+ if (pEntry->compression != STORED) {
+ LOGE("Can't getStoredEntry for '%s'; not stored\n",
+ pEntry->fileName);
+ return false;
+ }
+
+ *addr = pArchive->addr + pEntry->offset;
+ *length = pEntry->uncompLen;
+ return true;
+}
+
typedef struct {
unsigned char* buffer;
long len;