summaryrefslogtreecommitdiff
path: root/usr.bin/compress/main.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-01-27 12:58:23 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-01-27 12:58:23 +0000
commitc3e35652142bd21c6f26285087161b8a2d227555 (patch)
tree5a73ed9c94564f5659caaa97f44cce5093d0cb6b /usr.bin/compress/main.c
parent678ecb374eb0e903b8daf773f473b62ed7faa29a (diff)
Compute compression ratio using signed arithmetic, since the compressed size
might be larger than the original, yielding negative percentages. Spotted by markus@ ok henning@ hshoexer@
Diffstat (limited to 'usr.bin/compress/main.c')
-rw-r--r--usr.bin/compress/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/compress/main.c b/usr.bin/compress/main.c
index 2eddeecd5ff..7ffeca51001 100644
--- a/usr.bin/compress/main.c
+++ b/usr.bin/compress/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.56 2004/09/20 18:53:20 millert Exp $ */
+/* $OpenBSD: main.c,v 1.57 2005/01/27 12:58:22 otto Exp $ */
#ifndef SMALL
static const char copyright[] =
@@ -36,7 +36,7 @@ static const char license[] =
#endif /* SMALL */
#ifndef SMALL
-static const char main_rcsid[] = "$OpenBSD: main.c,v 1.56 2004/09/20 18:53:20 millert Exp $";
+static const char main_rcsid[] = "$OpenBSD: main.c,v 1.57 2005/01/27 12:58:22 otto Exp $";
#endif
#include <sys/param.h>
@@ -811,7 +811,7 @@ list_stats(const char *name, const struct compressor *method,
printf("%10lld %10lld %4.1f%% %s\n",
(long long)(info->total_in + info->hlen),
(long long)info->total_out,
- (info->total_out - info->total_in) *
+ ((long long)info->total_out - (long long)info->total_in) *
100.0 / info->total_out, name);
compressed_total += info->total_in;
uncompressed_total += info->total_out;