Fix warning and restore asm.cmtright in r_core_visual_graph

This commit is contained in:
Álvaro Felipe Melchor 2016-12-20 02:12:05 +01:00
parent 355551f025
commit 24f9981b65
2 changed files with 14 additions and 5 deletions

View File

@ -1607,7 +1607,7 @@ static char *get_body(RCore *core, ut64 addr, int size, int opts) {
}
r_config_save_num (hc, "asm.fcnlines", "asm.lines", "asm.bytes",
"asm.cmtcol", "asm.marks", "asm.marks", "asm.offset",
"asm.comments", "asm.cmtright", NULL);
"asm.comments", NULL);
const bool o_comments = r_config_get_i (core->config, "graph.comments");
const bool o_cmtright = r_config_get_i (core->config, "graph.cmtright");
int o_cursor = core->print->cur_enabled;
@ -2768,16 +2768,23 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
bool graph_allocated = false;
int movspeed;
int ret, invscroll;
RConfigHold *hc = r_config_hold_new (core->config);
int h, w = r_cons_get_size (&h);
can = r_cons_canvas_new (w, h);
if (!can) {
eprintf ("Cannot create RCons.canvas context. Invalid screen size? See scr.columns + scr.rows\n");
eprintf (
"Cannot create RCons.canvas context. Invalid screen "
"size? See scr.columns + scr.rows\n");
return false;
}
can->linemode = 1;
can->color = r_config_get_i (core->config, "scr.color");
if (!hc) {
return false;
}
r_config_save_num (hc, "asm.cmtright", NULL);
if (!g) {
graph_allocated = true;
fcn = _fcn ? _fcn : r_anal_get_fcn_in (core->anal, core->offset, 0);
@ -3194,5 +3201,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
} else {
g->can = o_can;
}
r_config_restore (hc);
r_config_hold_free (hc);
return !is_error;
}

View File

@ -424,7 +424,7 @@ static void findPair (RCore *core) {
p = (const ut8*)strchr (keys, ch);
if (p) {
char p_1 = 0;
if (p != keys) {
if ((char *)p != keys) {
p_1 = p[-1];
}
delta = (size_t)(p-(const ut8*)keys);
@ -433,8 +433,8 @@ static void findPair (RCore *core) {
len = 1;
buf[0] = ch;
if (p && (delta%2)) {
for (i = d-1; i>=0; i--) {
if (p && (delta % 2)) {
for (i = d - 1; i >= 0; i--) {
if (core->block[i] == ch) {
q = core->block + i;
break;