You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
995 B

# On Android, lseek64 should be used, whlie lseek should be in other platfrom.
--- a/base/files/file_posix.cc
+++ b/base/files/file_posix.cc
@@ -189,7 +189,9 @@ int64_t File::Seek(Whence whence, int64_t offset) {
SCOPED_FILE_TRACE_WITH_SIZE("Seek", offset);
-#if defined(OS_ANDROID)
+// Additionally check __BIONIC__ since older versions of Android don't define
+// _FILE_OFFSET_BITS.
+#if _FILE_OFFSET_BITS != 64 || defined(__BIONIC__)
static_assert(sizeof(int64_t) == sizeof(off64_t), "off64_t must be 64 bits");
return lseek64(file_.get(), static_cast<off64_t>(offset),
static_cast<int>(whence));
@@ -275,7 +277,7 @@ int File::Write(int64_t offset, const char* data, int size) {
int bytes_written = 0;
int rv;
do {
-#if defined(OS_ANDROID)
+#if _FILE_OFFSET_BITS != 64 || defined(__BIONIC__)
// In case __USE_FILE_OFFSET64 is not used, we need to call pwrite64()
// instead of pwrite().
static_assert(sizeof(int64_t) == sizeof(off64_t),