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

Commit 44859db7 authored by Adam Lesinski's avatar Adam Lesinski Committed by Android (Google) Code Review
Browse files

Merge "AAPT2: Variety of small fixes to get the build working"

parents e7d716d5 52364f7a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,11 @@ using android::ResTable_config;

static const char* kWildcardName = "any";

const ConfigDescription& ConfigDescription::defaultConfig() {
    static ConfigDescription config = {};
    return config;
}

static bool parseMcc(const char* name, ResTable_config* out) {
    if (strcmp(name, kWildcardName) == 0) {
        if (out) out->mcc = 0;
+5 −0
Original line number Diff line number Diff line
@@ -29,6 +29,11 @@ namespace aapt {
 * initialization and comparison methods.
 */
struct ConfigDescription : public android::ResTable_config {
    /**
     * Returns an immutable default config.
     */
    static const ConfigDescription& defaultConfig();

    /*
     * Parse a string of the form 'fr-sw600dp-land' and fill in the
     * given ResTable_config with resulting configuration parameters.
+15 −0
Original line number Diff line number Diff line
@@ -210,4 +210,19 @@ void Debug::printStyleGraph(ResourceTable* table, const ResourceName& targetStyl
    std::cout << "}" << std::endl;
}

void Debug::dumpHex(const void* data, size_t len) {
    const uint8_t* d = (const uint8_t*) data;
    for (size_t i = 0; i < len; i++) {
        std::cerr << std::hex << std::setfill('0') << std::setw(2) << (uint32_t) d[i] << " ";
        if (i % 8 == 7) {
            std::cerr << "\n";
        }
    }

    if (len - 1 % 8 != 7) {
        std::cerr << std::endl;
    }
}


} // namespace aapt
+4 −0
Original line number Diff line number Diff line
@@ -20,12 +20,16 @@
#include "Resource.h"
#include "ResourceTable.h"

// Include for printf-like debugging.
#include <iostream>

namespace aapt {

struct Debug {
    static void printTable(ResourceTable* table);
    static void printStyleGraph(ResourceTable* table,
                                const ResourceName& targetStyle);
    static void dumpHex(const void* data, size_t len);
};

} // namespace aapt
+4 −2
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ Flags& Flags::optionalSwitch(const StringPiece& name, const StringPiece& descrip
}

void Flags::usage(const StringPiece& command, std::ostream* out) {
    constexpr size_t kWidth = 50;

    *out << command << " [options]";
    for (const Flag& flag : mFlags) {
        if (flag.required) {
@@ -100,11 +102,11 @@ void Flags::usage(const StringPiece& command, std::ostream* out) {
        // the first line) followed by the description line. This will make sure that multiline
        // descriptions are still right justified and aligned.
        for (StringPiece line : util::tokenize<char>(flag.description, '\n')) {
            *out << " " << std::setw(30) << std::left << argLine << line << "\n";
            *out << " " << std::setw(kWidth) << std::left << argLine << line << "\n";
            argLine = " ";
        }
    }
    *out << " " << std::setw(30) << std::left << "-h" << "Displays this help menu\n";
    *out << " " << std::setw(kWidth) << std::left << "-h" << "Displays this help menu\n";
    out->flush();
}

Loading