Merge "libziparchive: fix mac os breakage" am: 390f3b364c am: 7cfe1d69b0
am: cdbadafb4a

Change-Id: Ie327879eaea542911603640e36f0d867e05afd61
diff --git a/libutils/include/utils/Compat.h b/libutils/include/utils/Compat.h
index 2709e3b..dee577e 100644
--- a/libutils/include/utils/Compat.h
+++ b/libutils/include/utils/Compat.h
@@ -37,6 +37,10 @@
     return pwrite(fd, buf, nbytes, offset);
 }
 
+static inline int ftruncate64(int fd, off64_t length) {
+    return ftruncate(fd, length);
+}
+
 #endif /* __APPLE__ */
 
 #if defined(_WIN32)
diff --git a/libziparchive/zip_writer.cc b/libziparchive/zip_writer.cc
index ddd4dd5..7600528 100644
--- a/libziparchive/zip_writer.cc
+++ b/libziparchive/zip_writer.cc
@@ -25,6 +25,7 @@
 #include <vector>
 
 #include "android-base/logging.h"
+#include "utils/Compat.h"
 #include "utils/Log.h"
 
 #include "entry_name_utils-inl.h"
diff --git a/libziparchive/zip_writer_test.cc b/libziparchive/zip_writer_test.cc
index 259bcff..30f4950 100644
--- a/libziparchive/zip_writer_test.cc
+++ b/libziparchive/zip_writer_test.cc
@@ -377,7 +377,7 @@
   ASSERT_EQ(0, writer.WriteBytes(data.data(), data.size()));
   ASSERT_EQ(0, writer.FinishEntry());
 
-  off64_t before_len = ftello64(file_);
+  off_t before_len = ftello(file_);
 
   ZipWriter::FileEntry entry;
   ASSERT_EQ(0, writer.GetLastEntry(&entry));
@@ -385,7 +385,7 @@
 
   ASSERT_EQ(0, writer.Finish());
 
-  off64_t after_len = ftello64(file_);
+  off_t after_len = ftello(file_);
 
   ASSERT_GT(before_len, after_len);
 }