Fix warnings

This commit is contained in:
Álvaro Felipe Melchor 2016-09-26 12:52:14 +02:00
parent 8abffec384
commit 3a5444f3ca
5 changed files with 21 additions and 21 deletions

View File

@ -18,7 +18,7 @@ https://en.wikipedia.org/wiki/Atmel_AVR_instruction_set
#define AVR_SOFTCAST(x,y) (x+(y*0x100))
typedef struct _cpu_models_tag_ {
const char const *model;
const char *const model;
int pc_bits;
int pc_mask;
int pc_size;
@ -28,7 +28,7 @@ typedef struct _cpu_models_tag_ {
typedef void (*inst_handler_t) (RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, int *fail, CPU_MODEL *cpu);
typedef struct _opcodes_tag_ {
const char const *name;
const char *const name;
int mask;
int selector;
inst_handler_t handler;
@ -41,7 +41,7 @@ typedef struct _opcodes_tag_ {
{ \
model, \
(pc_bits), \
(~((~0) << (pc_bits))), \
(~((unsigned int)(~0) << (pc_bits))), \
((pc_bits) >> 3) + (((pc_bits) & 0x07) ? 1 : 0), \
eeprom_sz \
}
@ -69,7 +69,7 @@ CPU_MODEL cpu_models[] = {
CPU_MODEL_DECL ((char *) 0, 16, 512)
};
void __generic_brxx(RAnalOp *op, const ut8 *buf, const char const *eval) {
void __generic_brxx(RAnalOp *op, const ut8 *buf, const char *const eval) {
op->jump = op->addr
+ ((((buf[0] & 0xf8) >> 2) | (buf[1] & 0x03) << 6)
| (buf[1] & 0x2 ? ~((int) 0x7f) : 0))

View File

@ -802,15 +802,15 @@ R_API int r_bin_load_io_at_offset_as_sz(RBin *bin, RIODesc *desc, ut64 baseaddr,
iob->desc_seek (io, desc, seekaddr);
buf_bytes = iob->desc_read (io, desc, &sz);
if (!buf_bytes) {
if (seekaddr == 0) {
seekaddr = baseaddr;
}
if (seekaddr == UT64_MAX) {
seekaddr = 0;
}
int i, totalsz = 0;
if (!seekaddr) {
seekaddr = baseaddr;
}
if (seekaddr == UT64_MAX) {
seekaddr = 0;
}
int totalsz = 0;
ut8 *buf;
const blksz = 4096;
const int blksz = 4096;
buf_bytes = malloc (blksz);
ut64 maxsz = 2 * 1024 * 1024;
while (totalsz < maxsz) {
@ -818,7 +818,7 @@ R_API int r_bin_load_io_at_offset_as_sz(RBin *bin, RIODesc *desc, ut64 baseaddr,
iob->desc_seek (io, desc, seekaddr + totalsz);
buf = iob->desc_read (io, desc, &sz);
if (buf) {
char *out = realloc (buf_bytes, totalsz + blksz);
ut8 *out = realloc (buf_bytes, totalsz + blksz);
if (!out) {
eprintf ("out of memory\n");
break;

View File

@ -129,5 +129,6 @@ RBinPlugin r_bin_plugin_cgc = {
.relocs = &relocs,
.dbginfo = &r_bin_dbginfo_elf,
.create = &create,
.patch_relocs = &patch_relocs,
.write = &r_bin_write_elf,
};

View File

@ -803,18 +803,17 @@ static void parse_class(RBinFile *binfile, RBinDexObj *bin, RBinDexClass *c, int
free (sym);
continue;
}
ut16 regsz = r_read_le16 (ff2);
ut16 ins_size = r_read_le16 (ff2 + 2);
ut16 outs_size = r_read_le16 (ff2 + 4);
//ut16 regsz = r_read_le16 (ff2);
//ut16 ins_size = r_read_le16 (ff2 + 2);
//ut16 outs_size = r_read_le16 (ff2 + 4);
ut16 tries_size = r_read_le16 (ff2 + 6);
ut32 debug_info_off = r_read_le32 (ff2 + 8);
//ut32 debug_info_off = r_read_le32 (ff2 + 8);
ut32 insns_size = r_read_le32 (ff2 + 12);
ut64 prolog_size = 2+2+2+2+4+4;
ut64 prolog_size = 2 + 2 + 2 + 2 + 4 + 4;
if (tries_size > 0) {
//prolog_size += 2 + 8*tries_size; // we need to parse all so the catch info...
}
// TODO: prolog_size
sym->paddr = MC + prolog_size;// + 0x10;
sym->vaddr = MC + prolog_size;// + 0x10;

View File

@ -49,14 +49,14 @@ static void fcn_zig_search(RCore *core, ut64 ini, ut64 fin) {
}
}
} else {
eprintf ("Cannot read %d bytes at 0x%08"PFMT64x"\n", len, ini);
eprintf ("Cannot read %llu bytes at 0x%08"PFMT64x"\n", len, ini);
}
r_cons_printf ("fs %s\n", (old_fs == -1) ? "*" : core->flags->spaces[old_fs]);
r_cons_break_end ();
free (buf);
core->sign->matches = count;
} else {
eprintf ("Cannot alloc %d bytes\n", len);
eprintf ("Cannot alloc %llu bytes\n", len);
core->sign->matches = 0;
}
}