diff --git a/libr/anal/fcn.c b/libr/anal/fcn.c index 492945bdf2..b2beca8618 100644 --- a/libr/anal/fcn.c +++ b/libr/anal/fcn.c @@ -1296,7 +1296,7 @@ R_API int r_anal_fcn_add(RAnal *a, ut64 addr, ut64 size, const char *name, int t append = 1; } fcn->addr = addr; - fcn->cc = r_anal_cc_default (a); + fcn->cc = r_str_const (r_anal_cc_default (a)); fcn->bits = a->bits; r_anal_fcn_set_size (fcn, size); free (fcn->name); diff --git a/libr/anal/p/anal_java.c b/libr/anal/p/anal_java.c index ee77f724cc..d33fff826d 100644 --- a/libr/anal/p/anal_java.c +++ b/libr/anal/p/anal_java.c @@ -593,7 +593,7 @@ static int java_analyze_fns_from_buffer( RAnal *anal, ut64 start, ut64 end, int ut64 length = buf_len - offset; RAnalFunction *fcn = r_anal_fcn_new (); - fcn->cc = r_anal_cc_default (anal); + fcn->cc = r_str_const (r_anal_cc_default (anal)); result = analyze_from_code_buffer ( anal, fcn, addr, buffer+offset, length ); if (result == R_ANAL_RET_ERROR) { eprintf ("Failed to parse java fn: %s @ 0x%04"PFMT64x"\n", fcn->name, fcn->addr); @@ -643,7 +643,7 @@ static int java_analyze_fns( RAnal *anal, ut64 start, ut64 end, int reftype, int (check_addr_less_start (method, end) || check_addr_in_code (method, end))) { RAnalFunction *fcn = r_anal_fcn_new (); - fcn->cc = r_anal_cc_default (anal); + fcn->cc = r_str_const (r_anal_cc_default (anal)); java_set_function_prototype (anal, fcn, method); result = analyze_from_code_attr (anal, fcn, method, loadaddr); if (result == R_ANAL_RET_ERROR) { diff --git a/libr/core/canal.c b/libr/core/canal.c index f96296a1c5..3212f353e9 100644 --- a/libr/core/canal.c +++ b/libr/core/canal.c @@ -490,7 +490,7 @@ static int core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int depth eprintf ("Error: new (fcn)\n"); return false; } - fcn->cc = r_anal_cc_default (core->anal); + fcn->cc = r_str_const (r_anal_cc_default (core->anal)); hint = r_anal_hint_get (core->anal, at); if (hint && hint->bits == 16) { // expand 16bit for function diff --git a/libr/core/cbin.c b/libr/core/cbin.c index f301c4a022..35cc3249d3 100644 --- a/libr/core/cbin.c +++ b/libr/core/cbin.c @@ -585,6 +585,7 @@ R_API void r_core_anal_cc_init(RCore *core) { if (!fcn->cc) { fcn->cc = r_anal_cc_default (core->anal); } + fcn->cc = r_str_const (fcn->cc); } sdb_close (sdbs[0]); sdb_free (sdbs[0]); diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index 10fcb90dc0..fb9617665e 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -1517,7 +1517,7 @@ static int cmd_anal_fcn(RCore *core, const char *input) { eprintf ("Unknown calling convention '%s'\n" "See afCl for available types\n", cc); } else { - fcn->cc = r_anal_cc_to_constant (core->anal, cc); + fcn->cc = r_str_const (r_anal_cc_to_constant (core->anal, cc)); } }break; case 0: diff --git a/libr/parse/parse.c b/libr/parse/parse.c index 9ec4512698..d74adf1202 100644 --- a/libr/parse/parse.c +++ b/libr/parse/parse.c @@ -188,9 +188,14 @@ static int filter(RParse *p, RFlag *f, char *data, char *str, int len, bool big_ #endif ptr2 = NULL; // remove "dword" 2 - while ((ptr = findNextNumber (ptr))) { + char *nptr; + while ((nptr = findNextNumber (ptr))) { + char *optr = ptr; + ptr = nptr; if (x86) { - for (ptr2 = ptr; *ptr2 && !isx86separator (*ptr2); ptr2++); + for (ptr2 = ptr; *ptr2 && !isx86separator (*ptr2); ptr2++) { + // eprintf ("(%s) (%c)\n", optr, *ptr2); + } } else { for (ptr2 = ptr; *ptr2 && (*ptr2 != ']' && (*ptr2 != '\x1b') && !ISSEPARATOR (*ptr2)); ptr2++); } diff --git a/libr/util/str.c b/libr/util/str.c index 9cf2aa344f..f4b63fc888 100644 --- a/libr/util/str.c +++ b/libr/util/str.c @@ -322,7 +322,7 @@ R_API ut64 r_str_hash64(const char *s) { } // Compute a 32bit DJB hash of a string. -R_API ut32 r_str_hash (const char *s) { +R_API ut32 r_str_hash(const char *s) { return (ut32) r_str_hash64 (s); } @@ -388,7 +388,7 @@ R_API int r_str_word_set0(char *str) { continue; } if (*p == ' ') { - char *q = p-1; + char *q = p - 1; if (p > str && (*q == '\\' || !*q)) { memmove (p, p + 1, strlen (p + 1) + 1); if (*q == '\\') { @@ -450,7 +450,7 @@ R_API int r_str_word_set0_stack(char *str) { continue; case ')': case '}': - case ']': + case ']': pop = r_stack_pop (s); if (pop) { if ((*(char *)pop == '(' && *p == ')') || @@ -485,7 +485,9 @@ R_API char *r_str_word_get0set(char *stra, int stralen, int idx, const char *new char *p = NULL; char *out; int alen, blen, nlen; - if (!stra && !newstr) return NULL; + if (!stra && !newstr) { + return NULL; + } if (stra) { p = (char *)r_str_word_get0 (stra, idx); } @@ -502,7 +504,7 @@ R_API char *r_str_word_get0set(char *stra, int stralen, int idx, const char *new } return out; } - alen = (size_t)(p-stra); + alen = (size_t)(p - stra); blen = stralen - ((alen + strlen (p)) + 1); if (blen < 0) { blen = 0;