r3925 - trunk/src/target/opkg

thomas at sita.openmoko.org thomas at sita.openmoko.org
Tue Jan 22 18:11:12 CET 2008


Author: thomas
Date: 2008-01-22 18:11:11 +0100 (Tue, 22 Jan 2008)
New Revision: 3925

Modified:
   trunk/src/target/opkg/libopkg.h
   trunk/src/target/opkg/opkg_download.c
Log:
opkg: include the current url being downloaded in the progress callback


Modified: trunk/src/target/opkg/libopkg.h
===================================================================
--- trunk/src/target/opkg/libopkg.h	2008-01-22 16:39:09 UTC (rev 3924)
+++ trunk/src/target/opkg/libopkg.h	2008-01-22 17:11:11 UTC (rev 3925)
@@ -36,7 +36,7 @@
 typedef int (*opkg_status_callback)(char *name, int istatus, char *desc,
 	void *userdata);
 typedef char* (*opkg_response_callback)(char *question);
-typedef void (*opkg_download_progress_callback)(int percent);
+typedef void (*opkg_download_progress_callback)(int percent, char *url);
 
 extern int opkg_op(int argc, char *argv[]); /* opkglib.c */
 extern int opkg_init (opkg_message_callback mcall, 

Modified: trunk/src/target/opkg/opkg_download.c
===================================================================
--- trunk/src/target/opkg/opkg_download.c	2008-01-22 16:39:09 UTC (rev 3924)
+++ trunk/src/target/opkg/opkg_download.c	2008-01-22 17:11:11 UTC (rev 3925)
@@ -34,11 +34,11 @@
 #endif
 
 int
-curl_progress_func (void* data,
-                         double t, /* dltotal */
-                         double d, /* dlnow */
-                         double ultotal,
-                         double ulnow)
+curl_progress_func (char* url,
+		    double t, /* dltotal */
+		    double d, /* dlnow */
+		    double ultotal,
+		    double ulnow)
 {
     int i;
     int p = d*100/t;
@@ -46,7 +46,7 @@
 #ifdef OPKG_LIB
     if (opkg_cb_download_progress)
     {
-	opkg_cb_download_progress (p);
+	opkg_cb_download_progress (p, url);
 	return 0;
     }
 #endif
@@ -142,7 +142,8 @@
     {
 	curl_easy_setopt (curl, CURLOPT_URL, src);
 	curl_easy_setopt (curl, CURLOPT_WRITEDATA, file);
-	curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
+	curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 0);
+	curl_easy_setopt (curl, CURLOPT_PROGRESSDATA, src);
 	curl_easy_setopt (curl, CURLOPT_PROGRESSFUNCTION, curl_progress_func);
 	if (conf->http_proxy || conf->ftp_proxy)
 	{





More information about the commitlog mailing list