From 8bd37ba458633ee7b2aeec0a7593817000aa84b2 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Wed, 10 Aug 2016 14:15:30 -0700 Subject: Fix clang-tidy warnings in aapt and aapt2. * Add explicit keyword to conversion constructors. * Add NOLINT(implicit) comments for implicit conversion constructors. Bug: 28341362 * Use const reference type for read-only parameters. Bug: 30407689 * Use const reference type to avoid unnecessary copy. Bug: 30413862 Test: build with WITH_TIDY=1 Change-Id: Id6d21961f313a1ad92b15a37fdaa5be9e8ab48e1 Merged-In: Id6d21961f313a1ad92b15a37fdaa5be9e8ab48e1 --- tools/aapt/Resource.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tools/aapt/Resource.cpp') diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index d05ae3cec028..b6f9aaf5d4f0 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -394,7 +394,7 @@ static void collect_files(const sp& dir, const DefaultKeyedVector >& groups = dir->getFiles(); int N = groups.size(); for (int i=0; i& group = groups.valueAt(i); const DefaultKeyedVector >& files @@ -417,7 +417,7 @@ static void collect_files(const sp& dir, set->add(leafName, group); resources->add(resType, set); } else { - sp set = resources->valueAt(index); + const sp& set = resources->valueAt(index); index = set->indexOfKey(leafName); if (index < 0) { if (kIsDebug) { @@ -452,7 +452,7 @@ static void collect_files(const sp& ass, int N = dirs.size(); for (int i=0; i d = dirs.itemAt(i); + const sp& d = dirs.itemAt(i); if (kIsDebug) { printf("Collecting dir #%d %p: %s, leaf %s\n", i, d.get(), d->getPath().string(), d->getLeaf().string()); @@ -610,7 +610,7 @@ static bool applyFileOverlay(Bundle *bundle, // get the overlay resources of the requested type ssize_t index = overlayRes->indexOfKey(resTypeString); if (index >= 0) { - sp overlaySet = overlayRes->valueAt(index); + const sp& overlaySet = overlayRes->valueAt(index); // for each of the resources, check for a match in the previously built // non-overlay "baseset". @@ -760,7 +760,7 @@ bool addTagAttribute(const sp& node, const char* ns8, return addTagAttribute(node, ns8, attr8, value, errorOnFailedInsert, false); } -static void fullyQualifyClassName(const String8& package, sp node, +static void fullyQualifyClassName(const String8& package, const sp& node, const String16& attrName) { XMLNode::attribute_entry* attr = node->editAttribute( String16("http://schemas.android.com/apk/res/android"), attrName); @@ -1339,7 +1339,7 @@ status_t buildResources(Bundle* bundle, const sp& assets, spvalueAt(index), String8("values")); ssize_t res; while ((res=it.next()) == NO_ERROR) { - sp file = it.getFile(); + const sp& file = it.getFile(); res = compileResourceFile(bundle, assets, file, it.getParams(), (current!=assets), &table); if (res != NO_ERROR) { @@ -2674,7 +2674,7 @@ status_t writeResourceSymbols(Bundle* bundle, const sp& assets, String8 dest(bundle->getRClassDir()); if (bundle->getMakePackageDirs()) { - String8 pkg(package); + const String8& pkg(package); const char* last = pkg.string(); const char* s = last-1; do { -- cgit v1.2.3-59-g8ed1b