diff options
author | Paul N. Hilfinger <hilfinger@adacore.com> | 2004-03-20 09:53:03 +0000 |
---|---|---|
committer | Paul N. Hilfinger <hilfinger@adacore.com> | 2004-03-20 09:53:03 +0000 |
commit | 66efcc3e4474682db262bd05d6ce8169bbc64992 (patch) | |
tree | e8f0a7dd5e5e038ab03703943906a22c836cac6d | |
parent | b6b82cd80a290f99461761d03544d058524ae818 (diff) | |
download | gdb-66efcc3e4474682db262bd05d6ce8169bbc64992.tar.gz |
print_percentage: Use floating point to avoid incorrect results when
portion*100 overflows.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/bcache.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 442af68deab..53824f1d941 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2004-03-20 Paul Hilfinger <hilfingr@nile.gnat.com> + + * bcache.c (print_percentage): Use floating point to avoid + incorrect results when portion*100 overflows. + 2004-03-19 Kevin Buettner <kevinb@redhat.com> * ppc_tdep.h (ppc_linux_frame_saved_pc) diff --git a/gdb/bcache.c b/gdb/bcache.c index cadadb5cce6..0bc533ebfef 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -303,7 +303,7 @@ print_percentage (int portion, int total) if (total == 0) printf_filtered ("(not applicable)\n"); else - printf_filtered ("%3d%%\n", portion * 100 / total); + printf_filtered ("%3d%%\n", (int) (portion * 100.0 / total)); } |