diff options
author | Mark Salyzyn <salyzyn@google.com> | 2014-05-01 07:27:02 -0700 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2014-05-14 08:33:55 -0700 |
commit | ab886745bc422e46d811a43043f7f2b2e132c15f (patch) | |
tree | 5dba4a3b5b91c6f34746d639b8676a2331bae1d4 | |
parent | 32e4479d5535887d03625b43b7e3574b458dfc8d (diff) | |
download | system_core-ab886745bc422e46d811a43043f7f2b2e132c15f.zip system_core-ab886745bc422e46d811a43043f7f2b2e132c15f.tar.gz system_core-ab886745bc422e46d811a43043f7f2b2e132c15f.tar.bz2 |
libzipfile: turn on -Werror
- resolve some unused references
Change-Id: Ia3748c7e25963c2fd3d58e175177f0f4dd405997
-rw-r--r-- | libzipfile/Android.mk | 6 | ||||
-rw-r--r-- | libzipfile/centraldir.c | 39 | ||||
-rw-r--r-- | libzipfile/zipfile.c | 1 |
3 files changed, 10 insertions, 36 deletions
diff --git a/libzipfile/Android.mk b/libzipfile/Android.mk index d2d758c..614a460 100644 --- a/libzipfile/Android.mk +++ b/libzipfile/Android.mk @@ -14,6 +14,8 @@ LOCAL_MODULE:= libzipfile LOCAL_C_INCLUDES += external/zlib +LOCAL_CFLAGS := -Werror + include $(BUILD_HOST_STATIC_LIBRARY) # build device static library @@ -30,6 +32,8 @@ LOCAL_MODULE:= libzipfile LOCAL_C_INCLUDES += external/zlib +LOCAL_CFLAGS := -Werror + include $(BUILD_STATIC_LIBRARY) @@ -45,4 +49,6 @@ LOCAL_MODULE := test_zipfile LOCAL_C_INCLUDES += external/zlib +LOCAL_CFLAGS := -Werror + include $(BUILD_HOST_EXECUTABLE) diff --git a/libzipfile/centraldir.c b/libzipfile/centraldir.c index 911e2b9..69cf47a 100644 --- a/libzipfile/centraldir.c +++ b/libzipfile/centraldir.c @@ -3,6 +3,8 @@ #include <string.h>
#include <stdlib.h>
+#include <utils/Compat.h>
+
enum {
// finding the directory
CD_SIGNATURE = 0x06054b50,
@@ -66,24 +68,10 @@ read_central_directory_entry(Zipfile* file, Zipentry* entry, {
const unsigned char* p;
- unsigned short versionMadeBy;
- unsigned short versionToExtract;
- unsigned short gpBitFlag;
- unsigned short compressionMethod;
- unsigned short lastModFileTime;
- unsigned short lastModFileDate;
- unsigned long crc32;
unsigned short extraFieldLength;
unsigned short fileCommentLength;
- unsigned short diskNumberStart;
- unsigned short internalAttrs;
- unsigned long externalAttrs;
unsigned long localHeaderRelOffset;
- const unsigned char* extraField;
- const unsigned char* fileComment;
unsigned int dataOffset;
- unsigned short lfhExtraFieldSize;
-
p = *buf;
@@ -97,21 +85,12 @@ read_central_directory_entry(Zipfile* file, Zipentry* entry, return -1;
}
- versionMadeBy = read_le_short(&p[0x04]);
- versionToExtract = read_le_short(&p[0x06]);
- gpBitFlag = read_le_short(&p[0x08]);
entry->compressionMethod = read_le_short(&p[0x0a]);
- lastModFileTime = read_le_short(&p[0x0c]);
- lastModFileDate = read_le_short(&p[0x0e]);
- crc32 = read_le_int(&p[0x10]);
entry->compressedSize = read_le_int(&p[0x14]);
entry->uncompressedSize = read_le_int(&p[0x18]);
entry->fileNameLength = read_le_short(&p[0x1c]);
extraFieldLength = read_le_short(&p[0x1e]);
fileCommentLength = read_le_short(&p[0x20]);
- diskNumberStart = read_le_short(&p[0x22]);
- internalAttrs = read_le_short(&p[0x24]);
- externalAttrs = read_le_int(&p[0x26]);
localHeaderRelOffset = read_le_int(&p[0x2a]);
p += ENTRY_LEN;
@@ -125,19 +104,9 @@ read_central_directory_entry(Zipfile* file, Zipentry* entry, p += entry->fileNameLength;
// extra field
- if (extraFieldLength != 0) {
- extraField = p;
- } else {
- extraField = NULL;
- }
p += extraFieldLength;
// comment, if any
- if (fileCommentLength != 0) {
- fileComment = p;
- } else {
- fileComment = NULL;
- }
p += fileCommentLength;
*buf = p;
@@ -183,7 +152,7 @@ read_central_dir(Zipfile *file) int err;
const unsigned char* buf = file->buf;
- ssize_t bufsize = file->bufsize;
+ ZD_TYPE bufsize = file->bufsize;
const unsigned char* eocd;
const unsigned char* p;
const unsigned char* start;
@@ -192,7 +161,7 @@ read_central_dir(Zipfile *file) // too small to be a ZIP archive?
if (bufsize < EOCD_LEN) {
- fprintf(stderr, "Length is %zd -- too small\n", bufsize);
+ fprintf(stderr, "Length is " ZD " -- too small\n", bufsize);
goto bail;
}
diff --git a/libzipfile/zipfile.c b/libzipfile/zipfile.c index a401a9b..b903fcf 100644 --- a/libzipfile/zipfile.c +++ b/libzipfile/zipfile.c @@ -79,7 +79,6 @@ static int uninflate(unsigned char* out, int unlen, const unsigned char* in, int clen) { z_stream zstream; - unsigned long crc; int err = 0; int zerr; |