commit daa2dde19e2b1d27477eaa618157551d3fcd84bb
Author: Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Oct 22 00:25:26 2011 +0000
Commit: Simon Howard <fraggle@gmail.com>
CommitDate: Sat Oct 22 00:25:26 2011 +0000
Fix percentage output to match that of statdump.exe.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2452
---
src/doom/statdump.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/doom/statdump.c b/src/doom/statdump.c
index 0e83df8d..e80641c8 100644
--- a/src/doom/statdump.c
+++ b/src/doom/statdump.c
@@ -152,7 +152,12 @@ static void PrintPercentage(FILE *stream, int amount, int total)
{
fprintf(stream, "%i / %i", amount, total);
- fprintf(stream, " (%i%%)", (amount * 100) / total);
+ // statdump.exe is a 16-bit program, so very occasionally an
+ // integer overflow can occur when doing this calculation with
+ // a large value. Therefore, cast to short to give the same
+ // output.
+
+ fprintf(stream, " (%i%%)", (short) (amount * 100) / total);
}
}