Remove all the uses of %z as its not supported on Windows

This commit is contained in:
pancake 2022-02-01 11:07:46 +01:00 committed by GitHub
parent 48829c64b8
commit b30a4ea80b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 23 deletions

View File

@ -340,9 +340,9 @@ static bool parse_segments(struct MACH0_(obj_t) *bin, ut64 off) {
char *segment_flagname = NULL;
#if R_BIN_MACH064
segment_flagname = r_str_newf ("mach0_segment64_%zu.offset", j);
segment_flagname = r_str_newf ("mach0_segment64_%u.offset", (ut32)j);
#else
segment_flagname = r_str_newf ("mach0_segment_%zu.offset", j);
segment_flagname = r_str_newf ("mach0_segment_%u.offset", (ut32)j);
#endif
sdb_num_set (bin->kv, segment_flagname, off, 0);
free (segment_flagname);
@ -2297,7 +2297,7 @@ RList *MACH0_(get_segments)(RBinFile *bf) {
}
}
char *section_name = r_str_ndup (bin->sects[i].sectname, 16);
char *segment_name = r_str_newf ("%zu.%s", i, bin->segs[segment_index].segname);
char *segment_name = r_str_newf ("%u.%s", (ut32)i, bin->segs[segment_index].segname);
s->name = r_str_newf ("%s.%s", segment_name, section_name);
s->is_data = __isDataSection (s);
if (strstr (section_name, "interpos") || strstr (section_name, "__mod_")) {
@ -2764,7 +2764,7 @@ const RList *MACH0_(get_symbols_list)(struct MACH0_(obj_t) *bin) {
}
}
} else {
sym->name = r_str_newf ("unk%zu", i);
sym->name = r_str_newf ("unk%u", (ut32)i);
}
if (!inSymtab (hash, sym->name, sym->vaddr)) {
r_list_append (list, sym);
@ -2787,7 +2787,7 @@ const RList *MACH0_(get_symbols_list)(struct MACH0_(obj_t) *bin) {
sym->paddr = symbol.offset;
sym->name = symbol.name;
if (!sym->name) {
sym->name = r_str_newf ("unk%zu", i);
sym->name = r_str_newf ("unk%u", (ut32)i);
}
sym->is_imported = symbol.is_imported;
r_list_append (list, sym);
@ -2829,7 +2829,7 @@ const RList *MACH0_(get_symbols_list)(struct MACH0_(obj_t) *bin) {
}
}
} else {
sym->name = r_str_newf ("unk%zu", i);
sym->name = r_str_newf ("unk%u", (ut32)i);
}
r_list_append (list, sym);
j++;
@ -4471,7 +4471,7 @@ RList *MACH0_(mach_fields)(RBinFile *bf) {
char section_flagname[128];
for (i = 0; i < nsects && (addr + off) < length && off < lcSize; i++) {
const char *sname = is64? "mach0_section64": "mach0_section";
snprintf (section_flagname, sizeof (section_flagname), "section_%zu", j++);
snprintf (section_flagname, sizeof (section_flagname), "section_%u", (ut32)j++);
RBinField *f = r_bin_field_new (addr + off, addr + off, 1, section_flagname, sname, sname, true);
r_list_append (ret, f);
off += is64? 80: 68;

View File

@ -189,7 +189,7 @@ static RList *sections(RBinFile *bf) {
free (tmp);
return ret;
}
ptr->name = r_str_newf ("%s-%zu", tmp, i);
ptr->name = r_str_newf ("%s-%u", tmp, (unsigned int)i);
free (tmp);
if (strstr (ptr->name, "data")) {
ptr->is_data = true;

View File

@ -1099,8 +1099,7 @@ static void parse_dex_class_fields(RBinFile *bf, RBinDexClass *c, RBinClass *cls
if (dexdump) {
char *accessStr = createAccessFlagStr (
accessFlags, kAccessForField);
bin->cb_printf (" #%zu : (in %s;)\n", i,
cls->name);
bin->cb_printf (" #%u : (in %s;)\n", (unsigned int)i, cls->name);
bin->cb_printf (" name : '%s'\n", fieldName);
bin->cb_printf (" type : '%s'\n", type_str);
bin->cb_printf (" access : 0x%04x (%s)\n",
@ -1652,7 +1651,7 @@ static bool dex_loadcode(RBinFile *bf) {
for (i = 0; i < dex->header.class_size; i++) {
struct dex_class_t *c = &dex->classes[i];
if (dexdump) {
cb_printf ("Class #%zu -\n", i);
cb_printf ("Class #%u -\n", (unsigned int)i);
}
parse_class (bf, c, i, methods, &sym_count);
}

View File

@ -3666,7 +3666,7 @@ R_API int r_core_config_init(RCore *core) {
update_cfgcharsets_options (core, n);
SETBPREF ("cfg.r2wars", "false", "Enable some tweaks for the r2wars game");
SETBPREF ("cfg.plugins", "true", "Load plugins at startup");
SETCB ("time.fmt", "%Y-%m-%d %H:%M:%S %z", &cb_cfgdatefmt, "Date format (%Y-%m-%d %H:%M:%S %z)");
SETCB ("time.fmt", "%Y-%m-%d %H:%M:%S %u", &cb_cfgdatefmt, "Date format (%Y-%m-%d %H:%M:%S %u)");
SETICB ("time.zone", 0, &cb_timezone, "Time zone, in hours relative to GMT: +2, -1,..");
SETCB ("cfg.corelog", "false", &cb_cfgcorelog, "Log changes using the T api needed for realtime syncing");
SETBPREF ("cfg.newtab", "false", "Show descriptions in command completion");

View File

@ -352,17 +352,17 @@ static const char *r_cmd_java_strtok(const char *str1, const char b, size_t len)
if (len == (size_t)-1) {
len = strlen (str1);
}
IFDBG r_cons_printf ("Looking for char (%c) in (%s) up to %zu\n", b, p, len);
IFDBG r_cons_printf ("Looking for char (%c) in (%s) up to %u\n", b, p, (unsigned int)len);
for (; i < len; i++, p++) {
if (*p == b) {
IFDBG r_cons_printf ("Found? for char (%c) @ %zu: (%s)\n", b, i, p);
IFDBG r_cons_printf ("Found? for char (%c) @ %u: (%s)\n", b, (unsigned int)i, p);
break;
}
}
if (i == len) {
p = NULL;
}
IFDBG r_cons_printf ("Found? for char (%c) @ %zu: (%s)\n", b, len, p);
IFDBG r_cons_printf ("Found? for char (%c) @ %u: (%s)\n", b, (unsigned int)len, p);
return p;
}
@ -475,7 +475,7 @@ static RList *cpfind_str(RBinJavaObj *obj, const char *cmd) {
if (!cmd) {
return r_list_new ();
}
IFDBG r_cons_printf ("Looking for str: %s (%zu)\n", cmd, strlen (cmd));
IFDBG r_cons_printf ("Looking for str: %s (%u)\n", cmd, (unsigned int)strlen (cmd));
return r_bin_java_find_cp_const_by_val (obj, (const ut8 *)cmd, strlen (cmd), R_BIN_JAVA_CP_UTF8);
}

View File

@ -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: %zu\n", ctrl.cr8 & 0xf);
io->cb_printf (" [*] TPL: %u\n", (ut32)(ctrl.cr8 & 0xf));
#endif
}
@ -760,14 +760,13 @@ int run_old_command(RIO *io, RIODesc *iodesc, const char *buf) {
io->cb_printf (" %s\n", (char*)&(proc_data.vmareastruct[i + 7]));
i = nextstart;
}
io->cb_printf ("STACK BASE ADDRESS = 0x%zx\n", proc_data.stack);
io->cb_printf ("STACK BASE ADDRESS = 0x%p\n", (void*)proc_data.stack);
}
}
break;
default:
{
print_help (io, NULL, 1);
}
print_help (io, NULL, 1);
break;
}
end:
free (databuf);

View File

@ -152,7 +152,7 @@ void file_magerror(RMagic *ms, const char *f, ...) {
}
void file_oomem(RMagic *ms, size_t len) {
file_error (ms, errno, "cannot allocate %zu bytes", len);
file_error (ms, errno, "cannot allocate %u bytes", (unsigned int)len);
}
void file_badseek(RMagic *ms) {

View File

@ -304,7 +304,7 @@ R_API RPrint* r_print_new(void) {
if (!p) {
return NULL;
}
strcpy (p->datefmt, "%Y-%m-%d %H:%M:%S %z");
strcpy (p->datefmt, "%Y-%m-%d %H:%M:%S %u");
r_io_bind_init (p->iob);
p->pairs = true;
p->resetbg = true;