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

Commit f3635039 authored by Dan Albert's avatar Dan Albert Committed by android-build-merger
Browse files

Merge "Indicate that a packet was truncated." am: 04616095 am: e76c8020 am: c83ec67e

am: 6c95c3ed

Change-Id: Iac3a13f340da4bc522528742100d5ce21164fc55
parents f301aec0 6c95c3ed
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -157,7 +157,12 @@ bool mkdirs(const std::string& path) {
}
}


std::string dump_hex(const void* data, size_t byte_count) {
std::string dump_hex(const void* data, size_t byte_count) {
    byte_count = std::min(byte_count, size_t(16));
    size_t truncate_len = 16;
    bool truncated = false;
    if (byte_count > truncate_len) {
        byte_count = truncate_len;
        truncated = true;
    }


    const uint8_t* p = reinterpret_cast<const uint8_t*>(data);
    const uint8_t* p = reinterpret_cast<const uint8_t*>(data);


@@ -172,6 +177,10 @@ std::string dump_hex(const void* data, size_t byte_count) {
        line.push_back(isprint(ch) ? ch : '.');
        line.push_back(isprint(ch) ? ch : '.');
    }
    }


    if (truncated) {
        line += " [truncated]";
    }

    return line;
    return line;
}
}