dovecot-2.0: fts: Removed float calculations from "Indexed n% of...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 1 22:33:23 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/1012052e2e85
changeset: 12063:1012052e2e85
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 01 20:33:20 2010 +0100
description:
fts: Removed float calculations from "Indexed n% of the mailbox" message.

diffstat:

 src/plugins/fts/fts-storage.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (35 lines):

diff -r 267385a0ccd3 -r 1012052e2e85 src/plugins/fts/fts-storage.c
--- a/src/plugins/fts/fts-storage.c	Wed Sep 01 18:44:32 2010 +0100
+++ b/src/plugins/fts/fts-storage.c	Wed Sep 01 20:33:20 2010 +0100
@@ -565,8 +565,7 @@
 {
 	struct mailbox *box = ctx->mail->transaction->box;
 	const struct seq_range *range;
-	float percentage;
-	unsigned int msecs, secs;
+	unsigned int percentage, msecs, secs;
 
 	if (ctx->last_notify.tv_sec == 0) {
 		/* set the search time in here, in case a plugin
@@ -574,17 +573,17 @@
 		ctx->search_start_time = ioloop_timeval;
 	} else if (box->storage->callbacks.notify_ok != NULL) {
 		range = array_idx(&ctx->search_args->args->value.seqset, 0);
-		percentage = (ctx->mail->seq - range->seq1) * 100.0 /
+		percentage = (ctx->mail->seq - range->seq1) * 100 /
 			(range->seq2 - range->seq1);
 		msecs = timeval_diff_msecs(&ioloop_timeval,
 					   &ctx->search_start_time);
-		secs = (msecs / (percentage / 100.0) - msecs) / 1000;
+		secs = (msecs*percentage / 100 - msecs) / 1000;
 
 		T_BEGIN {
 			const char *text;
 
-			text = t_strdup_printf("Indexed %d%% of the mailbox, "
-					       "ETA %d:%02d", (int)percentage,
+			text = t_strdup_printf("Indexed %u%% of the mailbox, "
+					       "ETA %d:%02d", percentage,
 					       secs/60, secs%60);
 			box->storage->callbacks.
 				notify_ok(box, text,


More information about the dovecot-cvs mailing list