From 2bd189255e26e9e65c3c19a32e502ec7aa73a8b7 Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 31 May 2016 21:23:55 +0200 Subject: [PATCH] Remove trailing spaces in px --- libr/util/print.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/libr/util/print.c b/libr/util/print.c index 9e73af1189..f01bc42861 100644 --- a/libr/util/print.c +++ b/libr/util/print.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2007-2015 - pancake */ +/* radare - LGPL - Copyright 2007-2016 - pancake */ #include "r_anal.h" #include "r_cons.h" @@ -414,7 +414,7 @@ static void print_c_code(RPrint *p, ut64 addr, ut8 *buf, int len, int ws, int w) } R_API void r_print_code(RPrint *p, ut64 addr, ut8 *buf, int len, char lang) { - int ws, i, w = p->cols*0.7; + int i, w = p->cols*0.7; switch (lang) { case '?': eprintf ("Valid print code formats are: JSON, C, Python, Cstring (pcj, pc, pcp, pcs) \n" @@ -682,7 +682,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba if (use_segoff) { ut32 s, a; a = addr & 0xffff; - s = ((addr-a)>>4 ) &0xffff; + s = ((addr - a) >> 4) & 0xffff; snprintf (soff, sizeof (soff), "%04x:%04x ", s, a); printfmt ("- offset -"); } else { @@ -708,8 +708,9 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba printfmt (col != 1 ? " " : ((i + 1) < inc) ? " " : "|"); } printfmt ((col == 2) ? "|" : " "); - for (i = 0; i < inc; i++) + for (i = 0; i < inc; i++) { printfmt ("%c", hex[(i+k)%16]); + } printfmt (col == 2 ? "|\n" : "\n"); } } @@ -783,7 +784,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba r_print_cursor (p, j, 0); j += step - 1; } else if (base == -8) { - printfmt(" %d=%c=%X ", -base, 0x3d, 13); + printfmt (" %d=%c=%X ", -base, 0x3d, 13); j += 3; } else if (base == -1) { st8 *w = (st8*)(buf+j); @@ -797,29 +798,35 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba printfmt ("%13d ", *w); j += 3; } else { - if (j>=len) { + if (j >= len) { break; } r_print_byte (p, fmt, j, buf[j]); if (j%2 || !pairs) { if (col==1) { - if (j+1= len) printfmt (" "); - else r_print_byte (p, "%c", j, buf[j]); + for (j = i; j < i + inc; j++) { + if (j >= len) { + break; + } + r_print_byte (p, "%c", j, buf[j]); } if (col == 2) printfmt("|"); if (p && p->flags & R_PRINT_FLAGS_REFS) { ut64 *foo = (ut64*)(buf+i); ut64 addr = *foo; - if (base == 32) addr &= UT32_MAX; + if (base == 32) { + addr &= UT32_MAX; + } if (p->hasrefs) { const char *rstr = p->hasrefs (p->user, addr); if (rstr && *rstr)