Few code cleanups. (#12526)

This commit is contained in:
David CARLIER 2018-12-20 23:35:41 +00:00 committed by radare
parent 23388801f2
commit 2f8891caaf
4 changed files with 12 additions and 6 deletions

View File

@ -1779,8 +1779,10 @@ static int esil_poke_n(RAnalEsil *esil, int bits) {
if (src2 && r_anal_esil_get_parm (esil, src2, &num2)) {
r_write_ble (b, num, esil->anal->big_endian, 64);
ret = r_anal_esil_mem_write (esil, addr, b, bytes);
r_write_ble (b, num2, esil->anal->big_endian, 64);
ret = r_anal_esil_mem_write (esil, addr + 8, b, bytes);
if (ret == 0) {
r_write_ble (b, num2, esil->anal->big_endian, 64);
ret = r_anal_esil_mem_write (esil, addr + 8, b, bytes);
}
goto out;
}
ret = -1;

View File

@ -97,7 +97,7 @@ static int vtable_is_addr_vtable_start(RVTableContext *context, ut64 curAddress)
if (!curAddress || curAddress == UT64_MAX) {
return false;
}
if (!vtable_is_value_in_text_section (context, curAddress, NULL)) {
if (curAddress && !vtable_is_value_in_text_section (context, curAddress, NULL)) {
return false;
}
// total xref's to curAddress

View File

@ -39,7 +39,6 @@ static RIODesc *__open(RIO *io, const char *file, int rw, int mode) {
if (i) {
l = i - file - 8;
fileBochs = r_str_ndup (file + 8, l);
l = strlen (i + 1);
fileCfg = strdup (i + 1);
} else {
free (fileCfg);

View File

@ -143,10 +143,15 @@ R_API int r_sys_truncate(const char *file, int sz) {
return false;
}
#ifdef _MSC_VER
_chsize (fd, sz);
int r = _chsize (fd, sz);
#else
ftruncate (fd, sz);
int r = ftruncate (fd, sz);
#endif
if (r != 0) {
eprintf ("Could not resize '%s' file\n", file);
close (fd);
return false;
}
close (fd);
return true;
#else