Fix Win32 build

Windows std::ptrdiff_t is `int` instead of `long` as it should be.
Expand the values out to `long` (which is the same size as `int` on
Win32!) before printing them.  This fixes format string warnings.

Reported-by: Ninjared <https://forum.dxx-rebirth.com/showthread.php?tid=857&pid=12555#pid12555>
Fixes: 42a2e3ab0b ("Avoid crash loading polymodels with invalid subcalls")
This commit is contained in:
Kp 2019-03-16 04:35:31 +00:00
parent de53747452
commit 31859ff128

View file

@ -144,7 +144,10 @@ public:
auto &opref = *wp(p);
const auto badop = opref;
opref = OP_EOF;
con_printf(CON_URGENT, "warning: %s:%u: invalid polymodel at %p with length %u; opcode %u at offset %li references invalid offset %li; replacing invalid operation with EOF", __FILE__, line, model_base, static_cast<unsigned>(model_length), badop, offset_from_base, offset_of_value);
const unsigned long uml = model_length;
const long ofb = offset_from_base;
const long oov = offset_of_value;
con_printf(CON_URGENT, "%s:%u: warning: invalid polymodel at %p with length %lu; opcode %u at offset %li references invalid offset %li; replacing invalid operation with EOF", __FILE__, line, model_base, uml, badop, ofb, oov);
return 1;
}
return 0;