id
stringlengths
27
29
content
stringlengths
226
3.24k
codereview_new_cpp_data_7132
TEST(sycl, raw_sycl_interop) { Kokkos::Experimental::SYCL default_space; sycl::context default_context = default_space.sycl_queue().get_context(); - sycl::default_selector device_selector; - sycl::queue queue(default_context, device_selector); constexpr int n = 100; int* p = sycl::malloc_devic...
codereview_new_cpp_data_7133
int SYCL::concurrency() { return Impl::SYCLInternal::singleton().m_maxConcurrency; } #else -int SYCL::concurrency() const { - return Impl::SYCLInternal::singleton().m_maxConcurrency; -} #endif const char* SYCL::name() { return "SYCL"; } why not return `m_space_instance->m_maxConcurrency`? int SYCL::concur...
codereview_new_cpp_data_7134
void OpenMPInternal::initialize(int thread_count) { } // Check for over-subscription - auto const mpi_local_size = []() { - auto ranks = mpi_ranks_per_node(); - if (ranks < 0) return 1; - return ranks; - }(); if (Kokkos::show_warnings() && (mpi_local_size * long(thread_count) > Impl::proce...
codereview_new_cpp_data_7135
void OpenMPInternal::initialize(int thread_count) { } // Check for over-subscription - auto const mpi_local_size = []() { - auto ranks = mpi_ranks_per_node(); - if (ranks < 0) return 1; - return ranks; - }(); if (Kokkos::show_warnings() && (mpi_local_size * long(thread_count) > Impl::proce...
codereview_new_cpp_data_7136
BENCHMARK(Atomic_ContentiousMinReplacements<double>) ->Arg(LENGTH / 5) ->UseManualTime() ->Iterations(10); -/////////////////////////////////////////////////////////////////////// - -int main(int argc, char* argv[]) { - Kokkos::initialize(argc, argv); - benchmark::Initialize(&argc, argv); - benchmark...
codereview_new_cpp_data_7137
TEST(defaultdevicetype, shared_space) { // GET PAGE MIGRATING TIMINGS DATA std::vector<decltype(deviceLocalTimings)> deviceSharedTimings{}; - std::vector<decltype(deviceLocalTimings)> hostSharedTimings{}; for (unsigned i = 0; i < numDeviceHostCycles; ++i) { // GET RESULTS DEVICE deviceSharedTimin...
codereview_new_cpp_data_7138
int get_device_count() { return acc_get_num_devices( Kokkos::Experimental::Impl::OpenACC_Traits::dev_type); #elif defined(KOKKOS_ENABLE_OPENMPTARGET) - return Kokkos::Experimental::OpenMPTarget::detect_device_count(); #else Kokkos::abort("implementation bug"); return -1; If this is the only place w...
codereview_new_cpp_data_7139
TEST(std_algorithms_nonmod_seq_ops, adjacent_find) { #if defined(KOKKOS_ENABLE_CUDA) && \ defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { - GTEST_SKIP() << "FIXME please"; } #endif run_all_scenarios<DynamicTag, int>(); Wrong result? Compiler er...
codereview_new_cpp_data_7140
int HIP::impl_is_initialized() { void HIP::impl_initialize(InitializationSettings const& settings) { const int hip_device_id = Impl::get_gpu(settings); - // Need at least a GPU device - int hipDevCount; - KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceCount(&hipDevCount)); - Impl::HIPInternal::m_hipDev = hip_device...
codereview_new_cpp_data_7141
void cuda_internal_error_abort(cudaError e, const char *name, const char *file, if (file) { out << " " << file << ":" << line; } - // Call Kokkos::Impl::host_abort instead of Kokkos::abort to avoid a warning - // about Kokkos::abort returning in some cases. - host_abort(out.str().c_str()); } //------...
codereview_new_cpp_data_7962
void AdvancedView::update(Cluster cluster) startButton->setText(getStartLabel(isRunning)); QString startToolTip = ""; if (isRunning) { - startToolTip = "Restart the Kubernetes API"; } startButton->setToolTip(startToolTip); } Restarts the already started minikube that might refresh the...
codereview_new_cpp_data_7979
static ut64 shifted_imm64(Instruction *insn, int n, int sz) { // #define VEC64(n) insn->detail->arm64.operands[n].vess #define VEC64_APPEND(sb, n, i) vector64_append (sb, insn, n, i) -#define VEC64_MASK(sh, sz) (bitmask_by_width[63]^(bitmask_by_width[sz-1]<<sh)) static void vector64_append(RStrBuf *sb, Instruct...
codereview_new_cpp_data_7980
R_IPI int wasm_asm(const char *str, ut8 *buf, int buf_len) { } } // TODO: parse immediates - return len? len: -1; } // disassemble an instruction from the given buffer. ```suggestion return len > 0? len: -1; ``` R_IPI int wasm_asm(const char *str, ut8 *buf, int buf_len) { } } // TODO: parse imm...
codereview_new_cpp_data_7981
ut64 Elf_(r_bin_elf_get_entry_offset)(ELFOBJ *bin) { if (entry) { return Elf_(r_bin_elf_v2p) (bin, entry); } - return get_entry_offset_from_shdr(bin); } static ut64 getmainsymbol(ELFOBJ *bin) { ```suggestion return get_entry_offset_from_shdr (bin); ``` ut64 Elf_(r_bin_elf_get_entry_offset)(ELFOBJ *bin...
codereview_new_cpp_data_7982
R_API void r_core_loadlibs_init(RCore *core) { DF (BIN, "bin plugins", bin); DF (EGG, "egg plugins", egg); DF (FS, "fs plugins", fs); - DF (ARCH, "archplugins", arch); core->times->loadlibs_init_time = r_time_now_mono () - prev; } ```suggestion DF (ARCH, "arch plugins", arch); ``` R_API void r_core_lo...
codereview_new_cpp_data_7983
R_API bool r_project_rename(RProject *p, const char *newname) { free (p->name); p->path = new_prjdir; p->name = new_name; - rvc_close(p->rvc, true); p->rvc = NULL; return true; } ```suggestion rvc_close (p->rvc, true); ``` R_API bool r_project_rename(RProject *p, const char *newname) { free...
codereview_new_cpp_data_7984
R_API bool r_core_project_save(RCore *core, const char *prj_name) { free (cwd); } // LEAK : not always in heap free (prj_name); core->prj->path = prj_dir; if (scr_null) { r_config_set_b (core->config, "scr.null", true); maybe good to free (core->prj->path) before overwriting the field? R_API bool r_co...
codereview_new_cpp_data_7985
R_API bool r_project_rename(RProject *p, const char *newname) { return true; } } return false; } newprjdir will leak if newname is null R_API bool r_project_rename(RProject *p, const char *newname) { return true; } } + free (newprjdir); return false; }
codereview_new_cpp_data_7986
R_API bool r_vc_git_commit(Rvc *vc, const char *_message, const char *author, co if (epath) { char *emsg = r_str_escape (message); if (emsg) { - int res = r_sys_cmdf ("git -C %s commit -m \"%s\" --author \"%s <%s@localhost>\"", epath, emsg, escauth, escauth); free (escauth); free (message); ``...
codereview_new_cpp_data_7987
R_API bool r2r_check_jq_available(void) { const char *invalid_json = "this is not json lol"; R2RSubprocess *proc = r2r_subprocess_start (JQ_CMD, args, 1, NULL, NULL, 0); if (!proc) { - R_LOG_ERROR ("Cnnot start subprocess"); return false; } r2r_subprocess_stdin_write (proc, (const ut8 *)invalid_json, str...
codereview_new_cpp_data_7988
R_API int r_main_ravc2(int argc, const char **argv) { } else if (!strcmp (action, "checkout") && opt.argc > 2) { save = rvc_git_checkout (rvc, opt.argv[opt.ind + 1]); } else if (!strcmp (action, "status")) { - char *current_branch = r_vc_git_current_branch (rvc); if (current_branch) { printf ("Branch: ...
codereview_new_cpp_data_7989
R_API RList *r_type_get_enum(Sdb *TDB, const char *name) { } R_API void r_type_enum_free(RTypeEnum *member) { - free (member->name); - free (member->val); - free (member); } R_API char *r_type_enum_member(Sdb *TDB, const char *name, const char *member, ut64 val) { All free methods must accept null. Add an if ...
codereview_new_cpp_data_7990
RList *MACH0_(parse_classes)(RBinFile *bf, objc_cache_opt_info *oi) { int i, amount = swift5_types_size / 4; int res = r_buf_read_at (bf->buf, swift5_types_addr, (ut8*)words, aligned_size); // TODO check for return if (res >= aligned_size) { - for (i = 0; i + 4 < amount; i++) { st32 word = r_...
codereview_new_cpp_data_7991
static inline int l_num_to_bytes(ut64 n, bool sign) { test = -test; flip = true; } - st64 last; while (test) { last = test; test = test >> 8; ```suggestion st64 last = 0; ``` static inline int l_num_to_bytes(ut64 n, bool sign) { test = -test; flip = true; } + st64 last = 0; while (test)...
codereview_new_cpp_data_7992
R_API bool r_core_project_is_dirty(RCore *core) { } R_API void r_core_project_undirty(RCore *core) { core->config->is_dirty = false; core->anal->is_dirty = false; core->flags->is_dirty = false; } dont remove those R_API bool r_core_project_is_dirty(RCore *core) { } R_API void r_core_project_undirty(R...
codereview_new_cpp_data_7993
R_API bool r_core_project_is_dirty(RCore *core) { } R_API void r_core_project_undirty(RCore *core) { core->config->is_dirty = false; core->anal->is_dirty = false; core->flags->is_dirty = false; } ```suggestion R_CRITICAL_ENTER (core); core->config->is_dirty = false; ``` R_API bool r_core_project_is_...
codereview_new_cpp_data_7994
R_API bool r_core_project_is_dirty(RCore *core) { } R_API void r_core_project_undirty(RCore *core) { core->config->is_dirty = false; core->anal->is_dirty = false; core->flags->is_dirty = false; } ```suggestion core->flags->is_dirty = false; R_CRITICAL_LEAVE (core); ``` R_API bool r_core_project_is_d...
codereview_new_cpp_data_7995
R_API int r_main_ravc2(int argc, const char **argv) { printf ("Branch: %s\n", current_branch); RList *uncommitted = rvc->get_uncommitted (rvc); if (r_list_empty (uncommitted)) { - printf ("All files are committed\n"); } else { - printf ("The following files were NOT committed:\n"); RListIter...
codereview_new_cpp_data_7996
R_API void r_core_anal_autoname_all_golang_fcns(RCore *core) { if (num_syms) { R_LOG_INFO ("Found %d symbols and saved them at sym.go.*", num_syms); } else { - R_LOG_ERROR ("Found no symbols."); } } ```suggestion R_LOG_ERROR ("Found no symbols"); ``` R_API void r_core_anal_autoname_all_golang_fcns(...
codereview_new_cpp_data_7997
RCoreSymCacheElement *r_coresym_cache_element_new(RBinFile *bf, RBuffer *buf, ut RCoreSymCacheElementSegment *seg = &result->segments[i]; seg->paddr = seg->vaddr = r_read_le64 (cursor); cursor += 8; - if (cursor + 8 >= end) { break; } seg->size = seg->vsize = r_read_le64 (cursor); ```sugges...
codereview_new_cpp_data_7998
RCoreSymCacheElement *r_coresym_cache_element_new(RBinFile *bf, RBuffer *buf, ut RCoreSymCacheElementSegment *seg = &result->segments[i]; seg->paddr = seg->vaddr = r_read_le64 (cursor); cursor += 8; - if (cursor + 8 >= end) { break; } seg->size = seg->vsize = r_read_le64 (cursor); ```sugges...
codereview_new_cpp_data_7999
RCoreSymCacheElement *r_coresym_cache_element_new(RBinFile *bf, RBuffer *buf, ut return NULL; } if (hdr->version != 1 && hdr->version != 7) { - eprintf ("Unsupported CoreSymbolication cache version (%d)\n", hdr->version); goto beach; } if (hdr->size == 0 || hdr->size > r_buf_size (buf) - off) { - eprin...
codereview_new_cpp_data_8000
static void handle_var_stack_access(RAnalEsil *esil, ut64 addr, RAnalVarAccessTy if (addr >= spaddr && addr < ctx->initial_sp) { int stack_off = addr - ctx->initial_sp; // int stack_off = ctx->initial_sp - addr; // R2STACK - eprintf ("%x\n", stack_off); // eprintf (" (%llx) %llx = %d\n", ctx->initial_...
codereview_new_cpp_data_8001
static inline void prevPrintFormat(RCore *core) { printFormat (core, -1); } -R_API bool r_core_visual_hud(RCore *core) { const char *c = r_config_get (core->config, "hud.path"); char *f = r_str_newf (R_JOIN_3_PATHS ("%s", R2_HUD, "main"), r_sys_prefix (NULL)); ```suggestion R_API int r_core_visual_hud(RC...
codereview_new_cpp_data_8002
static inline int handle_opstring(RAnalOp *op, const ut8 *buf, int buflen) { return -1; } buf++; - buflen -= 1; // remove starting quote char *str = get_line (buf, buflen); if (str) { size_t len = strlen (str); ```suggestion buflen --; // remove starting quote ``` static inline int handle_opstring(...
codereview_new_cpp_data_8003
R_API void r_core_diff_show_json(RCore *c, RCore *c2) { const char *match; RListIter *iter; RAnalFunction *f; - PJ *pj = pj_new (); if (!pj) { return; Better use the corepj.new() if you have access to the core instance. This way the user have the ability to configure some options like indent, colors or h...
codereview_new_cpp_data_8004
R_API void r_core_diff_show_json(RCore *c, RCore *c2) { fcns = r_anal_get_fcns (c->anal); if (r_list_empty (fcns)) { - R_LOG_INFO ("No functions found, try running with -A or load a project\n"); return; } This var is assigned twice R_API void r_core_diff_show_json(RCore *c, RCore *c2) { fcns = r_a...
codereview_new_cpp_data_8005
R_API void r_core_diff_show_json(RCore *c, RCore *c2) { fcns = r_anal_get_fcns (c->anal); if (r_list_empty (fcns)) { - R_LOG_INFO ("No functions found, try running with -A or load a project\n"); return; } ```suggestion R_LOG_INFO ("No functions found, try running with -A or load a project"); ``` R...
codereview_new_cpp_data_8006
R_API void r_core_diff_show_json(RCore *c, RCore *c2) { fcns = r_anal_get_fcns (c->anal); if (r_list_empty (fcns)) { - R_LOG_INFO ("No functions found, try running with -A or load a project"); return; } ```suggestion R_LOG_ERROR ("No functions found, try running with -A or load a project"); ``` R_...
codereview_new_cpp_data_8007
static char *pickle_mnemonics(RAnal *a, int id, bool json) { } if (id >= 0 && id < R_ARRAY_SIZE (op_name_map)) { return strdup (op_name_map[id].name); - } else if (id == -1) { size_t i; RStrBuf *buf = buf = r_strbuf_new (""); for (i = 0; i < R_ARRAY_SIZE (op_name_map); i++) { dont else after return ...
codereview_new_cpp_data_8008
static int pickle_opasm(RAnal *a, ut64 addr, const char *str, ut8 *outbuf, int o case OP_UNICODE: case OP_GET: case OP_PUT: - R_LOG_ERROR ("This assembler can't handle %s (op: 0x%02x) yet\n", opstr, op); wlen = -1; break; default: ```suggestion R_LOG_ERROR ("This assembler can't handle %s (o...
codereview_new_cpp_data_8009
R_API void r_print_fill(RPrint *p, const ut8 *arr, int size, ut64 addr, int step for (i = 0; i < size; i++) { cols = arr[i] > cols ? arr[i] : cols; } - int div = R_MAX(255 / (p->cols * 3), 1); cols /= div; for (i = 0; i < size; i++) { if (addr != UT64_MAX && step > 0) { ```suggestion int div = R_MAX (...
codereview_new_cpp_data_8010
const char *file_fmttime(ut32 v, int local, char *pp, int *daylight) { } #endif /* HAVE_TM_ISDST */ #endif /* HAVE_DAYLIGHT */ - if (&daylight) { t += 3600; } #if __MINGW32__ ```suggestion if (*daylight) { ``` you need to access the contents with *, not the address of the reference const char *...
codereview_new_cpp_data_8011
static inline int handle_float(RAnalOp *op, const char *name, int sz, const ut8 static inline char *get_line(const ut8 *buf, int len) { // TODO: find end of large strings through RAnal->iob - char *str = (char *)malloc (len + 1); - strncpy (str, (char *)buf, len); - str[len + 1] = '\0'; - if (str) { char *n ...
codereview_new_cpp_data_8012
static inline int handle_float(RAnalOp *op, const char *name, int sz, const ut8 static inline char *get_line(const ut8 *buf, int len) { // TODO: find end of large strings through RAnal->iob - char *str = (char *)malloc (len + 1); - strncpy (str, (char *)buf, len); - str[len + 1] = '\0'; - if (str) { char *n ...
codereview_new_cpp_data_8013
static bool cb_asmpseudo(void *user, void *data) { RCore *core = (RCore *) user; RConfigNode *node = (RConfigNode *) data; core->rasm->pseudo = node->i_value; - core->anal->pseudo = node->i_value; return true; } See the r_anal.h comment static bool cb_asmpseudo(void *user, void *data) { RCore *core = (...
codereview_new_cpp_data_8014
R_API void r_core_seek_previous(RCore *core, const char *type) { r_flag_foreach (core->flags, seek_flag_offset, &u); found = u.found; } - if (found == true) { r_core_seek (core, next, true); } } ```suggestion if (found) { ``` R_API void r_core_seek_previous(RCore *core, const char *type) { r_fla...
codereview_new_cpp_data_8015
static bool subvar(RParse *p, RAnalFunction *f, ut64 addr, int oplen, char *data ripend = "]"; } char * maybe_num = neg? neg+1 : rip; - if( r_is_valid_input_num_value(NULL, maybe_num)){ if (neg) { - repl_num -= r_num_get(NULL, maybe_num); } else { - repl_num += r_num_get(NULL, maybe_nu...
codereview_new_cpp_data_8016
jmp $$ + 4 + ( [delta] * 2 ) op->stackop = R_ANAL_STACK_GET; op->stackptr = 0; op->ptr = -MEMDISP (1); - } else if (REGBASE(1) == ARM_REG_PC && !HASMEMINDEX(1)) { op->ptr = (addr & ~3LL) + (thumb? 4: 8) + MEMDISP (1); op->refptr = 4; if (REGID(0) == ARM_REG_PC && insn->detail->arm.cc != ARM_CC...
codereview_new_cpp_data_8017
static int make_projects_directory(RCore *core) { R_API bool r_core_is_project(RCore *core, const char *name) { bool ret = false; - if (!R_STR_ISEMPTY (name) && *name != '.') { char *path = get_project_script_path (core, name); if (!path) { return false; ```suggestion if (R_STR_ISNOTEMPTY (name) && *...
codereview_new_cpp_data_8018
static const char *help_msg_c[] = { "c", " [string]", "compare a plain with escaped chars string", "c*", " [string]", "same as above, but printing r2 commands instead", "c1", " [addr]", "compare byte at addr with current offset", - "c2", "* [value]", "compare word at offset with given value", - "c4", "* [value]"...
codereview_new_cpp_data_8019
static inline RBinWasmSection *sections_first_custom_name(RBinWasmObj *bin) { RBinWasmSection *sec; r_list_foreach (bin->g_sections, iter, sec) { if (sec->id == R_BIN_WASM_SECTION_CUSTOM && sec->size > 6) { - ut8 _tmp[CUST_NAME_START_LEN]; r_buf_read_at (buf, sec->offset, _tmp, CUST_NAME_START_LEN); i...
codereview_new_cpp_data_8020
static inline RBinWasmSection *sections_first_custom_name(RBinWasmObj *bin) { r_list_foreach (bin->g_sections, iter, sec) { if (sec->id == R_BIN_WASM_SECTION_CUSTOM && sec->size > 6) { ut8 _tmp[CUST_NAME_START_LEN] = {0}; - r_buf_read_at (buf, sec->offset, _tmp, CUST_NAME_START_LEN); - if (!memcmp (CUST_N...
codereview_new_cpp_data_8021
static inline RBinWasmSection *sections_first_custom_name(RBinWasmObj *bin) { r_list_foreach (bin->g_sections, iter, sec) { if (sec->id == R_BIN_WASM_SECTION_CUSTOM && sec->size > 6) { ut8 _tmp[CUST_NAME_START_LEN] = {0}; - r_buf_read_at (buf, sec->offset, _tmp, CUST_NAME_START_LEN); - if (!memcmp (CUST_N...
codereview_new_cpp_data_8022
static void visual_refresh(RCore *core); -#define PROMPTSTR "> "; // remove globals pls static R_TH_LOCAL int obs = 0; static R_TH_LOCAL int blocksize = 0; ```suggestion #define PROMPTSTR "> " ``` static void visual_refresh(RCore *core); +#define PROMPTSTR "> " // remove globals pls static R_TH_LOC...
codereview_new_cpp_data_8023
void (rm_op)(struct op_parameter par) { op_obj->op_name = r_str_newf ("<%u>", par.op_code); op_obj->type = op_obj->op_pop = op_obj->op_push = 0; } else { - R_LOG_ERROR ("Error in rm_op() while constructing opcodes for .pyc file: .op_code = %u, .op_name = %s", par.op_code, par.op_name); } } ```suggestion ...
codereview_new_cpp_data_8024
void (rm_op)(struct op_parameter par) { op_obj->op_name = r_str_newf ("<%u>", par.op_code); op_obj->type = op_obj->op_pop = op_obj->op_push = 0; } else { - R_LOG_ERROR ("Error in rm_op() while constructing opcodes for .pyc file: .op_code = %u, .op_name = %s", par.op_code, par.op_name); } } ```suggestion ...
codereview_new_cpp_data_8025
static RBinWasmCustomNameEntry *parse_custom_name_entry(RBinWasmObj *bin, ut64 b } break; default: - R_LOG_WARN ("[wasm] Halting custom name section parsing at unknown type 0x%x offset 0x%" PFMTSZx "", cust->type, start); cust->type = R_BIN_WASM_NAMETYPE_None; goto beach; } ```suggestion R_LOG_WAR...
codereview_new_cpp_data_8026
static bool objc_find_refs(RCore *core) { } if (classMethodsVA > to) { - R_LOG_WARN ("Warning: Fuzzed binary or bug in here, checking next %"PFMT64x" !< %"PFMT64x"", classMethodsVA, to); break; } for (va = classMethodsVA; va < to; va += objc2ClassMethSize) { ```suggestion R_LOG_WARN ("Warning:...
codereview_new_cpp_data_8027
static bool __is_data_block_cb(RAnalBlock *block, void *user) { static int __isdata(RCore *core, ut64 addr) { if (!r_io_is_valid_offset (core->io, addr, false)) { - // R_LOG_WARN ("Warning: Invalid memory address at 0x%08"PFMT64x"", addr); return 4; } ```suggestion // R_LOG_WARN ("Warning: Invalid mem...
codereview_new_cpp_data_8028
R_API void r_core_visual_define(RCore *core, const char *args, int distance) { int rc = r_anal_op (core->anal, &op, off, core->block + off - core->offset, 32, R_ANAL_OP_MASK_BASIC); if (rc < 1) { - R_LOG_ERROR ("Error analyzing opcode at 0x%08"PFMT64x"", off); } else { tgt_addr = op.jump != UT64_MAX...
codereview_new_cpp_data_8029
R_API void r_w32_identify_window(void) { return; } if (!win) { - R_LOG_ERROR ("Error trying to get information from 0x%08"PFMT64x"", (ut64)hwnd); return; } RTable *tbl = __create_window_table (); ```suggestion R_LOG_ERROR ("Error trying to get information from 0x%08"PFMT64x, (ut64)hwnd); ``` R_AP...
codereview_new_cpp_data_8030
R_API void r_io_cache_commit(RIO *io, ut64 from, ut64 to) { if (r_io_write_at (io, r_itv_begin (c->itv), c->data, r_itv_size (c->itv))) { c->written = true; } else { - R_LOG_ERROR ("Error writing change at 0x%08"PFMT64x"", r_itv_begin (c->itv)); } io->cached = cached; // break; // XXX old b...
codereview_new_cpp_data_8031
static bool __core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int de const char *cc = r_anal_cc_default (core->anal); if (!cc) { if (r_anal_cc_once (core->anal)) { - R_LOG_WARN ("set your favourite calling convention in `e anal.cc=?`"); } cc = "reg"; } revert this line as it seems to brea...
codereview_new_cpp_data_8032
R_API RAsmCode *r_asm_massemble(RAsm *a, const char *assembly) { } if (stage == STAGES - 1) { if (ret < 1) { - R_LOG_ERROR ("Cannot assemble '%s' at line %d", ptr_start, linenum); goto fail; } acode->len = idx + ret; ```suggestion eprintf ("Cannot assemble '%s' at line %d\n", pt...
codereview_new_cpp_data_8033
R_API int r_fs_shell_prompt(RFSShell* shell, RFS* fs, const char* root) { RIODesc *fd = fs->iob.open_at (fs->iob.io, uri, R_PERM_RW, 0, 0); free (uri); if (fd) { - r_io_desc_write (fd, file->data, file->size); r_list_free (list); return true; } you cant use the r_io_api use fs->iob...
codereview_new_cpp_data_8034
static int i8080_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len, RAnalOpMask mask) { char out[32]; - unsigned char code[3] = {0}; memcpy (code, data, R_MIN (sizeof(code), len)); int ilen = i8080_disasm (code, out, len); if (mask & R_ANAL_OP_MASK_DISASM) { ```suggestion ut8 code[3] = {0}...
codereview_new_cpp_data_8035
static int i8080_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len, RAnalOpMask mask) { char out[32]; - unsigned char code[3] = {0}; memcpy (code, data, R_MIN (sizeof(code), len)); int ilen = i8080_disasm (code, out, len); if (mask & R_ANAL_OP_MASK_DISASM) { ```suggestion memcpy (code, dat...
codereview_new_cpp_data_8036
static int archinfo(RAnal *anal, int q) { case R_ANAL_ARCHINFO_MIN_OP_SIZE: return 2; case R_ANAL_ARCHINFO_DATA_ALIGN: const char *cpu = anal->config->cpu; if (strstr (cpu, "68030") || strstr (cpu, "68040") || strstr (cpu, "68060")) { return 1; - } else { - return 2; } } return 2; Dont else...
codereview_new_cpp_data_8037
char* Elf_(r_bin_elf_get_arch)(ELFOBJ *bin) { case EM_X86_64: return strdup("x86"); case EM_NONE: - return strdup("No machine"); default: return strdup ("Unknown or unsupported arch"); } } ```suggestion return strdup ("null"); ``` what do you think about this? this way it will use the "null" plugi...
codereview_new_cpp_data_8038
char* Elf_(r_bin_elf_get_arch)(ELFOBJ *bin) { case EM_X86_64: return strdup("x86"); case EM_NONE: - return strdup("No machine"); default: return strdup ("Unknown or unsupported arch"); } } ```suggestion return strdup ("x86"); ``` char* Elf_(r_bin_elf_get_arch)(ELFOBJ *bin) { case EM_X86_64: re...
codereview_new_cpp_data_8039
static ut32 ccmn(ArmOp *op, const char *str) { } else { return data; } - ut32 data = k | (op->operands[0].reg & 0x7) << 29; data |= (op->operands[0].reg & 0x18) << 13; data |= (op->operands[1].reg & 0x1f) << 8; data |= (op->operands[2].immediate & 0xf) << 24; ```suggestion data = k | (op->operands[0].r...
codereview_new_cpp_data_8040
static int cmd_info(void *data, const char *input) { break; } bool fullGraph = true; - if (input[3] != ' ') { - bool fullGraph = false; r_list_foreach (obj->classes, iter, cls) { - if (cls->super && strstr (cls->super, input + 3)) { r_cons_printf ("agn %s\n", cls->super...
codereview_new_cpp_data_8041
static int cmd_info(void *data, const char *input) { break; } bool fullGraph = true; - if (input[3] != ' ') { - bool fullGraph = false; r_list_foreach (obj->classes, iter, cls) { - if (cls->super && strstr (cls->super, input + 3)) { r_cons_printf ("agn %s\n", cls->super...
codereview_new_cpp_data_8042
static int cmd_info(void *data, const char *input) { break; } bool fullGraph = true; - if (input[3] != ' ') { - bool fullGraph = false; r_list_foreach (obj->classes, iter, cls) { - if (cls->super && strstr (cls->super, input + 3)) { r_cons_printf ("agn %s\n", cls->super...
codereview_new_cpp_data_8043
static int cmd_info(void *data, const char *input) { break; } bool fullGraph = true; - if (input[2] == ' ' && strcmp(input + 3, "")) { const char *match = r_str_trim_head_ro (input + 3); r_list_foreach (obj->classes, iter, cls) { if (cls->super && strstr (cls->super, match)...
codereview_new_cpp_data_8044
static int cmd_info(void *data, const char *input) { break; } bool fullGraph = true; - if (input[2] == ' ' && strcmp(input + 3, "")) { const char *match = r_str_trim_head_ro (input + 3); r_list_foreach (obj->classes, iter, cls) { if (cls->super && strstr (cls->super, match)...
codereview_new_cpp_data_8045
static int cmd_info(void *data, const char *input) { const char *match = r_str_trim_head_ro (input + 2); if (*match) { r_list_foreach (obj->classes, iter, cls) { - if (cls->super && strstr (cls->super, match)) { r_cons_printf ("agn %s\n", cls->super); r_cons_printf ("agn %s\...
codereview_new_cpp_data_8705
int CPyStatics_Initialize(PyObject **statics, for (int i = 0; i < num_items; i++) { PyObject *item = statics[*frozensets++]; Py_INCREF(item); - PySet_Add(obj, item); } *result++ = obj; } Check the return value of `PySet_A...
codereview_new_cpp_data_9300
_PyErr_SetObject(PyThreadState *tstate, PyObject *exception, PyObject *value) Py_DECREF(exc_value); } } - if (value != NULL && PyExceptionInstance_Check(value)) tb = PyException_GetTraceback(value); _PyErr_Restore(tstate, Py_NewRef(Py_TYPE(value)), value, tb); } This would...
codereview_new_cpp_data_9302
notify_func_watchers(PyInterpreterState *interp, PyFunction_WatchEvent event, Py_DECREF(repr); } if (context == NULL) { - context = Py_None; - Py_INCREF(context); } PyErr_WriteUnraisable(conte...
codereview_new_cpp_data_9303
notify_code_watchers(PyCodeEvent event, PyCodeObject *co) Py_DECREF(repr); } if (context == NULL) { - context = Py_None; - Py_INCREF(context); } PyErr_WriteUnraisable(context); ...
codereview_new_cpp_data_9304
code_event_name(PyCodeEvent event) { #define CASE(op) \ case PY_CODE_EVENT_##op: \ return "PY_CODE_EVENT_" #op; - FOREACH_CODE_EVENT(CASE) #undef CASE } } static void Need a default and/or error return after the switch. code_event_name(P...
codereview_new_cpp_data_9308
ensure_array_large_enough(int index, void **arr_, int *alloc, int default_alloc, return ERROR; } - if (newsize == 0) { - PyErr_NoMemory(); - return ERROR; - } void *tmp = PyObject_Realloc(arr, newsize); if (tmp == NULL) { PyErr_...
codereview_new_cpp_data_9309
# endif #endif -/* the deprecated posix apis are not available on xbox */ -#ifdef MS_WINDOWS_GAMES -# define dup _dup -# define dup2 _dup2 -#endif - #if defined(__FreeBSD__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__DragonFly__) # define FD_DIR "/dev/fd" #else The `_posixsubprocess` extension...
codereview_new_cpp_data_9310
getpath_isxfile(PyObject *Py_UNUSED(self), PyObject *args) path = PyUnicode_AsWideCharString(pathobj, &cchPath); if (path) { #ifdef MS_WINDOWS - const wchar_t *ext; -#ifdef MS_WINDOWS_GAMES - ext = (cchPath >= 4) ? path + cchPath - 4 : NULL; -#endif DWORD attr = GetFileAttributesW(pat...
codereview_new_cpp_data_9311
win32_getppid() } PSS_PROCESS_INFORMATION info; - error = PssQuerySnapshot( - snapshot, PSS_QUERY_PROCESS_INFORMATION, &info, sizeof(info) - ); if (error != ERROR_SUCCESS) { result = PyLong_FromUnsignedLong(info.ParentProcessId); - } else { result = PyErr_SetFromWindo...
codereview_new_cpp_data_9312
extern void bzero(void *, int); # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif -# ifdef MS_WINDOWS_GAMES -# include <winsock2.h> -# else -# include <winsock.h> -# endif #else # define SOCKET int #endif Can we not just use `winsock2.h` unconditionally? extern void bzero(void *...
codereview_new_cpp_data_9313
remove_unusable_flags(PyObject *m) VER_MAJORVERSION|VER_MINORVERSION|VER_BUILDNUMBER, dwlConditionMask); #else - BOOL isSupported = info.dwMajorVersion >= 10 && - info.dwMinorVersion >= 0 && - info.dwBuildNumber >= win_runtime_flags[i].build_number; #endif ...
codereview_new_cpp_data_9314
_Py_stat(PyObject *path, struct stat *statbuf) } #ifdef MS_WINDOWS #ifndef HANDLE_FLAG_INHERIT #define HANDLE_FLAG_INHERIT 0x00000001 #endif ```suggestion #ifdef MS_WINDOWS // For some Windows API partitions, SetHandleInformation() is declared // but none of the handle flags are defined. ``` _Py_stat(PyO...
codereview_new_cpp_data_9315
remove_unusable_flags(PyObject *m) VER_MAJORVERSION|VER_MINORVERSION|VER_BUILDNUMBER, dwlConditionMask); #else BOOL isSupported = info.dwMajorVersion > 10 || (info.dwMajorVersion == 10 && info.dwMinorVersion > 0) || (info.dwMajorVersion == 10 && info.dwMino...
codereview_new_cpp_data_9316
#include "structmember.h" // PyMemberDef #include <stddef.h> // offsetof() -#if !defined(MS_WINDOWS) || defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES) #ifndef MS_WINDOWS #define UNIX We can't support the system API partition until `mmap` is updated...
codereview_new_cpp_data_9317
sock_initobj_impl(PySocketSockObject *self, int family, int type, int proto, Py_BEGIN_ALLOW_THREADS fd = WSASocketW(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, - FROM_PROTOCOL_INFO, &info, 0, - WSA_FLAG_OVERLAPPED ); Py_END_ALLOW_THREADS ...
codereview_new_cpp_data_9318
random_seed_time_pid(RandomObject *self) key[0] = (uint32_t)(now & 0xffffffffU); key[1] = (uint32_t)(now >> 32); -#if defined(MS_WINDOWS) && !defined(MS_WINDOWS_DESKTOP) key[2] = (uint32_t)GetCurrentProcessId(); #elif defined(HAVE_GETPID) key[2] = (uint32_t)getpid(); The CRT defines `_CRT_USE_W...
codereview_new_cpp_data_9319
os_kill_impl(PyObject *module, pid_t pid, Py_ssize_t signal) Py_RETURN_NONE; } } -#endif /* MS_WINDOWS_APP || MS_WINDOWS_SYSTEM */ /* If the signal is outside of what GenerateConsoleCtrlEvent can use, attempt to open and terminate the process. */ ```suggestion #endif /* HAVE...
codereview_new_cpp_data_9320
sock_accept(PySocketSockObject *s, PyObject *Py_UNUSED(ignored)) newfd = ctx.result; #ifdef MS_WINDOWS -#ifdef MS_WINDOWS_DESKTOP if (!SetHandleInformation((HANDLE)newfd, HANDLE_FLAG_INHERIT, 0)) { PyErr_SetFromWindowsErr(0); SOCKETCLOSE(newfd); In 10.0.19041, `SetHandleInformation()` i...
codereview_new_cpp_data_9321
_Py_abspath(const wchar_t *path, wchar_t **abspath_p) // Note that this implementation does not handle all the same cases as the real // function, but we expect games are very unlikely to encounter the more obscure // cases. -#if defined(MS_WINDOWS) && !defined(MS_WINDOWS_APP) && !defined(MS_WINDOWS_SYSTEM) HRESUL...
codereview_new_cpp_data_9322
PathCchCombineEx(wchar_t *buffer, size_t bufsize, const wchar_t *dirname, } return S_OK; } -#endif /* MS_WINDOWS && !MS_WINDOWS_APP && !MS_WINDOWS_SYSTEM */ // The caller must ensure "buffer" is big enough. static int ```suggestion #endif /* defined(MS_WINDOWS_GAMES) && !defined(MS_WINDOWS_DESKTOP) */...
codereview_new_cpp_data_9323
PathCchCombineEx(wchar_t *buffer, size_t bufsize, const wchar_t *dirname, size_t file_len = relfile ? wcslen(relfile) : 0; /* path is at max dirname + filename + backslash + \0 */ size_t new_len = dir_len + file_len + 2; - if (bufsize >= MAXPATHLEN || new_len > bufsize) { return E_INVALIDARG...
codereview_new_cpp_data_9324
_PyGen_FetchStopIterationValue(PyObject **pvalue) PyObject *value = NULL; if (PyErr_ExceptionMatches(PyExc_StopIteration)) { PyObject *exc = PyErr_GetRaisedException(); - if (exc) { - /* exception will usually be normalised already */ - value = Py_NewRef(((PyStopIteratio...