Rollback a reggression in 'pi'

This commit is contained in:
pancake 2014-11-07 05:16:33 +01:00
parent ff324cb682
commit e530a902e5
2 changed files with 31 additions and 2 deletions

View File

@ -2026,6 +2026,7 @@ R_API int r_core_print_disasm_instructions (RCore *core, int nb_bytes, int nb_op
free (ds->opstr);
ds->opstr = strdup (R_STRBUF_SAFEGET (&ds->analop.esil));
}
#if 1
} else if (ds->filter) {
char *asm_str = colorize_asm_string (core, ds);
int ofs = core->parser->flagspace;
@ -2053,6 +2054,7 @@ R_API int r_core_print_disasm_instructions (RCore *core, int nb_bytes, int nb_op
#endif
core->parser->flagspace = ofs; // ???
free (asm_str);
#endif
} else if (ds->decode) {
free (ds->opstr);
r_anal_op (core->anal, &ds->analop, ds->at, core->block+i, core->blocksize-i);

View File

@ -1387,25 +1387,51 @@ R_API const char *r_str_closer_chr (const char *b, const char *s) {
return NULL;
}
#if 0
R_API int r_str_bounds(const char *str, int *h) {
int W = 0, H = 0;
int cw = 0;
if (!str)
return W;
while (*str) {
if (*str=='\n') {
H++;
if (cw>W)
W = cw;
cw = 0;
}
str++;
cw++;
}
if (*str == '\n') // skip last newline
H--;
if (h) *h = H;
return W;
}
#else
R_API int r_str_bounds(const char *_str, int *h) {
char *ostr, *str, *ptr;
int W = 0, H = 0;
int cw = 0;
if (str) {
if (_str) {
ptr = str = ostr = strdup (_str);
while (*str) {
if (*str=='\n') {
H++;
*str = 0;
cw = (size_t)(str-ptr);
cw = r_str_ansi_len (ptr);
if (cw>W)
W = cw;
*str = '\n';
cw = 0;
ptr = str+1;
}
str++;
//cw++;
cw++;
}
if (*str == '\n') // skip last newline
H--;
@ -1414,6 +1440,7 @@ R_API int r_str_bounds(const char *_str, int *h) {
}
return W;
}
#endif
R_API char *r_str_crop(const char *str, int x, int y, int w, int h) {
char *ret = strdup (str);