Skip to contentSkip to conversation

arch_init: Fix format string by using RAM_ADDR_FMT

PATCH Applied Stefan Weil 2 participants 2 messages Jun 27, 2013 – Jul 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch_init: Fix format string by using RAM_ADDR_FMT

length is a ram_addr_t, so RAM_ADDR_FMT must be used instead of %ld. This fixes a recently introduced regression for w64 builds.

Using RAM_ADDR_FMT also changes decimal output to sedecimal. This is good here because length and block->length should both use the same base in the error message.

---
 arch_init.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch_init.c +3 -2
index ea9ddad..4255db9 100644
@@ -815,8 +815,9 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
                     QTAILQ_FOREACH(block, &ram_list.blocks, next) {
                         if (!strncmp(id, block->idstr, sizeof(id))) {
                             if (block->length != length) {
-                                fprintf(stderr, "Length mismatch: %s: %ld "
-                                        "in != " RAM_ADDR_FMT "\n", id, length,
+                                fprintf(stderr,
+                                        "Length mismatch: %s: " RAM_ADDR_FMT
+                                        " in != " RAM_ADDR_FMT "\n", id, length,
                                         block->length);
                                 ret =  -EINVAL;
                                 goto done;
Signature · 1 line
1.7.10.4