diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-06-27 22:50:46 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-06-27 22:50:48 +0000 |
commit | d125ee19bb9e2e48c305f1a72083a3caeaf364ed (patch) | |
tree | 4c2087af3f9ecc62bae60c0ae619229145be7633 | |
parent | c730b465b18017c9f26c37a2c34d586e406559b4 (diff) | |
parent | 33a98e1862ea1cad0439241e6c17c537c9db16e6 (diff) | |
download | adb-d125ee19bb9e2e48c305f1a72083a3caeaf364ed.tar.gz |
Merge "Indicate that a packet was truncated."
-rw-r--r-- | adb_utils.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/adb_utils.cpp b/adb_utils.cpp index bb26e70..b236fb3 100644 --- a/adb_utils.cpp +++ b/adb_utils.cpp @@ -157,7 +157,12 @@ bool mkdirs(const std::string& path) { } 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); @@ -172,6 +177,10 @@ std::string dump_hex(const void* data, size_t byte_count) { line.push_back(isprint(ch) ? ch : '.'); } + if (truncated) { + line += " [truncated]"; + } + return line; } |