Fix warnings in libziparchive

system/core/include is included in the global include path using
-isystem, which hides all warnings.  zlib.h is included through
system/core/include/ziparchive/zip_archive.h, which was hiding warnings
in it.  Use a #pragma around the call to deflateInit2, it is a macro
that expands to an old-style cast, in preparation for moving from
-isystem to -I.  Also move the ZipString constructor to zip_archive.cc
so it can assert on the length of the string parameter and fix an
implicit conversion from size_t to uint16_t.

Test: m -j native
Bug: 31492149
Change-Id: I74cdad7fe9c723859b5cfbea73c8f27d9d9ca265
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index 350be31..4649a75 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -31,6 +31,7 @@
 #include <vector>
 
 #include "android-base/file.h"
+#include "android-base/logging.h"
 #include "android-base/macros.h"  // TEMP_FAILURE_RETRY may or may not be in unistd
 #include "android-base/memory.h"
 #include "log/log.h"
@@ -1073,3 +1074,10 @@
 int GetFileDescriptor(const ZipArchiveHandle handle) {
   return reinterpret_cast<ZipArchive*>(handle)->fd;
 }
+
+ZipString::ZipString(const char* entry_name)
+    : name(reinterpret_cast<const uint8_t*>(entry_name)) {
+  size_t len = strlen(entry_name);
+  CHECK_LE(len, static_cast<size_t>(UINT16_MAX));
+  name_length = static_cast<uint16_t>(len);
+}