MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / applyPublicEntryOrder

Method applyPublicEntryOrder

tools/aapt/ResourceTable.cpp:3633–3713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3631}
3632
3633status_t ResourceTable::Type::applyPublicEntryOrder()
3634{
3635 size_t N = mOrderedConfigs.size();
3636 Vector<sp<ConfigList> > origOrder(mOrderedConfigs);
3637 bool hasError = false;
3638
3639 size_t i;
3640 for (i=0; i<N; i++) {
3641 mOrderedConfigs.replaceAt(NULL, i);
3642 }
3643
3644 const size_t NP = mPublic.size();
3645 //printf("Ordering %d configs from %d public defs\n", N, NP);
3646 size_t j;
3647 for (j=0; j<NP; j++) {
3648 const String16& name = mPublic.keyAt(j);
3649 const Public& p = mPublic.valueAt(j);
3650 int32_t idx = Res_GETENTRY(p.ident);
3651 //printf("Looking for entry \"%s\"/\"%s\" (0x%08x) in %d...\n",
3652 // String8(mName).string(), String8(name).string(), p.ident, N);
3653 bool found = false;
3654 for (i=0; i<N; i++) {
3655 sp<ConfigList> e = origOrder.itemAt(i);
3656 //printf("#%d: \"%s\"\n", i, String8(e->getName()).string());
3657 if (e->getName() == name) {
3658 if (idx >= (int32_t)mOrderedConfigs.size()) {
3659 p.sourcePos.error("Public entry identifier 0x%x entry index "
3660 "is larger than available symbols (index %d, total symbols %d).\n",
3661 p.ident, idx, mOrderedConfigs.size());
3662 hasError = true;
3663 } else if (mOrderedConfigs.itemAt(idx) == NULL) {
3664 e->setPublic(true);
3665 e->setPublicSourcePos(p.sourcePos);
3666 mOrderedConfigs.replaceAt(e, idx);
3667 origOrder.removeAt(i);
3668 N--;
3669 found = true;
3670 break;
3671 } else {
3672 sp<ConfigList> oe = mOrderedConfigs.itemAt(idx);
3673
3674 p.sourcePos.error("Multiple entry names declared for public entry"
3675 " identifier 0x%x in type %s (%s vs %s).\n"
3676 "%s:%d: Originally defined here.",
3677 idx+1, String8(mName).string(),
3678 String8(oe->getName()).string(),
3679 String8(name).string(),
3680 oe->getPublicSourcePos().file.string(),
3681 oe->getPublicSourcePos().line);
3682 hasError = true;
3683 }
3684 }
3685 }
3686
3687 if (!found) {
3688 p.sourcePos.error("Public symbol %s/%s declared here is not defined.",
3689 String8(mName).string(), String8(name).string());
3690 hasError = true;

Callers 1

assignResourceIdsMethod · 0.80

Calls 9

setPublicMethod · 0.80
setPublicSourcePosMethod · 0.80
stringMethod · 0.80
sizeMethod · 0.65
getNameMethod · 0.65
errorMethod · 0.65
keyAtMethod · 0.45
valueAtMethod · 0.45
removeAtMethod · 0.45

Tested by

no test coverage detected