mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-26 22:50:48 +00:00
Add =0 and =1 lintings
This commit is contained in:
parent
b9161f5b3c
commit
a538b2b700
@ -730,9 +730,7 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
|
||||
|
||||
default:
|
||||
instrName = instruction_name (state,state->_opcode,0,&flags);
|
||||
/* if (instrName) printf ("FLAGS=0x%x\n", flags); */
|
||||
if (!instrName)
|
||||
{
|
||||
if (!instrName) {
|
||||
instrName = "???";
|
||||
state->flow=invalid_instr;
|
||||
}
|
||||
|
@ -664,7 +664,6 @@ sign_extend (int value, int bits)
|
||||
static int
|
||||
dsmOneArcInst (bfd_vma addr, struct arcDisState *state, disassemble_info * info)
|
||||
{
|
||||
|
||||
int subopcode, mul;
|
||||
int condCodeIsPartOfName = 0;
|
||||
int decodingClass;
|
||||
|
@ -96,14 +96,13 @@ R_API int r_anal_cond_eval(RAnal *anal, RAnalCond *cond) {
|
||||
|
||||
// XXX conflict naming with tostring()
|
||||
R_API char *r_anal_cond_to_string(RAnalCond *cond) {
|
||||
char *val0, *val1, *out = NULL;
|
||||
const char *cnd;
|
||||
char *out = NULL;
|
||||
if (!cond) {
|
||||
return NULL;
|
||||
}
|
||||
cnd = condstring (cond);
|
||||
val0 = r_anal_value_to_string (cond->arg[0]);
|
||||
val1 = r_anal_value_to_string (cond->arg[1]);
|
||||
const char *cnd = condstring (cond);
|
||||
char *val0 = r_anal_value_to_string (cond->arg[0]);
|
||||
char *val1 = r_anal_value_to_string (cond->arg[1]);
|
||||
if (val0) {
|
||||
if (R_ANAL_COND_SINGLE (cond)) {
|
||||
int val0len = strlen (val0) + 10;
|
||||
|
@ -441,7 +441,8 @@ static int _6502_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le
|
||||
op->type = R_ANAL_OP_TYPE_SWI;
|
||||
// override 65816 code which seems to be wrong: size is 1, but pc = pc + 2
|
||||
op->size = 1;
|
||||
// PC + 2 to Stack, P to Stack B=1 D=0 I=1. "B" is not a flag. Only its bit is pushed on the stack
|
||||
// PC + 2 to Stack, P to Stack B=1 D=0 I=1. "B" is not a flag.
|
||||
// Only its bit is pushed on the stack
|
||||
// PC was already incremented by one at this point. Needs to incremented once more
|
||||
// New PC is Interrupt Vector: $fffe. (FIXME: Confirm this is valid for all 6502)
|
||||
r_strbuf_set (&op->esil, ",1,I,=,0,D,=,flags,0x10,|,0x100,sp,+,=[1],pc,1,+,0xfe,sp,+,=[2],3,sp,-=,0xfffe,[2],pc,=");
|
||||
|
@ -2080,8 +2080,8 @@ static int analop64_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int l
|
||||
case ARM64_INS_STP: // stp x6, x7, [x6,0xf90]
|
||||
{
|
||||
int disp = (int)MEMDISP64 (2);
|
||||
char sign = disp>=0?'+':'-';
|
||||
st64 abs = disp>=0? MEMDISP64 (2): -(st64)MEMDISP64 (2);
|
||||
char sign = (disp >= 0)?'+':'-';
|
||||
st64 abs = (disp >= 0)? MEMDISP64 (2): -(st64)MEMDISP64 (2);
|
||||
int size = REGSIZE64 (0);
|
||||
// Pre-index case
|
||||
if (ISPREINDEX64 ()) {
|
||||
@ -2095,8 +2095,8 @@ static int analop64_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int l
|
||||
// Post-index case
|
||||
} else if (ISPOSTINDEX64 ()) {
|
||||
int val = IMM64 (3);
|
||||
sign = val>=0?'+':'-';
|
||||
abs = val>=0? val: -val;
|
||||
sign = (val >= 0)?'+':'-';
|
||||
abs = (val >= 0)? val: -val;
|
||||
// "stp x4, x5, [x8], 0x10"
|
||||
// "x4,x8,=[],x5,x8,8,+,=[],16,x8,+="
|
||||
r_strbuf_setf(&op->esil,
|
||||
@ -2117,8 +2117,8 @@ static int analop64_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int l
|
||||
case ARM64_INS_LDP: // ldp x29, x30, [sp], 0x10
|
||||
{
|
||||
int disp = (int)MEMDISP64 (2);
|
||||
char sign = disp>=0?'+':'-';
|
||||
ut64 abs = disp>=0? MEMDISP64 (2): (ut64)(-MEMDISP64 (2));
|
||||
char sign = (disp >= 0)? '+': '-';
|
||||
ut64 abs = (disp >= 0)? MEMDISP64 (2): (ut64)(-MEMDISP64 (2));
|
||||
int size = REGSIZE64 (0);
|
||||
// Pre-index case
|
||||
// x2,x8,32,+,=[8],x3,x8,32,+,8,+,=[8]
|
||||
@ -2135,8 +2135,8 @@ static int analop64_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int l
|
||||
// Post-index case
|
||||
} else if (ISPOSTINDEX64 ()) {
|
||||
int val = IMM64 (3);
|
||||
sign = val>=0?'+':'-';
|
||||
abs = val>=0? val: -val;
|
||||
sign = (val >= 0)?'+':'-';
|
||||
abs = (val >= 0)? val: -val;
|
||||
// ldp x4, x5, [x8], -0x10
|
||||
// x8,[8],x4,=,x8,8,+,[8],x5,=,16,x8,+=
|
||||
r_strbuf_setf (&op->esil,
|
||||
@ -2739,8 +2739,8 @@ r6,r5,r4,3,sp,[*],12,sp,+=
|
||||
if (OPCOUNT() == 2) {
|
||||
if (ISMEM(1) && !HASMEMINDEX(1)) {
|
||||
int disp = MEMDISP (1);
|
||||
char sign = disp>=0?'+':'-';
|
||||
disp = disp>=0?disp:-disp;
|
||||
char sign = (disp >= 0)?'+':'-';
|
||||
disp = (disp >= 0)? disp: -disp;
|
||||
r_strbuf_appendf (&op->esil, "%s,0x%x,%s,%c,0xffffffff,&,=[%d]",
|
||||
REG(0), disp, MEMBASE(1), sign, str_ldr_bytes);
|
||||
if (insn->detail->arm.writeback) {
|
||||
@ -2839,8 +2839,8 @@ r6,r5,r4,3,sp,[*],12,sp,+=
|
||||
if (ISREG (1) && str_ldr_bytes == 8) { // e.g. 'strd r2, r3, [r4]', normally should be the only case for ISREG(1).
|
||||
if (!HASMEMINDEX(2)) {
|
||||
int disp = MEMDISP (2);
|
||||
char sign = disp>=0?'+':'-';
|
||||
disp = disp>=0?disp:-disp;
|
||||
char sign = (disp >= 0)?'+':'-';
|
||||
disp = (disp >= 0)? disp: -disp;
|
||||
r_strbuf_appendf (&op->esil, "%s,%d,%s,%c,0xffffffff,&,=[4],%s,4,%d,+,%s,%c,0xffffffff,&,=[4]",
|
||||
REG(0), disp, MEMBASE(2), sign, REG(1), disp, MEMBASE(2), sign);
|
||||
if (insn->detail->arm.writeback) {
|
||||
|
@ -2224,8 +2224,8 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len
|
||||
case ARM64_STP: // stp x6, x7, [x6,0xf90]
|
||||
{
|
||||
int disp = (int)MEMDISP64 (2);
|
||||
char sign = disp>=0?'+':'-';
|
||||
ut64 abs = disp>=0? MEMDISP64 (2): -MEMDISP64 (2);
|
||||
char sign = (disp >= 0)?'+':'-';
|
||||
ut64 abs = (disp >= 0)? MEMDISP64 (2): -MEMDISP64 (2);
|
||||
int size = REGSIZE64 (0);
|
||||
// Pre-index case
|
||||
if (ISPREINDEX64 ()) {
|
||||
@ -2239,8 +2239,8 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len
|
||||
// Post-index case
|
||||
} else if (ISPOSTINDEX64 ()) {
|
||||
int val = GETIMM64 (3);
|
||||
sign = val>=0?'+':'-';
|
||||
abs = val>=0? val: -val;
|
||||
sign = (val >= 0)?'+':'-';
|
||||
abs = (val >= 0)? val: -val;
|
||||
// "stp x4, x5, [x8], 0x10"
|
||||
// "x4,x8,=[],x5,x8,8,+,=[],16,x8,+="
|
||||
r_strbuf_setf(&op->esil,
|
||||
@ -2262,8 +2262,8 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len
|
||||
case ARM64_LDP: // ldp x29, x30, [sp], 0x10
|
||||
{
|
||||
int disp = (int)MEMDISP64 (2);
|
||||
char sign = disp>=0?'+':'-';
|
||||
ut64 abs = disp>=0? MEMDISP64 (2): -MEMDISP64 (2);
|
||||
char sign = (disp >= 0)?'+':'-';
|
||||
ut64 abs = (disp >= 0)? MEMDISP64 (2): -MEMDISP64 (2);
|
||||
int size = REGSIZE64 (0);
|
||||
// Pre-index case
|
||||
// x2,x8,32,+,=[8],x3,x8,32,+,8,+,=[8]
|
||||
@ -2280,8 +2280,8 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len
|
||||
// Post-index case
|
||||
} else if (ISPOSTINDEX64 ()) {
|
||||
int val = GETIMM64 (3);
|
||||
sign = val>=0?'+':'-';
|
||||
abs = val>=0? val: -val;
|
||||
sign = (val >= 0)? '+': '-';
|
||||
abs = (val >= 0)? val: -val;
|
||||
// ldp x4, x5, [x8], -0x10
|
||||
// x8,[8],x4,=,x8,8,+,[8],x5,=,16,x8,+=
|
||||
r_strbuf_setf (&op->esil,
|
||||
|
@ -239,7 +239,7 @@ static int java_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len
|
||||
// the easy parts though
|
||||
if (IN_SWITCH_OP) {
|
||||
NUM_CASES_SEEN++;
|
||||
if (NUM_CASES_SEEN == SWITCH_OP_CASES) IN_SWITCH_OP=0;
|
||||
if (NUM_CASES_SEEN == SWITCH_OP_CASES) { IN_SWITCH_OP = 0; }
|
||||
op->addr = addr;
|
||||
op->size = 4;
|
||||
op->type2 = 0;
|
||||
|
@ -846,7 +846,7 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, gnu_insn*insn) {
|
||||
break;
|
||||
case MIPS_INS_JALR:
|
||||
case MIPS_INS_JALRS:
|
||||
if (strcmp(R_REG(rd), "rd")==0) {
|
||||
if (!strcmp (R_REG (rd), "rd")) {
|
||||
r_strbuf_appendf (&op->esil, ES_TRAP_DS () "" ES_CALL_D ("%s"), R_REG (rs));
|
||||
} else {
|
||||
r_strbuf_appendf (&op->esil, ES_TRAP_DS () "" ES_CALL_DR ("%s", "%s"), R_REG (rd), R_REG (rs));
|
||||
|
@ -55,7 +55,7 @@ fail:
|
||||
return false;
|
||||
}
|
||||
|
||||
static int r_bin_bflt_init(struct r_bin_bflt_obj *obj, RBuffer *buf) {
|
||||
static bool r_bin_bflt_init(RBinBfltObj *obj, RBuffer *buf) {
|
||||
obj->b = r_buf_ref (buf);
|
||||
obj->size = r_buf_size (buf);
|
||||
obj->endian = false;
|
||||
@ -69,19 +69,20 @@ static int r_bin_bflt_init(struct r_bin_bflt_obj *obj, RBuffer *buf) {
|
||||
return true;
|
||||
}
|
||||
|
||||
R_API void r_bin_bflt_free(struct r_bin_bflt_obj *obj) {
|
||||
if (obj) {
|
||||
R_FREE (obj->hdr);
|
||||
r_buf_free (obj->b);
|
||||
R_FREE (obj);
|
||||
R_IPI void r_bin_bflt_free(RBinBfltObj *o) {
|
||||
if (o) {
|
||||
R_FREE (o->hdr);
|
||||
r_buf_free (o->b);
|
||||
free (o);
|
||||
}
|
||||
}
|
||||
|
||||
R_API struct r_bin_bflt_obj *r_bin_bflt_new_buf(RBuffer *buf) {
|
||||
struct r_bin_bflt_obj *bin = R_NEW0 (struct r_bin_bflt_obj);
|
||||
if (bin && r_bin_bflt_init (bin, buf)) {
|
||||
return bin;
|
||||
R_IPI RBinBfltObj *r_bin_bflt_new_buf(RBuffer *buf) {
|
||||
r_return_val_if_fail (buf, NULL);
|
||||
RBinBfltObj *o = R_NEW0 (RBinBfltObj);
|
||||
if (o && r_bin_bflt_init (o, buf)) {
|
||||
return o;
|
||||
}
|
||||
r_bin_bflt_free (bin);
|
||||
r_bin_bflt_free (o);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
#define FLAT_FLAG_GZDATA 0x8 /* only data/relocs are compressed (for XIP) */
|
||||
#define FLAT_FLAG_KTRACE 0x10 /* output useful kernel trace for debugging */
|
||||
|
||||
struct bflt_hdr {
|
||||
typedef struct bflt_hdr {
|
||||
ut8 magic[4];
|
||||
ut32 rev;
|
||||
ut32 entry;
|
||||
@ -28,28 +28,28 @@ struct bflt_hdr {
|
||||
ut32 flags;
|
||||
ut32 build_date;
|
||||
ut32 filler[5];
|
||||
};
|
||||
} RBinBfltHeader;
|
||||
|
||||
struct reloc_struct_t {
|
||||
typedef struct reloc_struct_t {
|
||||
ut32 addr_to_patch;
|
||||
ut32 data_offset;
|
||||
};
|
||||
} RBinBfltReloc;
|
||||
|
||||
struct r_bin_bflt_obj {
|
||||
struct bflt_hdr *hdr;
|
||||
struct reloc_struct_t *reloc_table;
|
||||
struct reloc_struct_t *got_table;
|
||||
typedef struct r_bin_bflt_obj {
|
||||
RBinBfltHeader *hdr;
|
||||
RBinBfltReloc *reloc_table;
|
||||
RBinBfltReloc *got_table;
|
||||
RBuffer *b;
|
||||
ut8 endian;
|
||||
size_t size;
|
||||
ut32 n_got;
|
||||
};
|
||||
} RBinBfltObj;
|
||||
|
||||
#define BFLT_HDR_SIZE sizeof (struct bflt_hdr)
|
||||
#define BFLT_HDR_SIZE sizeof (RBinBfltHeader)
|
||||
#define VALID_GOT_ENTRY(x) (x != UT32_MAX)
|
||||
|
||||
R_API RBinAddr *r_bflt_get_entry(struct r_bin_bflt_obj *bin);
|
||||
R_API struct r_bin_bflt_obj *r_bin_bflt_new_buf(RBuffer *buf);
|
||||
R_API void r_bin_bflt_free(struct r_bin_bflt_obj *obj);
|
||||
R_IPI RBinAddr *r_bflt_get_entry(RBinBfltObj *bin);
|
||||
R_IPI RBinBfltObj *r_bin_bflt_new_buf(RBuffer *buf);
|
||||
R_IPI void r_bin_bflt_free(RBinBfltObj *obj);
|
||||
|
||||
#endif
|
||||
|
@ -162,7 +162,6 @@ static RList* sections(RBinFile *bf) {
|
||||
|
||||
} else {
|
||||
for (i = 0; i < ((bf->size - hdroffset)/ 0x8000) ; i++) {
|
||||
|
||||
addrom(ret,"ROM",i,hdroffset + i*0x8000,0x8000 + (i*0x10000), 0x8000);
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,7 @@
|
||||
#include "stream_file.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void parse_pe_stream(void *stream, R_STREAM_FILE *stream_file)
|
||||
{
|
||||
void parse_pe_stream(void *stream, R_STREAM_FILE *stream_file) {
|
||||
int data_size = 0;
|
||||
char *data = 0, *ptmp = 0;
|
||||
int read_bytes = 0;
|
||||
|
@ -10,11 +10,14 @@ R_LIB_VERSION (r_cons);
|
||||
|
||||
// Stub function that cb_main_output gets pointed to in util/log.c by r_cons_new
|
||||
// This allows Iaito to set per-task logging redirection
|
||||
static R_TH_LOCAL int oldraw = -1;
|
||||
static R_TH_LOCAL RThreadLock *lock = NULL;
|
||||
static R_TH_LOCAL RConsContext r_cons_context_default = {{{{0}}}};
|
||||
static R_TH_LOCAL RCons g_cons_instance = {0};
|
||||
static R_TH_LOCAL RCons *r_cons_instance = NULL;
|
||||
static R_TH_LOCAL RThreadLock r_cons_lock = R_THREAD_LOCK_INIT;
|
||||
static R_TH_LOCAL ut64 prev = 0LL; //r_time_now_mono ();
|
||||
static R_TH_LOCAL RStrBuf *echodata = NULL; // TODO: move into RConsInstance? maybe nope
|
||||
#define I (r_cons_instance)
|
||||
#define C (getctx())
|
||||
|
||||
@ -973,7 +976,6 @@ static bool lastMatters(void) {
|
||||
}
|
||||
|
||||
R_API void r_cons_echo(const char *msg) {
|
||||
static R_TH_LOCAL RStrBuf *echodata = NULL; // TODO: move into RConsInstance? maybe nope
|
||||
if (msg) {
|
||||
if (echodata) {
|
||||
r_strbuf_append (echodata, msg);
|
||||
@ -1207,7 +1209,6 @@ R_API void r_cons_visual_flush(void) {
|
||||
|
||||
R_API void r_cons_print_fps(int col) {
|
||||
int fps = 0, w = r_cons_get_size (NULL);
|
||||
static R_TH_LOCAL ut64 prev = 0LL; //r_time_now_mono ();
|
||||
fps = 0;
|
||||
if (prev) {
|
||||
ut64 now = r_time_now_mono ();
|
||||
@ -1835,7 +1836,6 @@ R_API void r_cons_show_cursor(int cursor) {
|
||||
*
|
||||
*/
|
||||
R_API void r_cons_set_raw(bool is_raw) {
|
||||
static R_TH_LOCAL int oldraw = -1;
|
||||
if (oldraw != -1) {
|
||||
if (is_raw == oldraw) {
|
||||
return;
|
||||
|
@ -971,7 +971,7 @@ static int cmd_rap(void *data, const char *input) {
|
||||
case '!': // "=!"
|
||||
if (input[1] == 'q') {
|
||||
R_FREE (core->cmdremote);
|
||||
} else if (input[1] == '=') { // =!=0 or =!= for iosystem
|
||||
} else if (input[1] == '=') { // =!= or =!= for iosystem
|
||||
R_FREE (core->cmdremote);
|
||||
core->cmdremote = r_str_trim_dup (input + 2);
|
||||
} else {
|
||||
|
@ -2085,7 +2085,8 @@ R_API int r_core_visual_trackflags(RCore *core) {
|
||||
option = 0;
|
||||
}
|
||||
break;
|
||||
case 'K': option-=10;
|
||||
case 'K':
|
||||
option -= 10;
|
||||
if (option < 0) {
|
||||
option = 0;
|
||||
}
|
||||
@ -2200,7 +2201,6 @@ R_API int r_core_visual_trackflags(RCore *core) {
|
||||
format = MAX_FORMAT;
|
||||
}
|
||||
break;
|
||||
// = (format<=0)? MAX_FORMAT: format-1; break;
|
||||
case 'p': format++; break;
|
||||
case 'l':
|
||||
case ' ':
|
||||
|
@ -100,7 +100,7 @@ static int r_debug_bochs_reg_read(RDebug *dbg, int type, ut8 *buf, int size) {
|
||||
bochs_send_cmd (desc, "regs", true);
|
||||
//r14: 00000000_00000000 r15: 00000000_00000000
|
||||
//rip: 00000000_0000e07b
|
||||
//eflags 0x00000046: id vip vif ac vm rf nt IOPL=0 of df if tf sf ZF af PF cf
|
||||
//"eflags 0x00000046: id vip vif ac vm rf nt IOPL=0 of df if tf sf ZF af PF cf"
|
||||
//<bochs:109>return -1;
|
||||
pos = 0x78;
|
||||
lenRec = strlen (desc->data);
|
||||
|
@ -212,12 +212,13 @@ static RList *osx_dbg_maps(RDebug *dbg) {
|
||||
address = prev_address + prev_size;
|
||||
print = 0;
|
||||
|
||||
if (prev_size==0)
|
||||
if (prev_size == 0) {
|
||||
break;
|
||||
}
|
||||
/* Check to see if address space has wrapped around. */
|
||||
if (address == 0)
|
||||
if (address == 0) {
|
||||
done = 1;
|
||||
|
||||
}
|
||||
if (!done) {
|
||||
count = VM_REGION_BASIC_INFO_COUNT_64;
|
||||
kret = mach_vm_region (task, (mach_vm_address_t *)&address,
|
||||
|
@ -193,7 +193,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
#if 1
|
||||
if (argc > 1) {
|
||||
|
||||
mpc_result_t r;
|
||||
if (mpc_parse_contents (argv[1], Smallc, &r)) {
|
||||
mpc_ast_print_to (r.output, stderr);
|
||||
@ -224,7 +223,6 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
mpc_cleanup (17, Ident, Number, Character, String, Factor, Term, Lexp, Stmt, Exp,
|
||||
Vartype, Typeident, Decls, Args, Body, Comment, Procedure, CProcedure,
|
||||
Sigdef, Includes, Smallc);
|
||||
|
@ -354,7 +354,6 @@ static bool ihex_parse(RBuffer *rbuf, char *str) {
|
||||
sec_start = segreg;
|
||||
|
||||
if (eol) {
|
||||
// checksum
|
||||
byte = 0; //break checksum if sscanf failed
|
||||
if (sscanf (str + 9 + 4, "%02x", &byte) != 1) {
|
||||
cksum = 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2008-2011 pancake<nopcode.org> */
|
||||
/* radare - LGPL - Copyright 2008-2022 pancake */
|
||||
|
||||
#include "r_io.h"
|
||||
#include "r_lib.h"
|
||||
@ -13,8 +13,9 @@ typedef struct {
|
||||
#define RIOW32_HANDLE(x) (((RIOW32*)x)->hnd)
|
||||
|
||||
static int w32__write(RIO *io, RIODesc *fd, const ut8 *buf, int count) {
|
||||
if (!fd || !fd->data)
|
||||
if (!fd || !fd->data) {
|
||||
return -1;
|
||||
}
|
||||
return WriteFile (RIOW32_HANDLE (fd), buf, count, NULL, NULL);
|
||||
}
|
||||
|
||||
@ -33,8 +34,9 @@ static bool w32__close(RIODesc *fd) {
|
||||
}
|
||||
|
||||
static ut64 w32__lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
|
||||
SetFilePointer (RIOW32_HANDLE (fd), offset, 0, !whence?FILE_BEGIN:whence==1?FILE_CURRENT:FILE_END);
|
||||
return (whence == 0)?offset:whence==1?io->off+offset:ST64_MAX;
|
||||
int where = !whence? FILE_BEGIN: whence == 1? FILE_CURRENT: FILE_END;
|
||||
SetFilePointer (RIOW32_HANDLE (fd), offset, 0, where);
|
||||
return (whence == 0)? offset: (whence == 1)? io->off + offset: ST64_MAX;
|
||||
}
|
||||
|
||||
static bool w32__plugin_open(RIO *io, const char *pathname, bool many) {
|
||||
@ -74,6 +76,7 @@ RIOPlugin r_io_plugin_w32 = {
|
||||
.name = "w32",
|
||||
.desc = "w32 API io",
|
||||
.license = "LGPL3",
|
||||
.author = "pancake",
|
||||
.uris = "w32://",
|
||||
.open = w32__open,
|
||||
.close = w32__close,
|
||||
|
@ -1416,7 +1416,7 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
}
|
||||
#if 0
|
||||
if (o && o->info && compute_hashes) {
|
||||
// TODO: recall with limit=0 ?
|
||||
// TODO: recall with !limit ?
|
||||
ut64 limit = r_config_get_i (r->config, "bin.hashlimit");
|
||||
r_bin_file_set_hashes (r->bin, r_bin_file_compute_hashes (r->bin, limit));
|
||||
}
|
||||
|
@ -235,6 +235,7 @@ static int parse(RParse *p, const char *data, char *str) {
|
||||
char w4[64];
|
||||
|
||||
if (!strcmp (data, "invalid")
|
||||
|| !strcmp (data, "???")
|
||||
|| !strcmp (data, "nop")
|
||||
|| !strcmp (data, "DEPRECATED")) {
|
||||
str[0] = 0;
|
||||
|
@ -137,9 +137,7 @@ static int parse(RParse *p, const char *data, char *str) {
|
||||
}
|
||||
if (ptr) {
|
||||
*ptr = '\0';
|
||||
for (++ptr; *ptr == ' '; ptr++) {
|
||||
;
|
||||
}
|
||||
ptr = r_str_trim_head_ro (ptr + 1);
|
||||
strncpy (w0, buf, WSZ - 1);
|
||||
strncpy (w1, ptr, WSZ - 1);
|
||||
|
||||
@ -147,9 +145,7 @@ static int parse(RParse *p, const char *data, char *str) {
|
||||
ptr = strchr (ptr, ',');
|
||||
if (ptr) {
|
||||
*ptr = '\0';
|
||||
for (++ptr; *ptr == ' '; ptr++) {
|
||||
;
|
||||
}
|
||||
ptr = r_str_trim_head_ro (ptr + 1);
|
||||
strncpy (w1, optr, WSZ - 1);
|
||||
strncpy (w2, ptr, WSZ - 1);
|
||||
optr=ptr;
|
||||
|
@ -193,9 +193,9 @@ R_API RSearchKeyword* r_search_keyword_new_hexmask(const char *kwstr, const char
|
||||
|
||||
/* Validate a regexp in the canonical format /<regexp>/<options> */
|
||||
R_API RSearchKeyword *r_search_keyword_new_regexp(const char *str, const char *data) {
|
||||
RSearchKeyword *kw;
|
||||
int i = 0, start, length;
|
||||
|
||||
// TODO: use r_str_trim_head_ro (str);
|
||||
while (isspace ((const unsigned char)str[i])) {
|
||||
i++;
|
||||
}
|
||||
@ -223,17 +223,15 @@ R_API RSearchKeyword *r_search_keyword_new_regexp(const char *str, const char *d
|
||||
return NULL;
|
||||
}
|
||||
|
||||
kw = R_NEW0(RSearchKeyword);
|
||||
RSearchKeyword *kw = R_NEW0 (RSearchKeyword);
|
||||
if (!kw) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
kw->bin_keyword = malloc (length+1);
|
||||
if (!kw->bin_keyword) {
|
||||
r_search_keyword_free (kw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
kw->bin_keyword[length] = 0;
|
||||
memcpy (kw->bin_keyword, str + start, length);
|
||||
kw->keyword_length = length - specials;
|
||||
|
@ -17,7 +17,7 @@ void** r_flist_get(void **x) {
|
||||
#define r_flist_t void**
|
||||
#define RFList void**
|
||||
#define r_flist_rewind(it) for (; (it)!=*(it); (it)--) {} (it)++
|
||||
#define r_flist_next(it) *(it)!=0
|
||||
#define r_flist_next(it) (*(it) != 0)
|
||||
#define r_flist_get(it) *((it)++)
|
||||
#define r_flist_iterator(x) x
|
||||
#define r_flist_unref(x) x
|
||||
|
@ -1452,7 +1452,6 @@ static const char* getchardiff(RPrint *p, char *fmt, ut8 a, ut8 b) {
|
||||
} else {
|
||||
sprintf (fmt, "%c", ch);
|
||||
}
|
||||
//else { fmt[0] = ch; fmt[1]=0; }
|
||||
return fmt;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ static int qrcodegen_getSize(const uint8_t qrcode[]);
|
||||
|
||||
/*
|
||||
* Returns the color of the module (pixel) at the given coordinates, which is either
|
||||
* false for white or true for black. The top left corner has the coordinates (x=0, y=0).
|
||||
* false for white or true for black. The top left corner has the coordinates (x,y)=(0,0)
|
||||
* If the given coordinates are out of bounds, then false (white) is returned.
|
||||
*/
|
||||
static bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y);
|
||||
|
@ -200,7 +200,7 @@ R_API int r_str_binstr2bin(const char *str, ut8 *out, int outlen) {
|
||||
continue;
|
||||
}
|
||||
if (str[j] == '1') {
|
||||
ret|=1 << k;
|
||||
ret |= (1 << k);
|
||||
} else if (str[j] != '0') {
|
||||
return n;
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
/* radare - LGPL - Copyright 2009-2021 - pancake, nikolai */
|
||||
/* radare - LGPL - Copyright 2009-2022 - pancake, nikolai */
|
||||
|
||||
#include <r_util/r_diff.h>
|
||||
|
||||
// the non-system-diff doesnt work well
|
||||
#define USE_SYSTEM_DIFF 1
|
||||
|
||||
|
||||
R_API RDiff *r_diff_new_from(ut64 off_a, ut64 off_b) {
|
||||
RDiff *d = R_NEW0 (RDiff);
|
||||
if (d) {
|
||||
@ -842,7 +841,8 @@ R_API st32 r_diff_levenshtein_path(RLevBuf *bufa, RLevBuf *bufb, ut32 maxdst, RL
|
||||
size_t skip;
|
||||
ut32 alen = bufa->len;
|
||||
ut32 blen = bufb->len;
|
||||
for (skip=0; skip < alen && !levdiff (bufa, bufb, skip, skip); skip++) {}
|
||||
for (skip = 0; skip < alen && !levdiff (bufa, bufb, skip, skip); skip++) {
|
||||
}
|
||||
|
||||
// strip suffix as long as bytes don't diff
|
||||
size_t i;
|
||||
|
@ -9,10 +9,13 @@
|
||||
(git grep -n 'for (size_t' | grep -v sys/) && exit 1
|
||||
(git grep -n 'R_LOG_' | grep '\\n' | grep -v sys/) && exit 1
|
||||
(git grep "`printf '\tfree('`" libr | grep c: ) && exit 1
|
||||
# (git grep '=0' libr| grep c:|grep -v '"' |grep -v '=0x' | less) && exit 1
|
||||
(git grep '=0' libr| grep c:|grep -v '"' |grep -v '=0x') && exit 1
|
||||
(git grep '=1' libr| grep c:|grep -v '"' |grep -v '//') && exit 1
|
||||
(git grep -n 'eprintf' libr | grep 'Error:') && exit 1
|
||||
(git grep -n 'x ""' libr) && exit 1
|
||||
(git grep -n 'x""' libr) && exit 1
|
||||
# (git grep -e 'sizeof(' -e 'for(' -e 'while(' -e 'if(' libr) && exit 1
|
||||
# ( git grep strcmp | grep '== 0') && exit 1
|
||||
(git grep -n ';;$' libr) && exit 1
|
||||
(git grep -n '0 ;' libr) && exit 1
|
||||
(git grep -n -e 'i<' -e 'j<' -e 'k<' libr | grep -v '"') && exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user