aboutsummaryrefslogtreecommitdiff
path: root/pw_hex_dump/hex_dump.cc
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2023-08-14 15:38:30 -0700
committerXin Li <delphij@google.com>2023-08-14 15:38:30 -0700
commitbddf63953e111d742b591c1c0c7c34bcda8a51c7 (patch)
tree3a93128bff4b737b24b0c9581922c0b20410f0f4 /pw_hex_dump/hex_dump.cc
parentee890da55c82b95deca3518d5f3777e3d8ca9f0e (diff)
parentfbb9890f8922aa55fde183655a0017e69127ea4b (diff)
downloadpigweed-tmp_amf_298295554.tar.gz
Merge Android U (ab/10368041)tmp_amf_298295554
Bug: 291102124 Merged-In: I10c41adb8fe3e126cfa4ff2f49b15863fff379de Change-Id: I66f7a6cccaafc173d3924dae62a736c6c53520c7
Diffstat (limited to 'pw_hex_dump/hex_dump.cc')
-rw-r--r--pw_hex_dump/hex_dump.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/pw_hex_dump/hex_dump.cc b/pw_hex_dump/hex_dump.cc
index 1758b528f..e13b45b37 100644
--- a/pw_hex_dump/hex_dump.cc
+++ b/pw_hex_dump/hex_dump.cc
@@ -66,7 +66,7 @@ void AddGroupingByte(size_t byte_index,
} // namespace
-Status DumpAddr(std::span<char> dest, uintptr_t addr) {
+Status DumpAddr(span<char> dest, uintptr_t addr) {
if (dest.data() == nullptr) {
return Status::InvalidArgument();
}
@@ -145,15 +145,15 @@ Status FormattedHexDumper::DumpLine() {
// easy way to control zero padding for hex address.
if (flags.prefix_mode != AddressMode::kDisabled) {
uintptr_t val;
+ size_t significant;
if (flags.prefix_mode == AddressMode::kAbsolute) {
val = reinterpret_cast<uintptr_t>(source_data_.data());
builder << "0x";
- uint8_t significant = HexDigitCount(val);
+ significant = HexDigitCount(val);
builder.append(sizeof(uintptr_t) * 2 - significant, '0');
} else {
val = current_offset_;
- size_t significant =
- HexDigitCount(source_data_.size_bytes() + current_offset_);
+ significant = HexDigitCount(val);
if (significant < kMinOffsetChars) {
builder.append(kMinOffsetChars - significant, '0');
}
@@ -161,7 +161,7 @@ Status FormattedHexDumper::DumpLine() {
if (val != 0) {
builder << reinterpret_cast<void*>(val);
} else {
- builder.append(2, '0');
+ builder.append(significant, '0');
}
builder << kAddressSeparator;
}
@@ -198,7 +198,7 @@ Status FormattedHexDumper::DumpLine() {
return builder.status();
}
-Status FormattedHexDumper::SetLineBuffer(std::span<char> dest) {
+Status FormattedHexDumper::SetLineBuffer(span<char> dest) {
if (dest.data() == nullptr || dest.size_bytes() == 0) {
return Status::InvalidArgument();
}