+ Res_value value;
+ if (index >= 0 && parser.getAttributeValue(index, &value) >= 0) {
+ const ResStringPool* pool = &parser.getStrings();
+ if (value.dataType == Res_value::TYPE_REFERENCE) {
+ uint32_t specFlags = 0;
+ int strIdx;
+ if ((strIdx=table.resolveReference(&value, 0x10000000, NULL, &specFlags)) < 0) {
+ fprintf(stderr, "%s:%d: Tag <%s> attribute %s references unknown resid 0x%08x.\n",
+ path.string(), parser.getLineNumber(),
+ String8(parser.getElementName(&len)).string(), attr,
+ value.data);
+ return ATTR_NOT_FOUND;
+ }
+
+ pool = table.getTableStringBlock(strIdx);
+ #if 0
+ if (pool != NULL) {
+ str = pool->stringAt(value.data, &len);
+ }
+ printf("***** RES ATTR: %s specFlags=0x%x strIdx=%d: %s\n", attr,
+ specFlags, strIdx, str != NULL ? String8(str).string() : "???");
+ #endif
+ if ((specFlags&~ResTable_typeSpec::SPEC_PUBLIC) != 0 && false) {
+ fprintf(stderr, "%s:%d: Tag <%s> attribute %s varies by configurations 0x%x.\n",
+ path.string(), parser.getLineNumber(),
+ String8(parser.getElementName(&len)).string(), attr,
+ specFlags);
+ return ATTR_NOT_FOUND;
+ }
+ }
+ if (value.dataType == Res_value::TYPE_STRING) {
+ if (pool == NULL) {
+ fprintf(stderr, "%s:%d: Tag <%s> attribute %s has no string block.\n",
+ path.string(), parser.getLineNumber(),
+ String8(parser.getElementName(&len)).string(), attr);
+ return ATTR_NOT_FOUND;
+ }
+ if ((str=pool->stringAt(value.data, &len)) == NULL) {
+ fprintf(stderr, "%s:%d: Tag <%s> attribute %s has corrupt string value.\n",
+ path.string(), parser.getLineNumber(),
+ String8(parser.getElementName(&len)).string(), attr);
+ return ATTR_NOT_FOUND;
+ }
+ } else {
+ fprintf(stderr, "%s:%d: Tag <%s> attribute %s has invalid type %d.\n",
+ path.string(), parser.getLineNumber(),
+ String8(parser.getElementName(&len)).string(), attr,
+ value.dataType);
+ return ATTR_NOT_FOUND;
+ }