Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bd37ba4 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

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
parent d0197ac3
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -103,7 +103,7 @@ struct AaptGroupEntry
{
{
public:
public:
    AaptGroupEntry() {}
    AaptGroupEntry() {}
    AaptGroupEntry(const ConfigDescription& config) : mParams(config) {}
    explicit AaptGroupEntry(const ConfigDescription& config) : mParams(config) {}


    bool initFromDirName(const char* dir, String8* resType);
    bool initFromDirName(const char* dir, String8* resType);


@@ -312,7 +312,7 @@ public:
        : isPublic(false), isJavaSymbol(false), typeCode(TYPE_UNKNOWN)
        : isPublic(false), isJavaSymbol(false), typeCode(TYPE_UNKNOWN)
    {
    {
    }
    }
    AaptSymbolEntry(const String8& _name)
    explicit AaptSymbolEntry(const String8& _name)
        : name(_name), isPublic(false), isJavaSymbol(false), typeCode(TYPE_UNKNOWN)
        : name(_name), isPublic(false), isJavaSymbol(false), typeCode(TYPE_UNKNOWN)
    {
    {
    }
    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@ class AaptFile;


class ApkBuilder : public android::RefBase {
class ApkBuilder : public android::RefBase {
public:
public:
    ApkBuilder(const sp<WeakResourceFilter>& configFilter);
    explicit ApkBuilder(const sp<WeakResourceFilter>& configFilter);


    /**
    /**
     * Tells the builder to generate a separate APK for resources that
     * Tells the builder to generate a separate APK for resources that
+1 −1
Original line number Original line Diff line number Diff line
@@ -51,7 +51,7 @@ private:
class SystemCacheUpdater : public CacheUpdater {
class SystemCacheUpdater : public CacheUpdater {
public:
public:
    // Constructor to set bundle to pass to preProcessImage
    // Constructor to set bundle to pass to preProcessImage
    SystemCacheUpdater (Bundle* b)
    explicit SystemCacheUpdater (Bundle* b)
        : bundle(b) { };
        : bundle(b) { };


    // Make sure all the directories along this path exist
    // Make sure all the directories along this path exist
+2 −2
Original line number Original line Diff line number Diff line
@@ -248,7 +248,7 @@ bail:
}
}


static void printResolvedResourceAttribute(const ResTable& resTable, const ResXMLTree& tree,
static void printResolvedResourceAttribute(const ResTable& resTable, const ResXMLTree& tree,
        uint32_t attrRes, String8 attrLabel, String8* outError)
        uint32_t attrRes, const String8& attrLabel, String8* outError)
{
{
    Res_value value;
    Res_value value;
    AaptXml::getResolvedResourceAttribute(resTable, tree, attrRes, &value, outError);
    AaptXml::getResolvedResourceAttribute(resTable, tree, attrRes, &value, outError);
@@ -399,7 +399,7 @@ static void printUsesImpliedPermission(const String8& name, const String8& reaso
            ResTable::normalizeForOutput(reason.string()).string());
            ResTable::normalizeForOutput(reason.string()).string());
}
}


Vector<String8> getNfcAidCategories(AssetManager& assets, String8 xmlPath, bool offHost,
Vector<String8> getNfcAidCategories(AssetManager& assets, const String8& xmlPath, bool offHost,
        String8 *outError = NULL)
        String8 *outError = NULL)
{
{
    Asset* aidAsset = assets.openNonAsset(xmlPath, Asset::ACCESS_BUFFER);
    Asset* aidAsset = assets.openNonAsset(xmlPath, Asset::ACCESS_BUFFER);
+1 −1
Original line number Original line Diff line number Diff line
@@ -29,7 +29,7 @@ struct ConfigDescription : public android::ResTable_config {
        size = sizeof(android::ResTable_config);
        size = sizeof(android::ResTable_config);
    }
    }


    ConfigDescription(const android::ResTable_config&o) {
    ConfigDescription(const android::ResTable_config&o) {  // NOLINT(implicit)
        *static_cast<android::ResTable_config*>(this) = o;
        *static_cast<android::ResTable_config*>(this) = o;
        size = sizeof(android::ResTable_config);
        size = sizeof(android::ResTable_config);
    }
    }
Loading