mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 07:00:30 +00:00
Fix some warnings
This commit is contained in:
parent
c9a33998b7
commit
d257493fb3
@ -180,8 +180,6 @@ typedef enum
|
||||
|
||||
#define add_target(x) (state->targets[state->tcnt++] = (x))
|
||||
|
||||
static char comment_prefix[] = " ; ";
|
||||
|
||||
static const char *
|
||||
core_reg_name (struct arcDisState * state, int val)
|
||||
{
|
||||
@ -408,38 +406,6 @@ arc_sprintf (struct arcDisState *state, char *buf, const char *format, ...)
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static void
|
||||
write_comments_(struct arcDisState * state,
|
||||
int shimm,
|
||||
int is_limm,
|
||||
long limm_value)
|
||||
{
|
||||
if (state->commentBuffer != 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (is_limm)
|
||||
{
|
||||
const char *name = post_address (state, limm_value + shimm);
|
||||
|
||||
if (*name != 0)
|
||||
WRITE_COMMENT (name);
|
||||
}
|
||||
for (i = 0; i < state->commNum; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
strcpy (state->commentBuffer, comment_prefix);
|
||||
else
|
||||
strcat (state->commentBuffer, ", ");
|
||||
strncat (state->commentBuffer, state->comm[i],
|
||||
sizeof (state->commentBuffer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define write_comments2(x) write_comments_ (state, x, is_limm, limm_value)
|
||||
#define write_comments() write_comments2 (0)
|
||||
|
||||
static const char *condName[] =
|
||||
{
|
||||
/* 0..15. */
|
||||
@ -557,9 +523,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
state->flow = noflow;
|
||||
ignoreFirstOpd = 0;
|
||||
|
||||
if (state->commentBuffer)
|
||||
state->commentBuffer[0] = '\0';
|
||||
|
||||
switch (state->_opcode)
|
||||
{
|
||||
case op_LD0:
|
||||
@ -798,7 +761,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
arc_sprintf (state, state->operandBuffer, formatString,
|
||||
fieldB, fieldC);
|
||||
}
|
||||
write_comments ();
|
||||
break;
|
||||
|
||||
case CLASS_A4_OP3_GENERAL:
|
||||
@ -820,7 +782,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
WRITE_FORMAT_x (B);
|
||||
arc_sprintf (state, state->operandBuffer, formatString, fieldB);
|
||||
}
|
||||
write_comments ();
|
||||
break;
|
||||
|
||||
case CLASS_A4_FLAG:
|
||||
@ -831,7 +792,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
write_instr_name ();
|
||||
WRITE_FORMAT_x (B);
|
||||
arc_sprintf (state, state->operandBuffer, formatString, fieldB);
|
||||
write_comments ();
|
||||
break;
|
||||
|
||||
case CLASS_A4_BRANCH:
|
||||
@ -855,7 +815,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
strcat (formatString, "%s"); /* Address/label name. */
|
||||
arc_sprintf (state, state->operandBuffer, formatString,
|
||||
post_address (state, fieldA));
|
||||
write_comments ();
|
||||
break;
|
||||
|
||||
case CLASS_A4_JC:
|
||||
@ -901,7 +860,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
else
|
||||
arc_sprintf (state, state->operandBuffer, formatString,
|
||||
post_address (state, fieldB), fieldA);
|
||||
write_comments ();
|
||||
break;
|
||||
|
||||
case CLASS_A4_LD0:
|
||||
@ -938,7 +896,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
WRITE_FORMAT_x_RB (C);
|
||||
arc_sprintf (state, state->operandBuffer, formatString,
|
||||
fieldA, fieldB, fieldC);
|
||||
write_comments ();
|
||||
break;
|
||||
|
||||
case CLASS_A4_LD1:
|
||||
@ -984,7 +941,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
}
|
||||
arc_sprintf (state, state->operandBuffer, formatString,
|
||||
fieldA, fieldB, fieldC);
|
||||
write_comments ();
|
||||
break;
|
||||
|
||||
case CLASS_A4_ST:
|
||||
@ -1030,7 +986,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
}
|
||||
arc_sprintf (state, state->operandBuffer, formatString,
|
||||
fieldC, fieldB, fieldA);
|
||||
write_comments2 (fieldA);
|
||||
break;
|
||||
|
||||
case CLASS_A4_SR:
|
||||
@ -1045,7 +1000,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
WRITE_FORMAT_x (B);
|
||||
WRITE_FORMAT_RB ();
|
||||
arc_sprintf (state, state->operandBuffer, formatString, fieldC, fieldB);
|
||||
write_comments ();
|
||||
break;
|
||||
|
||||
case CLASS_A4_OP3_SUBOPC3F:
|
||||
@ -1065,7 +1019,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
WRITE_FORMAT_x (B);
|
||||
WRITE_FORMAT_RB ();
|
||||
arc_sprintf (state, state->operandBuffer, formatString, fieldA, fieldB);
|
||||
write_comments ();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -281,7 +281,6 @@ static bfd_vma bfd_getm32_ac (unsigned int) ATTRIBUTE_UNUSED;
|
||||
|
||||
#define add_target(x) (state->targets[state->tcnt++] = (x))
|
||||
|
||||
static char comment_prefix[] = " ; ";
|
||||
static short int enable_simd = 0;
|
||||
static short int enable_insn_stream = 0;
|
||||
|
||||
@ -534,29 +533,6 @@ my_sprintf (struct arcDisState *state, char *buf, const char*format, ...)
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
write_comments_(struct arcDisState *state, int shimm, int is_limm, long limm_value)
|
||||
{
|
||||
if (state->commentBuffer != 0)
|
||||
{
|
||||
int i;
|
||||
if (is_limm)
|
||||
{
|
||||
const char *name = post_address(state, limm_value+shimm);
|
||||
if (*name != 0) WRITE_COMMENT(name);
|
||||
}
|
||||
for(i = 0; i < state->commNum; i++)
|
||||
{
|
||||
if (i == 0) strcpy(state->commentBuffer, comment_prefix);
|
||||
else strcat(state->commentBuffer, ", ");
|
||||
strncat(state->commentBuffer, state->comm[i], sizeof(state->commentBuffer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define write_comments2(x) write_comments_(state, x, is_limm, limm_value)
|
||||
#define write_comments() write_comments2(0)
|
||||
|
||||
static const char *condName[] =
|
||||
{
|
||||
/* 0..15. */
|
||||
@ -736,9 +712,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
state->acnt = 0;
|
||||
state->flow = noflow;
|
||||
|
||||
if (state->commentBuffer)
|
||||
state->commentBuffer[0] = '\0';
|
||||
|
||||
/* Find the match for the opcode. Once the major opcode category is
|
||||
* identified, get the subopcode to determine the exact instruction.
|
||||
* Based on the instruction identified, select the decoding class.
|
||||
@ -2491,7 +2464,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_FORMAT_COMMA_x(C);
|
||||
WRITE_NOP_COMMENT();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldA, fieldB, fieldC);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@ -2515,7 +2487,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_FORMAT_COMMA_x(C);
|
||||
WRITE_NOP_COMMENT();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldB, fieldC);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@ -2575,7 +2546,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_NOP_COMMENT();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldB, fieldC);
|
||||
}
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
@ -2605,7 +2575,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
write_instr_name();
|
||||
WRITE_FORMAT_x(C);
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldC);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
@ -2664,7 +2633,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
else
|
||||
my_sprintf(state, state->operandBuffer, formatString,
|
||||
post_address(state, fieldC));
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
@ -2730,7 +2698,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
|
||||
WRITE_FORMAT_COMMA_x_RB(C);
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldA, fieldB, fieldC);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
@ -2784,7 +2751,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_FORMAT_COMMA_x_RB(C);
|
||||
}
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldA, fieldB, fieldC);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
@ -2826,7 +2792,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_FORMAT_COMMA_x_RB(A);
|
||||
}
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldC, fieldB, fieldA);
|
||||
write_comments2(fieldA);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
@ -2863,7 +2828,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_FORMAT_x(C);
|
||||
WRITE_FORMAT_RB();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldB, fieldC);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 9:
|
||||
@ -2893,7 +2857,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
strcat(formatString, ",%s"); /* address/label name */
|
||||
WRITE_NOP_COMMENT();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldB, fieldC, post_address(state, fieldA));
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 10:
|
||||
@ -2920,7 +2883,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_FORMAT_x(C);
|
||||
WRITE_FORMAT_RB();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldB, fieldC);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 11:
|
||||
@ -2948,7 +2910,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
fieldCisReg = 0;
|
||||
strcat(formatString, "%s"); /* address/label name */
|
||||
my_sprintf(state, state->operandBuffer, formatString, post_address(state, fieldC));
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 12:
|
||||
@ -3045,7 +3006,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
|
||||
strcat(formatString, "%s"); /* address/label name */
|
||||
my_sprintf(state, state->operandBuffer, formatString, post_address(state, fieldA));
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 14:
|
||||
@ -3326,7 +3286,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
|
||||
strcat(formatString, "%s"); /* address/label name */
|
||||
my_sprintf(state, state->operandBuffer, formatString, post_address(state, fieldA));
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 25:
|
||||
@ -3350,7 +3309,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
strcat(formatString, ",%s"); /* address/label name */
|
||||
WRITE_NOP_COMMENT();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldB, fieldA, post_address(state, fieldC));
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 26:
|
||||
@ -3403,7 +3361,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_FORMAT_RB();
|
||||
WRITE_NOP_COMMENT();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldC, fieldB, fieldA);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 29:
|
||||
@ -3422,7 +3379,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_FORMAT_COMMA_x(A);
|
||||
WRITE_NOP_COMMENT();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldB, fieldC, fieldA);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 30:
|
||||
@ -3439,7 +3395,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
WRITE_FORMAT_COMMA_x(C);
|
||||
WRITE_NOP_COMMENT();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldB, fieldC);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 31:
|
||||
@ -3528,7 +3483,6 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
|
||||
WRITE_NOP_COMMENT();
|
||||
my_sprintf(state, state->operandBuffer, formatString, fieldB, fieldC);
|
||||
write_comments();
|
||||
break;
|
||||
|
||||
case 35:
|
||||
|
@ -208,13 +208,13 @@ static int PE_(r_bin_pe_init_imports)(struct PE_(r_bin_pe_obj_t) *bin) {
|
||||
}
|
||||
|
||||
static int PE_(r_bin_pe_init_exports)(struct PE_(r_bin_pe_obj_t) *bin) {
|
||||
int i;
|
||||
PE_(image_data_directory) *data_dir_export = \
|
||||
&bin->nt_headers->optional_header.DataDirectory[PE_IMAGE_DIRECTORY_ENTRY_EXPORT];
|
||||
PE_DWord export_dir_offset = PE_(r_bin_pe_rva_to_offset)(bin, data_dir_export->VirtualAddress);
|
||||
|
||||
#if 0
|
||||
// STAB PARSER
|
||||
int i;
|
||||
{
|
||||
ut8 *stab = NULL;
|
||||
int stab_sz = 0;
|
||||
|
@ -1,13 +1,14 @@
|
||||
/* radare - LGPL - Copyright 2007-2013 - pancake */
|
||||
/* radare - LGPL - Copyright 2007-2014 - pancake */
|
||||
|
||||
#include <r_io.h>
|
||||
#include <r_lib.h>
|
||||
#include <r_util.h>
|
||||
#include <r_debug.h> /* only used for BSD PTRACE redefinitions */
|
||||
|
||||
#define r_io_redirect(io,file) \
|
||||
free (io->redirect); \
|
||||
io->redirect = file? strdup (file): NULL
|
||||
static void my_io_redirect (RIO *io, const char *file) {
|
||||
free (io->redirect);
|
||||
io->redirect = file? strdup (file): NULL;
|
||||
}
|
||||
|
||||
#if __linux__ || __APPLE__ || __WINDOWS__ || \
|
||||
__NetBSD__ || __KFBSD__ || __OpenBSD__
|
||||
@ -282,14 +283,14 @@ static RIODesc *__open(RIO *io, const char *file, int rw, int mode) {
|
||||
// TODO: use io_procpid here? faster or what?
|
||||
sprintf (uri, "ptrace://%d", pid);
|
||||
#endif
|
||||
r_io_redirect (io, uri);
|
||||
my_io_redirect (io, uri);
|
||||
} else {
|
||||
sprintf (uri, "attach://%d", pid);
|
||||
r_io_redirect (io, uri);
|
||||
my_io_redirect (io, uri);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
r_io_redirect (io, NULL);
|
||||
my_io_redirect (io, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -169,10 +169,10 @@ static int assemble(RParse *p, char *data, char *str) {
|
||||
}
|
||||
|
||||
static int varsub(RParse *p, RAnalFunction *f, char *data, char *str, int len) {
|
||||
#if USE_VARSUBS
|
||||
char *ptr, *ptr2;
|
||||
int i;
|
||||
strncpy (str, data, len);
|
||||
#if USE_VARSUBS
|
||||
for (i = 0; i < R_ANAL_VARSUBS; i++)
|
||||
if (f->varsubs[i].pat[0] != '\0' && f->varsubs[i].sub[0] != '\0' &&
|
||||
(ptr = strstr (data, f->varsubs[i].pat))) {
|
||||
@ -182,6 +182,7 @@ static int varsub(RParse *p, RAnalFunction *f, char *data, char *str, int len) {
|
||||
}
|
||||
return R_TRUE;
|
||||
#else
|
||||
strncpy (str, data, len);
|
||||
return R_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
@ -275,11 +275,11 @@ static int assemble(RParse *p, char *data, char *str) {
|
||||
}
|
||||
|
||||
static int varsub(RParse *p, RAnalFunction *f, char *data, char *str, int len) {
|
||||
#if USE_VARSUBS
|
||||
char *ptr, *ptr2;
|
||||
int i;
|
||||
|
||||
strncpy (str, data, len);
|
||||
#if USE_VARSUBS
|
||||
for (i = 0; i < R_ANAL_VARSUBS; i++)
|
||||
if (f->varsubs[i].pat[0] != '\0' && f->varsubs[i].sub[0] != '\0' &&
|
||||
(ptr = strstr (data, f->varsubs[i].pat))) {
|
||||
@ -289,6 +289,7 @@ static int varsub(RParse *p, RAnalFunction *f, char *data, char *str, int len) {
|
||||
}
|
||||
return R_TRUE;
|
||||
#else
|
||||
strncpy (str, data, len);
|
||||
return R_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
@ -206,11 +206,10 @@ static int assemble(RParse *p, char *data, char *str) {
|
||||
}
|
||||
|
||||
static int varsub(RParse *p, RAnalFunction *f, char *data, char *str, int len) {
|
||||
#if USE_VARSUBS
|
||||
char *ptr, *ptr2;
|
||||
int i;
|
||||
|
||||
strncpy (str, data, len);
|
||||
#if USE_VARSUBS
|
||||
for (i = 0; i < R_ANAL_VARSUBS; i++)
|
||||
if (f->varsubs[i].pat[0] != '\0' && f->varsubs[i].sub[0] != '\0' &&
|
||||
(ptr = strstr (data, f->varsubs[i].pat))) {
|
||||
@ -220,6 +219,7 @@ static int varsub(RParse *p, RAnalFunction *f, char *data, char *str, int len) {
|
||||
}
|
||||
return R_TRUE;
|
||||
#else
|
||||
strncpy (str, data, len);
|
||||
return R_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
@ -163,10 +163,10 @@ static inline int issegoff (const char *w) {
|
||||
|
||||
|
||||
static int varsub(RParse *p, RAnalFunction *f, char *data, char *str, int len) {
|
||||
int i;
|
||||
char *ptr, *ptr2;
|
||||
strncpy (str, data, len);
|
||||
#if USE_VARSUBS
|
||||
int i;
|
||||
char *ptr, *ptr2;
|
||||
for (i = 0; i < R_ANAL_VARSUBS; i++)
|
||||
if (f->varsubs[i].pat[0] != '\0' && \
|
||||
f->varsubs[i].sub[0] != '\0' && \
|
||||
|
Loading…
Reference in New Issue
Block a user