mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 07:00:30 +00:00
Variadic argument fixes
This commit is contained in:
parent
253865bb7c
commit
aaccc09828
@ -126,7 +126,7 @@ void reil_print_inst(RAnalEsil *esil, RAnalReilInst *ins) {
|
||||
if (!ins || !esil) {
|
||||
return;
|
||||
}
|
||||
esil->anal->cb_printf("%04"PFMT64x".%02"PFMT64x": %8s",
|
||||
esil->anal->cb_printf("%04"PFMT64x".%02x: %8s",
|
||||
esil->Reil->addr, esil->Reil->seq_num++, ops[ins->opcode]);
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (i > 0) {
|
||||
|
@ -641,7 +641,7 @@ static const ut8 *parse_line_header (
|
||||
}
|
||||
hdr->std_opcode_lengths[i] = READ (buf, ut8);
|
||||
if (mode == R_MODE_PRINT) {
|
||||
print (" Opcode %d has %d arg\n", i, hdr->std_opcode_lengths[i]);
|
||||
print (" Opcode %zu has %d arg\n", i, hdr->std_opcode_lengths[i]);
|
||||
}
|
||||
}
|
||||
if (mode == R_MODE_PRINT) {
|
||||
|
@ -1113,7 +1113,7 @@ static void parse_dex_class_fields(RBinFile *bf, RBinDexClass *c, RBinClass *cls
|
||||
if (dexdump) {
|
||||
const char *accessStr = createAccessFlagStr (
|
||||
accessFlags, kAccessForField);
|
||||
bin->cb_printf (" #%d : (in %s;)\n", i,
|
||||
bin->cb_printf (" #%zu : (in %s;)\n", i,
|
||||
cls->name);
|
||||
bin->cb_printf (" name : '%s'\n", fieldName);
|
||||
bin->cb_printf (" type : '%s'\n", type_str);
|
||||
@ -1665,7 +1665,7 @@ static bool dex_loadcode(RBinFile *bf) {
|
||||
for (i = 0; i < bin->header.class_size; i++) {
|
||||
struct dex_class_t *c = &bin->classes[i];
|
||||
if (dexdump) {
|
||||
cb_printf ("Class #%d -\n", i);
|
||||
cb_printf ("Class #%zu -\n", i);
|
||||
}
|
||||
parse_class (bf, c, i, methods, &sym_count);
|
||||
}
|
||||
|
@ -2023,7 +2023,7 @@ static void header(RBinFile *bf) {
|
||||
}
|
||||
|
||||
pj_end (pj);
|
||||
p (pj_string (pj));
|
||||
p ("%s", pj_string (pj));
|
||||
|
||||
beach:
|
||||
pj_free (pj);
|
||||
|
@ -227,7 +227,7 @@ static void header(RBinFile *bf) {
|
||||
rbin->cb_printf (" SizeOfUninitializedData : 0x%x\n", bin->nt_headers->optional_header.SizeOfUninitializedData);
|
||||
rbin->cb_printf (" AddressOfEntryPoint : 0x%x\n", bin->nt_headers->optional_header.AddressOfEntryPoint);
|
||||
rbin->cb_printf (" BaseOfCode : 0x%x\n", bin->nt_headers->optional_header.BaseOfCode);
|
||||
rbin->cb_printf (" ImageBase : 0x%x\n", bin->nt_headers->optional_header.ImageBase);
|
||||
rbin->cb_printf (" ImageBase : 0x%"PFMT64x"\n", bin->nt_headers->optional_header.ImageBase);
|
||||
rbin->cb_printf (" SectionAlignment : 0x%x\n", bin->nt_headers->optional_header.SectionAlignment);
|
||||
rbin->cb_printf (" FileAlignment : 0x%x\n", bin->nt_headers->optional_header.FileAlignment);
|
||||
rbin->cb_printf (" MajorOperatingSystemVersion : 0x%x\n", bin->nt_headers->optional_header.MajorOperatingSystemVersion);
|
||||
@ -242,10 +242,10 @@ static void header(RBinFile *bf) {
|
||||
rbin->cb_printf (" CheckSum : 0x%x\n", bin->nt_headers->optional_header.CheckSum);
|
||||
rbin->cb_printf (" Subsystem : 0x%x\n", bin->nt_headers->optional_header.Subsystem);
|
||||
rbin->cb_printf (" DllCharacteristics : 0x%x\n", bin->nt_headers->optional_header.DllCharacteristics);
|
||||
rbin->cb_printf (" SizeOfStackReserve : 0x%x\n", bin->nt_headers->optional_header.SizeOfStackReserve);
|
||||
rbin->cb_printf (" SizeOfStackCommit : 0x%x\n", bin->nt_headers->optional_header.SizeOfStackCommit);
|
||||
rbin->cb_printf (" SizeOfHeapReserve : 0x%x\n", bin->nt_headers->optional_header.SizeOfHeapReserve);
|
||||
rbin->cb_printf (" SizeOfHeapCommit : 0x%x\n", bin->nt_headers->optional_header.SizeOfHeapCommit);
|
||||
rbin->cb_printf (" SizeOfStackReserve : 0x%"PFMT64x"\n", bin->nt_headers->optional_header.SizeOfStackReserve);
|
||||
rbin->cb_printf (" SizeOfStackCommit : 0x%"PFMT64x"\n", bin->nt_headers->optional_header.SizeOfStackCommit);
|
||||
rbin->cb_printf (" SizeOfHeapReserve : 0x%"PFMT64x"\n", bin->nt_headers->optional_header.SizeOfHeapReserve);
|
||||
rbin->cb_printf (" SizeOfHeapCommit : 0x%"PFMT64x"\n", bin->nt_headers->optional_header.SizeOfHeapCommit);
|
||||
rbin->cb_printf (" LoaderFlags : 0x%x\n", bin->nt_headers->optional_header.LoaderFlags);
|
||||
rbin->cb_printf (" NumberOfRvaAndSizes : 0x%x\n", bin->nt_headers->optional_header.NumberOfRvaAndSizes);
|
||||
RListIter *it;
|
||||
|
@ -183,7 +183,7 @@ static void header(RBinFile *bf) {
|
||||
rbin->cb_printf ("stack_index : 0x%xH\n", bin->lmfh.stack_index);
|
||||
rbin->cb_printf ("heap_index : 0x%xH\n", bin->lmfh.heap_index);
|
||||
rbin->cb_printf ("argv_index : 0x%xH\n", bin->lmfh.argv_index);
|
||||
rbin->cb_printf ("spare2[4] : 0x0H\n", bin->lmfh.spare2);
|
||||
rbin->cb_printf ("spare2[4] : 0x0H\n");
|
||||
rbin->cb_printf ("code_offset : 0x%xH\n", bin->lmfh.code_offset);
|
||||
rbin->cb_printf ("stack_nbytes : 0x%xH\n", bin->lmfh.stack_nbytes);
|
||||
rbin->cb_printf ("heap_nbytes : 0x%xH\n", bin->lmfh.heap_nbytes);
|
||||
|
@ -275,7 +275,7 @@ R_API bool r_debug_reg_list(RDebug *dbg, int type, int size, int rad, const char
|
||||
break;
|
||||
default:
|
||||
if (delta && use_color) {
|
||||
dbg->cb_printf (use_color);
|
||||
dbg->cb_printf ("%s", use_color);
|
||||
dbg->cb_printf (fmt, item->name, strvalue, Color_RESET"\n");
|
||||
} else {
|
||||
dbg->cb_printf (fmt, item->name, strvalue, "\n");
|
||||
|
@ -62,7 +62,7 @@ R_API int r_debug_pid_list(RDebug *dbg, int pid, char fmt) {
|
||||
}
|
||||
pj_end (j);
|
||||
if (fmt == 'j') {
|
||||
dbg->cb_printf (pj_string (j));
|
||||
dbg->cb_printf ("%s", pj_string (j));
|
||||
}
|
||||
pj_free (j);
|
||||
r_list_free (list);
|
||||
@ -121,7 +121,7 @@ R_API int r_debug_thread_list(RDebug *dbg, int pid, char fmt) {
|
||||
}
|
||||
pj_end (j);
|
||||
if (fmt == 'j') {
|
||||
dbg->cb_printf (pj_string (j));
|
||||
dbg->cb_printf ("%s", pj_string (j));
|
||||
}
|
||||
pj_free (j);
|
||||
r_list_free (list);
|
||||
|
@ -262,7 +262,7 @@ R_API bool r_flag_zone_list(RFlag *f, int mode) {
|
||||
r_list_foreach (DB, iter, zi) {
|
||||
if (mode == '*') {
|
||||
f->cb_printf ("fz %s @ 0x08%"PFMT64x"\n", zi->name, zi->from);
|
||||
f->cb_printf ("f %s %d 0x08%"PFMT64x"\n", zi->name,
|
||||
f->cb_printf ("f %s %"PFMT64d" 0x08%"PFMT64x"\n", zi->name,
|
||||
zi->to - zi->from, zi->from);
|
||||
} else {
|
||||
f->cb_printf ("0x08%"PFMT64x" 0x%08"PFMT64x" %s\n",
|
||||
|
@ -111,7 +111,7 @@ R_API int r_io_cache_list(RIO *io, int rad) {
|
||||
}
|
||||
io->cb_printf ("\n");
|
||||
} else if (rad == 2) {
|
||||
io->cb_printf ("{\"idx\":%"PFMT64d",\"addr\":%"PFMT64d",\"size\":%d,",
|
||||
io->cb_printf ("{\"idx\":%d,\"addr\":%"PFMT64d",\"size\":%d,",
|
||||
j, r_itv_begin (c->itv), dataSize);
|
||||
io->cb_printf ("\"before\":\"");
|
||||
for (i = 0; i < dataSize; i++) {
|
||||
|
@ -150,7 +150,7 @@ R_API int r_io_plugin_list_json(RIO *io) {
|
||||
}
|
||||
pj_end (pj);
|
||||
pj_end (pj);
|
||||
io->cb_printf (pj_string (pj));
|
||||
io->cb_printf ("%s", pj_string (pj));
|
||||
pj_free (pj);
|
||||
return n;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ static void x86_ctrl_reg_pretty_print (RIO *io, struct r2k_control_reg ctrl) {
|
||||
|
||||
#if __x86_64__
|
||||
io->cb_printf ("CR8: 0x%"PFMT64x"\n", (ut64) ctrl.cr8);
|
||||
io->cb_printf (" [*] TPL: %d\n", ctrl.cr8 & 0xf);
|
||||
io->cb_printf (" [*] TPL: %zu\n", ctrl.cr8 & 0xf);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -731,15 +731,15 @@ int run_old_command(RIO *io, RIODesc *iodesc, const char *buf) {
|
||||
nextstart > 0 && nextstart - 1 < buffsize) {
|
||||
break;
|
||||
}
|
||||
io->cb_printf ("f pid.%d.%s.%d.start=0x%"PFMT64x"\n", proc_data.pid, &(proc_data.vmareastruct[i + 7]), j, (ut64) proc_data.vmareastruct[i]);
|
||||
io->cb_printf ("f pid.%d.%s.%d.end=0x%"PFMT64x"\n", proc_data.pid, &(proc_data.vmareastruct[i + 7]), j, (ut64) proc_data.vmareastruct[i + 1]);
|
||||
io->cb_printf ("f pid.%d.%s.%d.start=0x%"PFMT64x"\n", proc_data.pid, (char*)&(proc_data.vmareastruct[i + 7]), j, (ut64) proc_data.vmareastruct[i]);
|
||||
io->cb_printf ("f pid.%d.%s.%d.end=0x%"PFMT64x"\n", proc_data.pid, (char*)&(proc_data.vmareastruct[i + 7]), j, (ut64) proc_data.vmareastruct[i + 1]);
|
||||
j += 1;
|
||||
i = nextstart;
|
||||
}
|
||||
io->cb_printf ("f pid.%d.task_struct = 0x%08"PFMT64x"\n", proc_data.pid, proc_data.task);
|
||||
io->cb_printf ("f pid.%d.task_struct = 0x%08zu\n", proc_data.pid, proc_data.task);
|
||||
} else {
|
||||
io->cb_printf ("pid = %d\nprocess name = %s\n", proc_data.pid, proc_data.comm);
|
||||
io->cb_printf ("task_struct = 0x%08"PFMT64x"\n", proc_data.task);
|
||||
io->cb_printf ("task_struct = 0x%08zu\n", proc_data.task);
|
||||
for (i = 0; i < buffsize;) {
|
||||
nextstart = 0;
|
||||
if (i + 7 < buffsize) {
|
||||
@ -749,7 +749,7 @@ int run_old_command(RIO *io, RIODesc *iodesc, const char *buf) {
|
||||
nextstart > 0 && nextstart - 1 < buffsize) {
|
||||
break;
|
||||
}
|
||||
io->cb_printf ("0x%08"PFMT64x" - 0x%08"PFMT64x" %c%c%c%c 0x%08"PFMT64x" %02x:%02x %-8"PFMT64u"",
|
||||
io->cb_printf ("0x%08"PFMT64x" - 0x%08"PFMT64x" %c%c%c%c 0x%08"PFMT64x" %02zu:%02zu %-8"PFMT64u"",
|
||||
(ut64) proc_data.vmareastruct[i], (ut64) proc_data.vmareastruct[i+1],
|
||||
proc_data.vmareastruct[i + 2] & VM_READ ? 'r' : '-',
|
||||
proc_data.vmareastruct[i + 2] & VM_WRITE ? 'w' : '-',
|
||||
@ -757,10 +757,10 @@ int run_old_command(RIO *io, RIODesc *iodesc, const char *buf) {
|
||||
proc_data.vmareastruct[i + 2] & VM_MAYSHARE ? 's' : 'p',
|
||||
(ut64) proc_data.vmareastruct[i + 3], proc_data.vmareastruct[i + 4],
|
||||
proc_data.vmareastruct[i + 5], (ut64) proc_data.vmareastruct[i + 6]);
|
||||
io->cb_printf ("\t%s\n", &(proc_data.vmareastruct[i + 7]));
|
||||
io->cb_printf ("\t%s\n", (char*)&(proc_data.vmareastruct[i + 7]));
|
||||
i = nextstart;
|
||||
}
|
||||
io->cb_printf ("STACK BASE ADDRESS = 0x%"PFMT64x"\n", (void *) proc_data.stack);
|
||||
io->cb_printf ("STACK BASE ADDRESS = 0x%zx\n", proc_data.stack);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -460,7 +460,7 @@ static int r_print_format_string(const RPrint* p, ut64 seeki, ut64 addr64, ut64
|
||||
if (MUSTSEEJSON) {
|
||||
char *encstr = r_str_utf16_encode ((const char *)buffer, -1);
|
||||
if (encstr) {
|
||||
p->cb_printf ("%d,\"string\":\"%s\"}", seeki, encstr);
|
||||
p->cb_printf ("%"PFMT64d",\"string\":\"%s\"}", seeki, encstr);
|
||||
free (encstr);
|
||||
}
|
||||
} else if (MUSTSEESTRUCT) {
|
||||
@ -640,13 +640,13 @@ static void r_print_format_hex(const RPrint* p, int endian, int mode,
|
||||
}
|
||||
} else if (MUSTSEEJSON) {
|
||||
if (size == -1) {
|
||||
p->cb_printf ("%d", addr);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
} else {
|
||||
p->cb_printf ("[ ");
|
||||
while (size--) {
|
||||
updateAddr (buf + i, size - i, endian, &addr, NULL);
|
||||
if (elem == -1 || elem == 0) {
|
||||
p->cb_printf ("%d", addr);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
if (elem == 0) {
|
||||
elem = -2;
|
||||
}
|
||||
@ -710,13 +710,13 @@ static void r_print_format_int(const RPrint* p, int endian, int mode,
|
||||
}
|
||||
} else if (MUSTSEEJSON) {
|
||||
if (size == -1) {
|
||||
p->cb_printf ("%d", addr);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
} else {
|
||||
p->cb_printf ("[ ");
|
||||
while (size--) {
|
||||
updateAddr (buf + i, size - i, endian, &addr, NULL);
|
||||
if (elem == -1 || elem == 0) {
|
||||
p->cb_printf ("%d", addr);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
if (elem == 0) {
|
||||
elem = -2;
|
||||
}
|
||||
@ -765,7 +765,6 @@ static void r_print_format_octal(const RPrint* p, int endian, int mode,
|
||||
} else if ((mode & R_PRINT_DOT) || MUSTSEESTRUCT) {
|
||||
p->cb_printf ("0%"PFMT64o, addr);
|
||||
} else if (MUSTSEE) {
|
||||
ut32 addr32 = (ut32)addr;
|
||||
if (!SEEVALUE && !ISQUIET) {
|
||||
p->cb_printf ("0x%08" PFMT64x " = ", seeki + ((elem >= 0) ? elem * 4 : 0));
|
||||
}
|
||||
@ -773,16 +772,15 @@ static void r_print_format_octal(const RPrint* p, int endian, int mode,
|
||||
p->cb_printf ("(octal) ");
|
||||
}
|
||||
if (size == -1) {
|
||||
p->cb_printf (" 0%08"PFMT64o, addr32);
|
||||
p->cb_printf (" 0%08"PFMT64o, addr);
|
||||
} else {
|
||||
if (!SEEVALUE) {
|
||||
p->cb_printf ("[ ");
|
||||
}
|
||||
while (size--) {
|
||||
updateAddr (buf + i, size - i, endian, &addr, NULL);
|
||||
addr32 = (ut32)addr;
|
||||
if (elem == -1 || elem == 0) {
|
||||
p->cb_printf ("0%08"PFMT64o, addr32);
|
||||
p->cb_printf ("0%08"PFMT64o, addr);
|
||||
if (elem == 0) {
|
||||
elem = -2;
|
||||
}
|
||||
@ -800,16 +798,14 @@ static void r_print_format_octal(const RPrint* p, int endian, int mode,
|
||||
}
|
||||
}
|
||||
} else if (MUSTSEEJSON) {
|
||||
ut32 addr32 = (ut32)addr;
|
||||
if (size == -1) {
|
||||
p->cb_printf ("%d", addr32);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
} else {
|
||||
p->cb_printf ("[ ");
|
||||
while (size--) {
|
||||
updateAddr (buf, i, endian, &addr, NULL);
|
||||
addr32 = (ut32)addr;
|
||||
if (elem == -1 || elem == 0) {
|
||||
p->cb_printf ("%d", addr32);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
if (elem == 0) {
|
||||
elem = -2;
|
||||
}
|
||||
@ -858,9 +854,8 @@ static void r_print_format_hexflag(const RPrint* p, int endian, int mode,
|
||||
}
|
||||
while (size--) {
|
||||
updateAddr (buf + i, size - i, endian, &addr, NULL);
|
||||
addr32 = (ut32)addr;
|
||||
if (elem == -1 || elem == 0) {
|
||||
p->cb_printf ("0x%08"PFMT64x, addr32);
|
||||
p->cb_printf ("0x%08"PFMT64x, addr);
|
||||
if (elem == 0) {
|
||||
elem = -2;
|
||||
}
|
||||
@ -878,16 +873,14 @@ static void r_print_format_hexflag(const RPrint* p, int endian, int mode,
|
||||
}
|
||||
}
|
||||
} else if (MUSTSEEJSON) {
|
||||
ut32 addr32 = (ut32)addr;
|
||||
if (size == -1) {
|
||||
p->cb_printf ("%d", addr32);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
} else {
|
||||
p->cb_printf ("[ ");
|
||||
while (size--) {
|
||||
updateAddr (buf + i, size - i, endian, &addr, NULL);
|
||||
addr32 = (ut32)addr;
|
||||
if (elem == -1 || elem == 0) {
|
||||
p->cb_printf ("%d", addr32);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
if (elem == 0) {
|
||||
elem = -2;
|
||||
}
|
||||
@ -1135,14 +1128,14 @@ static void r_print_format_word(const RPrint* p, int endian, int mode,
|
||||
p->cb_printf ("wv2 %s @ 0x%08"PFMT64x"\n", setval, seeki+((elem>=0)?elem*2:0));
|
||||
} else if ((mode & R_PRINT_DOT) || MUSTSEESTRUCT) {
|
||||
if (size == -1) {
|
||||
p->cb_printf ("0x%04x", addr);
|
||||
p->cb_printf ("0x%04"PFMT64x, addr);
|
||||
}
|
||||
while ((size -= 2) > 0) {
|
||||
addr = endian
|
||||
? (*(buf+i))<<8 | (*(buf+i+1))
|
||||
: (*(buf+i+1))<<8 | (*(buf+i));
|
||||
if (elem == -1 || elem == 0) {
|
||||
p->cb_printf ("%d", addr);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
if (elem == 0) {
|
||||
elem = -2;
|
||||
}
|
||||
@ -1160,7 +1153,7 @@ static void r_print_format_word(const RPrint* p, int endian, int mode,
|
||||
p->cb_printf ("0x%08"PFMT64x" = ", seeki+((elem>=0)?elem*2:0));
|
||||
}
|
||||
if (size==-1) {
|
||||
p->cb_printf ("0x%04x", addr);
|
||||
p->cb_printf ("0x%04"PFMT64x, addr);
|
||||
} else {
|
||||
if (!SEEVALUE) {
|
||||
p->cb_printf ("[ ");
|
||||
@ -1170,7 +1163,7 @@ static void r_print_format_word(const RPrint* p, int endian, int mode,
|
||||
? (*(buf+i))<<8 | (*(buf+i+1))
|
||||
: (*(buf+i+1))<<8 | (*(buf+i));
|
||||
if (elem == -1 || elem == 0) {
|
||||
p->cb_printf ("0x%04x", addr);
|
||||
p->cb_printf ("0x%04"PFMT64x, addr);
|
||||
if (elem == 0) {
|
||||
elem = -2;
|
||||
}
|
||||
@ -1189,7 +1182,7 @@ static void r_print_format_word(const RPrint* p, int endian, int mode,
|
||||
}
|
||||
} else if (MUSTSEEJSON) {
|
||||
if (size==-1) {
|
||||
p->cb_printf ("%d", addr);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
} else {
|
||||
p->cb_printf ("[ ");
|
||||
while ( (size -= 2) >0) {
|
||||
@ -1197,7 +1190,7 @@ static void r_print_format_word(const RPrint* p, int endian, int mode,
|
||||
? (*(buf+i))<<8 | (*(buf+i+1))
|
||||
: (*(buf+i+1))<<8 | (*(buf+i));
|
||||
if (elem == -1 || elem == 0) {
|
||||
p->cb_printf ("%d", addr);
|
||||
p->cb_printf ("%"PFMT64d, addr);
|
||||
if (elem == 0) {
|
||||
elem = -2;
|
||||
}
|
||||
@ -1356,7 +1349,7 @@ static void r_print_format_nulltermwidestring(const RPrint* p, const int len, in
|
||||
}
|
||||
} else if (MUSTSEEJSON) {
|
||||
int j = i;
|
||||
p->cb_printf ("%d,\"string\":\"", seeki);
|
||||
p->cb_printf ("%"PFMT64d",\"string\":\"", seeki);
|
||||
for (; j < len && ((size == -1 || size-- > 0) && buf[j]); j += 2) {
|
||||
if (IS_PRINTABLE (buf[j])) {
|
||||
p->cb_printf ("%c", buf[j]);
|
||||
@ -1384,9 +1377,9 @@ static void r_print_format_bitfield(const RPrint* p, ut64 seeki, char *fmtname,
|
||||
}
|
||||
} else {
|
||||
if (MUSTSEEJSON) {
|
||||
p->cb_printf ("\"`tb %s 0x%x`\"}", fmtname, addr);
|
||||
p->cb_printf ("\"`tb %s 0x%"PFMT64x"`\"}", fmtname, addr);
|
||||
} else if (MUSTSEE) {
|
||||
p->cb_printf ("%s (bitfield) = `tb %s 0x%x`\n",
|
||||
p->cb_printf ("%s (bitfield) = `tb %s 0x%"PFMT64x"`\n",
|
||||
fieldname, fmtname, addr);
|
||||
}
|
||||
}
|
||||
@ -1417,7 +1410,7 @@ static void r_print_format_enum(const RPrint* p, ut64 seeki, char *fmtname,
|
||||
if (MUSTSEEJSON) {
|
||||
p->cb_printf ("%"PFMT64d",\"enum\":\"%s\"}", addr, fmtname);
|
||||
} else if (MUSTSEE) {
|
||||
p->cb_printf ("%s (enum %s) = 0x%x\n",//`te %s 0x%x`\n",
|
||||
p->cb_printf ("%s (enum %s) = 0x%"PFMT64x"\n",//`te %s 0x%x`\n",
|
||||
fieldname, fmtname, addr); //enumvalue); //fmtname, addr);
|
||||
}
|
||||
}
|
||||
@ -1440,7 +1433,7 @@ static void r_print_format_register(const RPrint* p, int mode,
|
||||
p->cb_printf ("0x%08" PFMT64x "\n", p->get_register_value (p->reg, ri));
|
||||
}
|
||||
} else if (MUSTSEEJSON) {
|
||||
p->cb_printf ("%d}", p->get_register_value (p->reg, ri));
|
||||
p->cb_printf ("%"PFMT64d"}", p->get_register_value (p->reg, ri));
|
||||
}
|
||||
} else {
|
||||
p->cb_printf ("Register %s does not exists\n", name);
|
||||
@ -2077,7 +2070,7 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
|
||||
if (otimes > times) {
|
||||
p->cb_printf (",");
|
||||
}
|
||||
p->cb_printf ("[{\"index\":%d,\"offset\":%d},", otimes-times, seek+i);
|
||||
p->cb_printf ("[{\"index\":%d,\"offset\":%"PFMT64d"},", otimes-times, seek+i);
|
||||
} else if (mode) {
|
||||
p->cb_printf ("0x%08"PFMT64x" [%d] {\n", seek + i, otimes-times);
|
||||
}
|
||||
@ -2353,7 +2346,7 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
|
||||
if (isptr) {
|
||||
p->cb_printf ("*");
|
||||
}
|
||||
p->cb_printf ("\",\"offset\":%d,\"value\":",
|
||||
p->cb_printf ("\",\"offset\":%"PFMT64d",\"value\":",
|
||||
isptr? (seek + nexti - (p->bits / 8)) : seek + i);
|
||||
}
|
||||
|
||||
@ -2372,7 +2365,7 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
|
||||
int oi = i;
|
||||
if (isptr == NULLPTR) {
|
||||
if (MUSTSEEJSON) {
|
||||
p->cb_printf ("\"NULL\"}", tmp, seek + i);
|
||||
p->cb_printf ("\"NULL\"}");
|
||||
} else if (MUSTSEE) {
|
||||
p->cb_printf (" NULL\n");
|
||||
}
|
||||
@ -2549,14 +2542,14 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
|
||||
}
|
||||
if (MUSTSEEJSON) {
|
||||
if (isptr) {
|
||||
p->cb_printf ("%d},", seeki);
|
||||
p->cb_printf ("%"PFMT64d"},", seeki);
|
||||
} else {
|
||||
p->cb_printf ("[");
|
||||
}
|
||||
}
|
||||
if (MUSTSEESTRUCT) {
|
||||
if (isptr) {
|
||||
p->cb_printf ("%d", seeki);
|
||||
p->cb_printf ("%"PFMT64d, seeki);
|
||||
} else {
|
||||
ident += 4;
|
||||
p->cb_printf ("\n");
|
||||
|
@ -66,6 +66,7 @@ R_API void r_print_portionbar(RPrint *p, const ut64 *portions, int n_portions) {
|
||||
}
|
||||
|
||||
R_API void r_print_columns(RPrint *p, const ut8 *buf, int len, int height) {
|
||||
#define cb_print(x) p->cb_printf("%s", x)
|
||||
size_t i, j;
|
||||
int cols = 78; // TODO: do not hardcode this value, columns should be defined by the user
|
||||
int rows = height > 0 ? height : 10;
|
||||
@ -93,10 +94,10 @@ R_API void r_print_columns(RPrint *p, const ut8 *buf, int len, int height) {
|
||||
p->cb_printf ("%s%s%s", kol[koli], vline, Color_RESET);
|
||||
}
|
||||
} else {
|
||||
p->cb_printf (" ");
|
||||
cb_print (" ");
|
||||
}
|
||||
}
|
||||
p->cb_printf ("\n");
|
||||
cb_print ("\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -109,15 +110,15 @@ R_API void r_print_columns(RPrint *p, const ut8 *buf, int len, int height) {
|
||||
if (p->histblock) {
|
||||
p->cb_printf ("%s%s%s", Color_BGGRAY, block, Color_RESET);
|
||||
} else {
|
||||
p->cb_printf (vline);
|
||||
cb_print (vline);
|
||||
}
|
||||
} else if (i + 1 == rows) {
|
||||
p->cb_printf ("_");
|
||||
cb_print ("_");
|
||||
} else {
|
||||
p->cb_printf (" ");
|
||||
cb_print (" ");
|
||||
}
|
||||
}
|
||||
p->cb_printf ("\n");
|
||||
cb_print ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,6 +430,7 @@ R_API void r_print_addr(RPrint *p, ut64 addr) {
|
||||
const char *white = "";
|
||||
#define PREOFF(x) (p && p->cons && p->cons->context && p->cons->context->pal.x)? p->cons->context->pal.x
|
||||
PrintfCallback printfmt = (PrintfCallback) (p? p->cb_printf: libc_printf);
|
||||
#define print(x) printfmt("%s", x)
|
||||
bool use_segoff = p? (p->flags & R_PRINT_FLAGS_SEGOFF): false;
|
||||
bool use_color = p? (p->flags & R_PRINT_FLAGS_COLOR): false;
|
||||
bool dec = p? (p->flags & R_PRINT_FLAGS_ADDRDEC): false;
|
||||
@ -621,6 +623,7 @@ R_API const char *r_print_byte_color(RPrint *p, int ch) {
|
||||
|
||||
R_API void r_print_byte(RPrint *p, const char *fmt, int idx, ut8 ch) {
|
||||
PrintfCallback printfmt = (PrintfCallback) (p? p->cb_printf: libc_printf);
|
||||
#define print(x) printfmt("%s", x)
|
||||
ut8 rch = ch;
|
||||
if (!IS_PRINTABLE (ch) && fmt[0] == '%' && fmt[1] == 'c') {
|
||||
rch = '.';
|
||||
@ -629,11 +632,11 @@ R_API void r_print_byte(RPrint *p, const char *fmt, int idx, ut8 ch) {
|
||||
if (p && p->flags & R_PRINT_FLAGS_COLOR) {
|
||||
const char *bytecolor = r_print_byte_color (p, ch);
|
||||
if (bytecolor) {
|
||||
printfmt (bytecolor);
|
||||
print ( bytecolor);
|
||||
}
|
||||
printfmt (fmt, rch);
|
||||
if (bytecolor) {
|
||||
printfmt (Color_RESET);
|
||||
print (Color_RESET);
|
||||
}
|
||||
} else {
|
||||
printfmt (fmt, rch);
|
||||
@ -749,7 +752,7 @@ R_API void r_print_hexii(RPrint *rp, ut64 addr, const ut8 *buf, int len, int ste
|
||||
continue;
|
||||
}
|
||||
if (show_offset) {
|
||||
p ("%8X:", addr + i);
|
||||
p ("%8"PFMT64x":", addr + i);
|
||||
}
|
||||
for (j = 0; j < inc; j++) {
|
||||
ut8 ch = buf[i + j];
|
||||
@ -765,7 +768,7 @@ R_API void r_print_hexii(RPrint *rp, ut64 addr, const ut8 *buf, int len, int ste
|
||||
}
|
||||
p ("\n");
|
||||
}
|
||||
p ("%8X ]\n", addr + i);
|
||||
p ("%8"PFMT64x" ]\n", addr + i);
|
||||
}
|
||||
|
||||
/* set screen_bounds to addr if the cursor is not visible on the screen anymore.
|
||||
@ -810,6 +813,7 @@ R_API void r_print_section(RPrint *p, ut64 at) {
|
||||
|
||||
R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int base, int step, size_t zoomsz) {
|
||||
PrintfCallback printfmt = (PrintfCallback)printf;
|
||||
#define print(x) printfmt("%s", x)
|
||||
bool c = p? (p->flags & R_PRINT_FLAGS_COLOR): false;
|
||||
const char *color_title = c? (Pal (p, offset): Color_MAGENTA): "";
|
||||
int inc = p? p->cols : 16;
|
||||
@ -918,7 +922,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
}
|
||||
if (use_header) {
|
||||
if (c) {
|
||||
printfmt (color_title);
|
||||
print (color_title);
|
||||
}
|
||||
if (base < 32) {
|
||||
ut32 opad = (ut32) (addr >> 32);
|
||||
@ -926,11 +930,11 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
int i, delta;
|
||||
char soff[32];
|
||||
if (hex_style) {
|
||||
printfmt ("..offset..");
|
||||
print ("..offset..");
|
||||
} else {
|
||||
printfmt ("- offset -");
|
||||
print ("- offset -");
|
||||
if (p->wide_offsets) {
|
||||
printfmt (" ");
|
||||
print (" ");
|
||||
}
|
||||
}
|
||||
if (use_segoff) {
|
||||
@ -947,11 +951,11 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
delta--;
|
||||
}
|
||||
for (i = 0; i < delta; i++) {
|
||||
printfmt (space);
|
||||
print (space);
|
||||
}
|
||||
}
|
||||
/* column after number, before hex data */
|
||||
printfmt ((col == 1)? "|": space);
|
||||
print ((col == 1)? "|": space);
|
||||
opad >>= 4;
|
||||
if (use_hdroff) {
|
||||
k = addr & 0xf;
|
||||
@ -962,10 +966,10 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
if (use_hexa) {
|
||||
/* extra padding for offsets > 8 digits */
|
||||
for (i = 0; i < inc; i++) {
|
||||
printfmt (pre);
|
||||
print (pre);
|
||||
if (base < 0) {
|
||||
if (i & 1) {
|
||||
printfmt (space);
|
||||
print (space);
|
||||
}
|
||||
}
|
||||
if (use_hdroff) {
|
||||
@ -981,16 +985,16 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
}
|
||||
if (i & 1 || !pairs) {
|
||||
if (!compact) {
|
||||
printfmt (col != 1? space: ((i + 1) < inc)? space: "|");
|
||||
print (col != 1? space: ((i + 1) < inc)? space: "|");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* ascii column */
|
||||
if (compact) {
|
||||
printfmt (col > 0? "|": space);
|
||||
print (col > 0? "|": space);
|
||||
} else {
|
||||
printfmt (col == 2? "|": space);
|
||||
print (col == 2? "|": space);
|
||||
}
|
||||
if (!p || !(p->flags & R_PRINT_FLAGS_NONASCII)) {
|
||||
for (i = 0; i < inc; i++) {
|
||||
@ -1003,17 +1007,17 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
/* print comment header*/
|
||||
if (p && p->use_comments && !compact) {
|
||||
if (col != 2) {
|
||||
printfmt (" ");
|
||||
print (" ");
|
||||
}
|
||||
if (!hex_style) {
|
||||
printfmt (" comment");
|
||||
print (" comment");
|
||||
}
|
||||
}
|
||||
printfmt ("\n");
|
||||
print ("\n");
|
||||
}
|
||||
|
||||
if (c) {
|
||||
printfmt (Color_RESET);
|
||||
print (Color_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1045,7 +1049,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
sparse_char = buf[j];
|
||||
last_sparse++;
|
||||
if (last_sparse == 2) {
|
||||
printfmt (" ...\n");
|
||||
print (" ...\n");
|
||||
continue;
|
||||
}
|
||||
if (last_sparse > 2) {
|
||||
@ -1066,7 +1070,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
ut64 row_have_addr = UT64_MAX;
|
||||
if (use_hexa) {
|
||||
if (!compact && !isPxr) {
|
||||
printfmt ((col == 1)? "|": " ");
|
||||
print ((col == 1)? "|": " ");
|
||||
}
|
||||
for (j = i; j < i + inc; j++) {
|
||||
if (j!=i && use_align && rowbytes == inc) {
|
||||
@ -1084,24 +1088,24 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
if (!compact && ((j >= len) || bytes >= rowbytes)) {
|
||||
if (col == 1) {
|
||||
if (j + 1 >= inc + i) {
|
||||
printfmt (j % 2? " |": "| ");
|
||||
print (j % 2? " |": "| ");
|
||||
} else {
|
||||
printfmt (j % 2? " ": " ");
|
||||
print (j % 2? " ": " ");
|
||||
}
|
||||
} else {
|
||||
if (base == 32) {
|
||||
printfmt ((j % 4)? " ": " ");
|
||||
print ((j % 4)? " ": " ");
|
||||
} else if (base == 10) {
|
||||
printfmt (j % 2? " ": " ");
|
||||
print (j % 2? " ": " ");
|
||||
} else {
|
||||
printfmt (j % 2? " ": " ");
|
||||
print (j % 2? " ": " ");
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const char *hl = (hex_style && p && p->offname (p->user, addr + j))? Color_INVERT: NULL;
|
||||
if (hl) {
|
||||
printfmt (hl);
|
||||
print (hl);
|
||||
}
|
||||
if (p && (base == 32 || base == 64)) {
|
||||
int left = len - i;
|
||||
@ -1201,33 +1205,33 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
if (use_unalloc && !p->iob.is_valid_offset (p->iob.io, addr + j, false)) {
|
||||
char ch = p->io_unalloc_ch;
|
||||
char dbl_ch_str[] = { ch, ch, 0 };
|
||||
p->cb_printf (dbl_ch_str);
|
||||
p->cb_printf ("%s", dbl_ch_str);
|
||||
} else {
|
||||
r_print_byte (p, bytefmt, j, buf[j]);
|
||||
}
|
||||
if (pairs && !compact && (inc & 1)) {
|
||||
bool mustspace = (rows % 2) ? !(j&1) : (j&1);
|
||||
if (mustspace) {
|
||||
printfmt (" ");
|
||||
print (" ");
|
||||
}
|
||||
} else if (bytes % 2 || !pairs) {
|
||||
if (col == 1) {
|
||||
if (j + 1 < inc + i) {
|
||||
if (!compact) {
|
||||
printfmt (" ");
|
||||
print (" ");
|
||||
}
|
||||
} else {
|
||||
printfmt ("|");
|
||||
print ("|");
|
||||
}
|
||||
} else {
|
||||
if (!compact) {
|
||||
printfmt (" ");
|
||||
print (" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hl) {
|
||||
printfmt (Color_RESET);
|
||||
print (Color_RESET);
|
||||
}
|
||||
bytes++;
|
||||
}
|
||||
@ -1235,14 +1239,14 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
if (printValue) {
|
||||
if (compact) {
|
||||
if (col == 0) {
|
||||
printfmt (" ");
|
||||
print (" ");
|
||||
} else if (col == 1) {
|
||||
//printfmt (" ");
|
||||
//print (" ");
|
||||
} else {
|
||||
printfmt ((col == 2)? "|": "");
|
||||
print ((col == 2)? "|": "");
|
||||
}
|
||||
} else {
|
||||
printfmt ((col == 2)? "|": " ");
|
||||
print ((col == 2)? "|": " ");
|
||||
}
|
||||
if (!p || !(p->flags & R_PRINT_FLAGS_NONASCII)) {
|
||||
bytes = 0;
|
||||
@ -1251,7 +1255,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
if (j != i && use_align && bytes >= rowbytes) {
|
||||
int sz = (p && p->offsize)? p->offsize (p->user, addr + j): -1;
|
||||
if (sz >= 0) {
|
||||
printfmt (" ");
|
||||
print (" ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1266,7 +1270,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
}
|
||||
/* ascii column */
|
||||
if (col == 2) {
|
||||
printfmt ("|");
|
||||
print ("|");
|
||||
}
|
||||
bool eol = false;
|
||||
if (!eol && p && p->flags & R_PRINT_FLAGS_REFS) {
|
||||
@ -1302,7 +1306,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
}
|
||||
if (!eol && p && p->use_comments) {
|
||||
for (; j < i + inc; j++) {
|
||||
printfmt (" ");
|
||||
print (" ");
|
||||
}
|
||||
for (j = i; j < i + inc; j++) {
|
||||
if (use_align && (j-i) >= rowbytes) {
|
||||
@ -1336,25 +1340,25 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
if (use_align && rowbytes < inc && bytes >= rowbytes) {
|
||||
i -= (inc - bytes);
|
||||
}
|
||||
printfmt ("\n");
|
||||
print ("\n");
|
||||
}
|
||||
rows++;
|
||||
bytes = 0;
|
||||
if (p && p->cfmt && *p->cfmt) {
|
||||
if (row_have_cursor != -1) {
|
||||
int i = 0;
|
||||
printfmt (" _________");
|
||||
print (" _________");
|
||||
if (!compact) {
|
||||
printfmt ("_");
|
||||
print ("_");
|
||||
}
|
||||
for (i = 0; i < row_have_cursor; i++) {
|
||||
if (!pairs || (!compact && i % 2)) {
|
||||
printfmt ("___");
|
||||
print ("___");
|
||||
} else {
|
||||
printfmt ("__");
|
||||
print ("__");
|
||||
}
|
||||
}
|
||||
printfmt ("__|\n");
|
||||
print ("__|\n");
|
||||
printfmt ("| cmd.hexcursor = %s\n", p->cfmt);
|
||||
p->coreb.cmdf (p->coreb.core,
|
||||
"%s @ 0x%08"PFMT64x, p->cfmt, row_have_addr);
|
||||
@ -1431,7 +1435,7 @@ R_API void r_print_hexdiff(RPrint *p, ut64 aa, const ut8 *_a, ut64 ba, const ut8
|
||||
for (j = 0; j < min; j++) {
|
||||
*fmt = color;
|
||||
r_print_cursor (p, i + j, 1, 1);
|
||||
p->cb_printf (BD (a, b));
|
||||
p->cb_printf ("%s", BD (a, b));
|
||||
r_print_cursor (p, i + j, 1, 0);
|
||||
}
|
||||
p->cb_printf (" ");
|
||||
@ -1446,7 +1450,7 @@ R_API void r_print_hexdiff(RPrint *p, ut64 aa, const ut8 *_a, ut64 ba, const ut8
|
||||
for (j = 0; j < min; j++) {
|
||||
*fmt = color;
|
||||
r_print_cursor (p, i + j, 1, 1);
|
||||
p->cb_printf (BD (b, a));
|
||||
p->cb_printf ("%s", BD (b, a));
|
||||
r_print_cursor (p, i + j, 1, 0);
|
||||
}
|
||||
p->cb_printf (" ");
|
||||
@ -1485,7 +1489,7 @@ R_API void r_print_raw(RPrint *p, ut64 addr, const ut8 *buf, int len, int offlin
|
||||
int i, j, cols = p->cols * 4;
|
||||
char ch;
|
||||
for (i = 0; i < len; i += cols) {
|
||||
p->cb_printf ("0x%08x ", addr + i);
|
||||
p->cb_printf ("0x%08"PFMT64x" ", addr + i);
|
||||
for (j = 0; j < cols; j++) {
|
||||
if ((i + j) >= len) {
|
||||
break;
|
||||
@ -1573,10 +1577,10 @@ R_API void r_print_progressbar(RPrint *p, int pc, int _cols) {
|
||||
cols -= 15;
|
||||
p->cb_printf ("[");
|
||||
for (i = cols * pc / 100; i; i--) {
|
||||
p->cb_printf (block);
|
||||
p->cb_printf ("%s", block);
|
||||
}
|
||||
for (i = cols - (cols * pc / 100); i; i--) {
|
||||
p->cb_printf (h_line);
|
||||
p->cb_printf ("%s", h_line);
|
||||
}
|
||||
p->cb_printf ("]");
|
||||
}
|
||||
@ -1600,12 +1604,12 @@ R_API void r_print_rangebar(RPrint *p, ut64 startA, ut64 endA, ut64 min, ut64 ma
|
||||
p->cb_printf (Color_GREEN);
|
||||
isFirst = false;
|
||||
}
|
||||
p->cb_printf (block);
|
||||
p->cb_printf ("%s", block);
|
||||
} else {
|
||||
if (!isFirst) {
|
||||
p->cb_printf (Color_RESET);
|
||||
}
|
||||
p->cb_printf (h_line);
|
||||
p->cb_printf ("%s", h_line);
|
||||
}
|
||||
}
|
||||
p->cb_printf ("|");
|
||||
@ -1756,7 +1760,7 @@ R_API void r_print_fill(RPrint *p, const ut8 *arr, int size, ut64 addr, int step
|
||||
}
|
||||
p->cb_printf ("%03x %04x %s", i, arr[i], v_line);
|
||||
} else {
|
||||
p->cb_printf (v_line);
|
||||
p->cb_printf ("%s", v_line);
|
||||
}
|
||||
if (next < INC) {
|
||||
base = 1;
|
||||
|
@ -221,7 +221,7 @@ R_API void r_print_code(RPrint *p, ut64 addr, const ut8 *buf, int len, char lang
|
||||
p->cb_printf ("\n]\n");
|
||||
break;
|
||||
case 'y': // "pcy"
|
||||
p->cb_printf ("$hex_%"PFMT64x" = {");
|
||||
p->cb_printf ("$hex_%"PFMT64x" = {", addr);
|
||||
for (i = 0; !r_print_is_interrupted () && i < len; i++) {
|
||||
r_print_cursor (p, i, 1, 1);
|
||||
p->cb_printf (" %02x", buf[i] & 0xff);
|
||||
|
Loading…
Reference in New Issue
Block a user