opkg: don't report the same download percentage multiple times
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 04:19:03 +0000 (04:19 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 04:19:03 +0000 (04:19 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@14 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

opkg_download.c

index 3370b1f60a9253b5e17cc9a9a1793f48c209dad4..fcc52949a8ac43876152c77d5321c110208d4dc6 100644 (file)
@@ -46,6 +46,14 @@ curl_progress_func (char* url,
 #ifdef OPKG_LIB
     if (opkg_cb_download_progress)
     {
+       static int prev = -1;
+
+       /* don't report the same percentage multiple times
+        * (this can occur due to rounding) */
+       if (prev == p)
+           return 0;
+       prev = p;
+
        opkg_cb_download_progress (p, url);
        return 0;
     }