Merge "libziparchive: Turn on -Werror"
diff --git a/libziparchive/Android.mk b/libziparchive/Android.mk
index e754c3b..1d48fea 100644
--- a/libziparchive/Android.mk
+++ b/libziparchive/Android.mk
@@ -30,6 +30,7 @@
 LOCAL_MODULE:= libziparchive
 
 LOCAL_C_INCLUDES += ${includes}
+LOCAL_CFLAGS := -Werror
 include $(BUILD_STATIC_LIBRARY)
 
 include $(CLEAR_VARS)
@@ -40,6 +41,7 @@
 
 LOCAL_STATIC_LIBRARIES := libz libutils
 LOCAL_MODULE:= libziparchive-host
+LOCAL_CFLAGS := -Werror
 include $(BUILD_HOST_STATIC_LIBRARY)
 
 include $(CLEAR_VARS)
@@ -47,7 +49,8 @@
 LOCAL_CPP_EXTENSION := .cc
 LOCAL_CFLAGS += \
     -DGTEST_OS_LINUX_ANDROID \
-    -DGTEST_HAS_STD_STRING
+    -DGTEST_HAS_STD_STRING \
+    -Werror
 LOCAL_SRC_FILES := zip_archive_test.cc
 LOCAL_SHARED_LIBRARIES := liblog
 LOCAL_STATIC_LIBRARIES := libziparchive libz libgtest libgtest_main libutils
@@ -58,7 +61,8 @@
 LOCAL_CPP_EXTENSION := .cc
 LOCAL_CFLAGS += \
     -DGTEST_OS_LINUX \
-    -DGTEST_HAS_STD_STRING
+    -DGTEST_HAS_STD_STRING \
+    -Werror
 LOCAL_SRC_FILES := zip_archive_test.cc
 LOCAL_STATIC_LIBRARIES := libziparchive-host \
 	libz \
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index aebddc8..f1780f4 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <utils/Compat.h>
 #include <utils/FileMap.h>
 #include <zlib.h>
 
@@ -218,7 +219,7 @@
     ssize_t actual = TEMP_FAILURE_RETRY(read(fd, buf, get_size));
 
     if (actual != get_size) {
-      ALOGW("CopyFileToFile: copy read failed (%zd vs %zd)", actual, get_size);
+      ALOGW("CopyFileToFile: copy read failed (" ZD " vs " ZD ")", actual, get_size);
       return kIoError;
     }
 
@@ -900,10 +901,10 @@
   do {
     /* read as much as we can */
     if (zstream.avail_in == 0) {
-      const ssize_t getSize = (compressed_length > kBufSize) ? kBufSize : compressed_length;
-      const ssize_t actual = TEMP_FAILURE_RETRY(read(fd, read_buf, getSize));
+      const ZD_TYPE getSize = (compressed_length > kBufSize) ? kBufSize : compressed_length;
+      const ZD_TYPE actual = TEMP_FAILURE_RETRY(read(fd, read_buf, getSize));
       if (actual != getSize) {
-        ALOGW("Zip: inflate read failed (%zd vs %zd)", actual, getSize);
+        ALOGW("Zip: inflate read failed (" ZD " vs " ZD ")", actual, getSize);
         result = kIoError;
         goto z_bail;
       }