Loading include/androidfw/ResourceTypes.h +6 −7 Original line number Original line Diff line number Diff line Loading @@ -1279,14 +1279,13 @@ class ResTable { { public: public: ResTable(); ResTable(); ResTable(const void* data, size_t size, void* cookie, ResTable(const void* data, size_t size, const int32_t cookie, bool copyData=false); bool copyData=false); ~ResTable(); ~ResTable(); status_t add(const void* data, size_t size, void* cookie, status_t add(Asset* asset, const int32_t cookie, bool copyData, bool copyData=false, const void* idmap = NULL); const void* idmap); status_t add(Asset* asset, void* cookie, status_t add(const void *data, size_t size); bool copyData=false, const void* idmap = NULL); status_t add(ResTable* src); status_t add(ResTable* src); status_t getError() const; status_t getError() const; Loading Loading @@ -1534,7 +1533,7 @@ public: // but not the names their entries or types. // but not the names their entries or types. const ResStringPool* getTableStringBlock(size_t index) const; const ResStringPool* getTableStringBlock(size_t index) const; // Return unique cookie identifier for the given resource table. // Return unique cookie identifier for the given resource table. void* getTableCookie(size_t index) const; int32_t getTableCookie(size_t index) const; // Return the configurations (ResTable_config) that we know about // Return the configurations (ResTable_config) that we know about void getConfigurations(Vector<ResTable_config>* configs) const; void getConfigurations(Vector<ResTable_config>* configs) const; Loading Loading @@ -1569,7 +1568,7 @@ private: struct PackageGroup; struct PackageGroup; struct bag_set; struct bag_set; status_t add(const void* data, size_t size, void* cookie, status_t addInternal(const void* data, size_t size, const int32_t cookie, Asset* asset, bool copyData, const Asset* idmap); Asset* asset, bool copyData, const Asset* idmap); ssize_t getResourcePackageIndex(uint32_t resID) const; ssize_t getResourcePackageIndex(uint32_t resID) const; Loading libs/androidfw/AssetManager.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -335,7 +335,7 @@ bool AssetManager::createIdmapFileLocked(const String8& originalPath, const Stri ALOGW("failed to find resources.arsc in %s\n", ap.path.string()); ALOGW("failed to find resources.arsc in %s\n", ap.path.string()); goto error; goto error; } } tables[i].add(ass, (void*)1, false); tables[i].add(ass, 1, false /* copyData */, NULL /* idMap */); } } if (!getZipEntryCrcLocked(originalPath, "resources.arsc", &originalCrc)) { if (!getZipEntryCrcLocked(originalPath, "resources.arsc", &originalCrc)) { Loading Loading @@ -682,7 +682,7 @@ const ResTable* AssetManager::getResTable(bool required) const // can quickly copy it out for others. // can quickly copy it out for others. ALOGV("Creating shared resources for %s", ap.path.string()); ALOGV("Creating shared resources for %s", ap.path.string()); sharedRes = new ResTable(); sharedRes = new ResTable(); sharedRes->add(ass, (void*)(i+1), false, idmap); sharedRes->add(ass, i + 1, false, idmap); sharedRes = const_cast<AssetManager*>(this)-> sharedRes = const_cast<AssetManager*>(this)-> mZipSet.setZipResourceTable(ap.path, sharedRes); mZipSet.setZipResourceTable(ap.path, sharedRes); } } Loading @@ -706,7 +706,7 @@ const ResTable* AssetManager::getResTable(bool required) const rt->add(sharedRes); rt->add(sharedRes); } else { } else { ALOGV("Parsing resources for %s", ap.path.string()); ALOGV("Parsing resources for %s", ap.path.string()); rt->add(ass, (void*)(i+1), !shared, idmap); rt->add(ass, i + 1, !shared, idmap); } } if (!shared) { if (!shared) { Loading libs/androidfw/ResourceTypes.cpp +14 −14 Original line number Original line Diff line number Diff line Loading @@ -66,9 +66,9 @@ namespace android { // size measured in sizeof(uint32_t) // size measured in sizeof(uint32_t) #define IDMAP_HEADER_SIZE (ResTable::IDMAP_HEADER_SIZE_BYTES / sizeof(uint32_t)) #define IDMAP_HEADER_SIZE (ResTable::IDMAP_HEADER_SIZE_BYTES / sizeof(uint32_t)) static void printToLogFunc(void* cookie, const char* txt) static void printToLogFunc(int32_t cookie, const char* txt) { { ALOGV("%s", txt); ALOGV("[cookie=%d] %s", cookie, txt); } } // Standard C isspace() is only required to look at the low byte of its input, so // Standard C isspace() is only required to look at the low byte of its input, so Loading Loading @@ -2461,7 +2461,7 @@ struct ResTable::Header size_t size; size_t size; const uint8_t* dataEnd; const uint8_t* dataEnd; size_t index; size_t index; void* cookie; int32_t cookie; ResStringPool values; ResStringPool values; uint32_t* resourceIDMap; uint32_t* resourceIDMap; Loading Loading @@ -2860,12 +2860,12 @@ ResTable::ResTable() //ALOGI("Creating ResTable %p\n", this); //ALOGI("Creating ResTable %p\n", this); } } ResTable::ResTable(const void* data, size_t size, void* cookie, bool copyData) ResTable::ResTable(const void* data, size_t size, const int32_t cookie, bool copyData) : mError(NO_INIT) : mError(NO_INIT) { { memset(&mParams, 0, sizeof(mParams)); memset(&mParams, 0, sizeof(mParams)); memset(mPackageMap, 0, sizeof(mPackageMap)); memset(mPackageMap, 0, sizeof(mPackageMap)); add(data, size, cookie, copyData); addInternal(data, size, cookie, NULL /* asset */, copyData, NULL /* idMap */); LOG_FATAL_IF(mError != NO_ERROR, "Error parsing resource table"); LOG_FATAL_IF(mError != NO_ERROR, "Error parsing resource table"); //ALOGI("Creating ResTable %p\n", this); //ALOGI("Creating ResTable %p\n", this); } } Loading @@ -2881,13 +2881,12 @@ inline ssize_t ResTable::getResourcePackageIndex(uint32_t resID) const return ((ssize_t)mPackageMap[Res_GETPACKAGE(resID)+1])-1; return ((ssize_t)mPackageMap[Res_GETPACKAGE(resID)+1])-1; } } status_t ResTable::add(const void* data, size_t size, void* cookie, bool copyData, status_t ResTable::add(const void* data, size_t size) { const void* idmap) return addInternal(data, size, 0 /* cookie */, NULL /* asset */, { false /* copyData */, NULL /* idMap */); return add(data, size, cookie, NULL, copyData, reinterpret_cast<const Asset*>(idmap)); } } status_t ResTable::add(Asset* asset, void* cookie, bool copyData, const void* idmap) status_t ResTable::add(Asset* asset, const int32_t cookie, bool copyData, const void* idmap) { { const void* data = asset->getBuffer(true); const void* data = asset->getBuffer(true); if (data == NULL) { if (data == NULL) { Loading @@ -2895,7 +2894,8 @@ status_t ResTable::add(Asset* asset, void* cookie, bool copyData, const void* id return UNKNOWN_ERROR; return UNKNOWN_ERROR; } } size_t size = (size_t)asset->getLength(); size_t size = (size_t)asset->getLength(); return add(data, size, cookie, asset, copyData, reinterpret_cast<const Asset*>(idmap)); return addInternal(data, size, cookie, asset, copyData, reinterpret_cast<const Asset*>(idmap)); } } status_t ResTable::add(ResTable* src) status_t ResTable::add(ResTable* src) Loading @@ -2922,7 +2922,7 @@ status_t ResTable::add(ResTable* src) return mError; return mError; } } status_t ResTable::add(const void* data, size_t size, void* cookie, status_t ResTable::addInternal(const void* data, size_t size, const int32_t cookie, Asset* asset, bool copyData, const Asset* idmap) Asset* asset, bool copyData, const Asset* idmap) { { if (!data) return NO_ERROR; if (!data) return NO_ERROR; Loading @@ -2945,7 +2945,7 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, const bool notDeviceEndian = htods(0xf0) != 0xf0; const bool notDeviceEndian = htods(0xf0) != 0xf0; LOAD_TABLE_NOISY( LOAD_TABLE_NOISY( ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d " ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%d, asset=%p, copy=%d " "idmap=%p\n", data, size, cookie, asset, copyData, idmap)); "idmap=%p\n", data, size, cookie, asset, copyData, idmap)); if (copyData || notDeviceEndian) { if (copyData || notDeviceEndian) { Loading Loading @@ -4930,7 +4930,7 @@ const ResStringPool* ResTable::getTableStringBlock(size_t index) const return &mHeaders[index]->values; return &mHeaders[index]->values; } } void* ResTable::getTableCookie(size_t index) const int32_t ResTable::getTableCookie(size_t index) const { { return mHeaders[index]->cookie; return mHeaders[index]->cookie; } } Loading tools/aapt/AaptAssets.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2651,7 +2651,7 @@ status_t AaptAssets::addIncludedResources(const sp<AaptFile>& file) { { const ResTable& res = getIncludedResources(); const ResTable& res = getIncludedResources(); // XXX dirty! // XXX dirty! return const_cast<ResTable&>(res).add(file->getData(), file->getSize(), NULL); return const_cast<ResTable&>(res).add(file->getData(), file->getSize()); } } const ResTable& AaptAssets::getIncludedResources() const const ResTable& AaptAssets::getIncludedResources() const Loading tools/aapt/Resource.cpp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -1320,8 +1320,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets) } } // Read resources back in, // Read resources back in, finalResTable.add(resFile->getData(), resFile->getSize(), NULL); finalResTable.add(resFile->getData(), resFile->getSize()); #if 0 #if 0 NOISY( NOISY( printf("Generated resources:\n"); printf("Generated resources:\n"); Loading Loading
include/androidfw/ResourceTypes.h +6 −7 Original line number Original line Diff line number Diff line Loading @@ -1279,14 +1279,13 @@ class ResTable { { public: public: ResTable(); ResTable(); ResTable(const void* data, size_t size, void* cookie, ResTable(const void* data, size_t size, const int32_t cookie, bool copyData=false); bool copyData=false); ~ResTable(); ~ResTable(); status_t add(const void* data, size_t size, void* cookie, status_t add(Asset* asset, const int32_t cookie, bool copyData, bool copyData=false, const void* idmap = NULL); const void* idmap); status_t add(Asset* asset, void* cookie, status_t add(const void *data, size_t size); bool copyData=false, const void* idmap = NULL); status_t add(ResTable* src); status_t add(ResTable* src); status_t getError() const; status_t getError() const; Loading Loading @@ -1534,7 +1533,7 @@ public: // but not the names their entries or types. // but not the names their entries or types. const ResStringPool* getTableStringBlock(size_t index) const; const ResStringPool* getTableStringBlock(size_t index) const; // Return unique cookie identifier for the given resource table. // Return unique cookie identifier for the given resource table. void* getTableCookie(size_t index) const; int32_t getTableCookie(size_t index) const; // Return the configurations (ResTable_config) that we know about // Return the configurations (ResTable_config) that we know about void getConfigurations(Vector<ResTable_config>* configs) const; void getConfigurations(Vector<ResTable_config>* configs) const; Loading Loading @@ -1569,7 +1568,7 @@ private: struct PackageGroup; struct PackageGroup; struct bag_set; struct bag_set; status_t add(const void* data, size_t size, void* cookie, status_t addInternal(const void* data, size_t size, const int32_t cookie, Asset* asset, bool copyData, const Asset* idmap); Asset* asset, bool copyData, const Asset* idmap); ssize_t getResourcePackageIndex(uint32_t resID) const; ssize_t getResourcePackageIndex(uint32_t resID) const; Loading
libs/androidfw/AssetManager.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -335,7 +335,7 @@ bool AssetManager::createIdmapFileLocked(const String8& originalPath, const Stri ALOGW("failed to find resources.arsc in %s\n", ap.path.string()); ALOGW("failed to find resources.arsc in %s\n", ap.path.string()); goto error; goto error; } } tables[i].add(ass, (void*)1, false); tables[i].add(ass, 1, false /* copyData */, NULL /* idMap */); } } if (!getZipEntryCrcLocked(originalPath, "resources.arsc", &originalCrc)) { if (!getZipEntryCrcLocked(originalPath, "resources.arsc", &originalCrc)) { Loading Loading @@ -682,7 +682,7 @@ const ResTable* AssetManager::getResTable(bool required) const // can quickly copy it out for others. // can quickly copy it out for others. ALOGV("Creating shared resources for %s", ap.path.string()); ALOGV("Creating shared resources for %s", ap.path.string()); sharedRes = new ResTable(); sharedRes = new ResTable(); sharedRes->add(ass, (void*)(i+1), false, idmap); sharedRes->add(ass, i + 1, false, idmap); sharedRes = const_cast<AssetManager*>(this)-> sharedRes = const_cast<AssetManager*>(this)-> mZipSet.setZipResourceTable(ap.path, sharedRes); mZipSet.setZipResourceTable(ap.path, sharedRes); } } Loading @@ -706,7 +706,7 @@ const ResTable* AssetManager::getResTable(bool required) const rt->add(sharedRes); rt->add(sharedRes); } else { } else { ALOGV("Parsing resources for %s", ap.path.string()); ALOGV("Parsing resources for %s", ap.path.string()); rt->add(ass, (void*)(i+1), !shared, idmap); rt->add(ass, i + 1, !shared, idmap); } } if (!shared) { if (!shared) { Loading
libs/androidfw/ResourceTypes.cpp +14 −14 Original line number Original line Diff line number Diff line Loading @@ -66,9 +66,9 @@ namespace android { // size measured in sizeof(uint32_t) // size measured in sizeof(uint32_t) #define IDMAP_HEADER_SIZE (ResTable::IDMAP_HEADER_SIZE_BYTES / sizeof(uint32_t)) #define IDMAP_HEADER_SIZE (ResTable::IDMAP_HEADER_SIZE_BYTES / sizeof(uint32_t)) static void printToLogFunc(void* cookie, const char* txt) static void printToLogFunc(int32_t cookie, const char* txt) { { ALOGV("%s", txt); ALOGV("[cookie=%d] %s", cookie, txt); } } // Standard C isspace() is only required to look at the low byte of its input, so // Standard C isspace() is only required to look at the low byte of its input, so Loading Loading @@ -2461,7 +2461,7 @@ struct ResTable::Header size_t size; size_t size; const uint8_t* dataEnd; const uint8_t* dataEnd; size_t index; size_t index; void* cookie; int32_t cookie; ResStringPool values; ResStringPool values; uint32_t* resourceIDMap; uint32_t* resourceIDMap; Loading Loading @@ -2860,12 +2860,12 @@ ResTable::ResTable() //ALOGI("Creating ResTable %p\n", this); //ALOGI("Creating ResTable %p\n", this); } } ResTable::ResTable(const void* data, size_t size, void* cookie, bool copyData) ResTable::ResTable(const void* data, size_t size, const int32_t cookie, bool copyData) : mError(NO_INIT) : mError(NO_INIT) { { memset(&mParams, 0, sizeof(mParams)); memset(&mParams, 0, sizeof(mParams)); memset(mPackageMap, 0, sizeof(mPackageMap)); memset(mPackageMap, 0, sizeof(mPackageMap)); add(data, size, cookie, copyData); addInternal(data, size, cookie, NULL /* asset */, copyData, NULL /* idMap */); LOG_FATAL_IF(mError != NO_ERROR, "Error parsing resource table"); LOG_FATAL_IF(mError != NO_ERROR, "Error parsing resource table"); //ALOGI("Creating ResTable %p\n", this); //ALOGI("Creating ResTable %p\n", this); } } Loading @@ -2881,13 +2881,12 @@ inline ssize_t ResTable::getResourcePackageIndex(uint32_t resID) const return ((ssize_t)mPackageMap[Res_GETPACKAGE(resID)+1])-1; return ((ssize_t)mPackageMap[Res_GETPACKAGE(resID)+1])-1; } } status_t ResTable::add(const void* data, size_t size, void* cookie, bool copyData, status_t ResTable::add(const void* data, size_t size) { const void* idmap) return addInternal(data, size, 0 /* cookie */, NULL /* asset */, { false /* copyData */, NULL /* idMap */); return add(data, size, cookie, NULL, copyData, reinterpret_cast<const Asset*>(idmap)); } } status_t ResTable::add(Asset* asset, void* cookie, bool copyData, const void* idmap) status_t ResTable::add(Asset* asset, const int32_t cookie, bool copyData, const void* idmap) { { const void* data = asset->getBuffer(true); const void* data = asset->getBuffer(true); if (data == NULL) { if (data == NULL) { Loading @@ -2895,7 +2894,8 @@ status_t ResTable::add(Asset* asset, void* cookie, bool copyData, const void* id return UNKNOWN_ERROR; return UNKNOWN_ERROR; } } size_t size = (size_t)asset->getLength(); size_t size = (size_t)asset->getLength(); return add(data, size, cookie, asset, copyData, reinterpret_cast<const Asset*>(idmap)); return addInternal(data, size, cookie, asset, copyData, reinterpret_cast<const Asset*>(idmap)); } } status_t ResTable::add(ResTable* src) status_t ResTable::add(ResTable* src) Loading @@ -2922,7 +2922,7 @@ status_t ResTable::add(ResTable* src) return mError; return mError; } } status_t ResTable::add(const void* data, size_t size, void* cookie, status_t ResTable::addInternal(const void* data, size_t size, const int32_t cookie, Asset* asset, bool copyData, const Asset* idmap) Asset* asset, bool copyData, const Asset* idmap) { { if (!data) return NO_ERROR; if (!data) return NO_ERROR; Loading @@ -2945,7 +2945,7 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, const bool notDeviceEndian = htods(0xf0) != 0xf0; const bool notDeviceEndian = htods(0xf0) != 0xf0; LOAD_TABLE_NOISY( LOAD_TABLE_NOISY( ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d " ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%d, asset=%p, copy=%d " "idmap=%p\n", data, size, cookie, asset, copyData, idmap)); "idmap=%p\n", data, size, cookie, asset, copyData, idmap)); if (copyData || notDeviceEndian) { if (copyData || notDeviceEndian) { Loading Loading @@ -4930,7 +4930,7 @@ const ResStringPool* ResTable::getTableStringBlock(size_t index) const return &mHeaders[index]->values; return &mHeaders[index]->values; } } void* ResTable::getTableCookie(size_t index) const int32_t ResTable::getTableCookie(size_t index) const { { return mHeaders[index]->cookie; return mHeaders[index]->cookie; } } Loading
tools/aapt/AaptAssets.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2651,7 +2651,7 @@ status_t AaptAssets::addIncludedResources(const sp<AaptFile>& file) { { const ResTable& res = getIncludedResources(); const ResTable& res = getIncludedResources(); // XXX dirty! // XXX dirty! return const_cast<ResTable&>(res).add(file->getData(), file->getSize(), NULL); return const_cast<ResTable&>(res).add(file->getData(), file->getSize()); } } const ResTable& AaptAssets::getIncludedResources() const const ResTable& AaptAssets::getIncludedResources() const Loading
tools/aapt/Resource.cpp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -1320,8 +1320,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets) } } // Read resources back in, // Read resources back in, finalResTable.add(resFile->getData(), resFile->getSize(), NULL); finalResTable.add(resFile->getData(), resFile->getSize()); #if 0 #if 0 NOISY( NOISY( printf("Generated resources:\n"); printf("Generated resources:\n"); Loading