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

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

Fix/suppress bugprone-branch-clone warnings

* bugprone-* are treated as errors.

Bug: 155034972
Test: make tidy-soong_subset
Change-Id: I122f89cec98a514e2d48f1ff136bb7ead5f66b4e
parent c9f2c53a
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -565,9 +565,7 @@ AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream,
                                      int64_t *timeNanoseconds)
{
    AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
    if (framePosition == nullptr) {
        return AAUDIO_ERROR_NULL;
    } else if (timeNanoseconds == nullptr) {
    if (framePosition == nullptr || timeNanoseconds == nullptr) {
        return AAUDIO_ERROR_NULL;
    } else if (clockid != CLOCK_MONOTONIC && clockid != CLOCK_BOOTTIME) {
        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
+0 −1
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@ aaudio_result_t AAudioStreamParameters::validate() const {
    switch (mSessionId) {
        case AAUDIO_SESSION_ID_NONE:
        case AAUDIO_SESSION_ID_ALLOCATE:
            break;
        default:
            break;
    }
+2 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ nsecs_t MediaMetricsService::roundTime(nsecs_t timeNs)
bool MediaMetricsService::useUidForPackage(
        const std::string& package, const std::string& installer)
{
    // NOLINTBEGIN(bugprone-branch-clone)
    if (strchr(package.c_str(), '.') == nullptr) {
        return false;  // not of form 'com.whatever...'; assume internal and ok
    } else if (strncmp(package.c_str(), "android.", 8) == 0) {
@@ -85,6 +86,7 @@ bool MediaMetricsService::useUidForPackage(
    } else {
        return true;  // we're not sure where it came from, use uid only.
    }
    // NOLINTEND(bugprone-branch-clone)
}

/* static */
+4 −6
Original line number Diff line number Diff line
@@ -99,16 +99,14 @@ bool statsd_audiorecord(const std::shared_ptr<const mediametrics::Item>& item,
    }

    int32_t error_code = -1;
    if (item->getInt32("android.media.audiorecord.errcode", &error_code)) {
        metrics_proto.set_error_code(error_code);
    } else if (item->getInt32("android.media.audiorecord.lastError.code", &error_code)) {
    if (item->getInt32("android.media.audiorecord.errcode", &error_code) ||
        item->getInt32("android.media.audiorecord.lastError.code", &error_code)) {
        metrics_proto.set_error_code(error_code);
    }

    std::string error_function;
    if (item->getString("android.media.audiorecord.errfunc", &error_function)) {
        metrics_proto.set_error_function(error_function);
    } else if (item->getString("android.media.audiorecord.lastError.at", &error_function)) {
    if (item->getString("android.media.audiorecord.errfunc", &error_function) ||
        item->getString("android.media.audiorecord.lastError.at", &error_function)) {
        metrics_proto.set_error_function(error_function);
    }