]> granicus.if.org Git - curl/commitdiff
tool: use XFERFUNCTION to save some casts
authorDave Reisner <dreisner@archlinux.org>
Sun, 13 Oct 2013 17:39:41 +0000 (19:39 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 15 Oct 2013 18:42:05 +0000 (20:42 +0200)
src/tool_cb_prg.c
src/tool_cb_prg.h
src/tool_operate.c

index b049377eaa93eb641b07744b0e29cd400209d8f7..00078d0de184d959f89447698ac9a63a40aa8572 100644 (file)
 #include "memdebug.h" /* keep this as LAST include */
 
 /*
-** callback for CURLOPT_PROGRESSFUNCTION
+** callback for CURLOPT_XFERINFOFUNCTION
 */
 
 #define MAX_BARLENGTH 256
 
 int tool_progress_cb(void *clientp,
-                     double dltotal, double dlnow,
-                     double ultotal, double ulnow)
+                     curl_off_t dltotal, curl_off_t dlnow,
+                     curl_off_t ultotal, curl_off_t ulnow)
 {
   /* The original progress-bar source code was written for curl by Lars Aas,
      and this new edition inherits some of his concepts. */
@@ -60,10 +60,10 @@ int tool_progress_cb(void *clientp,
     return 0;
 
   /* expected transfer size */
-  total = (curl_off_t)dltotal + (curl_off_t)ultotal + bar->initial_size;
+  total = dltotal + ultotal + bar->initial_size;
 
   /* we've come this far */
-  point = (curl_off_t)dlnow + (curl_off_t)ulnow + bar->initial_size;
+  point = dlnow + ulnow + bar->initial_size;
 
   if(point > total)
     /* we have got more than the expected total! */
index a20645e86eb7f39d36dd4d7e711c05fa910b9483..d80e845b7686d83f417279aeae8f53851cb9ecec 100644 (file)
@@ -43,8 +43,8 @@ void progressbarinit(struct ProgressData *bar,
 */
 
 int tool_progress_cb(void *clientp,
-                     double dltotal, double dlnow,
-                     double ultotal, double ulnow);
+                     curl_off_t dltotal, curl_off_t dlnow,
+                     curl_off_t ultotal, curl_off_t ulnow);
 
 #endif /* HEADER_CURL_TOOL_CB_PRG_H */
 
index 6615270e03f8725df6112ccf832001524be46dd7..7b43691bb7c1f6ceb04d01681138a91f27340845 100644 (file)
@@ -1235,8 +1235,8 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
            !config->noprogress && !config->mute) {
           /* we want the alternative style, then we have to implement it
              ourselves! */
-          my_setopt(curl, CURLOPT_PROGRESSFUNCTION, tool_progress_cb);
-          my_setopt(curl, CURLOPT_PROGRESSDATA, &progressbar);
+          my_setopt(curl, CURLOPT_XFERINFOFUNCTION, tool_progress_cb);
+          my_setopt(curl, CURLOPT_XFERINFODATA, &progressbar);
         }
 
         /* new in libcurl 7.24.0: */