From 9dced68812e3729ac8b0d12a1b35cef202c29802 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 24 Jun 2017 14:09:20 -0700 Subject: [PATCH] Core: Buildfix. --- Common/CommonFuncs.h | 4 ---- Core/FileLoaders/LocalFileLoader.cpp | 11 +++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Common/CommonFuncs.h b/Common/CommonFuncs.h index 4d18e2c84f..76d960226e 100644 --- a/Common/CommonFuncs.h +++ b/Common/CommonFuncs.h @@ -59,10 +59,6 @@ inline u64 __rotr64(u64 x, unsigned int shift){ return (x >> n) | (x << (64 - n)); } -#ifndef linux -#define pread64 pread -#endif - #else // WIN32 // Function Cross-Compatibility diff --git a/Core/FileLoaders/LocalFileLoader.cpp b/Core/FileLoaders/LocalFileLoader.cpp index a06e79b825..588d2c944e 100644 --- a/Core/FileLoaders/LocalFileLoader.cpp +++ b/Core/FileLoaders/LocalFileLoader.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include "ppsspp_config.h" #include "util/text/utf8.h" #include "file/file_util.h" @@ -36,9 +37,15 @@ LocalFileLoader::LocalFileLoader(const std::string &filename) if (fd_ == -1) { return; } +#if defined(__ANDROID__) || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS < 64) off64_t off = lseek64(fd_, 0, SEEK_END); filesize_ = off; lseek64(fd_, 0, SEEK_SET); +#else + off_t off = lseek(fd_, 0, SEEK_END); + filesize_ = off; + lseek(fd_, 0, SEEK_SET); +#endif #else // !_WIN32 @@ -104,7 +111,11 @@ std::string LocalFileLoader::Path() const { size_t LocalFileLoader::ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags) { #ifndef _WIN32 +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS < 64 return pread64(fd_, data, bytes * count, absolutePos) / bytes; +#else + return pread(fd_, data, bytes * count, absolutePos) / bytes; +#endif #else DWORD read = -1; OVERLAPPED offset = { 0 };