summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-03-22 13:14:12 +0000
committerJason Woodward2005-03-22 13:14:12 +0000
commit696846ba9011ff1598071de04174143e20270e1e (patch)
tree6de909fa18d09fd2f352da46cc7b7b0a54b7441d /src
parent44558a0cc38d16e3edd1b5d5249dcabdd824264b (diff)
downloadslapt-get-696846ba9011ff1598071de04174143e20270e1e.tar.gz
fixed precision error in curl progress callback, d/l stats now report correct percentage
Diffstat (limited to 'src')
-rw-r--r--src/curl.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/curl.c b/src/curl.c
index 15d3ca4..23250b3 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -280,16 +280,15 @@ int download_pkg(const rc_config *global_config,pkg_info_t *pkg){
}
int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow){
- int percent = 0;
- int *bytes = (int *)clientp;
- /* supress unused parameter warning */
+ size_t percent = 0;
+ size_t *bytes = (size_t *)clientp;
(void) ultotal;
(void) ulnow;
- /* */
- if( ((int)dltotal + *bytes) == 0 ){
+
+ if( (dltotal + *bytes) == 0 ){
percent = 0;
}else{
- percent = ((*bytes + (int)dlnow)*100)/((int)dltotal + *bytes);
+ percent = ((*bytes + dlnow)*100)/(dltotal + *bytes);
}
printf("%3d%%\b\b\b\b",percent);
return 0;