[tracker] libtracker-miner: Fixed -0.00 progress being reported



commit 9f5a729f0158f15c876304571175b2d2e052e1d1
Author: Martyn Russell <martyn lanedo com>
Date:   Mon Jun 13 14:59:36 2011 +0100

    libtracker-miner: Fixed -0.00 progress being reported
    
    This occurred because progress of 0.00 was being rounded up from -0.49
    with ceil() and negative 0.00 is given to represented the direction it
    was rounded from.
    
    This fixes GB#652433, Progress signal gives faulty value just before finishing

 src/libtracker-miner/tracker-miner-object.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-object.c b/src/libtracker-miner/tracker-miner-object.c
index e56d55e..4f8c418 100644
--- a/src/libtracker-miner/tracker-miner-object.c
+++ b/src/libtracker-miner/tracker-miner-object.c
@@ -37,7 +37,7 @@
  * The 0.49 value is used for rounding correctness, because ceil()
  * rounds up if the number is > 0.0.
  */
-#define PROGRESS_ROUNDED(x) (ceil (((x) * 100) - 0.49) / 100)
+#define PROGRESS_ROUNDED(x) ((x) < 0.01 ? 0.00 : (ceil (((x) * 100) - 0.49) / 100))
 
 #define TRACKER_SERVICE "org.freedesktop.Tracker1"
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]