Fix printf format issues. (#379)

These issues appear when -Werror=format on 32-bit platforms depending on
the exact definitions of uint64_t and size_t.

It doesn't appear that bochs uses %zu for size_t -- since you support
Windows platforms, unclear if that would work for you. If so, that's
definitely correct rather than the unsigned long cast.
This commit is contained in:
Jonas Termansen 2024-11-05 05:29:45 +01:00 committed by GitHub
parent 3932aeac12
commit 905293b6f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -138,7 +138,7 @@ int vbox_image_t::open(const char* _pathname, int flags)
// (10gig = 10240 1-meg blocks with each entry using 4 bytes) = 40k
mtlb = new Bit32s[(unsigned) header.blocks_in_hdd];
if (mtlb == 0) {
BX_PANIC(("unable to allocate %lu bytes for vbox image's map table", header.blocks_in_hdd * sizeof(Bit32u)));
BX_PANIC(("unable to allocate %lu bytes for vbox image's map table", (unsigned long) (header.blocks_in_hdd * sizeof(Bit32u))));
}
// read in the map table

View File

@ -391,7 +391,7 @@ void bx_hpet_c::hpet_set_timer(HPETTimer *t)
}
if (diff < HPET_MIN_ALLOWED_PERIOD) diff = HPET_MIN_ALLOWED_PERIOD;
if (diff > HPET_MAX_ALLOWED_PERIOD) diff = HPET_MAX_ALLOWED_PERIOD;
BX_DEBUG(("Timer %d to fire in 0x%lX ticks", t->tn, diff));
BX_DEBUG(("Timer %d to fire in 0x" FMT_LL "X ticks", t->tn, diff));
bx_pc_system.activate_timer_nsec(t->timer_id, ticks_to_ns(diff), 0);
}