Change assets to use 64-bit API
The asset system and supporting libraries were using off_t instead of
off64_t to access files larger than 2GB (32-bit signed). This change
replaces all off_t with off64_t and lseek64.
There is a new utils/Compat.h added for Mac OS compatibility.
Also fixed some size-related compiler warnings.
Bug: 3205336
Change-Id: I9097b3cb7a602e811fe52f245939d8975da55e9e
diff --git a/core/jni/android/graphics/Utils.cpp b/core/jni/android/graphics/Utils.cpp
index b6ead19..cf6977e 100644
--- a/core/jni/android/graphics/Utils.cpp
+++ b/core/jni/android/graphics/Utils.cpp
@@ -20,8 +20,8 @@
using namespace android;
bool AssetStreamAdaptor::rewind() {
- off_t pos = fAsset->seek(0, SEEK_SET);
- if (pos == (off_t)-1) {
+ off64_t pos = fAsset->seek(0, SEEK_SET);
+ if (pos == (off64_t)-1) {
SkDebugf("----- fAsset->seek(rewind) failed\n");
return false;
}
@@ -38,12 +38,12 @@
// asset->seek returns new total offset
// we want to return amount that was skipped
- off_t oldOffset = fAsset->seek(0, SEEK_CUR);
+ off64_t oldOffset = fAsset->seek(0, SEEK_CUR);
if (-1 == oldOffset) {
SkDebugf("---- fAsset->seek(oldOffset) failed\n");
return 0;
}
- off_t newOffset = fAsset->seek(size, SEEK_CUR);
+ off64_t newOffset = fAsset->seek(size, SEEK_CUR);
if (-1 == newOffset) {
SkDebugf("---- fAsset->seek(%d) failed\n", size);
return 0;