libopkg: remove unused progress parameters from opkg_download()
[oweals/opkg-lede.git] / libopkg / opkg.c
index 253080fae5f40461b0cfa94b08d9942a9d6cdcd8..d994bd19888c98aa6e95fbcb1d29b94bad17d1bc 100644 (file)
@@ -74,39 +74,6 @@ static int opkg_configure_packages(char *pkg_name)
        return err;
 }
 
-struct _curl_cb_data {
-       opkg_progress_callback_t cb;
-       opkg_progress_data_t *progress_data;
-       void *user_data;
-       int start_range;
-       int finish_range;
-};
-
-int curl_progress_cb(struct _curl_cb_data *cb_data, double t,  /* dltotal */
-                    double d,  /* dlnow */
-                    double ultotal, double ulnow)
-{
-       int p = (t) ? d * 100 / t : 0;
-       static int prev = -1;
-       int progress = 0;
-
-       /* prevent the same value being sent twice (can occur due to rounding) */
-       if (p == prev)
-               return 0;
-       prev = p;
-
-       if (t < 1)
-               return 0;
-
-       progress = cb_data->start_range +
-           (d / t * ((cb_data->finish_range - cb_data->start_range)));
-       cb_data->progress_data->percentage = progress;
-
-       (cb_data->cb) (cb_data->progress_data, cb_data->user_data);
-
-       return 0;
-}
-
 static struct opkg_conf saved_conf;
 /*** Public API ***/
 
@@ -293,7 +260,6 @@ opkg_install_package(const char *package_name,
        /* download package and dependencies */
        for (i = 0; i < deps->len; i++) {
                pkg_t *pkg;
-               struct _curl_cb_data cb_data;
                char *url;
 
                pkg = deps->pkgs[i];
@@ -323,16 +289,7 @@ opkg_install_package(const char *package_name,
 
                pkg_set_string(pkg, PKG_LOCAL_FILENAME, local_filename);
 
-               cb_data.cb = progress_callback;
-               cb_data.progress_data = &pdata;
-               cb_data.user_data = user_data;
-               /* 75% of "install" progress is for downloading */
-               cb_data.start_range = 75 * i / deps->len;
-               cb_data.finish_range = 75 * (i + 1) / deps->len;
-
-               err = opkg_download(url, local_filename,
-                                   (curl_progress_func) curl_progress_cb,
-                                   &cb_data, 0);
+               err = opkg_download(url, local_filename, 0);
                free(url);
 
                if (err) {
@@ -581,7 +538,7 @@ opkg_update_package_lists(opkg_progress_callback_t progress_callback,
 
                sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
 
-               if (opkg_download(url, list_file_name, NULL, NULL, 0)) {
+               if (opkg_download(url, list_file_name, 0)) {
                        opkg_msg(ERROR, "Couldn't retrieve %s\n", url);
                        result = -1;
                }
@@ -606,7 +563,7 @@ opkg_update_package_lists(opkg_progress_callback_t progress_callback,
                        /* make sure there is no existing signature file */
                        unlink(sig_file_name);
 
-                       err = opkg_download(url, sig_file_name, NULL, NULL, 0);
+                       err = opkg_download(url, sig_file_name, 0);
                        if (err) {
                                opkg_msg(ERROR, "Couldn't retrieve %s\n", url);
                        } else {
@@ -810,7 +767,7 @@ int opkg_repository_accessibility_check(void)
                iter1 = str_list_pop(src);
                repositories--;
 
-               if (opkg_download(iter1->data, "/dev/null", NULL, NULL, 0))
+               if (opkg_download(iter1->data, "/dev/null", 0))
                        ret++;
                str_list_elt_deinit(iter1);
        }