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

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

Fix clang-tidy warnings in bootable/recovery.

* Use const reference type for read-only parameters.
Bug: 30407689
* Use faster overloaded string find function.
Bug: 30411878
* Add parentheses around macro parameters.
Bug: 28705665

Test: build with WITH_TIDY=1
Change-Id: I4e8e5748bfa4ae89871f1fb5fa4624d372530d75
parent b3ddc0a4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -54,8 +54,8 @@ static const float DEFAULT_FILES_PROGRESS_FRACTION = 0.4;
static const float DEFAULT_IMAGE_PROGRESS_FRACTION = 0.1;

// This function parses and returns the build.version.incremental
static int parse_build_number(std::string str) {
    size_t pos = str.find("=");
static int parse_build_number(const std::string& str) {
    size_t pos = str.find('=');
    if (pos != std::string::npos) {
        std::string num_string = android::base::Trim(str.substr(pos+1));
        int build_number;
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ static bool file_cmp(std::string& f1, std::string& f2) {
    return c1 == c2;
}

static std::string from_testdata_base(const std::string fname) {
static std::string from_testdata_base(const std::string& fname) {
    return android::base::StringPrintf("%s%s%s/%s",
            &DATA_PATH[0],
            &NATIVE_TEST_PATH[0],
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ void* WearSwipeDetector::touch_thread(void* cookie) {
    return NULL;
}

#define test_bit(bit, array)    (array[bit/8] & (1<<(bit%8)))
#define test_bit(bit, array)    ((array)[(bit)/8] & (1<<((bit)%8)))

int WearSwipeDetector::openDevice(const char *device) {
    int fd = open(device, O_RDONLY);