From 93c2a816ea59500f2bd5b800a54dc8add796ae7d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 2 Oct 2008 16:52:26 +0200 Subject: [PATCH] removed the deprecated easy_download library This library isn't being used anymore, delete it. --- src/easy_download.c | 90 --------------------------------------------- src/easy_download.h | 31 ---------------- 2 files changed, 121 deletions(-) delete mode 100644 src/easy_download.c delete mode 100644 src/easy_download.h diff --git a/src/easy_download.c b/src/easy_download.c deleted file mode 100644 index 1dff510..0000000 --- a/src/easy_download.c +++ /dev/null @@ -1,90 +0,0 @@ -/* by Qball - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "ncmpc.h" - -#ifdef ENABLE_LYRICS_SCREEN -#include "easy_download.h" - -#include -#include -#include -#include - -#include - -static size_t write_data(void *buffer, size_t size, - size_t nmemb, void *data) -{ - easy_download_struct *dld = data; - - if(dld->data == NULL) - { - dld->size = 0; - } - dld->data = g_realloc(dld->data,(gulong)(size*nmemb+dld->size)); - - memset(&(dld->data)[dld->size], '\0', (size*nmemb)); - memcpy(&(dld->data)[dld->size], buffer, size*nmemb); - - dld->size += size*nmemb; - if(dld->size >= dld->max_size && dld->max_size > 0) - { - return 0; - } - return size*nmemb; -} - -int easy_download(char *url,easy_download_struct *dld, - curl_progress_callback cb) -{ - CURL *curl = NULL; - int res; - if(!dld) return 0; - easy_download_clean(dld); - /* initialize curl */ - curl = curl_easy_init(); - if(!curl) return 0; - /* set uri */ - curl_easy_setopt(curl, CURLOPT_URL, url); - /* set callback data */ - curl_easy_setopt(curl, CURLOPT_WRITEDATA, dld); - /* set callback function */ - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, cb); - /* run */ - res = curl_easy_perform(curl); - /* cleanup */ - curl_easy_cleanup(curl); - if(!res) - { - return 1; - } - if(dld->data) g_free(dld->data); - return 0; -} - -void easy_download_clean(easy_download_struct *dld) -{ - if(dld->data)g_free(dld->data); - dld->data = NULL; - dld->size = 0; - dld->max_size = -1; -} - -#endif diff --git a/src/easy_download.h b/src/easy_download.h deleted file mode 100644 index 92dc22e..0000000 --- a/src/easy_download.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * by Qball - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include - -typedef struct _easy_download_struct{ - char *data; - int size; - int max_size; - -}easy_download_struct; - - -int easy_download(char *url,easy_download_struct *dld, - curl_progress_callback cb); -void easy_download_clean(easy_download_struct *dld); -- 2.30.2