Fix some of the warnings in #4013

This commit is contained in:
pancake 2016-01-27 03:14:19 +01:00
parent 12838c4459
commit 44a86928cc
6 changed files with 17 additions and 13 deletions

View File

@ -71,7 +71,7 @@ static int riscv_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le
for (; o < &riscv_opcodes[NUMOPCODES]; o++) {
// XXX ASAN segfault if ( !(o->match_func)(o, word) ) continue;
if ( no_alias && (o->pinfo & INSN_ALIAS) ) continue;
if ( isdigit ((ut8)o->subset[0]) && atoi (o->subset) != xlen) continue;
if ( isdigit ((int)(o->subset[0])) && atoi (o->subset) != xlen) continue;
else {
break;
}

View File

@ -526,7 +526,7 @@ static const ut8* r_bin_dwarf_parse_spec_opcode(
return buf;
}
static const ut8* r_bin_dwarf_parse_std_opcode(
static const ut8* r_bin_dwarf_parse_std_opcode (
const RBin *a, const ut8 *obuf, size_t len,
const RBinDwarfLNPHeader *hdr, RBinDwarfSMRegisters *regs,
ut8 opcode, FILE *f, int mode) {
@ -547,7 +547,7 @@ static const ut8* r_bin_dwarf_parse_std_opcode(
}
if (binfile && binfile->sdb_addrinfo && hdr->file_names) {
int fnidx = regs->file - 1;
if (fnidx>=0 && fnidx<hdr->file_names_count) {
if (fnidx >= 0 && fnidx < hdr->file_names_count) {
add_sdb_addrline (binfile->sdb_addrinfo,
regs->address,
hdr->file_names[fnidx].name,
@ -688,7 +688,7 @@ static void r_bin_dwarf_set_regs_default (const RBinDwarfLNPHeader *hdr,
R_API int r_bin_dwarf_parse_line_raw2(const RBin *a, const ut8 *obuf,
size_t len, int mode) {
RBinDwarfLNPHeader hdr;
RBinDwarfLNPHeader hdr = {0};
const ut8 *buf = NULL, *buf_tmp = NULL, *buf_end = NULL;
RBinDwarfSMRegisters regs;
int tmplen;

View File

@ -1,4 +1,4 @@
/* radare2 - LGPL - Copyright 2008-2015 - pancake */
/* radare2 - LGPL - Copyright 2008-2016 - pancake */
#include <r_cons.h>
// TWOK is a C implemnetation of 2048 game
@ -47,7 +47,7 @@ static bool twok_fin() {
static void twok_move(int u, int v) {
int i, j, k;
int nKI, nKJ, nIK, nJK;
int nKI = 0, nKJ = 0, nIK = 0, nJK = 0;
int moved = 0;
for (k = 0; k < 4; ++k) {
for (i = 0; i < 4; ++i) {

View File

@ -151,18 +151,22 @@ R_API int r_cons_less_str(const char *str, const char *exitkeys) {
" q - quit\n"
" ? - show this help\n"
"\n";
int lines_count;
int lines_count = 0;
RRegex *rx = NULL;
int w, h, ch, to, ui = 1, from = 0, i;
const char *sreg;
RList **mla;
if (str == NULL || str[0] == '\0') return 0;
char *p = strdup (str);
int *lines = splitlines (p, &lines_count);
RList **mla = malloc(lines_count * sizeof(RList *));
if (lines_count<1) {
mla = NULL;
} else {
mla = calloc (lines_count, sizeof (RList *));
}
for (i = 0; i < lines_count; i++)
mla[i] = r_list_new();
mla[i] = r_list_new ();
r_cons_set_raw (true);
r_cons_show_cursor (false);
@ -178,7 +182,7 @@ R_API int r_cons_less_str(const char *str, const char *exitkeys) {
ch = r_cons_readchar ();
if (exitkeys && strchr (exitkeys, ch)) {
for (i = 0; i < lines_count; i++) {
r_list_free(mla[i]);
r_list_free (mla[i]);
}
free (mla);
free (p);

View File

@ -207,7 +207,7 @@ static int r_debug_native_continue (RDebug *dbg, int pid, int tid, int sig) {
#elif __BSD__
void *data = (void*)(size_t)((sig != -1) ? sig : dbg->reason.signum);
ut64 pc = r_debug_reg_get (dbg, "pc");
return ptrace (PTRACE_CONT, pid, (void*)(size_t)pc, (int)data) == 0;
return ptrace (PTRACE_CONT, pid, (void*)(size_t)pc, (int)(size_t)data) == 0;
#elif __CYGWIN__
#warning "r_debug_native_continue not supported on this platform"
return -1;

View File

@ -3692,7 +3692,7 @@ R_API RBinJavaAttrInfo* r_bin_java_local_variable_table_attr_new (ut8* buffer, u
R_API ut64 r_bin_java_local_variable_type_table_attr_calc_size(RBinJavaAttrInfo *attr) {
RList * list = attr->info.local_variable_type_table_attr.local_variable_table;
RBinJavaLocalVariableTypeAttribute* lvattr;
RListIter *iter, *iter_tmp;
RListIter *iter;
ut64 size = 0;
if (attr) {
size += 6;