summaryrefslogtreecommitdiffstats
path: root/tools/aapt/Resource.cpp
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@google.com>2009-08-14 13:47:30 -0700
committerDaniel Sandler <dsandler@google.com>2009-08-17 10:55:47 -0400
commit3547f859d4a4e90eea52e9caf686c69a6e015b85 (patch)
tree68bc10f7e35b46565d203afe7f4233f7dfb48c89 /tools/aapt/Resource.cpp
parent6ba7ae1e4c3c04f6a71380b913ad79f83b00a628 (diff)
downloadframeworks_base-3547f859d4a4e90eea52e9caf686c69a6e015b85.zip
frameworks_base-3547f859d4a4e90eea52e9caf686c69a6e015b85.tar.gz
frameworks_base-3547f859d4a4e90eea52e9caf686c69a6e015b85.tar.bz2
aapt now attempts to process all assets even if some are malformed.
Previously aapt would bail out on the first broken image, making it difficult to compile a comprehensive list of broken images. Now it will pre- and post-process all of them and report any and all errors (before exiting with an error code if any errors were encountered). Bug: 2055485
Diffstat (limited to 'tools/aapt/Resource.cpp')
-rw-r--r--tools/aapt/Resource.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 1fa7b18..9a5127d 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -272,15 +272,16 @@ static status_t preProcessImages(Bundle* bundle, const sp<AaptAssets>& assets,
ResourceDirIterator it(set, String8("drawable"));
Vector<sp<AaptFile> > newNameFiles;
Vector<String8> newNamePaths;
+ bool hasErrors = false;
ssize_t res;
while ((res=it.next()) == NO_ERROR) {
res = preProcessImage(bundle, assets, it.getFile(), NULL);
- if (res != NO_ERROR) {
- return res;
+ if (res < NO_ERROR) {
+ hasErrors = true;
}
}
- return NO_ERROR;
+ return (hasErrors || (res < NO_ERROR)) ? UNKNOWN_ERROR : NO_ERROR;
}
status_t postProcessImages(const sp<AaptAssets>& assets,
@@ -288,15 +289,16 @@ status_t postProcessImages(const sp<AaptAssets>& assets,
const sp<ResourceTypeSet>& set)
{
ResourceDirIterator it(set, String8("drawable"));
+ bool hasErrors = false;
ssize_t res;
while ((res=it.next()) == NO_ERROR) {
res = postProcessImage(assets, table, it.getFile());
- if (res != NO_ERROR) {
- return res;
+ if (res < NO_ERROR) {
+ hasErrors = true;
}
}
- return res < NO_ERROR ? res : (status_t)NO_ERROR;
+ return (hasErrors || (res < NO_ERROR)) ? UNKNOWN_ERROR : NO_ERROR;
}
static void collect_files(const sp<AaptDir>& dir,