]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: Removed float calculations from "Indexed n% of the mailbox" message.
authorTimo Sirainen <tss@iki.fi>
Wed, 1 Sep 2010 19:33:20 +0000 (20:33 +0100)
committerTimo Sirainen <tss@iki.fi>
Wed, 1 Sep 2010 19:33:20 +0000 (20:33 +0100)
src/plugins/fts/fts-storage.c

index c425336aff268ab44933168d9d5533c8cc8335a9..31e40b0fbc9af2cb988b8a5e85b192ae23909401 100644 (file)
@@ -565,8 +565,7 @@ static void fts_build_notify(struct fts_storage_build_context *ctx)
 {
        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 @@ static void fts_build_notify(struct fts_storage_build_context *ctx)
                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,