From bbc85783755d095a7be98d5ec507a8275a418ebc Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 30 Sep 2025 12:35:18 -0400 Subject: [PATCH] get rid of a visual studio build warning lnt-arithmetic-overflow A sub-expression may overflow before being assigned to a wider type --- src/hack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hack.c b/src/hack.c index 7c30870c7..1f0873a79 100644 --- a/src/hack.c +++ b/src/hack.c @@ -4327,9 +4327,10 @@ dump_weights(void) { int i, cnt = 0, nmwidth = 49, mcount = NUMMONS, ocount = NUM_OBJECTS; char nmbuf[BUFSZ], nmbufbase[BUFSZ]; + size_t num_entries = (size_t) (mcount + ocount); weightlist = (struct weight_table_entry *) - alloc(sizeof (struct weight_table_entry) * (mcount + ocount)); + alloc(sizeof (struct weight_table_entry) * num_entries); decl_globals_init(); init_objects(); for (i = 0; i < mcount; ++i) {