diff options
author | Kenny Root <kroot@google.com> | 2010-12-13 11:58:55 -0800 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2010-12-13 12:02:19 -0800 |
commit | 06ea4d65e81123832d2ae547538d612b0e6b90fa (patch) | |
tree | a120b2dee9218ebc5814dc3bbe58d46b29a6b45c /native/include/android | |
parent | 14b0a6bc0ec8814291751b2b8e80da606cfa12b3 (diff) | |
download | frameworks_base-06ea4d65e81123832d2ae547538d612b0e6b90fa.zip frameworks_base-06ea4d65e81123832d2ae547538d612b0e6b90fa.tar.gz frameworks_base-06ea4d65e81123832d2ae547538d612b0e6b90fa.tar.bz2 |
Introduce NDK API for 64-bit assets
Assets were switched to using 64-bit all through the system, so switch
the NDK to using this new API as well.
Change-Id: I2817b11369db3a4dd504b839ef1a3a9780b83533
Diffstat (limited to 'native/include/android')
-rw-r--r-- | native/include/android/asset_manager.h | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/native/include/android/asset_manager.h b/native/include/android/asset_manager.h index 4fa0ef3..f5df46b 100644 --- a/native/include/android/asset_manager.h +++ b/native/include/android/asset_manager.h @@ -94,6 +94,17 @@ int AAsset_read(AAsset* asset, void* buf, size_t count); off_t AAsset_seek(AAsset* asset, off_t offset, int whence); /** + * Seek to the specified offset within the asset data. 'whence' uses the + * same constants as lseek()/fseek(). + * + * Uses 64-bit data type for large files as opposed to the 32-bit type used + * by AAsset_seek. + * + * Returns the new position on success, or (off64_t) -1 on error. + */ +off64_t AAsset_seek64(AAsset* asset, off64_t offset, int whence); + +/** * Close the asset, freeing all associated resources. */ void AAsset_close(AAsset* asset); @@ -111,12 +122,27 @@ const void* AAsset_getBuffer(AAsset* asset); off_t AAsset_getLength(AAsset* asset); /** + * 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); + +/** * Report the total amount of asset data that can be read from the current position. */ off_t AAsset_getRemainingLength(AAsset* asset); /** - * Open a new file descriptor that can be used to read the asset data. + * 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); + +/** + * Open a new file descriptor that can be used to read the asset data. If the + * start or length cannot be represented by a 32-bit number, it will be + * truncated. If the file is large, use AAsset_openFileDescriptor64 instead. * * Returns < 0 if direct fd access is not possible (for example, if the asset is * compressed). @@ -124,6 +150,17 @@ off_t AAsset_getRemainingLength(AAsset* asset); int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength); /** + * Open a new file descriptor that can be used to read the asset data. + * + * Uses a 64-bit number for the offset and length instead of 32-bit instead of + * as AAsset_openFileDescriptor does. + * + * Returns < 0 if direct fd access is not possible (for example, if the asset is + * compressed). + */ +int AAsset_openFileDescriptor64(AAsset* asset, off64_t* outStart, off64_t* outLength); + +/** * Returns whether this asset's internal buffer is allocated in ordinary RAM (i.e. not * mmapped). */ |