parent
a044c3e0e2
commit
72093ac706
|
@ -519,7 +519,7 @@ static int riscv_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le
|
|||
//else if (strcmp (name, "unimp") != 0 && name[0] != 'f' && name[1] != 'm') {
|
||||
// int i;
|
||||
// eprintf("[esil] missing risc v esil: %s", name);
|
||||
// for (i = 0; i < args.num; ++i) {
|
||||
// for (i = 0; i < args.num; i++) {
|
||||
// eprintf(" %s", ARG(i));
|
||||
// }
|
||||
// eprintf("\n");
|
||||
|
|
|
@ -42,7 +42,7 @@ static int rsp_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len, RA
|
|||
r_instr = rsp_instruction_decode (addr, iw);
|
||||
|
||||
/* parse operands */
|
||||
for (i = 0; i < r_instr.noperands; ++i) {
|
||||
for (i = 0; i < r_instr.noperands; i++) {
|
||||
parsed_operands[i].value = r_anal_value_new ();
|
||||
parsed_operands[i].esil[0] = '\0';
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ static RList *fcn_get_refs(RAnalFunction *fcn, HtUP *ht) {
|
|||
r_list_foreach (fcn->bbs, iter, bb) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < bb->ninstr; ++i) {
|
||||
for (i = 0; i < bb->ninstr; i++) {
|
||||
ut64 at = bb->addr + r_anal_bb_offset_inst (bb, i);
|
||||
listxrefs (ht, at, list);
|
||||
}
|
||||
|
|
|
@ -4328,7 +4328,7 @@ arc_opcode_init_tables (int flags)
|
|||
/* Initialize operand map table for ARCtanget-A4 */
|
||||
memset (arc_operand_map_a4, 0, sizeof (arc_operand_map_a4));
|
||||
|
||||
for (i = 0; i < (int)ELEMENTS_IN (arc_operands_a4); ++i) {
|
||||
for (i = 0; i < (int)ELEMENTS_IN (arc_operands_a4); i++) {
|
||||
arc_operand_map_a4[arc_operands_a4[i].fmt] = i;
|
||||
}
|
||||
|
||||
|
@ -4345,7 +4345,7 @@ arc_opcode_init_tables (int flags)
|
|||
/* Initialize operand map table for ARCompact */
|
||||
memset (arc_operand_map_ac, 0, sizeof (arc_operand_map_ac));
|
||||
|
||||
for (i = 0; i < (int)ELEMENTS_IN (arc_operands_ac); ++i) {
|
||||
for (i = 0; i < (int)ELEMENTS_IN (arc_operands_ac); i++) {
|
||||
arc_operand_map_ac[arc_operands_ac[i].fmt] = i;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ extract_all_fields (const aarch64_operand *self, aarch64_insn code)
|
|||
enum aarch64_field_kind kind;
|
||||
|
||||
value = 0;
|
||||
for (i = 0; i < ARRAY_SIZE (self->fields) && self->fields[i] != FLD_NIL; ++i)
|
||||
for (i = 0; i < ARRAY_SIZE (self->fields) && self->fields[i] != FLD_NIL; i++)
|
||||
{
|
||||
kind = self->fields[i];
|
||||
value <<= fields[kind].width;
|
||||
|
@ -1225,7 +1225,7 @@ aarch64_ext_pstatefield (const aarch64_operand *self ATTRIBUTE_UNUSED,
|
|||
int i;
|
||||
/* op1:op2 */
|
||||
info->pstatefield = extract_fields (code, 0, 2, FLD_op1, FLD_op2);
|
||||
for (i = 0; aarch64_pstatefields[i].name != NULL; ++i)
|
||||
for (i = 0; aarch64_pstatefields[i].name; i++)
|
||||
if (aarch64_pstatefields[i].value == (aarch64_insn)info->pstatefield)
|
||||
return TRUE;
|
||||
/* Reserved value in <pstatefield>. */
|
||||
|
@ -1257,7 +1257,7 @@ aarch64_ext_sysins_op (const aarch64_operand *self ATTRIBUTE_UNUSED,
|
|||
default: assert (0); return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; sysins_ops[i].name != NULL; ++i)
|
||||
for (i = 0; sysins_ops[i].name; i++)
|
||||
if (sysins_ops[i].value == value)
|
||||
{
|
||||
info->sysins_op = sysins_ops + i;
|
||||
|
@ -1874,7 +1874,7 @@ get_qualifier_from_partial_encoding (aarch64_insn value,
|
|||
{
|
||||
int i;
|
||||
DEBUG_TRACE ("enter with value: %d, mask: %d", (int)value, (int)mask);
|
||||
for (i = 0; i < AARCH64_MAX_QLF_SEQ_NUM; ++i)
|
||||
for (i = 0; i < AARCH64_MAX_QLF_SEQ_NUM; i++)
|
||||
{
|
||||
aarch64_insn standard_value;
|
||||
if (candidates[i] == AARCH64_OPND_QLF_NIL)
|
||||
|
@ -1896,7 +1896,7 @@ get_operand_possible_qualifiers (int idx,
|
|||
enum aarch64_opnd_qualifier *qualifiers)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < AARCH64_MAX_QLF_SEQ_NUM; ++i)
|
||||
for (i = 0; i < AARCH64_MAX_QLF_SEQ_NUM; i++)
|
||||
if ((qualifiers[i] = list[i][idx]) == AARCH64_OPND_QLF_NIL)
|
||||
break;
|
||||
}
|
||||
|
@ -1952,7 +1952,7 @@ decode_sizeq (aarch64_inst *inst)
|
|||
{
|
||||
int i;
|
||||
for (i = 0; candidates[i] != AARCH64_OPND_QLF_NIL
|
||||
&& i < AARCH64_MAX_QLF_SEQ_NUM; ++i)
|
||||
&& i < AARCH64_MAX_QLF_SEQ_NUM; i++)
|
||||
DEBUG_TRACE ("qualifier %d: %s", i,
|
||||
aarch64_get_qualifier_name(candidates[i]));
|
||||
DEBUG_TRACE ("%d, %d", (int)value, (int)mask);
|
||||
|
@ -2816,7 +2816,7 @@ aarch64_decode_variant_using_iclass (aarch64_inst *inst)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; i++)
|
||||
inst->operands[i].qualifier = inst->opcode->qualifiers_list[variant][i];
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2853,7 +2853,7 @@ aarch64_opcode_decode (const aarch64_opcode *opcode, const aarch64_insn code,
|
|||
inst->value = code;
|
||||
|
||||
/* Assign operand codes and indexes. */
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; i++)
|
||||
{
|
||||
if (opcode->operands[i] == AARCH64_OPND_NIL)
|
||||
break;
|
||||
|
@ -2877,7 +2877,7 @@ aarch64_opcode_decode (const aarch64_opcode *opcode, const aarch64_insn code,
|
|||
}
|
||||
|
||||
/* Call operand decoders. */
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; i++)
|
||||
{
|
||||
const aarch64_operand *opnd;
|
||||
enum aarch64_opnd type;
|
||||
|
@ -2997,7 +2997,7 @@ print_operands (bfd_vma pc, const aarch64_opcode *opcode,
|
|||
{
|
||||
int i, pcrel_p, num_printed;
|
||||
char *notes = NULL;
|
||||
for (i = 0, num_printed = 0; i < AARCH64_MAX_OPND_NUM; ++i)
|
||||
for (i = 0, num_printed = 0; i < AARCH64_MAX_OPND_NUM; i++)
|
||||
{
|
||||
char str[128];
|
||||
/* We regard the opcode operand info more, however we also look into
|
||||
|
@ -3078,7 +3078,7 @@ return;
|
|||
|
||||
remove_dot_suffix (name, inst);
|
||||
num_conds = ARRAY_SIZE (inst->cond->names);
|
||||
for (i = 1; i < num_conds && inst->cond->names[i]; ++i)
|
||||
for (i = 1; i < num_conds && inst->cond->names[i]; i++)
|
||||
(*info->fprintf_func) (info->stream, "%s %s.%s",
|
||||
i == 1 ? " //" : ",",
|
||||
name, inst->cond->names[i]);
|
||||
|
|
|
@ -643,7 +643,7 @@ aarch64_get_expected_qualifier (const aarch64_opnd_qualifier_seq_t *qseq_list,
|
|||
return qseq_list[0][idx];
|
||||
}
|
||||
|
||||
for (i = 0, saved_i = -1; i < AARCH64_MAX_QLF_SEQ_NUM; ++i)
|
||||
for (i = 0, saved_i = -1; i < AARCH64_MAX_QLF_SEQ_NUM; i++)
|
||||
{
|
||||
if (qseq_list[i][known_idx] == known_qlf)
|
||||
{
|
||||
|
@ -811,7 +811,7 @@ dump_qualifier_sequence (const aarch64_opnd_qualifier_t *qualifier)
|
|||
{
|
||||
int i;
|
||||
printf ("#### ");
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i, ++qualifier)
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; i++, ++qualifier)
|
||||
printf ("%s,", aarch64_get_qualifier_name (*qualifier));
|
||||
printf ("\n");
|
||||
}
|
||||
|
@ -824,7 +824,7 @@ dump_match_qualifiers (const struct aarch64_opnd_info *opnd,
|
|||
aarch64_opnd_qualifier_t curr[AARCH64_MAX_OPND_NUM];
|
||||
|
||||
aarch64_verbose ("dump_match_qualifiers:");
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
|
||||
for (i = 0; i < AARCH64_MAX_OPND_NUM; i++)
|
||||
curr[i] = opnd[i].qualifier;
|
||||
dump_qualifier_sequence (curr);
|
||||
aarch64_verbose ("against");
|
||||
|
|
|
@ -81,7 +81,7 @@ is_delayed_branch (insn)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUMOPCODES; ++i)
|
||||
for (i = 0; i < NUMOPCODES; i++)
|
||||
{
|
||||
CONST struct lanai_opcode *opcode = &lanai_opcodes[i];
|
||||
if ((opcode->match & insn) == opcode->match && (opcode->lose & insn) == 0) {
|
||||
|
@ -137,7 +137,7 @@ print_insn_lanai (memaddr, info)
|
|||
info->branch_delay_insns = 0; /* Assume no delay */
|
||||
info->target = 0; /* Assume no target known */
|
||||
|
||||
for (i = 0; i < NUMOPCODES; ++i)
|
||||
for (i = 0; i < NUMOPCODES; i++)
|
||||
{
|
||||
CONST struct lanai_opcode *opcode = &lanai_opcodes[i];
|
||||
if ((opcode->match & insn) == opcode->match
|
||||
|
|
|
@ -394,7 +394,7 @@ static mcore_t *find_instruction(const ut8* buffer) {
|
|||
op->type = op_ptr->type;
|
||||
op->name = op_ptr->name;
|
||||
op->n_args = op_ptr->n_args;
|
||||
for (i = 0; i < op_ptr->n_args; ++i) {
|
||||
for (i = 0; i < op_ptr->n_args; i++) {
|
||||
op->args[i].value = (data & op_ptr->args[i].mask) >> op_ptr->args[i].shift;
|
||||
op->args[i].type = op_ptr->args[i].type;
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ void print_loop(char* str, int size, ut64 addr, mcore_t* instr) {
|
|||
ut32 i;
|
||||
int bufsize = size;
|
||||
int add = snprintf (str, bufsize, "%s", instr->name);
|
||||
for (i = 0; add > 0 && i < instr->n_args && add < bufsize; ++i) {
|
||||
for (i = 0; add > 0 && i < instr->n_args && add < bufsize; i++) {
|
||||
if (instr->args[i].type == TYPE_REG) {
|
||||
add += snprintf (str + add, bufsize - add, " r%u,", instr->args[i].value);
|
||||
} else if (instr->args[i].type == TYPE_IMM) {
|
||||
|
|
|
@ -183,7 +183,7 @@ void libps_snprint(char* str, int size, ut64 addr, ppcps_t* instr) {
|
|||
ut32 i;
|
||||
int bufsize = size, add = 0;
|
||||
add = snprintf (str, bufsize, "%s", instr->name);
|
||||
for (i = 0; add > 0 && i < instr->n && add < bufsize; ++i) {
|
||||
for (i = 0; add > 0 && i < instr->n && add < bufsize; i++) {
|
||||
if (instr->operands[i].type == TYPE_REG) {
|
||||
add += snprintf (str + add, bufsize - add, " fr%u", instr->operands[i].value);
|
||||
} else if (instr->operands[i].type == TYPE_IMM) {
|
||||
|
|
|
@ -860,7 +860,7 @@ static vle_t *find_ppc(const ut8* buffer) {
|
|||
ut32 data = (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
|
||||
const ppc_t* p = NULL;
|
||||
const ut32 size = sizeof (ppc_ops) / sizeof (ppc_t);
|
||||
for (i = 0; i < size; ++i) {
|
||||
for (i = 0; i < size; i++) {
|
||||
p = &ppc_ops[i];
|
||||
if ((p->op & data) == p->op && (p->mask & data) == data) {
|
||||
vle_t* ret = R_NEW0 (vle_t);
|
||||
|
@ -880,7 +880,7 @@ static vle_t *find_e(const ut8* buffer) {
|
|||
ut32 data = (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
|
||||
const e_vle_t* p = NULL;
|
||||
const ut32 size = sizeof (e_ops) / sizeof (e_vle_t);
|
||||
for (i = 0; i < size; ++i) {
|
||||
for (i = 0; i < size; i++) {
|
||||
p = &e_ops[i];
|
||||
if ((p->op & data) == p->op && (p->mask & data) == data) {
|
||||
vle_t* ret = R_NEW0 (vle_t);
|
||||
|
@ -900,15 +900,15 @@ static vle_t *find_se(const ut8* buffer) {
|
|||
ut16 data = (buffer[0] << 8) | buffer[1];
|
||||
const se_vle_t* p = NULL;
|
||||
const ut32 size = sizeof (se_ops) / sizeof (se_vle_t);
|
||||
for (i = 0; i < size; ++i) {
|
||||
for (i = 0; i < size; i++) {
|
||||
p = &se_ops[i];
|
||||
if ((p->op & data) == p->op && (p->mask & data) == data) {
|
||||
vle_t* ret = R_NEW0 (vle_t);
|
||||
ret->name = p->name;
|
||||
ret->size = 2;
|
||||
ret->anal_op = p->anal_op;
|
||||
for (j = 0; j < p->n; ++j) {
|
||||
for (k = 0; k < p->n; ++k) {
|
||||
for (j = 0; j < p->n; j++) {
|
||||
for (k = 0; k < p->n; k++) {
|
||||
if (p->fields[k].idx == j) {
|
||||
ret->fields[j].value = data & p->fields[k].mask;
|
||||
ret->fields[j].value >>= p->fields[k].shr;
|
||||
|
@ -981,7 +981,7 @@ void vle_snprint(char* str, int size, ut32 addr, vle_t* instr) {
|
|||
ut32 i;
|
||||
int bufsize = size, add = 0;
|
||||
add = snprintf (str, bufsize, "%s", instr->name);
|
||||
for (i = 0; add > 0 && i < instr->n && add < bufsize; ++i) {
|
||||
for (i = 0; add > 0 && i < instr->n && add < bufsize; i++) {
|
||||
if (instr->fields[i].type == TYPE_REG) {
|
||||
add += snprintf (str + add, bufsize - add, " r%u", instr->fields[i].value);
|
||||
} else if (instr->fields[i].type == TYPE_IMM) {
|
||||
|
|
|
@ -397,7 +397,7 @@ rsp_instruction rsp_instruction_decode(ut64 pc, ut32 iw) {
|
|||
r_instr.mnemonic = priv->mnemonic;
|
||||
r_instr.opcode = priv->opcode;
|
||||
r_instr.noperands = priv->noperands;
|
||||
for (opnd = 0; opnd < r_instr.noperands; ++opnd) {
|
||||
for (opnd = 0; opnd < r_instr.noperands; opnd++) {
|
||||
r_instr.operands[opnd] = rsp_operand_decode (pc, iw, &priv->odecs[opnd]);
|
||||
}
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ compare_opcodes (const void * a, const void * b)
|
|||
|
||||
/* Because the bits that are variable in one opcode are constant in
|
||||
another, it is important to order the opcodes in the right order. */
|
||||
for (i = 0; i < 32; ++i)
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
unsigned long int x = 1 << i;
|
||||
int x0 = (match0 & x) != 0;
|
||||
|
@ -324,7 +324,7 @@ compare_opcodes (const void * a, const void * b)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 32; ++i)
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
unsigned long int x = 1 << i;
|
||||
int x0 = (lose0 & x) != 0;
|
||||
|
@ -453,7 +453,7 @@ build_hash_table (const sparc_opcode **opcode_table,
|
|||
int min_count = num_opcodes, max_count = 0;
|
||||
int total;
|
||||
|
||||
for (i = 0; i < HASH_SIZE; ++i)
|
||||
for (i = 0; i < HASH_SIZE; i++)
|
||||
{
|
||||
if (hash_count[i] < min_count)
|
||||
min_count = hash_count[i];
|
||||
|
@ -501,7 +501,7 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
|
|||
xmalloc (sparc_num_opcodes * sizeof (sparc_opcode *));
|
||||
}
|
||||
/* Reset the sorted table so we can resort it. */
|
||||
for (i = 0; i < sparc_num_opcodes; ++i) {
|
||||
for (i = 0; i < sparc_num_opcodes; i++) {
|
||||
sorted_opcodes[i] = &sparc_opcodes[i];
|
||||
}
|
||||
qsort ((char *) sorted_opcodes, sparc_num_opcodes,
|
||||
|
@ -586,7 +586,7 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
|
|||
const char *s;
|
||||
int brackets = 0;
|
||||
|
||||
for (s = opcode->args; *s != '\0'; ++s)
|
||||
for (s = opcode->args; *s != '\0'; s++)
|
||||
{
|
||||
while (*s == ',')
|
||||
{
|
||||
|
|
|
@ -131,7 +131,7 @@ rd_character (const char **p, int *valid, int print_errors)
|
|||
}
|
||||
else
|
||||
num_digits = 1;
|
||||
for (b = 0; b < num_digits; ++b)
|
||||
for (b = 0; b < num_digits; b++)
|
||||
{
|
||||
int bit = (*p)[num_digits - 1 - b] - '0';
|
||||
i += (1 << (b * 3)) * bit;
|
||||
|
@ -189,7 +189,7 @@ check_label (struct label *labels, const char **p, struct label **ret,
|
|||
const char *c;
|
||||
unsigned s2;
|
||||
*p = delspc (*p);
|
||||
for (c = *p; isalnum ((const unsigned char)*c) || *c == '_' || *c == '.'; ++c)
|
||||
for (c = *p; isalnum ((const unsigned char)*c) || *c == '_' || *c == '.'; c++)
|
||||
{
|
||||
}
|
||||
s2 = c - *p;
|
||||
|
|
|
@ -218,10 +218,10 @@ static void readlabel(const char **p, int store) {
|
|||
const char *c, *d, *pos, *dummy;
|
||||
int i, j;
|
||||
struct label *buf, *previous;
|
||||
for (d = *p; *d && *d != ';'; ++d) {
|
||||
for (d = *p; *d && *d != ';'; d++) {
|
||||
;
|
||||
}
|
||||
for (c = *p; !strchr (" \r\n\t", *c) && c < d; ++c) {
|
||||
for (c = *p; !strchr (" \r\n\t", *c) && c < d; c++) {
|
||||
;
|
||||
}
|
||||
pos = strchr (*p, ':');
|
||||
|
@ -818,7 +818,7 @@ static int assemble(const char *str, unsigned char *_obuf) {
|
|||
obuflen = 0;
|
||||
obuf = _obuf;
|
||||
/* continue assembling until the last input file is done */
|
||||
// for (file = 0; file < infilecount; ++file)
|
||||
// for (file = 0; file < infilecount; file++)
|
||||
do {
|
||||
int cmd, cont = 1;
|
||||
// XXX: must free
|
||||
|
|
|
@ -27,7 +27,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
|||
r_instr = rsp_instruction_decode (a->pc, iw);
|
||||
|
||||
r_strbuf_append (&op->buf_asm, r_instr.mnemonic);
|
||||
for (i = 0; i < r_instr.noperands; ++i) {
|
||||
for (i = 0; i < r_instr.noperands; i++) {
|
||||
r_strbuf_append (&op->buf_asm, (i == 0) ? " " : ", ");
|
||||
|
||||
switch (r_instr.operands[i].type) {
|
||||
|
|
|
@ -859,7 +859,7 @@ static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
|
|||
sdb_num_set (sdb, "link", shdr->sh_link, 0);
|
||||
sdb_set (sdb, "link_section_name", link_section_name, 0);
|
||||
|
||||
for (cnt = 0, i = 0; cnt < shdr->sh_info && i < shdr->sh_size; ++cnt) {
|
||||
for (cnt = 0, i = 0; cnt < shdr->sh_info && i < shdr->sh_size; cnt++) {
|
||||
Sdb *sdb_verdef = sdb_new0 ();
|
||||
char *vstart = ((char*)defs) + i;
|
||||
size_t vstart_off = i;
|
||||
|
@ -909,7 +909,7 @@ static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
|
|||
sdb_set (sdb_verdef, "vda_name", &bin->dynstr[aux.vda_name], 0);
|
||||
sdb_set (sdb_verdef, "flags", get_ver_flags (verdef->vd_flags), 0);
|
||||
|
||||
for (j = 1; j < verdef->vd_cnt; ++j) {
|
||||
for (j = 1; j < verdef->vd_cnt; j++) {
|
||||
int k;
|
||||
Sdb *sdb_parent = sdb_new0 ();
|
||||
if (shdr->sh_size - vstart_off < aux.vda_next) {
|
||||
|
@ -1019,7 +1019,7 @@ static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
|
|||
}
|
||||
//XXX we should use DT_VERNEEDNUM instead of sh_info
|
||||
//TODO https://sourceware.org/ml/binutils/2014-11/msg00353.html
|
||||
for (i = 0, cnt = 0; cnt < shdr->sh_info; ++cnt) {
|
||||
for (i = 0, cnt = 0; cnt < shdr->sh_info; cnt++) {
|
||||
int j, isum;
|
||||
ut8 *vstart = need + i;
|
||||
Elf_(Verneed) vvn = { 0 };
|
||||
|
@ -1056,7 +1056,7 @@ static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
|
|||
}
|
||||
vstart += vnaux;
|
||||
ut32 vn_cnt = entry->vn_cnt;
|
||||
for (j = 0, isum = i + entry->vn_aux; j < vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; ++j) {
|
||||
for (j = 0, isum = i + entry->vn_aux; j < vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; j++) {
|
||||
int k;
|
||||
Elf_(Vernaux) *aux = NULL;
|
||||
Elf_(Vernaux) vaux = {0};
|
||||
|
@ -1176,7 +1176,7 @@ static bool init_dynstr(ELFOBJ *bin) {
|
|||
if (!bin->shstrtab) {
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i < bin->ehdr.e_shnum; ++i) {
|
||||
for (i = 0; i < bin->ehdr.e_shnum; i++) {
|
||||
if (bin->shdr[i].sh_name > bin->shstrtab_size) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3792,7 +3792,7 @@ ut64 Elf_(r_bin_elf_p2v) (ELFOBJ *bin, ut64 paddr) {
|
|||
}
|
||||
return paddr;
|
||||
}
|
||||
for (i = 0; i < bin->ehdr.e_phnum; ++i) {
|
||||
for (i = 0; i < bin->ehdr.e_phnum; i++) {
|
||||
Elf_(Phdr) *p = &bin->phdr[i];
|
||||
if (p->p_type == PT_LOAD && is_in_pphdr (p, paddr)) {
|
||||
if (!p->p_vaddr && !p->p_offset) {
|
||||
|
@ -3816,7 +3816,7 @@ ut64 Elf_(r_bin_elf_v2p) (ELFOBJ *bin, ut64 vaddr) {
|
|||
}
|
||||
return vaddr;
|
||||
}
|
||||
for (i = 0; i < bin->ehdr.e_phnum; ++i) {
|
||||
for (i = 0; i < bin->ehdr.e_phnum; i++) {
|
||||
Elf_(Phdr) *p = &bin->phdr[i];
|
||||
if (p->p_type == PT_LOAD && is_in_vphdr (p, vaddr)) {
|
||||
if (!p->p_offset && !p->p_vaddr) {
|
||||
|
@ -3840,7 +3840,7 @@ ut64 Elf_(r_bin_elf_p2v_new) (ELFOBJ *bin, ut64 paddr) {
|
|||
}
|
||||
return UT64_MAX;
|
||||
}
|
||||
for (i = 0; i < bin->ehdr.e_phnum; ++i) {
|
||||
for (i = 0; i < bin->ehdr.e_phnum; i++) {
|
||||
Elf_(Phdr) *p = &bin->phdr[i];
|
||||
if (p->p_type == PT_LOAD && is_in_pphdr (p, paddr)) {
|
||||
return p->p_vaddr + paddr - p->p_offset;
|
||||
|
@ -3862,7 +3862,7 @@ ut64 Elf_(r_bin_elf_v2p_new) (ELFOBJ *bin, ut64 vaddr) {
|
|||
}
|
||||
return UT64_MAX;
|
||||
}
|
||||
for (i = 0; i < bin->ehdr.e_phnum; ++i) {
|
||||
for (i = 0; i < bin->ehdr.e_phnum; i++) {
|
||||
Elf_(Phdr) *p = &bin->phdr[i];
|
||||
if (p->p_type == PT_LOAD && is_in_vphdr (p, vaddr)) {
|
||||
return p->p_offset + vaddr - p->p_vaddr;
|
||||
|
|
|
@ -3292,7 +3292,7 @@ ut64 MACH0_(get_baddr)(struct MACH0_(obj_t) *bin) {
|
|||
if (bin->hdr.filetype != MH_EXECUTE && bin->hdr.filetype != MH_DYLINKER) {
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < bin->nsegs; ++i) {
|
||||
for (i = 0; i < bin->nsegs; i++) {
|
||||
if (bin->segs[i].fileoff == 0 && bin->segs[i].filesize != 0) {
|
||||
return bin->segs[i].vmaddr;
|
||||
}
|
||||
|
|
|
@ -1629,7 +1629,7 @@ static String* Pe_r_bin_pe_parse_string(struct PE_(r_bin_pe_obj_t)* bin, PE_DWor
|
|||
goto out_error;
|
||||
}
|
||||
|
||||
for (i = 0; *curAddr < begAddr + string->wLength; ++i, *curAddr += sizeof (ut16)) {
|
||||
for (i = 0; *curAddr < begAddr + string->wLength; i++, *curAddr += sizeof (ut16)) {
|
||||
ut16 utf16_char;
|
||||
ut16 *tmpKey;
|
||||
if (*curAddr > bin->size || *curAddr + sizeof (ut16) > bin->size) {
|
||||
|
|
|
@ -603,7 +603,7 @@ d_dump (struct demangle_component *dc, int indent)
|
|||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < indent; ++i)
|
||||
for (i = 0; i < indent; i++)
|
||||
putchar (' ');
|
||||
|
||||
switch (dc->type)
|
||||
|
|
|
@ -319,7 +319,7 @@ static ut64 va2pa(uint64_t addr, cache_hdr_t *hdr, cache_map_t *maps, RBuffer *c
|
|||
|
||||
addr -= slide;
|
||||
|
||||
for (i = 0; i < hdr->mappingCount; ++i) {
|
||||
for (i = 0; i < hdr->mappingCount; i++) {
|
||||
if (addr >= maps[i].address && addr < maps[i].address + maps[i].size) {
|
||||
res = maps[i].fileOffset + addr - maps[i].address;
|
||||
if (offset) {
|
||||
|
@ -499,7 +499,7 @@ static RDyldRebaseInfo *get_rebase_info(RBinFile *bf, RDyldCache *cache) {
|
|||
ut64 start_of_data = 0;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < cache->hdr->mappingCount; ++i) {
|
||||
for (i = 0; i < cache->hdr->mappingCount; i++) {
|
||||
int perm = prot2perm (cache->maps[i].initProt);
|
||||
if (!(perm & R_PERM_X)) {
|
||||
start_of_data = cache->maps[i].fileOffset;// + bf->o->boffset;
|
||||
|
@ -1500,7 +1500,7 @@ static RList *sections(RBinFile *bf) {
|
|||
|
||||
RBinSection *ptr = NULL;
|
||||
int i;
|
||||
for (i = 0; i < cache->hdr->mappingCount; ++i) {
|
||||
for (i = 0; i < cache->hdr->mappingCount; i++) {
|
||||
if (!(ptr = R_NEW0 (RBinSection))) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ static void twok_move(int u, int v) {
|
|||
int i, j, k;
|
||||
int nKI = 0, nKJ = 0, nIK = 0, nJK = 0;
|
||||
int moved = 0;
|
||||
for (k = 0; k < 4; ++k) {
|
||||
for (i = 0; i < 4; ++i) {
|
||||
for (j = i + 1; j < 4 && !twok_buf[nKJ = u ? k : v ? j : 3 - j][nJK = !u ? k : v ? j : 3 - j]; ++j) {
|
||||
for (k = 0; k < 4; k++) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = i + 1; j < 4 && !twok_buf[nKJ = u ? k : v ? j : 3 - j][nJK = !u ? k : v ? j : 3 - j]; j++) {
|
||||
;
|
||||
}
|
||||
if (j == 4) {
|
||||
|
|
|
@ -216,7 +216,7 @@ while_end:
|
|||
last = ptr3[1];
|
||||
ptr3[1] = '\0';
|
||||
ptr2++;
|
||||
for (; ptr2 <= ptr3; ++ptr2) {
|
||||
for (; ptr2 <= ptr3; ptr2++) {
|
||||
if (fail) {
|
||||
ZERO_FILL (grep->tokens);
|
||||
grep->tokens_used = 0;
|
||||
|
|
|
@ -45,7 +45,7 @@ static void init_color_table() {
|
|||
static int __lookup_rgb(int r, int g, int b) {
|
||||
int i, color = (r << 16) + (g << 8) + b;
|
||||
// lookup extended colors only, coz non-extended can be changed by users.
|
||||
for (i = 16; i < 256; ++i) {
|
||||
for (i = 16; i < 256; i++) {
|
||||
if (color_table[i] == color) {
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -455,7 +455,7 @@ static int **get_crossing_matrix(const RGraph *g,
|
|||
if (gj == gk) {
|
||||
continue;
|
||||
}
|
||||
for (s = 0; s < j; ++s) {
|
||||
for (s = 0; s < j; s++) {
|
||||
const RGraphNode *gs = layers[i - 1].nodes[s];
|
||||
const RList *neigh_s = r_graph_get_neighbours (g, gs);
|
||||
RGraphNode *gt;
|
||||
|
@ -491,7 +491,7 @@ static int **get_crossing_matrix(const RGraph *g,
|
|||
if (r_cons_is_breaked ()) {
|
||||
goto err_row;
|
||||
}
|
||||
for (j = 0; j < layers[i].n_nodes; ++j) {
|
||||
for (j = 0; j < layers[i].n_nodes; j++) {
|
||||
const RGraphNode *gj = layers[i].nodes[j];
|
||||
const RList *neigh = r_graph_get_neighbours (g, gj);
|
||||
const RANode *ak, *aj = get_anode (gj);
|
||||
|
@ -503,7 +503,7 @@ static int **get_crossing_matrix(const RGraph *g,
|
|||
}
|
||||
graph_foreach_anode (neigh, itk, gk, ak) {
|
||||
int s;
|
||||
for (s = 0; s < layers[i].n_nodes; ++s) {
|
||||
for (s = 0; s < layers[i].n_nodes; s++) {
|
||||
const RGraphNode *gs = layers[i].nodes[s];
|
||||
const RList *neigh_s;
|
||||
RGraphNode *gt;
|
||||
|
@ -549,7 +549,7 @@ static int layer_sweep(const RGraph *g, const struct layer_t layers[],
|
|||
return -1; // ERROR HAPPENS
|
||||
}
|
||||
|
||||
for (j = 0; j < len - 1; ++j) {
|
||||
for (j = 0; j < len - 1; j++) {
|
||||
int auidx, avidx;
|
||||
|
||||
u = layers[i].nodes[j];
|
||||
|
@ -570,12 +570,12 @@ static int layer_sweep(const RGraph *g, const struct layer_t layers[],
|
|||
/* update position in the layer of each node. During the swap of some
|
||||
* elements we didn't swap also the pos_in_layer because the cross_matrix
|
||||
* is indexed by it, so do it now! */
|
||||
for (j = 0; j < layers[i].n_nodes; ++j) {
|
||||
for (j = 0; j < layers[i].n_nodes; j++) {
|
||||
RANode *n = get_anode (layers[i].nodes[j]);
|
||||
n->pos_in_layer = j;
|
||||
}
|
||||
|
||||
for (j = 0; j < n_rows; ++j) {
|
||||
for (j = 0; j < n_rows; j++) {
|
||||
free (cross_matrix[j]);
|
||||
}
|
||||
free (cross_matrix);
|
||||
|
@ -711,7 +711,7 @@ static void create_dummy_nodes(RAGraph *g) {
|
|||
int i, nth = e->nth;
|
||||
|
||||
r_agraph_del_edge (g, from, to);
|
||||
for (i = 1; i < diff_layer; ++i) {
|
||||
for (i = 1; i < diff_layer; i++) {
|
||||
RANode *dummy = r_agraph_add_node (g, NULL, NULL);
|
||||
if (!dummy) {
|
||||
return;
|
||||
|
@ -756,7 +756,7 @@ static void create_layers(RAGraph *g) {
|
|||
g->layers[n->layer].n_nodes++;
|
||||
}
|
||||
|
||||
for (i = 0; i < g->n_layers; ++i) {
|
||||
for (i = 0; i < g->n_layers; i++) {
|
||||
if (sizeof (RGraphNode *) * g->layers[i].n_nodes < g->layers[i].n_nodes) {
|
||||
continue;
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ static void minimize_crossings(const RAGraph *g) {
|
|||
cross_changed = false;
|
||||
max_changes--;
|
||||
|
||||
for (i = 0; i < g->n_layers; ++i) {
|
||||
for (i = 0; i < g->n_layers; i++) {
|
||||
int rc = layer_sweep (g->graph, g->layers, g->n_layers, i, true);
|
||||
if (rc == -1) {
|
||||
return;
|
||||
|
@ -834,7 +834,7 @@ static int dist_nodes(const RAGraph *g, const RGraphNode *a, const RGraphNode *b
|
|||
int i;
|
||||
|
||||
res = aa == ab && !aa->is_reversed? HORIZONTAL_NODE_SPACING: 0;
|
||||
for (i = aa->pos_in_layer; i < ab->pos_in_layer; ++i) {
|
||||
for (i = aa->pos_in_layer; i < ab->pos_in_layer; i++) {
|
||||
const RGraphNode *cur = g->layers[aa->layer].nodes[i];
|
||||
const RGraphNode *next = g->layers[aa->layer].nodes[i + 1];
|
||||
const RANode *anext = get_anode (next);
|
||||
|
@ -911,8 +911,8 @@ static Sdb *compute_vertical_nodes(const RAGraph *g) {
|
|||
Sdb *res = sdb_new0 ();
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < g->n_layers; ++i) {
|
||||
for (j = 0; j < g->layers[i].n_nodes; ++j) {
|
||||
for (i = 0; i < g->n_layers; i++) {
|
||||
for (j = 0; j < g->layers[i].n_nodes; j++) {
|
||||
RGraphNode *gn = g->layers[i].nodes[j];
|
||||
const RList *Ln = hash_get_rlist (res, gn);
|
||||
const RANode *an = get_anode (gn);
|
||||
|
@ -958,7 +958,7 @@ static RList **compute_classes(const RAGraph *g, Sdb *v_nodes, int is_left, int
|
|||
n->klass = -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < g->n_layers; ++i) {
|
||||
for (i = 0; i < g->n_layers; i++) {
|
||||
c = i;
|
||||
|
||||
for (j = is_left? 0: g->layers[i].n_nodes - 1;
|
||||
|
@ -1145,7 +1145,7 @@ static Sdb *compute_pos(const RAGraph *g, int is_left, Sdb *v_nodes) {
|
|||
|
||||
Sdb *res = sdb_new0 ();
|
||||
Sdb *placed = sdb_new0 ();
|
||||
for (i = 0; i < n_classes; ++i) {
|
||||
for (i = 0; i < n_classes; i++) {
|
||||
const RGraphNode *gn;
|
||||
const RListIter *it;
|
||||
|
||||
|
@ -1159,7 +1159,7 @@ static Sdb *compute_pos(const RAGraph *g, int is_left, Sdb *v_nodes) {
|
|||
}
|
||||
|
||||
sdb_free (placed);
|
||||
for (i = 0; i < n_classes; ++i) {
|
||||
for (i = 0; i < n_classes; i++) {
|
||||
if (classes[i]) {
|
||||
r_list_free (classes[i]);
|
||||
}
|
||||
|
@ -1215,7 +1215,7 @@ static RGraphNode *get_right_dummy(const RAGraph *g, const RGraphNode *n) {
|
|||
}
|
||||
int k, layer = an->layer;
|
||||
|
||||
for (k = an->pos_in_layer + 1; k < g->layers[layer].n_nodes; ++k) {
|
||||
for (k = an->pos_in_layer + 1; k < g->layers[layer].n_nodes; k++) {
|
||||
RGraphNode *gk = g->layers[layer].nodes[k];
|
||||
const RANode *ak = get_anode (gk);
|
||||
if (!ak) {
|
||||
|
@ -1237,7 +1237,7 @@ static void adjust_directions(const RAGraph *g, int i, int from_up, Sdb *D, Sdb
|
|||
if (i + d < 0 || i + d >= g->n_layers) {
|
||||
return;
|
||||
}
|
||||
for (j = 0; j < g->layers[i + d].n_nodes; ++j) {
|
||||
for (j = 0; j < g->layers[i + d].n_nodes; j++) {
|
||||
const RGraphNode *wp, *vp = g->layers[i + d].nodes[j];
|
||||
const RANode *wpa, *vpa = get_anode (vp);
|
||||
|
||||
|
@ -1257,7 +1257,7 @@ static void adjust_directions(const RAGraph *g, int i, int from_up, Sdb *D, Sdb
|
|||
int p = hash_get_int (P, wm);
|
||||
int k;
|
||||
|
||||
for (k = wma->pos_in_layer + 1; k < wpa->pos_in_layer; ++k) {
|
||||
for (k = wma->pos_in_layer + 1; k < wpa->pos_in_layer; k++) {
|
||||
const RGraphNode *w = g->layers[wma->layer].nodes[k];
|
||||
const RANode *aw = get_anode (w);
|
||||
if (aw && aw->is_dummy) {
|
||||
|
@ -1266,7 +1266,7 @@ static void adjust_directions(const RAGraph *g, int i, int from_up, Sdb *D, Sdb
|
|||
}
|
||||
if (p) {
|
||||
hash_set (D, vm, from_up);
|
||||
for (k = vma->pos_in_layer + 1; k < vpa->pos_in_layer; ++k) {
|
||||
for (k = vma->pos_in_layer + 1; k < vpa->pos_in_layer; k++) {
|
||||
const RGraphNode *v = g->layers[vma->layer].nodes[k];
|
||||
const RANode *av = get_anode (v);
|
||||
if (av && av->is_dummy) {
|
||||
|
@ -1460,7 +1460,7 @@ static void combine_sequences(const RAGraph *g, int l, const RGraphNode *bm, con
|
|||
}
|
||||
}
|
||||
|
||||
for (i = t + 1; i < r; ++i) {
|
||||
for (i = t + 1; i < r; i++) {
|
||||
const RGraphNode *gv = g->layers[l].nodes[i];
|
||||
RANode *av = get_anode (gv);
|
||||
if (av && atp) {
|
||||
|
@ -1530,7 +1530,7 @@ static void original_traverse_l(const RAGraph *g, Sdb *D, Sdb *P, int from_up) {
|
|||
va = bma->pos_in_layer + 1;
|
||||
vr = g->layers[bma->layer].n_nodes;
|
||||
place_sequence (g, i, bm, NULL, from_up, va, vr);
|
||||
for (k = va; k < vr - 1; ++k) {
|
||||
for (k = va; k < vr - 1; k++) {
|
||||
set_dist_nodes (g, i, k, k + 1);
|
||||
}
|
||||
|
||||
|
@ -1943,7 +1943,7 @@ static void set_layout(RAGraph *g) {
|
|||
for (i = 0; i < g->n_layers; i++) {
|
||||
int rh = 0;
|
||||
int rw = 0;
|
||||
for (j = 0; j < g->layers[i].n_nodes; ++j) {
|
||||
for (j = 0; j < g->layers[i].n_nodes; j++) {
|
||||
const RANode *n = get_anode (g->layers[i].nodes[j]);
|
||||
if (n->h > rh) {
|
||||
rh = n->h;
|
||||
|
@ -1957,7 +1957,7 @@ static void set_layout(RAGraph *g) {
|
|||
}
|
||||
|
||||
for (i = 0; i < g->n_layers; i++) {
|
||||
for (j = 0; j < g->layers[i].n_nodes; ++j) {
|
||||
for (j = 0; j < g->layers[i].n_nodes; j++) {
|
||||
RANode *a = (RANode *) g->layers[i].nodes[j]->data;
|
||||
if (a->is_dummy) {
|
||||
if (g->layout == 0) {
|
||||
|
@ -1994,8 +1994,8 @@ static void set_layout(RAGraph *g) {
|
|||
default:
|
||||
case 0: // vertical layout
|
||||
/* horizontal finalize x coordinate */
|
||||
for (i = 0; i < g->n_layers; ++i) {
|
||||
for (j = 0; j < g->layers[i].n_nodes; ++j) {
|
||||
for (i = 0; i < g->n_layers; i++) {
|
||||
for (j = 0; j < g->layers[i].n_nodes; j++) {
|
||||
RANode *n = get_anode (g->layers[i].nodes[j]);
|
||||
if (n) {
|
||||
n->x -= n->w / 2;
|
||||
|
@ -2009,7 +2009,7 @@ static void set_layout(RAGraph *g) {
|
|||
set_layer_gap (g);
|
||||
|
||||
/* vertical align */
|
||||
for (i = 0; i < g->n_layers; ++i) {
|
||||
for (i = 0; i < g->n_layers; i++) {
|
||||
int tmp_y = 0;
|
||||
tmp_y = g->layers[0].gap; //TODO: XXX: set properly
|
||||
for (k = 1; k <= i; k++) {
|
||||
|
@ -2018,7 +2018,7 @@ static void set_layout(RAGraph *g) {
|
|||
if (g->is_tiny) {
|
||||
tmp_y = i;
|
||||
}
|
||||
for (j = 0; j < g->layers[i].n_nodes; ++j) {
|
||||
for (j = 0; j < g->layers[i].n_nodes; j++) {
|
||||
RANode *n = get_anode (g->layers[i].nodes[j]);
|
||||
if (n) {
|
||||
n->y = tmp_y;
|
||||
|
@ -2062,7 +2062,7 @@ static void set_layout(RAGraph *g) {
|
|||
//remove_dummy_nodes (g);
|
||||
|
||||
/* free all temporary structures used during layout */
|
||||
for (i = 0; i < g->n_layers; ++i) {
|
||||
for (i = 0; i < g->n_layers; i++) {
|
||||
free (g->layers[i].nodes);
|
||||
}
|
||||
free (g->layers);
|
||||
|
|
|
@ -521,7 +521,7 @@ R_API RList *r_core_asm_bwdisassemble(RCore *core, ut64 addr, int n, int len) {
|
|||
}
|
||||
numinstr = 0;
|
||||
asmlen = strlen (c->assembly);
|
||||
for (ii = 0; ii < asmlen; ++ii) {
|
||||
for (ii = 0; ii < asmlen; ii++) {
|
||||
if (c->assembly[ii] == '\n') {
|
||||
++numinstr;
|
||||
}
|
||||
|
|
|
@ -4553,7 +4553,7 @@ static char *escape_special_chars(char *s, const char *special_chars) {
|
|||
size_t s_len = strlen (s);
|
||||
char *d = R_NEWS (char, s_len * 2 + 1);
|
||||
int i, j = 0;
|
||||
for (i = 0; i < s_len; ++i) {
|
||||
for (i = 0; i < s_len; i++) {
|
||||
if (strchr (special_chars, s[i])) {
|
||||
d[j++] = '\\';
|
||||
}
|
||||
|
@ -4592,7 +4592,7 @@ static void parsed_args_free(struct parsed_args *a) {
|
|||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < a->argc; ++i) {
|
||||
for (i = 0; i < a->argc; i++) {
|
||||
free (a->argv[i]);
|
||||
}
|
||||
free (a->argv);
|
||||
|
@ -4650,7 +4650,7 @@ static void handle_substitution_args(struct tsr2cmd_state *state, TSNode args, R
|
|||
if (is_ts_args (args) || is_ts_concatenation (args) || is_ts_double_quoted_arg (args)) {
|
||||
uint32_t n_children = ts_node_named_child_count (args);
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_children; ++i) {
|
||||
for (i = 0; i < n_children; i++) {
|
||||
TSNode arg = ts_node_named_child (args, i);
|
||||
handle_substitution_args (state, arg, edits);
|
||||
}
|
||||
|
@ -4681,7 +4681,7 @@ static char *do_handle_ts_unescape_arg(struct tsr2cmd_state *state, TSNode arg)
|
|||
} else if (is_ts_concatenation (arg)) {
|
||||
uint32_t i, n_children = ts_node_named_child_count (arg);
|
||||
RStrBuf *sb = r_strbuf_new (NULL);
|
||||
for (i = 0; i < n_children; ++i) {
|
||||
for (i = 0; i < n_children; i++) {
|
||||
TSNode sub_arg = ts_node_named_child (arg, i);
|
||||
char *s = do_handle_ts_unescape_arg (state, sub_arg);
|
||||
r_strbuf_append (sb, s);
|
||||
|
@ -4695,7 +4695,7 @@ static char *do_handle_ts_unescape_arg(struct tsr2cmd_state *state, TSNode arg)
|
|||
static char *create_argv_str(struct parsed_args *a) {
|
||||
RStrBuf *sb = r_strbuf_new (NULL);
|
||||
int i;
|
||||
for (i = 0; i < a->argc; ++i) {
|
||||
for (i = 0; i < a->argc; i++) {
|
||||
if (i > 0) {
|
||||
r_strbuf_append (sb, " ");
|
||||
}
|
||||
|
@ -4721,7 +4721,7 @@ static struct parsed_args *parse_args(struct tsr2cmd_state *state, TSNode args)
|
|||
struct parsed_args *a = R_NEW0 (struct parsed_args);
|
||||
a->argc = n_children;
|
||||
a->argv = R_NEWS (char *, a->argc);
|
||||
for (i = 0; i < n_children; ++i) {
|
||||
for (i = 0; i < n_children; i++) {
|
||||
TSNode arg = ts_node_named_child (args, i);
|
||||
a->argv[i] = do_handle_ts_unescape_arg (state, arg);
|
||||
}
|
||||
|
@ -4869,7 +4869,7 @@ DEFINE_HANDLE_TS_FCN(arged_command) {
|
|||
substitute_args_fini (state);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < pr_args->argc; ++i) {
|
||||
for (i = 0; i < pr_args->argc; i++) {
|
||||
R_LOG_DEBUG ("parsed_arg %d: '%s'\n", i, pr_args->argv[i]);
|
||||
}
|
||||
}
|
||||
|
@ -4908,7 +4908,7 @@ DEFINE_HANDLE_TS_FCN(repeat_command) {
|
|||
}
|
||||
|
||||
bool res = true;
|
||||
for (int i = 0; i < rep; ++i) {
|
||||
for (int i = 0; i < rep; i++) {
|
||||
res &= handle_ts_command (state, command);
|
||||
}
|
||||
return res;
|
||||
|
@ -5200,7 +5200,7 @@ DEFINE_HANDLE_TS_FCN(tmp_eval_command) {
|
|||
|
||||
RConfigHold *hc = r_config_hold_new (core->config);
|
||||
uint32_t i, n_args = ts_node_named_child_count (args);
|
||||
for (i = 0; i < n_args; ++i) {
|
||||
for (i = 0; i < n_args; i++) {
|
||||
TSNode arg = ts_node_named_child (args, i);
|
||||
char *arg_str = ts_node_sub_string (arg, state->input);
|
||||
char *eq = strchr (arg_str, '=');
|
||||
|
@ -5547,7 +5547,7 @@ DEFINE_HANDLE_TS_FCN(iter_offsets_command) {
|
|||
substitute_args_fini (state);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < a->argc; ++i) {
|
||||
for (i = 0; i < a->argc; i++) {
|
||||
ut64 addr = r_num_math (core->num, a->argv[i]);
|
||||
R_LOG_DEBUG ("iter_offsets_command: seek to %" PFMT64x "\n", addr);
|
||||
r_core_seek (core, addr, 1);
|
||||
|
@ -5799,7 +5799,7 @@ DEFINE_HANDLE_TS_FCN(iter_interpret_command) {
|
|||
int i;
|
||||
ut64 orig_offset = core->offset;
|
||||
bool res = true;
|
||||
for (i = 0; i < a->argc; ++i) {
|
||||
for (i = 0; i < a->argc; i++) {
|
||||
ut64 addr = r_num_math (core->num, a->argv[i]);
|
||||
R_LOG_DEBUG ("iter_interpret_command: seek to %" PFMT64x "\n", addr);
|
||||
r_core_seek (core, addr, 1);
|
||||
|
@ -5958,7 +5958,7 @@ DEFINE_HANDLE_TS_FCN(commands) {
|
|||
if (state->split_lines) {
|
||||
r_cons_break_push (NULL, NULL);
|
||||
}
|
||||
for (i = 0; i < child_count; ++i) {
|
||||
for (i = 0; i < child_count; i++) {
|
||||
if (state->split_lines && r_cons_is_breaked ()) {
|
||||
r_cons_break_pop ();
|
||||
return false;
|
||||
|
|
|
@ -1657,7 +1657,7 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
|
|||
}
|
||||
if (ret < 1 && fmt != 'd') {
|
||||
eprintf ("Oops at 0x%08" PFMT64x " (", core->offset + idx);
|
||||
for (i = idx, j = 0; i < core->blocksize && j < 3; ++i, ++j) {
|
||||
for (i = idx, j = 0; i < core->blocksize && j < 3; i++, j++) {
|
||||
eprintf ("%02x ", buf[i]);
|
||||
}
|
||||
eprintf ("...)\n");
|
||||
|
|
|
@ -551,7 +551,7 @@ static int cmd_seek(void *data, const char *input) {
|
|||
}
|
||||
PJ *pj = pj_new ();
|
||||
pj_a (pj);
|
||||
for (i = 0; i < lsz; ++i) {
|
||||
for (i = 0; i < lsz; i++) {
|
||||
ut64 *addr = r_list_get_n (addrs, i);
|
||||
const char *name = r_list_get_n (names, i);
|
||||
pj_o (pj);
|
||||
|
|
|
@ -138,7 +138,7 @@ R_API ut64 r_core_get_asmqjmps(RCore *core, const char *str) {
|
|||
if (core->is_asmqjmps_letter) {
|
||||
int i, pos = 0;
|
||||
int len = strlen (str);
|
||||
for (i = 0; i < len - 1; ++i) {
|
||||
for (i = 0; i < len - 1; i++) {
|
||||
if (!isupper ((ut8)str[i])) {
|
||||
return UT64_MAX;
|
||||
}
|
||||
|
@ -3641,7 +3641,7 @@ R_API void r_core_autocomplete_free(RCoreAutocomplete *obj) {
|
|||
return;
|
||||
}
|
||||
int i;
|
||||
for (i = 0; i < obj->n_subcmds; ++i) {
|
||||
for (i = 0; i < obj->n_subcmds; i++) {
|
||||
r_core_autocomplete_free (obj->subcmds[i]);
|
||||
obj->subcmds[i] = NULL;
|
||||
}
|
||||
|
@ -3656,7 +3656,7 @@ R_API RCoreAutocomplete *r_core_autocomplete_find(RCoreAutocomplete *parent, con
|
|||
}
|
||||
int len = strlen (cmd);
|
||||
int i;
|
||||
for (i = 0; i < parent->n_subcmds; ++i) {
|
||||
for (i = 0; i < parent->n_subcmds; i++) {
|
||||
if (exact && len == parent->subcmds[i]->length && !strncmp (cmd, parent->subcmds[i]->cmd, len)) {
|
||||
return parent->subcmds[i];
|
||||
} else if (!exact && !strncmp (cmd, parent->subcmds[i]->cmd, len)) {
|
||||
|
@ -3678,7 +3678,7 @@ R_API bool r_core_autocomplete_remove(RCoreAutocomplete *parent, const char* cmd
|
|||
}
|
||||
// if (!strncmp (parent->subcmds[i]->cmd, cmd, parent->subcmds[i]->length)) {
|
||||
if (r_str_glob (ac->cmd, cmd)) {
|
||||
for (j = i + 1; j < parent->n_subcmds; ++j) {
|
||||
for (j = i + 1; j < parent->n_subcmds; j++) {
|
||||
parent->subcmds[j - 1] = parent->subcmds[j];
|
||||
parent->subcmds[j] = NULL;
|
||||
}
|
||||
|
|
|
@ -391,7 +391,7 @@ static void ds_print_ref_lines(char *line, char *line_col, RDisasmState *ds) {
|
|||
}
|
||||
} else {
|
||||
len = strlen (line);
|
||||
for (i = 0; i < len; ++i) {
|
||||
for (i = 0; i < len; i++) {
|
||||
r_cons_printf ("%s", get_utf8_char (line[i], ds));
|
||||
}
|
||||
}
|
||||
|
@ -3716,10 +3716,10 @@ static void ds_print_asmop_payload(RDisasmState *ds, const ut8 *buf) {
|
|||
if (ds->showpayloads) {
|
||||
int mod = ds->asmop.payload % ds->core->assembler->dataalign;
|
||||
int x;
|
||||
for (x = 0; x < ds->asmop.payload; ++x) {
|
||||
for (x = 0; x < ds->asmop.payload; x++) {
|
||||
r_cons_printf ("\n 0x%02x", buf[ds->oplen + x]);
|
||||
}
|
||||
for (x = 0; x < mod; ++x) {
|
||||
for (x = 0; x < mod; x++) {
|
||||
r_cons_printf ("\n 0x%02x ; alignment", buf[ds->oplen + ds->asmop.payload + x]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1757,7 +1757,7 @@ void __handleComment(RCore *core) {
|
|||
if (buf[3] == ' ') {
|
||||
int j, len = strlen (buf);
|
||||
char *duped = strdup (buf);
|
||||
for (i = 4, j = 4; i < len; ++i,++j) {
|
||||
for (i = 4, j = 4; i < len; i++, j++) {
|
||||
char c = duped[i];
|
||||
if (c == '"' && i != (len - 1)) {
|
||||
buf[j++] = '\\';
|
||||
|
|
|
@ -32,7 +32,7 @@ static void find_and_change (char* in, int len) {
|
|||
RFindCTX ctx = {0};
|
||||
end = in + len;
|
||||
// type = TYPE_NONE;
|
||||
for (ctx.linebegin = in; in < end; ++in) {
|
||||
for (ctx.linebegin = in; in < end; in++) {
|
||||
if (*in == '\n' || !*in) {
|
||||
if (ctx.type == TYPE_SYM && ctx.linecount < 1) {
|
||||
ctx.linecount++;
|
||||
|
|
|
@ -1248,7 +1248,7 @@ R_API bool r_core_prevop_addr(RCore *core, ut64 start_addr, int numinstrs, ut64
|
|||
if (bb) {
|
||||
if (r_anal_bb_opaddr_at (bb, start_addr) != UT64_MAX) {
|
||||
// Do some anal looping.
|
||||
for (i = 0; i < numinstrs; ++i) {
|
||||
for (i = 0; i < numinstrs; i++) {
|
||||
*prev_addr = prevop_addr (core, start_addr);
|
||||
start_addr = *prev_addr;
|
||||
}
|
||||
|
@ -1264,7 +1264,7 @@ R_API bool r_core_prevop_addr(RCore *core, ut64 start_addr, int numinstrs, ut64
|
|||
// no anal info is available.
|
||||
R_API ut64 r_core_prevop_addr_force(RCore *core, ut64 start_addr, int numinstrs) {
|
||||
int i;
|
||||
for (i = 0; i < numinstrs; ++i) {
|
||||
for (i = 0; i < numinstrs; i++) {
|
||||
start_addr = prevop_addr (core, start_addr);
|
||||
}
|
||||
return start_addr;
|
||||
|
@ -3496,7 +3496,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
|
|||
// have to escape any quotes.
|
||||
int j, len = strlen (buf);
|
||||
char *duped = strdup (buf);
|
||||
for (i = 4, j = 4; i < len; ++i,++j) {
|
||||
for (i = 4, j = 4; i < len; i++, j++) {
|
||||
char c = duped[i];
|
||||
if (c == '"' && i != (len - 1)) {
|
||||
buf[j] = '\\';
|
||||
|
|
|
@ -478,7 +478,7 @@ static void expand_1st_key(ut32 *dstkey, const ut32 *srckey) {
|
|||
dstkey[2] = 0;
|
||||
dstkey[3] = 0;
|
||||
|
||||
for (i = 0; i < 96; ++i) {
|
||||
for (i = 0; i < 96; i++) {
|
||||
dstkey[i / 24] |= BIT (srckey[bits[i] / 32], bits[i] % 32) << (i % 24);
|
||||
}
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ static void expand_2nd_key(ut32 *dstkey, const ut32 *srckey) {
|
|||
dstkey[2] = 0;
|
||||
dstkey[3] = 0;
|
||||
|
||||
for (i = 0; i < 96; ++i) {
|
||||
for (i = 0; i < 96; i++) {
|
||||
dstkey[i / 24] |= BIT(srckey[bits[i] / 32], bits[i] % 32) << (i % 24);
|
||||
}
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ static void expand_subkey(ut32* subkey, ut16 seed) {
|
|||
subkey[0] = 0;
|
||||
subkey[1] = 0;
|
||||
|
||||
for (i = 0; i < 64; ++i) {
|
||||
for (i = 0; i < 64; i++) {
|
||||
subkey[i / 32] |= BIT(seed, bits[i]) << (i % 32);
|
||||
}
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ static inline ut16 feistel(ut16 val, const int *bitsA, const int *bitsB,
|
|||
|
||||
static int extract_inputs(ut32 val, const int *inputs) {
|
||||
int i, res = 0;
|
||||
for (i = 0; i < 6; ++i) {
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (inputs[i] != -1) {
|
||||
res |= BIT (val, inputs[i]) << i;
|
||||
}
|
||||
|
@ -582,13 +582,13 @@ static int extract_inputs(ut32 val, const int *inputs) {
|
|||
static void optimise_sboxes(struct optimised_sbox* out, const struct sbox* in) {
|
||||
int i, box;
|
||||
|
||||
for (box = 0; box < 4; ++box) {
|
||||
for (box = 0; box < 4; box++) {
|
||||
// precalculate the input lookup
|
||||
for (i = 0; i < 256; ++i) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
out[box].input_lookup[i] = extract_inputs(i, in[box].inputs);
|
||||
}
|
||||
// precalculate the output masks
|
||||
for (i = 0; i < 64; ++i) {
|
||||
for (i = 0; i < 64; i++) {
|
||||
int o = in[box].table[i];
|
||||
out[box].output[i] = 0;
|
||||
if (o & 1) {
|
||||
|
@ -629,7 +629,7 @@ static void cps2_crypt(int dir, const ut16 *rom, ut16 *dec, int length, const ut
|
|||
key1[2] ^= BIT(key1[2], 1) << 5;
|
||||
key1[2] ^= BIT(key1[2], 8) << 11;
|
||||
|
||||
for (i = 0; i < 0x10000; ++i) {
|
||||
for (i = 0; i < 0x10000; i++) {
|
||||
int a;
|
||||
ut16 seed;
|
||||
ut32 subkey[2];
|
||||
|
|
|
@ -92,7 +92,7 @@ static bool des_set_key (RCrypto *cry, const ut8 *key, int keylen, int mode, int
|
|||
// key permutation to derive round keys
|
||||
r_des_permute_key (&keylo, &keyhi);
|
||||
|
||||
for (i = 0; i < 16; ++i) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
// filling round keys space
|
||||
r_des_round_key (i, &st.keylo[i], &st.keyhi[i], &keylo, &keyhi);
|
||||
}
|
||||
|
|
|
@ -563,7 +563,7 @@ R_API RFlagItem *r_flag_get_by_spaces(RFlag *f, ut64 off, ...) {
|
|||
r_list_foreach (list, iter, flg) {
|
||||
// get the "priority" of the flag flagspace and
|
||||
// check if better than what we found so far
|
||||
for (i = 0; i < n_spaces; ++i) {
|
||||
for (i = 0; i < n_spaces; i++) {
|
||||
if (flg->space == spaces[i]) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -20,14 +20,14 @@ R_API ut16 r_hash_fletcher16(const ut8 *data, size_t len) {
|
|||
size_t i;
|
||||
|
||||
for (c0 = c1 = 0; len >= 5802; len -= 5802) {
|
||||
for (i = 0; i < 5802; ++i) {
|
||||
for (i = 0; i < 5802; i++) {
|
||||
c0 = c0 + *data++;
|
||||
c1 = c1 + c0;
|
||||
}
|
||||
c0 %= 0xff;
|
||||
c1 %= 0xff;
|
||||
}
|
||||
for (i = 0; i < len; ++i) {
|
||||
for (i = 0; i < len; i++) {
|
||||
c0 += *data++;
|
||||
c1 += c0;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ static ut8 gprobe_checksum_i2c (const ut8 *p, unsigned int size, ut8 initial) {
|
|||
ut8 res = initial;
|
||||
unsigned int k;
|
||||
|
||||
for (k = 0; k < size; ++k) {
|
||||
for (k = 0; k < size; k++) {
|
||||
res ^= p[k];
|
||||
}
|
||||
|
||||
|
@ -648,7 +648,7 @@ static ut8 gprobe_checksum (const ut8 *p, unsigned int size) {
|
|||
ut8 res = 0;
|
||||
unsigned int k;
|
||||
|
||||
for (k = 0; k < size; ++k) {
|
||||
for (k = 0; k < size; k++) {
|
||||
res += p[k];
|
||||
}
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ static ut64 gdiff_start = 0;
|
|||
|
||||
void print_bytes(const void *p, size_t len, bool big_endian) {
|
||||
size_t i;
|
||||
for (i = 0; i < len; ++i) {
|
||||
for (i = 0; i < len; i++) {
|
||||
ut8 ch = ((ut8*) p)[big_endian ? (len - i - 1) : i];
|
||||
write (1, &ch, 1);
|
||||
}
|
||||
|
|
|
@ -311,7 +311,7 @@ R_API int r_reg_arena_set_bytes(RReg *reg, const char *str) {
|
|||
r_hex_str2bin (str, bin_str);
|
||||
|
||||
int i, n = 0; //n - cumulative sum of arena's sizes
|
||||
for (i = 0; i < R_REG_TYPE_LAST; ++i) {
|
||||
for (i = 0; i < R_REG_TYPE_LAST; i++) {
|
||||
int sz = reg->regset[i].arena->size;
|
||||
int bl = bin_str_len - n; //bytes left
|
||||
int bln = bl - n;
|
||||
|
|
|
@ -16,7 +16,7 @@ R_API const char *r_reg_32_to_64(RReg *reg, const char *rreg32) {
|
|||
int i, j = -1;
|
||||
RListIter *iter;
|
||||
RRegItem *item;
|
||||
for (i = 0; i < R_REG_TYPE_LAST; ++i) {
|
||||
for (i = 0; i < R_REG_TYPE_LAST; i++) {
|
||||
r_list_foreach (reg->regset[i].regs, iter, item) {
|
||||
if (item->size == 32 && !r_str_casecmp (rreg32, item->name)) {
|
||||
j = item->offset;
|
||||
|
@ -25,7 +25,7 @@ R_API const char *r_reg_32_to_64(RReg *reg, const char *rreg32) {
|
|||
}
|
||||
}
|
||||
if (j != -1) {
|
||||
for (i = 0; i < R_REG_TYPE_LAST; ++i) {
|
||||
for (i = 0; i < R_REG_TYPE_LAST; i++) {
|
||||
r_list_foreach (reg->regset[i].regs, iter, item) {
|
||||
if (item->offset == j && item->size == 64) {
|
||||
return item->name;
|
||||
|
@ -43,7 +43,7 @@ R_API const char *r_reg_64_to_32(RReg *reg, const char *rreg64) {
|
|||
int i, j = -1;
|
||||
RListIter *iter;
|
||||
RRegItem *item;
|
||||
for (i = 0; i < R_REG_TYPE_LAST; ++i) {
|
||||
for (i = 0; i < R_REG_TYPE_LAST; i++) {
|
||||
r_list_foreach (reg->regset[i].regs, iter, item) {
|
||||
if (item->size == 64 && !r_str_casecmp (rreg64, item->name)) {
|
||||
j = item->offset;
|
||||
|
@ -52,7 +52,7 @@ R_API const char *r_reg_64_to_32(RReg *reg, const char *rreg64) {
|
|||
}
|
||||
}
|
||||
if (j != -1) {
|
||||
for (i = 0; i < R_REG_TYPE_LAST; ++i) {
|
||||
for (i = 0; i < R_REG_TYPE_LAST; i++) {
|
||||
r_list_foreach (reg->regset[i].regs, iter, item) {
|
||||
if (item->offset == j && item->size == 32) {
|
||||
return item->name;
|
||||
|
|
|
@ -59,7 +59,7 @@ static RASN1Object *asn1_parse_header (const ut8 *buffer, ut32 length, const ut8
|
|||
if (length8 && length8 < length - 2) {
|
||||
ut8 i8;
|
||||
// can overflow.
|
||||
for (i8 = 0; i8 < length8; ++i8) {
|
||||
for (i8 = 0; i8 < length8; i8++) {
|
||||
byte = buffer[2 + i8];
|
||||
length64 <<= 8;
|
||||
length64 |= byte;
|
||||
|
@ -134,7 +134,7 @@ R_API RASN1Object *r_asn1_create_object (const ut8 *buffer, ut32 length, const u
|
|||
return NULL;
|
||||
}
|
||||
ut32 i;
|
||||
for (i = 0; next >= buffer && next < end && i < count; ++i) {
|
||||
for (i = 0; next >= buffer && next < end && i < count; i++) {
|
||||
RASN1Object *inner = r_asn1_create_object (next, end - next, start_pointer);
|
||||
if (!inner || next == inner->sector) {
|
||||
r_asn1_free_object (inner);
|
||||
|
@ -179,7 +179,7 @@ R_API void r_asn1_print_hex (RASN1Object *object, char* buffer, ut32 size, ut32
|
|||
snprintf (p, end - p, "%s", pad);
|
||||
p += strlen(pad);
|
||||
}
|
||||
for (i = 0; i < object->length && p < end; ++i) {
|
||||
for (i = 0; i < object->length && p < end; i++) {
|
||||
snprintf (p, end - p, "%02x", object->sector[i]);
|
||||
p += 2;
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ R_API char *r_asn1_to_string (RASN1Object *object, ut32 depth, RStrBuf *sb) {
|
|||
depth, object->form ? "cons" : "prim", name, string);
|
||||
r_asn1_free_string (asn1str);
|
||||
if (object->list.objects) {
|
||||
for (i = 0; i < object->list.length; ++i) {
|
||||
for (i = 0; i < object->list.length; i++) {
|
||||
r_asn1_to_string (object->list.objects[i], depth + 1, sb);
|
||||
}
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ R_API char *r_asn1_to_string (RASN1Object *object, ut32 depth, RStrBuf *sb) {
|
|||
r_asn1_print_padded (sb, object, depth, name, string);
|
||||
r_asn1_free_string (asn1str);
|
||||
if (object->list.objects) {
|
||||
for (i = 0; i < object->list.length; ++i) {
|
||||
for (i = 0; i < object->list.length; i++) {
|
||||
RASN1Object *obj = object->list.objects[i];
|
||||
r_asn1_to_string (obj, depth + 1, sb);
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ R_API void r_asn1_free_object (RASN1Object *object) {
|
|||
// This shall not be freed. it's a pointer into the buffer.
|
||||
object->sector = NULL;
|
||||
if (object->list.objects) {
|
||||
for (i = 0; i < object->list.length; ++i) {
|
||||
for (i = 0; i < object->list.length; i++) {
|
||||
r_asn1_free_object (object->list.objects[i]);
|
||||
}
|
||||
R_FREE (object->list.objects);
|
||||
|
|
|
@ -158,9 +158,9 @@ R_API RASN1String *r_asn1_stringify_bits (const ut8 *buffer, ut32 length) {
|
|||
if (!str) {
|
||||
return NULL;
|
||||
}
|
||||
for (i = 1, j = 0; i < length && j < size; ++i) {
|
||||
for (i = 1, j = 0; i < length && j < size; i++) {
|
||||
c = buffer[i];
|
||||
for (k = 0; k < 8 && j < size; ++k, j++) {
|
||||
for (k = 0; k < 8 && j < size; k++, j++) {
|
||||
str[size - j - 1] = c & 0x80 ? '1' : '0';
|
||||
c <<= 1;
|
||||
}
|
||||
|
|
|
@ -451,13 +451,13 @@ R_API ut8 r_buf_read8_at(RBuffer *b, ut64 addr) {
|
|||
static st64 buf_format(RBuffer *dst, RBuffer *src, const char *fmt, int n) {
|
||||
st64 res = 0;
|
||||
int i;
|
||||
for (i = 0; i < n; ++i) {
|
||||
for (i = 0; i < n; i++) {
|
||||
int j;
|
||||
int m = 1;
|
||||
int tsize = 2;
|
||||
bool bigendian = true;
|
||||
|
||||
for (j = 0; fmt[j]; ++j) {
|
||||
for (j = 0; fmt[j]; j++) {
|
||||
switch (fmt[j]) {
|
||||
case '0':
|
||||
case '1':
|
||||
|
|
|
@ -19,7 +19,7 @@ static void de_bruijn_seq(int prenecklace_len_t, int lyndon_prefix_len_p, int or
|
|||
}
|
||||
if (prenecklace_len_t > order) {
|
||||
if (order % lyndon_prefix_len_p == 0) {
|
||||
for (j = 1; j <= lyndon_prefix_len_p; ++j) {
|
||||
for (j = 1; j <= lyndon_prefix_len_p; j++) {
|
||||
sequence[strlen(sequence)] = charset[prenecklace_a[j]];
|
||||
if (strlen (sequence) == maxlen) {
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ static void de_bruijn_seq(int prenecklace_len_t, int lyndon_prefix_len_p, int or
|
|||
de_bruijn_seq(prenecklace_len_t + 1, lyndon_prefix_len_p, order, maxlen,
|
||||
size, prenecklace_a, sequence, charset);
|
||||
for (j = prenecklace_a[prenecklace_len_t - lyndon_prefix_len_p] + 1;
|
||||
j < size; ++j) {
|
||||
j < size; j++) {
|
||||
prenecklace_a[prenecklace_len_t] = j;
|
||||
de_bruijn_seq (prenecklace_len_t + 1, prenecklace_len_t, order, maxlen,
|
||||
size, prenecklace_a, sequence, charset);
|
||||
|
@ -118,7 +118,7 @@ R_API int r_debruijn_offset(ut64 value, bool is_big_endian) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
for (j = 0; j < 2 && retval == -1; ++j) {
|
||||
for (j = 0; j < 2 && retval == -1; j++) {
|
||||
pattern = r_debruijn_pattern (lens[j], 0, debruijn_charset);
|
||||
|
||||
buf[8] = '\0';
|
||||
|
|
|
@ -35,7 +35,7 @@ static bool r_pkcs7_parse_certificaterevocationlists(RPKCS7CertificateRevocation
|
|||
return false;
|
||||
}
|
||||
crls->length = object->list.length;
|
||||
for (i = 0; i < crls->length; ++i) {
|
||||
for (i = 0; i < crls->length; i++) {
|
||||
crls->elements[i] = r_x509_parse_crl (object->list.objects[i]);
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ static bool r_pkcs7_parse_certificaterevocationlists(RPKCS7CertificateRevocation
|
|||
static void r_pkcs7_free_certificaterevocationlists(RPKCS7CertificateRevocationLists *crls) {
|
||||
ut32 i;
|
||||
if (crls) {
|
||||
for (i = 0; i < crls->length; ++i) {
|
||||
for (i = 0; i < crls->length; i++) {
|
||||
r_x509_free_crl (crls->elements[i]);
|
||||
crls->elements[i] = NULL;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ static bool r_pkcs7_parse_extendedcertificatesandcertificates(RPKCS7ExtendedCert
|
|||
return false;
|
||||
}
|
||||
ecac->length = object->list.length;
|
||||
for (i = 0; i < ecac->length; ++i) {
|
||||
for (i = 0; i < ecac->length; i++) {
|
||||
ecac->elements[i] = r_x509_parse_certificate (object->list.objects[i]);
|
||||
object->list.objects[i] = NULL;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ static bool r_pkcs7_parse_extendedcertificatesandcertificates(RPKCS7ExtendedCert
|
|||
static void r_pkcs7_free_extendedcertificatesandcertificates(RPKCS7ExtendedCertificatesAndCertificates *ecac) {
|
||||
ut32 i;
|
||||
if (ecac) {
|
||||
for (i = 0; i < ecac->length; ++i) {
|
||||
for (i = 0; i < ecac->length; i++) {
|
||||
r_x509_free_certificate (ecac->elements[i]);
|
||||
ecac->elements[i] = NULL;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ static bool r_pkcs7_parse_digestalgorithmidentifier(RPKCS7DigestAlgorithmIdentif
|
|||
return false;
|
||||
}
|
||||
dai->length = object->list.length;
|
||||
for (i = 0; i < dai->length; ++i) {
|
||||
for (i = 0; i < dai->length; i++) {
|
||||
// r_x509_parse_algorithmidentifier returns bool,
|
||||
// so i have to allocate before calling the function
|
||||
dai->elements[i] = (RX509AlgorithmIdentifier *)malloc (sizeof (RX509AlgorithmIdentifier));
|
||||
|
@ -115,7 +115,7 @@ static bool r_pkcs7_parse_digestalgorithmidentifier(RPKCS7DigestAlgorithmIdentif
|
|||
static void r_pkcs7_free_digestalgorithmidentifier(RPKCS7DigestAlgorithmIdentifiers *dai) {
|
||||
ut32 i;
|
||||
if (dai) {
|
||||
for (i = 0; i < dai->length; ++i) {
|
||||
for (i = 0; i < dai->length; i++) {
|
||||
if (dai->elements[i]) {
|
||||
r_x509_free_algorithmidentifier (dai->elements[i]);
|
||||
// r_x509_free_algorithmidentifier doesn't free the pointer
|
||||
|
@ -209,7 +209,7 @@ static void r_pkcs7_free_attribute(RPKCS7Attribute *attribute) {
|
|||
static void r_pkcs7_free_attributes(RPKCS7Attributes *attributes) {
|
||||
ut32 i;
|
||||
if (attributes) {
|
||||
for (i = 0; i < attributes->length; ++i) {
|
||||
for (i = 0; i < attributes->length; i++) {
|
||||
r_pkcs7_free_attribute (attributes->elements[i]);
|
||||
}
|
||||
R_FREE (attributes->elements);
|
||||
|
@ -240,7 +240,7 @@ static bool r_pkcs7_parse_signerinfos(RPKCS7SignerInfos *ss, RASN1Object *object
|
|||
return false;
|
||||
}
|
||||
ss->length = object->list.length;
|
||||
for (i = 0; i < ss->length; ++i) {
|
||||
for (i = 0; i < ss->length; i++) {
|
||||
// r_pkcs7_parse_signerinfo returns bool,
|
||||
// so i have to allocate before calling the function
|
||||
ss->elements[i] = R_NEW0 (RPKCS7SignerInfo);
|
||||
|
@ -374,7 +374,7 @@ static bool r_pkcs7_parse_attributes(RPKCS7Attributes *attributes, RASN1Object *
|
|||
attributes->length = 0;
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i < object->list.length; ++i) {
|
||||
for (i = 0; i < object->list.length; i++) {
|
||||
attributes->elements[i] = r_pkcs7_parse_attribute (object->list.objects[i]);
|
||||
}
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ static void r_pkcs7_signerinfos_dump(RX509CertificateRevocationList *crl, const
|
|||
r_strbuf_appendf (sb, "%sLast Update: %s\n%sNext Update: %s\n%sRevoked Certificates:\n",
|
||||
pad2, last ? last->string : "Missing",
|
||||
pad2, next ? next->string : "Missing", pad2);
|
||||
for (i = 0; i < crl->length; ++i) {
|
||||
for (i = 0; i < crl->length; i++) {
|
||||
r_x509_crlentry_dump (crl->revokedCertificates[i], pad3, sb);
|
||||
}
|
||||
free (pad3);
|
||||
|
@ -441,7 +441,7 @@ static void r_x509_signedinfo_dump(RPKCS7SignerInfo *si, const char *pad, RStrBu
|
|||
r_strbuf_appendf (sb, "%sDigest Algorithm:\n%s%s\n%sAuthenticated Attributes:\n",
|
||||
pad2, pad3, s ? s->string : "Missing", pad2);
|
||||
|
||||
for (i = 0; i < si->authenticatedAttributes.length; ++i) {
|
||||
for (i = 0; i < si->authenticatedAttributes.length; i++) {
|
||||
RPKCS7Attribute *attr = si->authenticatedAttributes.elements[i];
|
||||
if (!attr) {
|
||||
continue;
|
||||
|
@ -458,7 +458,7 @@ static void r_x509_signedinfo_dump(RPKCS7SignerInfo *si, const char *pad, RStrBu
|
|||
// r_asn1_free_string (s);
|
||||
r_strbuf_appendf (sb, "%sEncrypted Digest: %u bytes\n", pad2, o ? o->length : 0);
|
||||
r_strbuf_appendf (sb, "%sUnauthenticated Attributes:\n", pad2);
|
||||
for (i = 0; i < si->unauthenticatedAttributes.length; ++i) {
|
||||
for (i = 0; i < si->unauthenticatedAttributes.length; i++) {
|
||||
RPKCS7Attribute *attr = si->unauthenticatedAttributes.elements[i];
|
||||
if (!attr) {
|
||||
continue;
|
||||
|
@ -480,7 +480,7 @@ R_API char *r_pkcs7_cms_to_string(RCMS *container) {
|
|||
r_strbuf_appendf (sb, "signedData\n Version: v%u\n Digest Algorithms:\n", sd->version);
|
||||
|
||||
if (container->signedData.digestAlgorithms.elements) {
|
||||
for (i = 0; i < container->signedData.digestAlgorithms.length; ++i) {
|
||||
for (i = 0; i < container->signedData.digestAlgorithms.length; i++) {
|
||||
if (container->signedData.digestAlgorithms.elements[i]) {
|
||||
RASN1String *s = container->signedData.digestAlgorithms.elements[i]->algorithm;
|
||||
r_strbuf_appendf (sb, " %s\n", s ? s->string : "Missing");
|
||||
|
@ -490,11 +490,11 @@ R_API char *r_pkcs7_cms_to_string(RCMS *container) {
|
|||
|
||||
r_strbuf_appendf (sb, " Certificates: %u\n", container->signedData.certificates.length);
|
||||
|
||||
for (i = 0; i < container->signedData.certificates.length; ++i) {
|
||||
for (i = 0; i < container->signedData.certificates.length; i++) {
|
||||
r_x509_certificate_dump (container->signedData.certificates.elements[i], " ", sb);
|
||||
}
|
||||
|
||||
for (i = 0; i < container->signedData.crls.length; ++i) {
|
||||
for (i = 0; i < container->signedData.crls.length; i++) {
|
||||
char *res = r_x509_crl_to_string (container->signedData.crls.elements[i], " ");
|
||||
if (res) {
|
||||
r_strbuf_append (sb, res);
|
||||
|
@ -504,7 +504,7 @@ R_API char *r_pkcs7_cms_to_string(RCMS *container) {
|
|||
|
||||
r_strbuf_appendf (sb, " SignerInfos:\n");
|
||||
if (container->signedData.signerinfos.elements) {
|
||||
for (i = 0; i < container->signedData.signerinfos.length; ++i) {
|
||||
for (i = 0; i < container->signedData.signerinfos.length; i++) {
|
||||
r_x509_signedinfo_dump (container->signedData.signerinfos.elements[i], " ", sb);
|
||||
}
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ R_API void r_x509_signedinfo_json(PJ *pj, RPKCS7SignerInfo *si) {
|
|||
}
|
||||
pj_k (pj, "AuthenticatedAttributes");
|
||||
pj_a (pj);
|
||||
for (i = 0; i < si->authenticatedAttributes.length; ++i) {
|
||||
for (i = 0; i < si->authenticatedAttributes.length; i++) {
|
||||
RPKCS7Attribute *attr = si->authenticatedAttributes.elements[i];
|
||||
if (!attr) {
|
||||
continue;
|
||||
|
@ -564,7 +564,7 @@ R_API void r_x509_signedinfo_json(PJ *pj, RPKCS7SignerInfo *si) {
|
|||
|
||||
pj_k (pj, "UnauthenticatedAttributes");
|
||||
pj_a (pj);
|
||||
for (i = 0; i < si->unauthenticatedAttributes.length; ++i) {
|
||||
for (i = 0; i < si->unauthenticatedAttributes.length; i++) {
|
||||
RPKCS7Attribute *attr = si->unauthenticatedAttributes.elements[i];
|
||||
if (!attr) {
|
||||
continue;
|
||||
|
@ -596,7 +596,7 @@ R_API PJ *r_pkcs7_cms_json (RCMS *container) {
|
|||
if (container->signedData.digestAlgorithms.elements) {
|
||||
pj_k (pj, "DigestAlgorithms");
|
||||
pj_a (pj);
|
||||
for (i = 0; i < container->signedData.digestAlgorithms.length; ++i) {
|
||||
for (i = 0; i < container->signedData.digestAlgorithms.length; i++) {
|
||||
if (container->signedData.digestAlgorithms.elements[i]) {
|
||||
RASN1String *s = container->signedData.digestAlgorithms.elements[i]->algorithm;
|
||||
if (s) {
|
||||
|
@ -609,14 +609,14 @@ R_API PJ *r_pkcs7_cms_json (RCMS *container) {
|
|||
|
||||
pj_k (pj, "Certificates");
|
||||
pj_a (pj);
|
||||
for (i = 0; i < container->signedData.certificates.length; ++i) {
|
||||
for (i = 0; i < container->signedData.certificates.length; i++) {
|
||||
r_x509_certificate_json (pj, container->signedData.certificates.elements[i]);
|
||||
}
|
||||
pj_end (pj);
|
||||
|
||||
pj_k (pj, "CRL");
|
||||
pj_a (pj);
|
||||
for (i = 0; i < container->signedData.crls.length; ++i) {
|
||||
for (i = 0; i < container->signedData.crls.length; i++) {
|
||||
r_x509_crl_json (pj, container->signedData.crls.elements[i]);
|
||||
}
|
||||
pj_end (pj);
|
||||
|
@ -624,7 +624,7 @@ R_API PJ *r_pkcs7_cms_json (RCMS *container) {
|
|||
pj_k (pj, "SignerInfos");
|
||||
pj_a (pj);
|
||||
if (container->signedData.signerinfos.elements) {
|
||||
for (i = 0; i < container->signedData.signerinfos.length; ++i) {
|
||||
for (i = 0; i < container->signedData.signerinfos.length; i++) {
|
||||
r_x509_signedinfo_json (pj, container->signedData.signerinfos.elements[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1915,7 +1915,7 @@ R_API char *r_str_ansi_crop(const char *str, ut32 x, ut32 y, ut32 x2, ut32 y2) {
|
|||
/* copy 0x1b and [ */
|
||||
*r++ = *str++;
|
||||
*r++ = *str++;
|
||||
for (ptr = str; *ptr && *ptr != 'J' && *ptr != 'm' && *ptr != 'H'; ++ptr) {
|
||||
for (ptr = str; *ptr && *ptr != 'J' && *ptr != 'm' && *ptr != 'H'; ptr++) {
|
||||
*r++ = *ptr;
|
||||
}
|
||||
*r++ = *ptr++;
|
||||
|
@ -3083,7 +3083,7 @@ R_API char *r_str_repeat(const char *ch, int sz) {
|
|||
return strdup ("");
|
||||
}
|
||||
RStrBuf *buf = r_strbuf_new (ch);
|
||||
for (i = 1; i < sz; ++i) {
|
||||
for (i = 1; i < sz; i++) {
|
||||
r_strbuf_append (buf, ch);
|
||||
}
|
||||
return r_strbuf_drain (buf);
|
||||
|
|
|
@ -86,7 +86,7 @@ bool r_x509_parse_name (RX509Name *name, RASN1Object *object) {
|
|||
R_FREE (name->names);
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i < object->list.length; ++i) {
|
||||
for (i = 0; i < object->list.length; i++) {
|
||||
RASN1Object *o = object->list.objects[i];
|
||||
if (o && o->klass == CLASS_UNIVERSAL &&
|
||||
o->tag == TAG_SET &&
|
||||
|
@ -143,7 +143,7 @@ bool r_x509_parse_extensions (RX509Extensions *ext, RASN1Object *object) {
|
|||
return false;
|
||||
}
|
||||
ext->length = object->list.length;
|
||||
for (i = 0; i < object->list.length; ++i) {
|
||||
for (i = 0; i < object->list.length; i++) {
|
||||
ext->extensions[i] = R_NEW0 (RX509Extension);
|
||||
if (!r_x509_parse_extension (ext->extensions[i], object->list.objects[i])) {
|
||||
r_x509_free_extension (ext->extensions[i]);
|
||||
|
@ -288,7 +288,7 @@ R_API RX509CertificateRevocationList *r_x509_parse_crl(RASN1Object *object) {
|
|||
return NULL;
|
||||
}
|
||||
crl->length = object->list.objects[4]->list.length;
|
||||
for (i = 0; i < object->list.objects[4]->list.length; ++i) {
|
||||
for (i = 0; i < object->list.objects[4]->list.length; i++) {
|
||||
crl->revokedCertificates[i] = r_x509_parse_crlentry (object->list.objects[4]->list.objects[i]);
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ void r_x509_free_name (RX509Name *name) {
|
|||
return;
|
||||
}
|
||||
if (name->names) {
|
||||
for (i = 0; i < name->length; ++i) {
|
||||
for (i = 0; i < name->length; i++) {
|
||||
r_asn1_free_string (name->oids[i]);
|
||||
r_asn1_free_string (name->names[i]);
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ void r_x509_free_extensions (RX509Extensions *ex) {
|
|||
return;
|
||||
}
|
||||
if (ex->extensions) {
|
||||
for (i = 0; i < ex->length; ++i) {
|
||||
for (i = 0; i < ex->length; i++) {
|
||||
r_x509_free_extension (ex->extensions[i]);
|
||||
}
|
||||
free (ex->extensions);
|
||||
|
@ -401,7 +401,7 @@ void r_x509_free_crl (RX509CertificateRevocationList *crl) {
|
|||
r_asn1_free_string (crl->nextUpdate);
|
||||
r_asn1_free_string (crl->lastUpdate);
|
||||
if (crl->revokedCertificates) {
|
||||
for (i = 0; i < crl->length; ++i) {
|
||||
for (i = 0; i < crl->length; i++) {
|
||||
r_x509_free_crlentry (crl->revokedCertificates[i]);
|
||||
crl->revokedCertificates[i] = NULL;
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ void r_x509_name_dump (RX509Name *name, const char *pad, RStrBuf *sb) {
|
|||
if (!pad) {
|
||||
pad = "";
|
||||
}
|
||||
for (i = 0; i < name->length; ++i) {
|
||||
for (i = 0; i < name->length; i++) {
|
||||
if (!name->oids[i] || !name->names[i]) {
|
||||
continue;
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ static void r_x509_extensions_dump(RX509Extensions *exts, const char *pad, RStrB
|
|||
if (!pad) {
|
||||
pad = "";
|
||||
}
|
||||
for (i = 0; i < exts->length; ++i) {
|
||||
for (i = 0; i < exts->length; i++) {
|
||||
RX509Extension *e = exts->extensions[i];
|
||||
if (!e) {
|
||||
continue;
|
||||
|
@ -629,7 +629,7 @@ R_API void r_x509_validity_json(PJ *pj, RX509Validity *validity) {
|
|||
|
||||
R_API void r_x509_name_json(PJ *pj, RX509Name *name) {
|
||||
ut32 i;
|
||||
for (i = 0; i < name->length; ++i) {
|
||||
for (i = 0; i < name->length; i++) {
|
||||
if (!name->oids[i] || !name->names[i]) {
|
||||
continue;
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ R_API void r_x509_extensions_json(PJ *pj, RX509Extensions *exts) {
|
|||
RASN1String *m = NULL;
|
||||
ut32 i;
|
||||
pj_a (pj);
|
||||
for (i = 0; i < exts->length; ++i) {
|
||||
for (i = 0; i < exts->length; i++) {
|
||||
RX509Extension *e = exts->extensions[i];
|
||||
if (!e) {
|
||||
continue;
|
||||
|
@ -726,7 +726,7 @@ R_API void r_x509_crl_json(PJ *pj, RX509CertificateRevocationList *crl) {
|
|||
}
|
||||
pj_k (pj, "RevokedCertificates");
|
||||
pj_a (pj);
|
||||
for (i = 0; i < crl->length; ++i) {
|
||||
for (i = 0; i < crl->length; i++) {
|
||||
r_x509_crlentry_json (pj, crl->revokedCertificates[i]);
|
||||
}
|
||||
pj_end (pj);
|
||||
|
|
|
@ -68,7 +68,7 @@ acorn_partition_map_find (grub_disk_t disk, struct linux_part *m,
|
|||
if ((boot.flags & NONADFS_PARTITION_TYPE_MASK) != NONADFS_PARTITION_TYPE_LINUX)
|
||||
goto fail;
|
||||
|
||||
for (i = 0; i != 0x1ff; ++i)
|
||||
for (i = 0; i != 0x1ff; i++)
|
||||
checksum = (checksum & 0xff) + (checksum >> 8) + boot.misc[i];
|
||||
|
||||
if ((grub_uint8_t) checksum != boot.checksum)
|
||||
|
@ -109,7 +109,7 @@ acorn_partition_map_iterate (grub_disk_t disk,
|
|||
|
||||
part.partmap = &grub_acorn_partition_map;
|
||||
|
||||
for (i = 0; i != LINUX_MAP_ENTRIES; ++i)
|
||||
for (i = 0; i != LINUX_MAP_ENTRIES; i++)
|
||||
{
|
||||
if (map[i].magic != LINUX_NATIVE_MAGIC
|
||||
&& map[i].magic != LINUX_SWAP_MAGIC)
|
||||
|
|
|
@ -149,7 +149,7 @@ extract_signed_integer (const ut8 *addr, int len, int be) {
|
|||
p = startaddr;
|
||||
/* Do the sign extension once at the start. */
|
||||
retval = ((LONGEST)*p ^ 0x80) - 0x80;
|
||||
for (++p; p < endaddr; ++p)
|
||||
for (++p; p < endaddr; p++)
|
||||
retval = (retval << 8) | *p;
|
||||
} else {
|
||||
p = endaddr - 1;
|
||||
|
|
|
@ -353,7 +353,7 @@ SDB_API bool Ht_(delete)(HtName_(Ht)* ht, const KEY_TYPE key) {
|
|||
SDB_API void Ht_(foreach)(HtName_(Ht) *ht, HT_(ForeachCallback) cb, void *user) {
|
||||
ut32 i;
|
||||
|
||||
for (i = 0; i < ht->size; ++i) {
|
||||
for (i = 0; i < ht->size; i++) {
|
||||
HT_(Bucket) *bt = &ht->table[i];
|
||||
HT_(Kv) *kv;
|
||||
ut32 j, count;
|
||||
|
|
Loading…
Reference in New Issue