From 3a5444f3caa567ec78357c2e7d635eb1fea586af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Felipe=20Melchor?= Date: Mon, 26 Sep 2016 12:52:14 +0200 Subject: [PATCH] Fix warnings --- libr/anal/p/anal_avr.c | 8 ++++---- libr/bin/bin.c | 18 +++++++++--------- libr/bin/p/bin_cgc.c | 1 + libr/bin/p/bin_dex.c | 11 +++++------ libr/core/cmd_zign.c | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libr/anal/p/anal_avr.c b/libr/anal/p/anal_avr.c index e00c74c912..cdf6a089d4 100644 --- a/libr/anal/p/anal_avr.c +++ b/libr/anal/p/anal_avr.c @@ -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)) diff --git a/libr/bin/bin.c b/libr/bin/bin.c index e8ea5b2cd3..e6a1b3d7ec 100644 --- a/libr/bin/bin.c +++ b/libr/bin/bin.c @@ -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; diff --git a/libr/bin/p/bin_cgc.c b/libr/bin/p/bin_cgc.c index 5b446d1426..b2122a51a8 100644 --- a/libr/bin/p/bin_cgc.c +++ b/libr/bin/p/bin_cgc.c @@ -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, }; diff --git a/libr/bin/p/bin_dex.c b/libr/bin/p/bin_dex.c index 2cffb575c5..d1387b757e 100644 --- a/libr/bin/p/bin_dex.c +++ b/libr/bin/p/bin_dex.c @@ -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; diff --git a/libr/core/cmd_zign.c b/libr/core/cmd_zign.c index 247c7441db..9dfdf61b88 100644 --- a/libr/core/cmd_zign.c +++ b/libr/core/cmd_zign.c @@ -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; } }