summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorthat <github@that.at>2015-03-04 23:05:00 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-03-11 13:31:40 +0100
commit0f425069dcbeee22ff2ad2ea782024ab6d39a72d (patch)
tree7ef71821e7f004df94452f6cd5d59258e0056ab9 /gui
parentgui: type safe resources part 2 (diff)
downloadandroid_bootable_recovery-0f425069dcbeee22ff2ad2ea782024ab6d39a72d.tar
android_bootable_recovery-0f425069dcbeee22ff2ad2ea782024ab6d39a72d.tar.gz
android_bootable_recovery-0f425069dcbeee22ff2ad2ea782024ab6d39a72d.tar.bz2
android_bootable_recovery-0f425069dcbeee22ff2ad2ea782024ab6d39a72d.tar.lz
android_bootable_recovery-0f425069dcbeee22ff2ad2ea782024ab6d39a72d.tar.xz
android_bootable_recovery-0f425069dcbeee22ff2ad2ea782024ab6d39a72d.tar.zst
android_bootable_recovery-0f425069dcbeee22ff2ad2ea782024ab6d39a72d.zip
Diffstat (limited to '')
-rw-r--r--gui/resources.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/gui/resources.cpp b/gui/resources.cpp
index 1e2e7f9c6..563dcc45c 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -288,17 +288,19 @@ ResourceManager::ResourceManager()
void ResourceManager::LoadResources(xml_node<>* resList, ZipArchive* pZip)
{
- xml_node<>* child;
-
if (!resList)
return;
- child = resList->first_node("resource");
- while (child != NULL)
+
+ for (xml_node<>* child = resList->first_node(); child; child = child->next_sibling())
{
- xml_attribute<>* attr = child->first_attribute("type");
+ std::string type = child->name();
+ if (type == "resource") {
+ // legacy format : <resource type="...">
+ xml_attribute<>* attr = child->first_attribute("type");
+ type = attr ? attr->value() : "*unspecified*";
+ }
bool error = false;
- std::string type = attr ? attr->value() : "*unspecified*";
if (type == "font")
{
FontResource* res = new FontResource(child, pZip);
@@ -356,8 +358,6 @@ void ResourceManager::LoadResources(xml_node<>* resList, ZipArchive* pZip)
} else
LOGERR("Resource type (%s) failed to load\n", type.c_str());
}
-
- child = child->next_sibling("resource");
}
}