mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-14 00:37:41 -04:00
use ptrdiff_t modifier for printing pointer differences
Use ptrdiff_t modifier (%tx) for printing a difference between 2 pointers. Currently %zx (size_t) is used, but it fails on platforms where size_t and ptrdiff_t are defined differently (like s390). Comes from https://src.fedoraproject.org/rpms/dtc/c/f3da2d1b00d01d83fef7001d5767baa3d5a6df87?branch=master originally. Signed-off-by: Dan Horák <dan@danny.cz>
This commit is contained in:
parent
da2b691ccf
commit
49903aed77
1 changed files with 5 additions and 5 deletions
10
fdtdump.c
10
fdtdump.c
|
@ -100,7 +100,7 @@ static void dump_blob(void *blob, bool debug)
|
||||||
p = p_struct;
|
p = p_struct;
|
||||||
while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
|
while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
|
||||||
|
|
||||||
dumpf("%04zx: tag: 0x%08"PRIx32" (%s)\n",
|
dumpf("%04tx: tag: 0x%08"PRIx32" (%s)\n",
|
||||||
(uintptr_t)p - blob_off - 4, tag, tagname(tag));
|
(uintptr_t)p - blob_off - 4, tag, tagname(tag));
|
||||||
|
|
||||||
if (tag == FDT_BEGIN_NODE) {
|
if (tag == FDT_BEGIN_NODE) {
|
||||||
|
@ -140,8 +140,8 @@ static void dump_blob(void *blob, bool debug)
|
||||||
|
|
||||||
p = PALIGN(p + sz, 4);
|
p = PALIGN(p + sz, 4);
|
||||||
|
|
||||||
dumpf("%04zx: string: %s\n", (uintptr_t)s - blob_off, s);
|
dumpf("%04tx: string: %s\n", (uintptr_t)s - blob_off, s);
|
||||||
dumpf("%04zx: value\n", (uintptr_t)t - blob_off);
|
dumpf("%04tx: value\n", (uintptr_t)t - blob_off);
|
||||||
printf("%*s%s", depth * shift, "", s);
|
printf("%*s%s", depth * shift, "", s);
|
||||||
utilfdt_print_data(t, sz);
|
utilfdt_print_data(t, sz);
|
||||||
printf(";\n");
|
printf(";\n");
|
||||||
|
@ -229,14 +229,14 @@ int main(int argc, char *argv[])
|
||||||
if (valid_header(p, this_len))
|
if (valid_header(p, this_len))
|
||||||
break;
|
break;
|
||||||
if (debug)
|
if (debug)
|
||||||
printf("%s: skipping fdt magic at offset %#zx\n",
|
printf("%s: skipping fdt magic at offset %#tx\n",
|
||||||
file, p - buf);
|
file, p - buf);
|
||||||
}
|
}
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
if (!p || endp - p < sizeof(struct fdt_header))
|
if (!p || endp - p < sizeof(struct fdt_header))
|
||||||
die("%s: could not locate fdt magic\n", file);
|
die("%s: could not locate fdt magic\n", file);
|
||||||
printf("%s: found fdt at offset %#zx\n", file, p - buf);
|
printf("%s: found fdt at offset %#tx\n", file, p - buf);
|
||||||
buf = p;
|
buf = p;
|
||||||
} else if (!valid_header(buf, len))
|
} else if (!valid_header(buf, len))
|
||||||
die("%s: header is not valid\n", file);
|
die("%s: header is not valid\n", file);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue