From 8f940cc47d01a1616bc2d43b471ef07ef2beda51 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Fri, 14 Aug 2009 13:47:30 -0700 Subject: [PATCH] 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 --- Resource.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Resource.cpp b/Resource.cpp index 1fa7b18..9a5127d 100644 --- a/Resource.cpp +++ b/Resource.cpp @@ -272,15 +272,16 @@ static status_t preProcessImages(Bundle* bundle, const sp& assets, ResourceDirIterator it(set, String8("drawable")); Vector > newNameFiles; Vector 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& assets, @@ -288,15 +289,16 @@ status_t postProcessImages(const sp& assets, const sp& 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& dir, -- 2.50.0