From fe9c41db5e4f2916439dd268a1b5e65447396ce3 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 2 Jan 2022 19:06:00 -0800 Subject: some verbose display stuff --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6a3d3ac..3e9b887 100644 --- a/src/main.rs +++ b/src/main.rs @@ -161,7 +161,7 @@ fn with_parsed_superh( // yaxpeax-arch while older decoders are still being updated. mod current_arch { use yaxpeax_arch_02::{AddressBase, Arch, Decoder, Instruction, LengthedInstruction, Reader, U8Reader}; - use yaxpeax_arch_02::{AnnotatingDecoder, FieldDescription, VecSink}; + use yaxpeax_arch_02::annotation::{AnnotatingDecoder, FieldDescription, VecSink}; use std::fmt; use num_traits::identities::Zero; @@ -351,19 +351,21 @@ mod current_arch { let mut fudge = 0; let mut col = [b' '; 160]; + let mut line_end = 0; for i in 0..160 { - if (i >> 3) >= data.len() { + if (i >> 3) > data.len() { continue; } if boundaries[i] { col[i + fudge] = b'|'; + line_end = i + fudge + 1; } if fudge_bits[i] { fudge += 1; } } - res.push_str(unsafe { std::str::from_utf8_unchecked(&col) }); + res.push_str(unsafe { std::str::from_utf8_unchecked(&col[..line_end]) }); res.push_str("\n"); for (field_index, bit) in boundary_order { @@ -371,7 +373,7 @@ mod current_arch { let mut col = [b' '; 160]; for i in 0..160 { - if (i >> 3) >= data.len() { + if (i >> 3) > data.len() { continue; } -- cgit v1.1