From e076734fb971dc5c5aa866dae1ba8df9d69e3ed8 Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 18 Apr 2017 16:22:06 +0200 Subject: [PATCH] Fix #7307 - Remove harmless warnings reported by a Debian user --- libr/asm/arch/arm/gnu/arm-dis.c | 44 ++++++++++++++++----------------- libr/asm/p/asm_arm_gnu.c | 4 +-- libr/crypto/p/crypto_xor.c | 8 ++---- libr/debug/p/debug_native.c | 1 + 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/libr/asm/arch/arm/gnu/arm-dis.c b/libr/asm/arch/arm/gnu/arm-dis.c index b127f1e843..77432fd3a5 100644 --- a/libr/asm/arch/arm/gnu/arm-dis.c +++ b/libr/asm/arch/arm/gnu/arm-dis.c @@ -5166,7 +5166,7 @@ print_insn_thumb16 (bfd_vma pc, struct disassemble_info *info, long given) for (insn = thumb_opcodes; insn->assembler; insn++) if ((given & insn->mask) == insn->value) { - signed long value_in_comment = 0; + // signed long value_in_comment = 0; const char *c = insn->assembler; for (; *c; c++) @@ -5349,17 +5349,17 @@ print_insn_thumb16 (bfd_vma pc, struct disassemble_info *info, long given) case 'd': func (stream, "%ld", (long) reg); - value_in_comment = reg; + // value_in_comment = reg; break; case 'H': func (stream, "%ld", (long) (reg << 1)); - value_in_comment = reg << 1; + // value_in_comment = reg << 1; break; case 'W': func (stream, "%ld", (long) (reg << 2)); - value_in_comment = reg << 2; + // value_in_comment = reg << 2; break; case 'a': @@ -5368,7 +5368,7 @@ print_insn_thumb16 (bfd_vma pc, struct disassemble_info *info, long given) before the calculation. */ info->print_address_func (((pc + 4) & ~3) + (reg << 2), info); - value_in_comment = 0; + //value_in_comment = 0; break; case 'x': @@ -5378,7 +5378,7 @@ print_insn_thumb16 (bfd_vma pc, struct disassemble_info *info, long given) case 'B': reg = ((reg ^ (1 << bitend)) - (1 << bitend)); info->print_address_func (reg * 2 + pc + 4, info); - value_in_comment = 0; + //value_in_comment = 0; break; case 'c': @@ -5409,7 +5409,6 @@ print_insn_thumb16 (bfd_vma pc, struct disassemble_info *info, long given) } } - #if 0 if (value_in_comment > 32 || value_in_comment < -16) func (stream, " ; 0x%lx", value_in_comment); @@ -5474,7 +5473,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) if ((given & insn->mask) == insn->value) { bfd_boolean is_unpredictable = FALSE; - signed long value_in_comment = 0; + // signed long value_in_comment = 0; const char *c = insn->assembler; for (; *c; c++) @@ -5515,7 +5514,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) imm12 |= (given & 0x00007000u) >> 4; imm12 |= (given & 0x04000000u) >> 15; func (stream, "%u", imm12); - value_in_comment = imm12; + //value_in_comment = imm12; } break; @@ -5540,7 +5539,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) imm = (((imm8 << (32 - mod)) | (imm8 >> mod)) & 0xffffffff); } func (stream, "%u", imm); - value_in_comment = imm; + //value_in_comment = imm; } break; @@ -5553,7 +5552,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) imm |= (given & 0x04000000u) >> 15; imm |= (given & 0x000f0000u) >> 4; func (stream, "%u", imm); - value_in_comment = imm; + //value_in_comment = imm; } break; @@ -5565,7 +5564,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) imm |= (given & 0x00000ff0u) >> 0; imm |= (given & 0x0000000fu) << 12; func (stream, "%u", imm); - value_in_comment = imm; + //value_in_comment = imm; } break; @@ -5576,7 +5575,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) imm |= (given & 0x000f0000u) >> 4; imm |= (given & 0x00000fffu) >> 0; func (stream, "%u", imm); - value_in_comment = imm; + //value_in_comment = imm; } break; @@ -5587,7 +5586,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) imm |= (given & 0x00000fffu); imm |= (given & 0x000f0000u) >> 4; func (stream, "%u", imm); - value_in_comment = imm; + //value_in_comment = imm; } break; @@ -5642,8 +5641,9 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) if (U) /* 12-bit positive immediate offset. */ { offset = i12; - if (Rn != 15) - value_in_comment = offset; + if (Rn != 15) { +// value_in_comment = offset; + } } else if (Rn == 15) /* 12-bit negative immediate offset. */ offset = - (int) i12; @@ -5725,7 +5725,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) if (off || !U) { func (stream, ", %c%u", U ? '+' : '-', off * 4); - value_in_comment = (off && U) ? 1 : -1; + //value_in_comment = (off && U) ? 1 : -1; } func (stream, "]"); if (W) @@ -5737,12 +5737,12 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) if (W) { func (stream, "%c%u", U ? '+' : '-', off * 4); - value_in_comment = (off && U) ? 1 : -1; + //value_in_comment = (off && U) ? 1 : -1; } else { func (stream, "{%u}", off); - value_in_comment = off; + // value_in_comment = off; } } } @@ -5958,17 +5958,17 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) { case 'd': func (stream, "%lu", val); - value_in_comment = val; + //value_in_comment = val; break; case 'D': func (stream, "%lu", val + 1); - value_in_comment = val + 1; + // value_in_comment = val + 1; break; case 'W': func (stream, "%lu", val * 4); - value_in_comment = val * 4; + // value_in_comment = val * 4; break; case 'S': diff --git a/libr/asm/p/asm_arm_gnu.c b/libr/asm/p/asm_arm_gnu.c index b24a18afed..4fdba38a25 100644 --- a/libr/asm/p/asm_arm_gnu.c +++ b/libr/asm/p/asm_arm_gnu.c @@ -121,7 +121,7 @@ static int buf_fprintf(void *stream, const char *format, ...) { static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { static char *oldcpu = NULL; - static int oldcpucode = 0; + // static int oldcpucode = 0; int opsize, cpucode = 0; struct disassemble_info obj; char *options = (a->bits == 16)? "force-thumb": "no-force-thumb"; @@ -167,7 +167,7 @@ cpucode = 66471; } obj.arch = 0; obj.mach = cpucode; - oldcpucode = cpucode; + // oldcpucode = cpucode; obj.buffer = bytes; obj.read_memory_func = &arm_buffer_read_memory; diff --git a/libr/crypto/p/crypto_xor.c b/libr/crypto/p/crypto_xor.c index 393cb44062..192ce06f10 100644 --- a/libr/crypto/p/crypto_xor.c +++ b/libr/crypto/p/crypto_xor.c @@ -10,13 +10,12 @@ struct xor_state { int key_size; }; +static struct xor_state st; + static bool xor_init(struct xor_state *const state, const ut8 *key, int keylen) { - int i;//index for key - if (!state || !key || keylen < 1) { // || keylen > MAX_xor_KEY_SIZE) { return false; } - state->key_size = keylen; state->key = malloc (keylen); memcpy (state->key, key, keylen); @@ -33,9 +32,6 @@ static void xor_crypt(struct xor_state *const state, const ut8 *inbuf, ut8 *outb outbuf[i] = inbuf[i] ^ state->key[(i%state->key_size)]; } } - -static struct xor_state st; - static bool xor_set_key(RCrypto *cry, const ut8 *key, int keylen, int mode, int direction) { return xor_init (&st, key, keylen); } diff --git a/libr/debug/p/debug_native.c b/libr/debug/p/debug_native.c index 5ab96ccfd5..5d695e5784 100644 --- a/libr/debug/p/debug_native.c +++ b/libr/debug/p/debug_native.c @@ -545,6 +545,7 @@ static RList *r_debug_native_pids (RDebug *dbg, int pid) { if (procfs_pid_slurp (ppid, "cmdline", buf, sizeof (buf)) == -1) { continue; } + // TODO: add support for gid in RDebugPid.new() r_list_append (list, r_debug_pid_new (buf, i, uid, 's', 0)); } }