diff options
Diffstat (limited to 'pw_hex_dump/hex_dump.cc')
-rw-r--r-- | pw_hex_dump/hex_dump.cc | 12 |
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(); } |