diff --git a/libr/anal/anal.c b/libr/anal/anal.c index 2998420361..d6be1ef46f 100644 --- a/libr/anal/anal.c +++ b/libr/anal/anal.c @@ -362,7 +362,7 @@ R_API RAnalOp *r_anal_op_hexstr(RAnal *anal, ut64 addr, const char *str) { return op; } -R_API _Bool r_anal_op_is_eob (RAnalOp *op) { +R_API bool r_anal_op_is_eob (RAnalOp *op) { switch (op->type) { case R_ANAL_OP_TYPE_JMP: case R_ANAL_OP_TYPE_UJMP: diff --git a/libr/anal/flirt.c b/libr/anal/flirt.c index ce8298fb47..cde6f7d80b 100644 --- a/libr/anal/flirt.c +++ b/libr/anal/flirt.c @@ -885,7 +885,7 @@ static ut8 read_node_variant_mask (RFlirtNode *node, RBuffer *b) { return true; } -static _Bool read_node_bytes (RFlirtNode *node, RBuffer *b) { +static bool read_node_bytes (RFlirtNode *node, RBuffer *b) { /*Reads the node bytes, and also sets the variant bytes in variant_bool_array*/ /*returns false on parsing error*/ int i; diff --git a/libr/anal/sign.c b/libr/anal/sign.c index eed781dfa8..4ad3ee7cd9 100644 --- a/libr/anal/sign.c +++ b/libr/anal/sign.c @@ -29,7 +29,7 @@ R_API void r_sign_ns(RSign *sig, const char *str) { } else sig->ns[0] = '\0'; } -R_API _Bool r_sign_add(RSign *sig, RAnal *anal, int type, const char *name, const char *arg) { +R_API bool r_sign_add(RSign *sig, RAnal *anal, int type, const char *name, const char *arg) { int len; char *data = NULL, *ptr; RSignItem *si; // TODO: like in r_search.. we need r_sign_item_new () diff --git a/libr/anal/state.c b/libr/anal/state.c index f11c1d81a5..7cfdc3330a 100644 --- a/libr/anal/state.c +++ b/libr/anal/state.c @@ -86,7 +86,7 @@ R_API const ut8 * r_anal_state_get_buf_by_addr (RAnalState *state, ut64 addr) { return NULL; } -R_API _Bool r_anal_state_addr_is_valid (RAnalState *state, ut64 addr) { +R_API bool r_anal_state_addr_is_valid (RAnalState *state, ut64 addr) { return (addr < state->end && addr >= state->start); } diff --git a/libr/asm/arch/lh5801/lh5801.c b/libr/asm/arch/lh5801/lh5801.c index e09ca0953b..bb46a73a1b 100644 --- a/libr/asm/arch/lh5801/lh5801.c +++ b/libr/asm/arch/lh5801/lh5801.c @@ -136,7 +136,7 @@ enum lh5801_insn_format { #define LH5801_IFMT_IMMS(f) ((f)&LH5801_IFMT_IMM_MASK) #define LH5801_IFMT_RMODE(f) ((f)&LH5801_IFMT_RMODE_MASK) -static _Bool lh5801_ifmt_fd_matches(enum lh5801_insn_format fmt, int fd) { +static bool lh5801_ifmt_fd_matches(enum lh5801_insn_format fmt, int fd) { switch (fmt & LH5801_IFMT_FD_MASK) { case LH5801_IFMT_FD_NO: return !fd; case LH5801_IFMT_FD_YES: return fd; diff --git a/libr/asm/p/asm_ppc_cs.c b/libr/asm/p/asm_ppc_cs.c index 3f14e24113..721c43e524 100644 --- a/libr/asm/p/asm_ppc_cs.c +++ b/libr/asm/p/asm_ppc_cs.c @@ -6,7 +6,7 @@ static csh handle = 0; -static _Bool the_end(void *p) { +static bool the_end(void *p) { if (handle) { cs_close (&handle); handle = 0; @@ -59,10 +59,8 @@ RAsmPlugin r_asm_plugin_ppc_cs = { .license = "BSD", .arch = "ppc", .bits = 32|64, - .init = NULL, .fini = the_end, .disassemble = &disassemble, - .assemble = NULL }; #ifndef CORELIB diff --git a/libr/asm/p/asm_sysz.c b/libr/asm/p/asm_sysz.c index b917a44b27..3ccf579f50 100644 --- a/libr/asm/p/asm_sysz.c +++ b/libr/asm/p/asm_sysz.c @@ -8,7 +8,7 @@ static csh cd = 0; -static _Bool the_end(void *p) { +static bool the_end(void *p) { if (cd) { cs_close (&cd); cd = 0; @@ -57,10 +57,8 @@ RAsmPlugin r_asm_plugin_sysz = { .license = "BSD", .arch = "sysz", .bits = 32, - .init = NULL, .fini = the_end, .disassemble = &disassemble, - .assemble = NULL }; #ifndef CORELIB diff --git a/libr/asm/p/asm_tms320.c b/libr/asm/p/asm_tms320.c index 02968143a2..afaf9368b8 100644 --- a/libr/asm/p/asm_tms320.c +++ b/libr/asm/p/asm_tms320.c @@ -28,11 +28,11 @@ static int tms320_disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { return op->size; } -static _Bool tms320_init(void * user) { +static bool tms320_init(void * user) { return tms320_dasm_init (&engine); } -static _Bool tms320_fini(void * user) { +static bool tms320_fini(void * user) { return tms320_dasm_fini (&engine); } diff --git a/libr/asm/p/asm_x86_cs.c b/libr/asm/p/asm_x86_cs.c index 254e4c18d2..b9c9910150 100644 --- a/libr/asm/p/asm_x86_cs.c +++ b/libr/asm/p/asm_x86_cs.c @@ -10,7 +10,7 @@ static csh cd = 0; static int n = 0; static cs_insn *insn = NULL; -static _Bool the_end(void *p) { +static bool the_end(void *p) { #if !USE_ITER_API if (insn) { cs_free (insn, n); diff --git a/libr/bin/demangle.c b/libr/bin/demangle.c index de2a40f60d..7521d8eccb 100644 --- a/libr/bin/demangle.c +++ b/libr/bin/demangle.c @@ -294,7 +294,7 @@ R_API int r_bin_demangle_type (const char *str) { return R_BIN_NM_NONE; } -R_API int r_bin_lang_rust(RBinFile *binfile) { +R_API bool r_bin_lang_rust(RBinFile *binfile) { RBinObject *o = binfile ? binfile->o : NULL; RBinInfo *info = o ? o->info : NULL; RBinSymbol *sym; diff --git a/libr/bin/format/coff/coff.c b/libr/bin/format/coff/coff.c index cad4a5a364..6886950cc4 100644 --- a/libr/bin/format/coff/coff.c +++ b/libr/bin/format/coff/coff.c @@ -1,10 +1,10 @@ -/* radare - LGPL - Copyright 2008-2014 pancake, inisider */ +/* radare - LGPL - Copyright 2008-2015 pancake, inisider */ #include #include "coff.h" -_Bool r_coff_supported_arch (const ut8 *buf) { +bool r_coff_supported_arch (const ut8 *buf) { ut16 arch = *(ut16*)buf; switch (arch) { case COFF_FILE_MACHINE_AMD64: diff --git a/libr/bin/format/coff/coff.h b/libr/bin/format/coff/coff.h index c4b3c24c70..1e0d268d3e 100644 --- a/libr/bin/format/coff/coff.h +++ b/libr/bin/format/coff/coff.h @@ -24,7 +24,7 @@ struct r_bin_coff_obj { Sdb *kv; }; -_Bool r_coff_supported_arch(const ut8 *buf); /* Reads two bytes from buf. */ +bool r_coff_supported_arch(const ut8 *buf); /* Reads two bytes from buf. */ struct r_bin_coff_obj* r_bin_coff_new_buf(struct r_buf_t *buf); void r_bin_coff_free(struct r_bin_coff_obj *obj); RBinAddr *r_coff_get_entry(struct r_bin_coff_obj *obj); diff --git a/libr/bin/mangling/cxx.c b/libr/bin/mangling/cxx.c index 593fa695bd..d1b917701f 100644 --- a/libr/bin/mangling/cxx.c +++ b/libr/bin/mangling/cxx.c @@ -2,20 +2,20 @@ #include -static int is_cxx_symbol (const char *name) { +static bool is_cxx_symbol (const char *name) { if (!strncmp (name, "_Z", 2)) - return 1; + return true; if (!strncmp (name, "__Z", 3)) - return 1; - return 0; + return true; + return false; } -R_API int r_bin_lang_cxx(RBinFile *binfile) { +R_API bool r_bin_lang_cxx(RBinFile *binfile) { RBinObject *o = binfile ? binfile->o : NULL; RBinInfo *info = o ? o->info : NULL; RBinSymbol *sym; RListIter *iter; - int hascxx = false; + bool hascxx = false; const char *lib; if (!info) diff --git a/libr/bin/mangling/dlang.c b/libr/bin/mangling/dlang.c index a04ac82ad9..21ee95a596 100644 --- a/libr/bin/mangling/dlang.c +++ b/libr/bin/mangling/dlang.c @@ -12,12 +12,12 @@ static int is_dlang_symbol (const char *name) { return 0; } -R_API int r_bin_lang_dlang(RBinFile *binfile) { +R_API bool r_bin_lang_dlang(RBinFile *binfile) { RBinObject *o = binfile ? binfile->o : NULL; RBinInfo *info = o ? o->info : NULL; + bool hasdlang = false; RBinSymbol *sym; RListIter *iter; - int hasdlang = false; const char *lib; if (!info) diff --git a/libr/bin/mangling/msvc.c b/libr/bin/mangling/msvc.c index 6c4974ae01..7aaaa72ddb 100644 --- a/libr/bin/mangling/msvc.c +++ b/libr/bin/mangling/msvc.c @@ -2,18 +2,16 @@ #include -static int is_cxx_symbol (const char *name) { - if (*name == '?') - return 1; - return 0; +static bool is_cxx_symbol (const char *name) { + return (*name == '?'); } -R_API int r_bin_lang_msvc(RBinFile *binfile) { +R_API bool r_bin_lang_msvc(RBinFile *binfile) { RBinObject *o = binfile ? binfile->o : NULL; RBinInfo *info = o ? o->info : NULL; RBinSymbol *sym; RListIter *iter; - _Bool hascxx = false; + bool hascxx = false; if (info) { r_list_foreach (o->symbols, iter, sym) { if (is_cxx_symbol (sym->name)) { @@ -24,5 +22,5 @@ R_API int r_bin_lang_msvc(RBinFile *binfile) { if (hascxx) info->lang = "msvc"; } - return (int)hascxx; + return hascxx; } diff --git a/libr/bin/mangling/objc.c b/libr/bin/mangling/objc.c index 4403215e3c..2804c56a90 100644 --- a/libr/bin/mangling/objc.c +++ b/libr/bin/mangling/objc.c @@ -1,26 +1,25 @@ -/* radare - LGPL - Copyright 2012 - pancake */ +/* radare - LGPL - Copyright 2012-2015 - pancake */ #include -R_API int r_bin_lang_objc(RBinFile *binfile) { +R_API bool r_bin_lang_objc(RBinFile *binfile) { RBinObject *o = binfile ? binfile->o : NULL; RBinInfo *info = o ? o->info : NULL; RListIter *iter; RBinSymbol *sym; - int hasobjc = false; - char *dsym; + bool hasobjc = false; const char *ft; + char *dsym; - if (!info) - return 0; + if (!info) return false; ft = info->rclass; - if (!ft || (!strstr (ft, "mach") && !strstr (ft, "elf"))) - return 0; + return false; r_list_foreach (o->symbols, iter, sym) { - if (!hasobjc) - if (!strncmp (sym->name, "_OBJC_", 6)) - hasobjc = true; + if (!hasobjc && !strncmp (sym->name, "_OBJC_", 6)) { + hasobjc = true; + break; + } dsym = r_bin_demangle_objc (binfile, sym->name); if (dsym) { // Add type diff --git a/libr/bin/mangling/swift.c b/libr/bin/mangling/swift.c index 9b514d4a70..a736f7880c 100644 --- a/libr/bin/mangling/swift.c +++ b/libr/bin/mangling/swift.c @@ -2,21 +2,18 @@ #include -R_API int r_bin_lang_swift(RBinFile *binfile) { +R_API bool r_bin_lang_swift(RBinFile *binfile) { RBinObject *o = binfile ? binfile->o : NULL; RBinInfo *info = o ? o->info : NULL; RBinSymbol *sym; RListIter *iter; - _Bool haslang = false; - if (info) { r_list_foreach (o->symbols, iter, sym) { if (strstr (sym->name, "swift_release")) { - haslang = true; info->lang = "swift"; - break; + return true; } } } - return (int)haslang; + return false; } diff --git a/libr/core/yank.c b/libr/core/yank.c index 799c5224a0..54438ed8a8 100644 --- a/libr/core/yank.c +++ b/libr/core/yank.c @@ -287,7 +287,7 @@ R_API int r_core_yank_cat (RCore *core, ut64 pos) { R_API int r_core_yank_hud_file (RCore *core, const char *input) { char *buf = NULL; - _Bool res = false; + bool res = false; ut32 len = 0; if (!input || !*input) return false; for (input++; *input==' '; input++) ; diff --git a/libr/debug/debug.c b/libr/debug/debug.c index 21dfb174a6..bb2d7b9eec 100644 --- a/libr/debug/debug.c +++ b/libr/debug/debug.c @@ -804,7 +804,7 @@ R_API int r_debug_continue_syscall(RDebug *dbg, int sc) { // TODO: remove from here? this is code injection! R_API int r_debug_syscall(RDebug *dbg, int num) { - _Bool ret = false; + bool ret = false; if (dbg->h->contsc) { ret = dbg->h->contsc (dbg, dbg->pid, num); } else { diff --git a/libr/debug/p/debug_native.c b/libr/debug/p/debug_native.c index e34343ae91..81416f18f9 100644 --- a/libr/debug/p/debug_native.c +++ b/libr/debug/p/debug_native.c @@ -755,9 +755,9 @@ static RList *r_debug_native_map_get (RDebug *dbg) { #if __KFBSD__ list = r_debug_native_sysctl_map (dbg); if (list != NULL) return list; - snprintf (path, sizeof(path), "/proc/%d/map", dbg->pid); + snprintf (path, sizeof (path), "/proc/%d/map", dbg->pid); #else - snprintf (path, sizeof(path), "/proc/%d/maps", dbg->pid); + snprintf (path, sizeof (path), "/proc/%d/maps", dbg->pid); #endif fd = fopen (path, "r"); if (!fd) { @@ -813,7 +813,7 @@ static RList *r_debug_native_map_get (RDebug *dbg) { r_num_get (NULL, region), r_num_get (NULL, region2), perm, 0); - if (map == NULL) break; + if (!map) break; map->file = strdup (path); r_list_append (list, map); } @@ -878,23 +878,6 @@ static RList *r_debug_native_modules_get (RDebug *dbg) { return last; } -// TODO: deprecate??? -#if 0 -static int r_debug_native_bp_write(int pid, ut64 addr, int size, int hw, int rwx) { - if (hw) { - /* implement DRx register handling here */ - return true; - } - return false; -} - -/* TODO: rethink */ -static int r_debug_native_bp_read(int pid, ut64 addr, int hw, int rwx) { - return true; -} -#endif - -// TODO: implement own-defined signals static int r_debug_native_kill (RDebug *dbg, int pid, int tid, int sig) { int ret = false; if (pid == 0) pid = dbg->pid; @@ -1075,6 +1058,7 @@ static RList *xnu_desc_list (int pid) { #endif } #endif + #if __WINDOWS__ static RList *win_desc_list (int pid) { RDebugDesc *desc; diff --git a/libr/include/r_anal.h b/libr/include/r_anal.h index 2d7b15c568..80187cf886 100644 --- a/libr/include/r_anal.h +++ b/libr/include/r_anal.h @@ -1176,7 +1176,7 @@ R_API const char *r_anal_stackop_tostring (int s); R_API RAnalOp *r_anal_op_new(void); R_API void r_anal_op_free(void *op); R_API void r_anal_op_fini(RAnalOp *op); -R_API _Bool r_anal_op_is_eob (RAnalOp *op); +R_API bool r_anal_op_is_eob (RAnalOp *op); R_API RList *r_anal_op_list_new(void); R_API int r_anal_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len); @@ -1188,7 +1188,7 @@ R_API RAnalEsil *r_anal_esil_new (int iotrap); R_API void r_anal_esil_trace (RAnalEsil *esil, RAnalOp *op); R_API void r_anal_esil_trace_list (RAnalEsil *esil); R_API void r_anal_esil_trace_show (RAnalEsil *esil, int idx); -R_API _Bool r_anal_esil_set_pc (RAnalEsil *esil, ut64 addr); +R_API bool r_anal_esil_set_pc (RAnalEsil *esil, ut64 addr); R_API int r_anal_esil_setup (RAnalEsil *esil, RAnal *anal, int romem, int stats); R_API void r_anal_esil_free (RAnalEsil *esil); R_API int r_anal_esil_parse (RAnalEsil *esil, const char *str); @@ -1198,7 +1198,7 @@ R_API int r_anal_esil_mem_write (RAnalEsil *esil, ut64 addr, const ut8 *buf, int R_API int r_anal_esil_reg_read (RAnalEsil *esil, const char *regname, ut64 *num, int *size); R_API int r_anal_esil_reg_write (RAnalEsil *esil, const char *dst, ut64 num); R_API int r_anal_esil_pushnum (RAnalEsil *esil, ut64 num); -R_API _Bool r_anal_esil_push (RAnalEsil *esil, const char *str); +R_API bool r_anal_esil_push (RAnalEsil *esil, const char *str); R_API char *r_anal_esil_pop (RAnalEsil *esil); R_API int r_anal_esil_set_op (RAnalEsil *esil, const char *op, RAnalEsilOp code); R_API void r_anal_esil_stack_free (RAnalEsil *esil); @@ -1476,7 +1476,7 @@ R_API RAnalBlock * r_anal_state_search_bb (RAnalState* state, ut64 addr); R_API void r_anal_state_free (RAnalState * state); R_API ut64 r_anal_state_get_len (RAnalState *state, ut64 addr); R_API const ut8 * r_anal_state_get_buf_by_addr (RAnalState *state, ut64 addr); -R_API _Bool r_anal_state_addr_is_valid (RAnalState *state, ut64 addr); +R_API bool r_anal_state_addr_is_valid (RAnalState *state, ut64 addr); R_API void r_anal_state_merge_bb_list (RAnalState *state, RList* bbs); R_API void r_anal_state_set_depth(RAnalState *state, ut32 depth); diff --git a/libr/include/r_asm.h b/libr/include/r_asm.h index 7d5d490c97..d2eb121816 100644 --- a/libr/include/r_asm.h +++ b/libr/include/r_asm.h @@ -116,8 +116,8 @@ typedef struct r_asm_plugin_t { char *license; void *user; // user data pointer int bits; - _Bool (*init)(void *user); - _Bool (*fini)(void *user); + bool (*init)(void *user); + bool (*fini)(void *user); int (*disassemble)(RAsm *a, RAsmOp *op, const ut8 *buf, int len); int (*assemble)(RAsm *a, RAsmOp *op, const char *buf); RAsmModifyCallback modify; diff --git a/libr/include/r_bin.h b/libr/include/r_bin.h index af151f742e..e8d4717d62 100644 --- a/libr/include/r_bin.h +++ b/libr/include/r_bin.h @@ -434,12 +434,12 @@ R_API char *r_bin_demangle_msvc(const char *str); R_API char *r_bin_demangle_swift(const char *s); R_API char *r_bin_demangle_objc(RBinFile *binfile, const char *sym); R_API int r_bin_lang_type(RBinFile *binfile, const char *def, const char *sym); -R_API int r_bin_lang_objc(RBinFile *binfile); -R_API int r_bin_lang_swift(RBinFile *binfile); -R_API int r_bin_lang_cxx(RBinFile *binfile); -R_API int r_bin_lang_msvc(RBinFile *binfile); -R_API int r_bin_lang_dlang(RBinFile *binfile); -R_API int r_bin_lang_rust(RBinFile *binfile); +R_API bool r_bin_lang_objc(RBinFile *binfile); +R_API bool r_bin_lang_swift(RBinFile *binfile); +R_API bool r_bin_lang_cxx(RBinFile *binfile); +R_API bool r_bin_lang_msvc(RBinFile *binfile); +R_API bool r_bin_lang_dlang(RBinFile *binfile); +R_API bool r_bin_lang_rust(RBinFile *binfile); R_API RList* r_bin_get_entries(RBin *bin); R_API RList* r_bin_get_fields(RBin *bin); diff --git a/libr/include/r_io.h b/libr/include/r_io.h index 5e8e5fff62..45ebbc8c08 100644 --- a/libr/include/r_io.h +++ b/libr/include/r_io.h @@ -353,7 +353,7 @@ R_API int r_io_cache_read(RIO *io, ut64 addr, ut8 *buf, int len); /* io/map.c */ R_API void r_io_map_init(RIO *io); -R_API _Bool r_io_map_overlaps (RIO *io, RIODesc *fd, RIOMap *map); +R_API bool r_io_map_overlaps (RIO *io, RIODesc *fd, RIOMap *map); R_API ut64 r_io_map_next(RIO *io, ut64 addr); R_API RIOMap *r_io_map_add(RIO *io, int fd, int flags, ut64 delta, ut64 offset, ut64 size); R_API int r_io_map_del_at(RIO *io, ut64 addr); diff --git a/libr/include/r_sign.h b/libr/include/r_sign.h index d9945698ea..e787593639 100644 --- a/libr/include/r_sign.h +++ b/libr/include/r_sign.h @@ -44,7 +44,7 @@ typedef int (*RSignCallback)(RSignItem *si, void *user); #ifdef R_API R_API RSign *r_sign_new(void); -R_API _Bool r_sign_add(RSign *sig, RAnal *anal, int type, +R_API bool r_sign_add(RSign *sig, RAnal *anal, int type, const char *name, const char *arg); R_API RSign *r_sign_free(RSign *sig); R_API void r_sign_ns(RSign *sig, const char *str); diff --git a/libr/io/map.c b/libr/io/map.c index c68a534500..3a535d02f0 100644 --- a/libr/io/map.c +++ b/libr/io/map.c @@ -314,7 +314,7 @@ R_API ut64 r_io_map_select_current_fd(RIO *io, ut64 off, int fd) { return paddr; } -R_API _Bool r_io_map_overlaps (RIO *io, RIODesc *fd, RIOMap *map) { +R_API bool r_io_map_overlaps (RIO *io, RIODesc *fd, RIOMap *map) { RListIter *iter; RIOMap *im = NULL; ut64 off = map->from; diff --git a/shlr/Makefile b/shlr/Makefile index edd5373649..74717aea25 100644 --- a/shlr/Makefile +++ b/shlr/Makefile @@ -11,7 +11,7 @@ CS_VER=3.0 CS_TAR=http://capstone-engine.org/download/$(CS_VER)/capstone-$(CS_VER).tgz CS_TAR= CS_URL=$(GIT_PREFIX)github.com/aquynh/capstone.git -CS_UPD=20151128 +CS_UPD=20151201 CS_BRA=next CS_TIP=7fc5bc3b4bed4f852124ec1af6a97985118c75b8 # REVERT THIS COMMIT BECAUSE ITS WRONG