mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-17 20:58:14 +00:00
Add asm.decoff
This commit is contained in:
parent
9b573dc996
commit
52dd1f85f0
@ -1131,9 +1131,10 @@ static int pdi(RCore *core, int nb_opcodes, int nb_bytes, int fmt) {
|
||||
} // do not show flags in pie
|
||||
}
|
||||
if (show_offset) {
|
||||
const int show_offseg = 0;
|
||||
const int show_offseg = core->print->flags & R_PRINT_FLAGS_ADDRMOD;
|
||||
const int show_offdec = core->print->flags & R_PRINT_FLAGS_ADDRDEC;
|
||||
ut64 at = core->offset + i;
|
||||
r_print_offset (core->print, at, 0, show_offseg, 0, NULL);
|
||||
r_print_offset (core->print, at, 0, show_offseg, show_offdec, 0, NULL);
|
||||
}
|
||||
// r_cons_printf ("0x%08"PFMT64x" ", core->offset+i);
|
||||
if (ret < 1) {
|
||||
@ -3479,7 +3480,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
for (i = c = 0; i < len; i++,c++) {
|
||||
if (c == 0) {
|
||||
r_print_offset (core->print,
|
||||
core->offset + i, 0, 0, 0, NULL);
|
||||
core->offset + i, 0, 0, 0, 0, NULL);
|
||||
}
|
||||
r_str_bits (buf, core->block+i, 8, NULL);
|
||||
SPLIT_BITS (buf);
|
||||
@ -4082,7 +4083,10 @@ static int lenof (ut64 off, int two) {
|
||||
}
|
||||
|
||||
// TODO : move to r_util? .. depends on r_cons...
|
||||
R_API void r_print_offset(RPrint *p, ut64 off, int invert, int offseg, int delta, const char *label) {
|
||||
// XXX: dupe of r_print_addr
|
||||
R_API void r_print_offset(RPrint *p, ut64 off, int invert, int offseg, int offdec, int delta, const char *label) {
|
||||
char space[32] = { 0 };
|
||||
const char *white;
|
||||
bool show_color = p->flags & R_PRINT_FLAGS_COLOR;
|
||||
if (show_color) {
|
||||
const char *k = r_cons_singleton ()->pal.offset; // TODO etooslow. must cache
|
||||
@ -4093,8 +4097,14 @@ R_API void r_print_offset(RPrint *p, ut64 off, int invert, int offseg, int delta
|
||||
ut32 s, a;
|
||||
a = off & 0xffff;
|
||||
s = (off - a) >> 4;
|
||||
r_cons_printf ("%s%04x:%04x"Color_RESET,
|
||||
k, s & 0xFFFF, a & 0xFFFF);
|
||||
if (offdec) {
|
||||
snprintf (space, sizeof (space), "%d:%d", s & 0xffff, a & 0xffff);
|
||||
white = r_str_pad (' ', 9 - strlen (space));
|
||||
r_cons_printf ("%s%s%s"Color_RESET, k, white, space);
|
||||
} else {
|
||||
r_cons_printf ("%s%04x:%04x"Color_RESET,
|
||||
k, s & 0xFFFF, a & 0xFFFF);
|
||||
}
|
||||
} else {
|
||||
int sz = lenof (off, 0);
|
||||
int sz2 = lenof (delta, 1);
|
||||
@ -4102,18 +4112,33 @@ R_API void r_print_offset(RPrint *p, ut64 off, int invert, int offseg, int delta
|
||||
if (label) {
|
||||
const int label_padding = 10;
|
||||
if (delta > 0) {
|
||||
const char *pad = r_str_pad (' ', sz - sz2 + label_padding);
|
||||
r_cons_printf ("%s%s"Color_RESET"+0x%x%s", k, label, delta, pad);
|
||||
if (offdec) {
|
||||
const char *pad = r_str_pad (' ', sz - sz2 + label_padding);
|
||||
r_cons_printf ("%s%s"Color_RESET"+%d%s", k, label, delta, pad);
|
||||
} else {
|
||||
const char *pad = r_str_pad (' ', sz - sz2 + label_padding);
|
||||
r_cons_printf ("%s%s"Color_RESET"+0x%x%s", k, label, delta, pad);
|
||||
}
|
||||
} else {
|
||||
const char *pad = r_str_pad (' ', sz + label_padding);
|
||||
r_cons_printf ("%s%s"Color_RESET"%s", k, label, pad);
|
||||
}
|
||||
} else {
|
||||
const char *pad = r_str_pad (' ', sz - sz2);
|
||||
r_cons_printf ("%s+0x%x"Color_RESET, pad, delta);
|
||||
if (offdec) {
|
||||
r_cons_printf ("%s+%d"Color_RESET, pad, delta);
|
||||
} else {
|
||||
r_cons_printf ("%s+0x%x"Color_RESET, pad, delta);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
r_cons_printf ("%s0x%08"PFMT64x""Color_RESET, k, off);
|
||||
if (offdec) {
|
||||
snprintf (space, sizeof (space), "%"PFMT64d, off);
|
||||
white = r_str_pad (' ', 10 - strlen (space));
|
||||
r_cons_printf ("%s%s%s"Color_RESET, k, white, space, off);
|
||||
} else {
|
||||
r_cons_printf ("%s0x%08"PFMT64x""Color_RESET, k, off);
|
||||
}
|
||||
}
|
||||
}
|
||||
r_cons_print (" ");
|
||||
@ -4122,15 +4147,31 @@ R_API void r_print_offset(RPrint *p, ut64 off, int invert, int offseg, int delta
|
||||
ut32 s, a;
|
||||
a = off & 0xffff;
|
||||
s = (off - a) >> 4;
|
||||
r_cons_printf ("%04x:%04x", s & 0xFFFF, a & 0xFFFF);
|
||||
if (offdec) {
|
||||
snprintf (space, sizeof (space), "%d:%d", s & 0xffff, a & 0xffff);
|
||||
white = r_str_pad (' ', 9 - strlen (space));
|
||||
r_cons_printf ("%s%s"Color_RESET, white, space);
|
||||
} else {
|
||||
r_cons_printf ("%04x:%04x", s & 0xFFFF, a & 0xFFFF);
|
||||
}
|
||||
} else {
|
||||
int sz = lenof (off, 0);
|
||||
int sz2 = lenof (delta, 1);
|
||||
const char *pad = r_str_pad (' ', sz - 5 - sz2 - 3);
|
||||
if (delta>0) {
|
||||
r_cons_printf ("%s+0x%x"Color_RESET, pad, delta);
|
||||
if (delta > 0) {
|
||||
if (offdec) {
|
||||
r_cons_printf ("%s+%d"Color_RESET, pad, delta);
|
||||
} else {
|
||||
r_cons_printf ("%s+0x%x"Color_RESET, pad, delta);
|
||||
}
|
||||
} else {
|
||||
r_cons_printf ("0x%08"PFMT64x" ", off);
|
||||
if (offdec) {
|
||||
snprintf (space, sizeof (space), "%"PFMT64d, off);
|
||||
white = r_str_pad (' ', 10 - strlen (space));
|
||||
r_cons_printf ("%s%s", white, space);
|
||||
} else {
|
||||
r_cons_printf ("0x%08"PFMT64x" ", off);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -711,6 +711,18 @@ static int cb_color(void *user, void *data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cb_decoff(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
if (node->i_value) {
|
||||
core->print->flags |= R_PRINT_FLAGS_ADDRDEC;
|
||||
} else {
|
||||
core->print->flags &= (~R_PRINT_FLAGS_ADDRDEC);
|
||||
}
|
||||
r_print_set_flags (core->print, core->print->flags);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cb_dbgbep(void *user, void *data) {
|
||||
RConfigNode *node = (RConfigNode*) data;
|
||||
if (*node->value == '?') {
|
||||
@ -1227,9 +1239,11 @@ static int cb_searchalign(void *user, void *data) {
|
||||
static int cb_segoff(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
if (node->i_value)
|
||||
if (node->i_value) {
|
||||
core->print->flags |= R_PRINT_FLAGS_SEGOFF;
|
||||
else core->print->flags &= (((ut32)-1) & (~R_PRINT_FLAGS_SEGOFF));
|
||||
} else {
|
||||
core->print->flags &= (((ut32)-1) & (~R_PRINT_FLAGS_SEGOFF));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1719,6 +1733,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETCB("asm.cpu", R_SYS_ARCH, &cb_asmcpu, "Set the kind of asm.arch cpu");
|
||||
SETCB("asm.parser", "x86.pseudo", &cb_asmparser, "Set the asm parser to use");
|
||||
SETCB("asm.segoff", "false", &cb_segoff, "Show segmented address in prompt (x86-16)");
|
||||
SETCB("asm.decoff", "false", &cb_decoff, "Show segmented address in prompt (x86-16)");
|
||||
SETCB("asm.syntax", "intel", &cb_asmsyntax, "Select assembly syntax");
|
||||
SETI("asm.nbytes", 6, "Number of bytes for each opcode at disassembly");
|
||||
SETPREF("asm.bytespace", "false", "Separate hexadecimal bytes with a whitespace");
|
||||
|
@ -78,6 +78,7 @@ typedef struct r_disam_options_t {
|
||||
int adistrick;
|
||||
int asm_demangle;
|
||||
bool show_offset;
|
||||
bool show_offdec; // dupe for r_print->flags
|
||||
bool show_bbline;
|
||||
bool show_emu;
|
||||
bool show_emu_str;
|
||||
@ -390,6 +391,7 @@ static RDisasmState * ds_init(RCore *core) {
|
||||
ds->asm_demangle = r_config_get_i (core->config, "asm.demangle");
|
||||
ds->asm_describe = r_config_get_i (core->config, "asm.describe");
|
||||
ds->show_offset = r_config_get_i (core->config, "asm.offset");
|
||||
ds->show_offdec = r_config_get_i (core->config, "asm.decoff");
|
||||
ds->show_bbline = r_config_get_i (core->config, "asm.bbline");
|
||||
ds->show_section = r_config_get_i (core->config, "asm.section");
|
||||
ds->show_section_col = r_config_get_i (core->config, "asm.section.col");
|
||||
@ -1708,7 +1710,7 @@ static void ds_print_offset(RDisasmState *ds) {
|
||||
}
|
||||
}
|
||||
r_print_offset (core->print, ds->at, (ds->at == ds->dest),
|
||||
ds->show_offseg, delta, label);
|
||||
ds->show_offseg, ds->show_offdec, delta, label);
|
||||
}
|
||||
if (ds->atabsoff > 0) {
|
||||
if (ds->_tabsoff != ds->atabsoff) {
|
||||
|
@ -20,6 +20,7 @@ extern "C" {
|
||||
#define R_PRINT_FLAGS_OFFSET 0x00000040
|
||||
#define R_PRINT_FLAGS_REFS 0x00000080
|
||||
#define R_PRINT_FLAGS_DIFFOUT 0x00000100 /* only show different rows in `cc` hexdiffing */
|
||||
#define R_PRINT_FLAGS_ADDRDEC 0x00000200
|
||||
|
||||
typedef int (*RPrintZoomCallback)(void *user, int mode, ut64 addr, ut8 *bufz, ut64 size);
|
||||
typedef const char *(*RPrintNameCallback)(void *user, ut64 addr);
|
||||
@ -99,7 +100,7 @@ R_API void r_print_set_interrupt(int i);
|
||||
R_API char *r_print_hexpair(RPrint *p, const char *str, int idx);
|
||||
R_API RPrint *r_print_new(void);
|
||||
R_API RPrint *r_print_free(RPrint *p);
|
||||
R_API int r_print_mute(RPrint *p, int x);
|
||||
R_API bool r_print_mute(RPrint *p, int x);
|
||||
R_API void r_print_set_flags(RPrint *p, int _flags);
|
||||
R_API void r_print_unset_flags(RPrint *p, int flags);
|
||||
R_API void r_print_addr(RPrint *p, ut64 addr);
|
||||
@ -132,7 +133,7 @@ R_API void r_print_code(RPrint *p, ut64 addr, ut8 *buf, int len, char lang);
|
||||
R_API int r_print_format_struct_size(const char *format, RPrint *p, int mode);
|
||||
R_API int r_print_format(RPrint *p, ut64 seek, const ut8* buf, const int len, const char *fmt, int elem, const char *setval, char *field);
|
||||
R_API int r_print_format_length(const char *fmt);
|
||||
R_API void r_print_offset(RPrint *p, ut64 off, int invert, int opt, int delta, const char *label);
|
||||
R_API void r_print_offset(RPrint *p, ut64 off, int invert, int opt, int dec, int delta, const char *label);
|
||||
#define R_PRINT_STRING_WIDE 1
|
||||
#define R_PRINT_STRING_ZEROEND 2
|
||||
#define R_PRINT_STRING_URLENCODE 4
|
||||
|
@ -19,11 +19,11 @@ R_API int r_util_lines_getline (ut64 *lines_cache, int lines_cache_sz, ut64 off)
|
||||
imid = imin + ((imax - imin) / 2);
|
||||
if (lines_cache[imid] == off) {
|
||||
return imid + 1;
|
||||
}
|
||||
else if (lines_cache[imid] < off)
|
||||
} else if (lines_cache[imid] < off) {
|
||||
imin = imid + 1;
|
||||
else
|
||||
} else {
|
||||
imax = imid - 1;
|
||||
}
|
||||
}
|
||||
return imin;
|
||||
}
|
||||
@ -36,19 +36,20 @@ R_API void r_print_set_interrupted(int i) {
|
||||
IsInterrupted = i;
|
||||
}
|
||||
|
||||
R_API int r_print_mute(RPrint *p, int x) {
|
||||
R_API bool r_print_mute(RPrint *p, int x) {
|
||||
if (x) {
|
||||
if (p->cb_printf == &nullprinter)
|
||||
return 0;
|
||||
if (p->cb_printf == &nullprinter) {
|
||||
return false;
|
||||
}
|
||||
p->oprintf = p->cb_printf;
|
||||
p->cb_printf = nullprinter;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
if (p->cb_printf == nullprinter) {
|
||||
p->cb_printf = p->oprintf;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int r_print_stereogram_private(const char *bump, int w, int h, char *out, int size) {
|
||||
@ -59,8 +60,9 @@ static int r_print_stereogram_private(const char *bump, int w, int h, char *out,
|
||||
int x, y, s, l = 0, l2 = 0, ch;
|
||||
int skip = 7;
|
||||
int bumpi = 0, outi = 0;
|
||||
if (!bump || !out)
|
||||
if (!bump || !out) {
|
||||
return 0;
|
||||
}
|
||||
for (y = 0; bump[bumpi] && outi<size; y++) {
|
||||
l = l2 = 0;
|
||||
for (x = 0; bump[bumpi] && outi<size && x<w; x++) {
|
||||
@ -84,9 +86,10 @@ static int r_print_stereogram_private(const char *bump, int w, int h, char *out,
|
||||
ch = data[s];
|
||||
if (!ch) ch = *string;
|
||||
data[x] = ch;
|
||||
if (outi<size) {
|
||||
out[outi++] = ch;
|
||||
} else break;
|
||||
if (outi >= size) {
|
||||
break;
|
||||
}
|
||||
out[outi++] = ch;
|
||||
}
|
||||
out[outi++] = '\n';
|
||||
s = 'a';
|
||||
@ -105,10 +108,11 @@ static int r_print_stereogram_private(const char *bump, int w, int h, char *out,
|
||||
R_API char *r_print_stereogram(const char *bump, int w, int h) {
|
||||
ut64 size;
|
||||
char *out;
|
||||
if (w<1 || h<1)
|
||||
if (w < 1 || h < 1) {
|
||||
return NULL;
|
||||
}
|
||||
size = w * (ut64)h * 2;
|
||||
if (size>UT32_MAX) {
|
||||
if (size > UT32_MAX) {
|
||||
return NULL;
|
||||
}
|
||||
out = calloc (1, size * 2);
|
||||
@ -126,20 +130,21 @@ R_API char *r_print_stereogram_bytes(const ut8 *buf, int len) {
|
||||
char *ret, *bump;
|
||||
int scr_width = 80;
|
||||
int rows, cols, size;
|
||||
if (!buf || len<1)
|
||||
if (!buf || len < 1) {
|
||||
return NULL;
|
||||
|
||||
}
|
||||
//scr_width = r_cons_get_size (NULL) -10;
|
||||
cols = scr_width;
|
||||
rows = len / cols;
|
||||
|
||||
size = (2+cols) * rows;
|
||||
bump = malloc (size+1); //(cols+2) * rows);
|
||||
size = (2 + cols) * rows;
|
||||
bump = malloc (size + 1); //(cols+2) * rows);
|
||||
if (!bump) return NULL;
|
||||
for (i = bumpi = 0; bumpi < size && i < len; i++) {
|
||||
int v = buf[i] / 26;
|
||||
if (i && !(i%scr_width))
|
||||
if (i && !(i%scr_width)) {
|
||||
bump[bumpi++] = '\n';
|
||||
}
|
||||
bump[bumpi++] = '0' + v;
|
||||
}
|
||||
bump[bumpi] = 0;
|
||||
@ -151,9 +156,11 @@ R_API char *r_print_stereogram_bytes(const ut8 *buf, int len) {
|
||||
R_API void r_print_stereogram_print(RPrint *p, const char *ret) {
|
||||
int i;
|
||||
const int use_color = p->flags & R_PRINT_FLAGS_COLOR;
|
||||
if (!ret) return;
|
||||
if (!ret) {
|
||||
return;
|
||||
}
|
||||
if (use_color) {
|
||||
for (i=0; ret[i]; i++) {
|
||||
for (i = 0; ret[i]; i++) {
|
||||
p->cb_printf ("\x1b[%dm%c", 30+(ret[i]%8), ret[i]);
|
||||
}
|
||||
p->cb_printf ("\x1b[0m\n");
|
||||
@ -164,7 +171,9 @@ R_API void r_print_stereogram_print(RPrint *p, const char *ret) {
|
||||
|
||||
R_API RPrint *r_print_new() {
|
||||
RPrint *p = R_NEW0 (RPrint);
|
||||
if (!p) return NULL;
|
||||
if (!p) {
|
||||
return NULL;
|
||||
}
|
||||
strcpy (p->datefmt, "%Y-%m-%d %H:%M:%S %z");
|
||||
r_io_bind_init (p->iob);
|
||||
p->pairs = true;
|
||||
@ -202,7 +211,9 @@ R_API RPrint *r_print_new() {
|
||||
}
|
||||
|
||||
R_API RPrint *r_print_free(RPrint *p) {
|
||||
if (!p) return NULL;
|
||||
if (!p) {
|
||||
return NULL;
|
||||
}
|
||||
r_strht_free (p->formats);
|
||||
p->formats = NULL;
|
||||
if (p->zoom) {
|
||||
@ -226,49 +237,87 @@ R_API void r_print_unset_flags(RPrint *p, int flags) {
|
||||
}
|
||||
|
||||
R_API void r_print_set_cursor(RPrint *p, int enable, int ocursor, int cursor) {
|
||||
if (!p) return;
|
||||
if (!p) {
|
||||
return;
|
||||
}
|
||||
p->cur_enabled = enable;
|
||||
p->ocur = ocursor;
|
||||
if (cursor<0) cursor = 0;
|
||||
if (cursor < 0) {
|
||||
cursor = 0;
|
||||
}
|
||||
p->cur = cursor;
|
||||
}
|
||||
|
||||
R_API void r_print_cursor(RPrint *p, int cur, int set) {
|
||||
if (!p || !p->cur_enabled)
|
||||
if (!p || !p->cur_enabled) {
|
||||
return;
|
||||
}
|
||||
if (p->ocur != -1) {
|
||||
int from = p->ocur;
|
||||
int to = p->cur;
|
||||
r_num_minmax_swap_i (&from, &to);
|
||||
if (cur>=from && cur<=to)
|
||||
if (cur >= from && cur <= to) {
|
||||
p->cb_printf ("%s", R_CONS_INVERT (set, 1));
|
||||
} else
|
||||
if (cur==p->cur)
|
||||
}
|
||||
} else if (cur == p->cur) {
|
||||
p->cb_printf ("%s", R_CONS_INVERT (set, 1));
|
||||
}
|
||||
}
|
||||
|
||||
R_API void r_print_addr(RPrint *p, ut64 addr) {
|
||||
char space[32] = { 0 };
|
||||
const char *white;
|
||||
#define PREOFF(x) (p && p->cons &&p->cons->pal.x)?p->cons->pal.x
|
||||
PrintfCallback printfmt = (PrintfCallback) (p? p->cb_printf: printf);
|
||||
int mod = p? (p->flags & R_PRINT_FLAGS_ADDRMOD): 0;
|
||||
char ch = p? ((p->addrmod&&mod)?((addr%p->addrmod)?' ':','):' '): ' ';
|
||||
int use_color = p? (p->flags & R_PRINT_FLAGS_COLOR): 0;
|
||||
int use_segoff = p? (p->flags & R_PRINT_FLAGS_SEGOFF): 0;
|
||||
bool use_segoff = p? (p->flags & R_PRINT_FLAGS_SEGOFF): false;
|
||||
bool use_color = p? (p->flags & R_PRINT_FLAGS_COLOR): false;
|
||||
bool dec = p? (p->flags & R_PRINT_FLAGS_ADDRDEC): false;
|
||||
bool mod = p? (p->flags & R_PRINT_FLAGS_ADDRMOD): false;
|
||||
char ch = p? ((p->addrmod && mod)? ((addr % p->addrmod)? ' ': ','): ' '): ' ';
|
||||
if (use_segoff) {
|
||||
ut32 s, a;
|
||||
a = addr & 0xffff;
|
||||
s = (addr-a)>>4;
|
||||
s = (addr - a) >> 4;
|
||||
if (dec) {
|
||||
snprintf (space, sizeof (space), "%d:%d", s & 0xffff, a & 0xffff);
|
||||
white = r_str_pad (' ', 9 - strlen (space));
|
||||
}
|
||||
if (use_color) {
|
||||
const char *pre = PREOFF(offset): Color_GREEN;
|
||||
const char *fin = Color_RESET;
|
||||
printfmt ("%s%04x:%04x%c%s", pre, s & 0xffff, a & 0xffff, ch, fin);
|
||||
} else printfmt ("%04x:%04x%c", s & 0xffff, a & 0xffff, ch);
|
||||
if (dec) {
|
||||
printfmt ("%s%s%s%c%s", pre, white, space, ch, fin);
|
||||
} else {
|
||||
printfmt ("%s%04x:%04x%c%s", pre, s & 0xffff, a & 0xffff, ch, fin);
|
||||
}
|
||||
} else {
|
||||
if (dec) {
|
||||
printfmt ("%s%s%c", white, space, ch);
|
||||
} else {
|
||||
printfmt ("%04x:%04x%c", s & 0xffff, a & 0xffff, ch);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (dec) {
|
||||
snprintf (space, sizeof (space), "%"PFMT64d, addr);
|
||||
int w = R_MAX (10 - strlen (space), 0);
|
||||
white = r_str_pad (' ', w);
|
||||
}
|
||||
if (use_color) {
|
||||
const char *pre = PREOFF(offset): Color_GREEN;
|
||||
const char *fin = Color_RESET;
|
||||
printfmt ("%s0x%08"PFMT64x"%c%s", pre, addr, ch, fin);
|
||||
} else printfmt ("0x%08"PFMT64x"%c", addr, ch);
|
||||
if (dec) {
|
||||
printfmt ("%s%s%"PFMT64d"%c%s", pre, white, addr, ch, fin);
|
||||
} else {
|
||||
printfmt ("%s0x%08"PFMT64x"%c%s", pre, addr, ch, fin);
|
||||
}
|
||||
} else {
|
||||
if (dec) {
|
||||
printfmt ("%s%"PFMT64d"%c", white, addr, ch);
|
||||
} else {
|
||||
printfmt ("0x%08"PFMT64x"%c", addr, ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,7 +343,7 @@ R_API char *r_print_hexpair(RPrint *p, const char *str, int n) {
|
||||
color_text = P(btext): Color_MAGENTA;
|
||||
color_other = P(other): "";
|
||||
}
|
||||
if (p->cur_enabled && cur==-1)
|
||||
if (p->cur_enabled && cur == -1)
|
||||
cur = ocur;
|
||||
ocur++;
|
||||
#if CURDBG
|
||||
@ -323,10 +372,14 @@ R_API char *r_print_hexpair(RPrint *p, const char *str, int n) {
|
||||
else if (s[0]=='f' && s[1]=='f') lastcol = color_0xff;
|
||||
else {
|
||||
ch = r_hex_pair2bin (s);
|
||||
if (ch==-1) break;
|
||||
if (ch == -1) {
|
||||
break;
|
||||
}
|
||||
if (IS_PRINTABLE (ch)) {
|
||||
lastcol = color_text;
|
||||
} else lastcol = color_other;
|
||||
} else {
|
||||
lastcol = color_other;
|
||||
}
|
||||
}
|
||||
memcat (d, lastcol);
|
||||
}
|
||||
|
@ -50,13 +50,13 @@ R_API void r_str_chop_path(char *s) {
|
||||
}
|
||||
dst = src = s + 1;
|
||||
while (*src) {
|
||||
if (*(src-1) == '/' && *src == '.' && *(src+1) == '.') {
|
||||
if (*(src+2) == '/' || *(src+2) == '\0') {
|
||||
p = dst-1;
|
||||
if (*(src - 1) == '/' && *src == '.' && *(src + 1) == '.') {
|
||||
if (*(src + 2) == '/' || *(src + 2) == '\0') {
|
||||
p = dst - 1;
|
||||
while (s != p) {
|
||||
if (*p == '/') {
|
||||
if (i) {
|
||||
dst = p+1;
|
||||
dst = p + 1;
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
@ -65,14 +65,14 @@ R_API void r_str_chop_path(char *s) {
|
||||
p--;
|
||||
}
|
||||
if (s == p && *p == '/') {
|
||||
dst = p+1;
|
||||
dst = p + 1;
|
||||
}
|
||||
src = src+2;
|
||||
src = src + 2;
|
||||
} else {
|
||||
*dst = *src;
|
||||
dst++;
|
||||
}
|
||||
} else if (*src == '/' && *(src+1) == '.' && (*(src+2) == '/' || *(src+2) == '\0')) {
|
||||
} else if (*src == '/' && *(src + 1) == '.' && (*(src + 2) == '/' || *(src + 2) == '\0')) {
|
||||
src++;
|
||||
} else if (*src != '/' || *(src-1) != '/') {
|
||||
*dst = *src;
|
||||
|
Loading…
x
Reference in New Issue
Block a user