From 06ea4d65e81123832d2ae547538d612b0e6b90fa Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Mon, 13 Dec 2010 11:58:55 -0800 Subject: 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 --- native/include/android/asset_manager.h | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'native/include/android/asset_manager.h') 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). */ -- cgit v1.1