diff options
author | Narayan Kamath <narayan@google.com> | 2014-01-27 12:07:15 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-01-27 12:07:15 +0000 |
commit | 1cd2834fde49738d9d884ed193bffa986224204d (patch) | |
tree | 2d88b9fa7fa7931d938241f413ab6f575eccc0f2 /libs | |
parent | dafb2420a34a5b39aca6ddf993e86778edd76b5d (diff) | |
parent | 30e20ac528731a778eec45506d1e57c8839b318a (diff) | |
download | frameworks_base-1cd2834fde49738d9d884ed193bffa986224204d.zip frameworks_base-1cd2834fde49738d9d884ed193bffa986224204d.tar.gz frameworks_base-1cd2834fde49738d9d884ed193bffa986224204d.tar.bz2 |
am 30e20ac5: am ebd43d46: am dff83e2b: am d5970e9c: Merge "AssetManager cookies should be int32_t and not void*."
* commit '30e20ac528731a778eec45506d1e57c8839b318a':
AssetManager cookies should be int32_t and not void*.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/androidfw/AssetManager.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 503c030..52ab361 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -165,7 +165,7 @@ AssetManager::~AssetManager(void) delete[] mVendor; } -bool AssetManager::addAssetPath(const String8& path, void** cookie) +bool AssetManager::addAssetPath(const String8& path, int32_t* cookie) { AutoMutex _l(mLock); @@ -192,7 +192,7 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie) for (size_t i=0; i<mAssetPaths.size(); i++) { if (mAssetPaths[i].path == ap.path) { if (cookie) { - *cookie = (void*)(i+1); + *cookie = static_cast<int32_t>(i+1); } return true; } @@ -205,7 +205,7 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie) // new paths are always added at the end if (cookie) { - *cookie = (void*)mAssetPaths.size(); + *cookie = static_cast<int32_t>(mAssetPaths.size()); } // add overlay packages for /system/framework; apps are handled by the @@ -395,17 +395,17 @@ bool AssetManager::addDefaultAssets() return addAssetPath(path, NULL); } -void* AssetManager::nextAssetPath(void* cookie) const +int32_t AssetManager::nextAssetPath(const int32_t cookie) const { AutoMutex _l(mLock); - size_t next = ((size_t)cookie)+1; - return next > mAssetPaths.size() ? NULL : (void*)next; + const size_t next = static_cast<size_t>(cookie) + 1; + return next > mAssetPaths.size() ? -1 : next; } -String8 AssetManager::getAssetPath(void* cookie) const +String8 AssetManager::getAssetPath(const int32_t cookie) const { AutoMutex _l(mLock); - const size_t which = ((size_t)cookie)-1; + const size_t which = static_cast<size_t>(cookie) - 1; if (which < mAssetPaths.size()) { return mAssetPaths[which].path; } @@ -575,15 +575,14 @@ Asset* AssetManager::openNonAsset(const char* fileName, AccessMode mode) return NULL; } -Asset* AssetManager::openNonAsset(void* cookie, const char* fileName, AccessMode mode) +Asset* AssetManager::openNonAsset(const int32_t cookie, const char* fileName, AccessMode mode) { - const size_t which = ((size_t)cookie)-1; + const size_t which = static_cast<size_t>(cookie) - 1; AutoMutex _l(mLock); LOG_FATAL_IF(mAssetPaths.size() == 0, "No assets added to AssetManager"); - if (mCacheMode != CACHE_OFF && !mCacheValid) loadFileNameCacheLocked(); @@ -1206,7 +1205,7 @@ AssetDir* AssetManager::openDir(const char* dirName) * * Pass in "" for the root dir. */ -AssetDir* AssetManager::openNonAssetDir(void* cookie, const char* dirName) +AssetDir* AssetManager::openNonAssetDir(const int32_t cookie, const char* dirName) { AutoMutex _l(mLock); @@ -1225,7 +1224,7 @@ AssetDir* AssetManager::openNonAssetDir(void* cookie, const char* dirName) pMergedInfo = new SortedVector<AssetDir::FileInfo>; - const size_t which = ((size_t)cookie)-1; + const size_t which = static_cast<size_t>(cookie) - 1; if (which < mAssetPaths.size()) { const asset_path& ap = mAssetPaths.itemAt(which); |