DO NOT MERGE : Partially revert change 141d1d836465e8a5a56a5cc1e.

There are no functional changes here. This is in place to make merge
conflicts less likely if any further changes are made to this code in
the future.

Test: make
Test: zip_archive_test
Bug: 64211847

Change-Id: I80ff9712c85d602d27f132ac54f62b3524ac9106
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index 4fe5638..7cc9ac3 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -594,28 +594,7 @@
   return result;
 }
 
-// Attempts to read |len| bytes into |buf| at offset |off|.
-//
-// This method uses pread64 on platforms that support it and
-// lseek64 + read on platforms that don't. This implies that
-// callers should not rely on the |fd| offset being incremented
-// as a side effect of this call.
-static inline ssize_t ReadAtOffset(int fd, uint8_t* buf, size_t len,
-                                   off64_t off) {
-#ifdef HAVE_PREAD
-  return TEMP_FAILURE_RETRY(pread64(fd, buf, len, off));
-#else
-  // The only supported platform that doesn't support pread at the moment
-  // is Windows. Only recent versions of windows support unix like forks,
-  // and even there the semantics are quite different.
-  if (lseek64(fd, off, SEEK_SET) != off) {
-    ALOGW("Zip: failed seek to offset %" PRId64, off);
-    return kIoError;
-  }
-
-  return TEMP_FAILURE_RETRY(read(fd, buf, len));
-#endif  // HAVE_PREAD
-}
+static inline ssize_t ReadAtOffset(int fd, uint8_t* buf, size_t len, off64_t off);
 
 /*
  * Parses the Zip archive's Central Directory.  Allocates and populates the
@@ -778,6 +757,29 @@
   return 0;
 }
 
+// Attempts to read |len| bytes into |buf| at offset |off|.
+//
+// This method uses pread64 on platforms that support it and
+// lseek64 + read on platforms that don't. This implies that
+// callers should not rely on the |fd| offset being incremented
+// as a side effect of this call.
+static inline ssize_t ReadAtOffset(int fd, uint8_t* buf, size_t len,
+                                   off64_t off) {
+#ifdef HAVE_PREAD
+  return TEMP_FAILURE_RETRY(pread64(fd, buf, len, off));
+#else
+  // The only supported platform that doesn't support pread at the moment
+  // is Windows. Only recent versions of windows support unix like forks,
+  // and even there the semantics are quite different.
+  if (lseek64(fd, off, SEEK_SET) != off) {
+    ALOGW("Zip: failed seek to offset %" PRId64, off);
+    return kIoError;
+  }
+
+  return TEMP_FAILURE_RETRY(read(fd, buf, len));
+#endif  // HAVE_PREAD
+}
+
 static int32_t FindEntry(const ZipArchive* archive, const int ent,
                          ZipEntry* data) {
   const uint16_t nameLen = archive->hash_table[ent].name_length;