Fix some gcc warnings

This commit is contained in:
jvoisin 2014-08-11 16:07:17 +02:00
parent a6ad71eccb
commit bcbeb3c066
13 changed files with 23 additions and 18 deletions

View File

@ -26,6 +26,8 @@ static const char *arg(csh *handle, cs_insn *insn, char *buf, int n) {
case ARM_OP_MEM:
// TODO
break;
default:
break;
}
return buf;
}
@ -50,6 +52,8 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len
case ARM_CC_GT:
case ARM_CC_LE:
break;
default:
break;
}
// TODO: PREFIX CONDITIONAL
switch (insn->id) {
@ -107,6 +111,8 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len
r_strbuf_appendf (&op->esil, "%s,%d,+,[1],%s,=",
MEMBASE(1), MEMDISP(1), REG(0));
break;
default:
break;
}
return 0;
}
@ -193,6 +199,8 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {
op->jump = IMM(0);
}
break;
default:
break;
}
if (a->decode) {
if (!analop_esil (a, op, addr, buf, len, &handle, insn))

View File

@ -40,7 +40,6 @@ static const char *arg(csh *handle, cs_insn *insn, char *buf, int n) {
#define ARG(x) arg(handle, insn, str[x], x)
static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, csh *handle, cs_insn *insn) {
int i;
char str[32][32];
r_strbuf_init (&op->esil);
r_strbuf_set (&op->esil, "");

View File

@ -7,7 +7,6 @@
#include <r_anal.h>
static int nios2_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len) {
ut64 dst = 0LL;
if (op == NULL)
return 1;
/* Ayeeee! What's inside op? Do we have an initialized RAnalOp? Are we going to have a leak here? :-( */

View File

@ -23,7 +23,7 @@ R_API int r_anal_fcn_var_add (RAnal *a, ut64 fna, const char kind, int scope, ut
}
R_API int r_anal_var_add (RAnal *a, ut64 addr, int scope, int delta, char kind, const char *type, int size, const char *name) {
char key[128], key2[128], val[128];
char key[128], val[128];
if (!kind) kind ='v';
switch (kind) {
case 'a':

View File

@ -25,8 +25,10 @@ int avrdis (char *out, ut64 addr, cut8 *buf, int len) {
ins.address = addr;
ins.opcode =
(buf[3]<<8) | (buf[2]);
// (buf[3]<<24) | (buf[2]<<16) | \
//(buf[1]<<8) | (buf[0]);
/*
(buf[3]<<24) | (buf[2]<<16) | \
(buf[1]<<8) | (buf[0]);
*/
if (disassembleInstruction (&dins, ins)) {
strcpy (out, "invalid");
return -1;

View File

@ -223,8 +223,7 @@ static int cmd_cmp(void *data, const char *input) {
ut16 v16;
ut32 v32;
ut64 v64;
int ret, sz;
const char *p;
int ret;
FILE *fd;
switch (*input) {

View File

@ -266,7 +266,6 @@ static int cmd_meta_comment(RCore *core, const char *input) {
//
{
const char* newcomment = input+2;
char *text;
while (*newcomment==' ') newcomment++;
char *comment = r_meta_get_string (
core->anal, R_META_TYPE_COMMENT, addr);

View File

@ -302,12 +302,11 @@ static int cb_dbgbep(void *user, void *data) {
}
return R_TRUE;
}
static int cb_runprofile(void *user, ut8 *data) {
//RRunProfile = data;
static int cb_runprofile(void *user, void *data) {
RCore *r = (RCore*) user;
RConfigNode *node = (RConfigNode*) data;
free ((void*)r->io->runprofile);
if (!data || !*data)
if (!node || !*(node->value))
r->io->runprofile = NULL;
else r->io->runprofile = strdup (node->value);
return R_TRUE;

View File

@ -707,7 +707,7 @@ static void handle_show_functions (RCore *core, RDisasmState *ds) {
f->name, f->size, core->cons->vline[LINE_VERT]); // |-
}
} else {
char *korner = "";
const char* korner;
const char *fmt = ds->show_color?
"%s%s "Color_RESET"%s(%s) %s"Color_RESET" %d\n":
"%s (%s) %s %d\n%s ";

View File

@ -464,11 +464,12 @@ static int r_cmd_java_reload_bin_from_buf (RCore *core, RBinJavaObj *obj, ut8* b
int res = r_bin_java_load_bin (obj, buffer, len);
if (res == R_TRUE) {
RBinPlugin *cp = NULL, *tmp;
//RBinPlugin *cp = NULL;
RBinPlugin *tmp;
RListIter *iter;
r_list_foreach (core->bin->plugins, iter, tmp) {
if (!strncmp ("java", tmp->name, 4)) {
cp = tmp;
//cp = tmp;
break;
}
}

View File

@ -404,13 +404,13 @@ static int r_cmd_yara_load_default_rules(const RCore* core) {
#define YARA_PATH R2_PREFIX "/share/radare2/" R2_VERSION "/yara/"
RListIter* iter = NULL;
char* filename, *complete_path;
ut8* rules;
char* rules;
RList* list = r_sys_dir (YARA_PATH);
r_list_foreach (list, iter, filename) {
if (filename[0] != '.') { // skip '.', '..' and hidden files
complete_path = r_str_concat (strdup (YARA_PATH), filename);
rules = r_file_gzslurp(complete_path, NULL, R_TRUE);
rules = (char*)r_file_gzslurp(complete_path, NULL, R_TRUE);
if (r_yr_compiler_add_string (compiler, rules, NULL) > 0) {
char buf[64];
eprintf ("Error: %s\n",

View File

@ -31,7 +31,7 @@ static int r_debug_handle_signals (RDebug *dbg) {
siginfo_t siginfo = {0};
int ret = ptrace (PTRACE_GETSIGINFO, dbg->pid, 0, &siginfo);
if (ret != -1 && siginfo.si_signo>0) {
siginfo_t newsiginfo = {0};
//siginfo_t newsiginfo = {0};
//ptrace (PTRACE_SETSIGINFO, dbg->pid, 0, &siginfo);
dbg->reason = R_DBG_REASON_SIGNAL;
dbg->signum = siginfo.si_signo;

View File

@ -104,7 +104,6 @@ int send_packet(libgdbr_t* g) {
}
int read_packet(libgdbr_t* g) {
int ret = 0;
int po_size = 0;
if (!g) {
fprintf (stderr, "Initialize libgdbr_t first\n");