diff options
author | Dan Albert <danalbert@google.com> | 2017-07-17 14:03:29 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2017-07-18 10:46:24 -0700 |
commit | eab5af99417c6d46cddf4a6f13a3945132e2961b (patch) | |
tree | 7c695a4811286bb76bcca6f3aa14302c79119aa1 | |
parent | 8a094116b1a2b5478945116c1c5c07bba1810aa5 (diff) | |
download | native-eab5af99417c6d46cddf4a6f13a3945132e2961b.tar.gz |
_FILE_OFFSET_BITS=64 support for asset_manager.h.
Rename off_t based functions to their 64-bit equivalents if we're in
LP32 with a 64-bit off_t.
We can safely do this for all supported API levels now since API 13 is
no longer supported. Clean up all the guards for that API level while
I'm here.
Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/459
Change-Id: I7032e94c7288f87b4895411079216f0ac2cab6bc
-rw-r--r-- | include/android/asset_manager.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/include/android/asset_manager.h b/include/android/asset_manager.h index 7ef3ecb595..2ac7d4d350 100644 --- a/include/android/asset_manager.h +++ b/include/android/asset_manager.h @@ -33,6 +33,10 @@ extern "C" { #endif +#if !defined(__ANDROID__) && !defined(__RENAME_IF_FILE_OFFSET64) +#define __RENAME_IF_FILE_OFFSET64(x) +#endif + struct AAssetManager; /** * {@link AAssetManager} provides access to an application's raw assets by @@ -132,9 +136,9 @@ int AAsset_read(AAsset* asset, void* buf, size_t count); * * Returns the new position on success, or (off_t) -1 on error. */ -off_t AAsset_seek(AAsset* asset, off_t offset, int whence); +off_t AAsset_seek(AAsset* asset, off_t offset, int whence) + __RENAME_IF_FILE_OFFSET64(AAsset_seek64); -#if __ANDROID_API__ >= 13 /** * Seek to the specified offset within the asset data. 'whence' uses the * same constants as lseek()/fseek(). @@ -145,7 +149,6 @@ off_t AAsset_seek(AAsset* asset, off_t offset, int whence); * Returns the new position on success, or (off64_t) -1 on error. */ off64_t AAsset_seek64(AAsset* asset, off64_t offset, int whence); -#endif /** * Close the asset, freeing all associated resources. @@ -162,29 +165,27 @@ const void* AAsset_getBuffer(AAsset* asset); /** * Report the total size of the asset data. */ -off_t AAsset_getLength(AAsset* asset); +off_t AAsset_getLength(AAsset* asset) + __RENAME_IF_FILE_OFFSET64(AAsset_getLength64); -#if __ANDROID_API__ >= 13 /** * Report the total size of the asset data. Reports the size using a 64-bit * number insted of 32-bit as AAsset_getLength. */ off64_t AAsset_getLength64(AAsset* asset); -#endif /** * Report the total amount of asset data that can be read from the current position. */ -off_t AAsset_getRemainingLength(AAsset* asset); +off_t AAsset_getRemainingLength(AAsset* asset) + __RENAME_IF_FILE_OFFSET64(AAsset_getRemainingLength64); -#if __ANDROID_API__ >= 13 /** * Report the total amount of asset data that can be read from the current position. * * Uses a 64-bit number instead of a 32-bit number as AAsset_getRemainingLength does. */ off64_t AAsset_getRemainingLength64(AAsset* asset); -#endif /** * Open a new file descriptor that can be used to read the asset data. If the @@ -194,9 +195,9 @@ off64_t AAsset_getRemainingLength64(AAsset* asset); * Returns < 0 if direct fd access is not possible (for example, if the asset is * compressed). */ -int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength); +int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength) + __RENAME_IF_FILE_OFFSET64(AAsset_openFileDescriptor64); -#if __ANDROID_API__ >= 13 /** * Open a new file descriptor that can be used to read the asset data. * @@ -207,7 +208,6 @@ int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength); * compressed). */ int AAsset_openFileDescriptor64(AAsset* asset, off64_t* outStart, off64_t* outLength); -#endif /** * Returns whether this asset's internal buffer is allocated in ordinary RAM (i.e. not |