X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/2ac58f0f8da20ec4af16b08e616c07d8caa93cf2..efcceadae722301c93c9335c53d2be7a108f4763:/ResourceTable.cpp?ds=sidebyside diff --git a/ResourceTable.cpp b/ResourceTable.cpp index 0c0b2ea..d98fe65 100644 --- a/ResourceTable.cpp +++ b/ResourceTable.cpp @@ -2304,10 +2304,8 @@ bool ResourceTable::getAttributeFlags( const char16_t* end = name + nameLen; const char16_t* pos = name; - bool failed = false; - while (pos < end && !failed) { + while (pos < end) { const char16_t* start = pos; - end++; while (pos < end && *pos != '|') { pos++; } @@ -2333,9 +2331,7 @@ bool ResourceTable::getAttributeFlags( // Didn't find this flag identifier. return false; } - if (pos < end) { - pos++; - } + pos++; } return true; @@ -2602,7 +2598,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp& dest) // Iterate through all data, collecting all values (strings, // references, etc). - StringPool valueStrings = StringPool(false, useUTF8); + StringPool valueStrings(useUTF8); Vector > allEntries; for (pi=0; pi p = mOrderedPackages.itemAt(pi); @@ -2611,8 +2607,8 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp& dest) continue; } - StringPool typeStrings = StringPool(false, useUTF8); - StringPool keyStrings = StringPool(false, useUTF8); + StringPool typeStrings(useUTF8); + StringPool keyStrings(useUTF8); const size_t N = p->getOrderedTypes().size(); for (size_t ti=0; ti& dest) const bool filterable = (typeName != mipmap16); const size_t N = t != NULL ? t->getOrderedConfigs().size() : 0; + + // Until a non-NO_ENTRY value has been written for a resource, + // that resource is invalid; validResources[i] represents + // the item at t->getOrderedConfigs().itemAt(i). + Vector validResources; + validResources.insertAt(false, 0, N); // First write the typeSpec chunk, containing information about // each resource entry in this type. @@ -2889,6 +2891,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp& dest) if (amt < 0) { return amt; } + validResources.editItemAt(ei) = true; } else { index[ei] = htodl(ResTable_type::NO_ENTRY); } @@ -2899,6 +2902,14 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp& dest) (((uint8_t*)data->editData()) + typeStart); tHeader->header.size = htodl(data->getSize()-typeStart); } + + for (size_t i = 0; i < N; ++i) { + if (!validResources[i]) { + sp c = t->getOrderedConfigs().itemAt(i); + fprintf(stderr, "warning: no entries written for %s/%s\n", + String8(typeName).string(), String8(c->getName()).string()); + } + } } // Fill in the rest of the package information. @@ -3727,9 +3738,7 @@ sp ResourceTable::getPackage(const String16& package) { sp p = mPackages.valueFor(package); if (p == NULL) { - if (mBundle->getIsOverlayPackage()) { - p = new Package(package, 0x00); - } else if (mIsAppPackage) { + if (mIsAppPackage) { if (mHaveAppPackage) { fprintf(stderr, "Adding multiple application package resources; only one is allowed.\n" "Use -x to create extended resources.\n");