libalpm: don't use curl's deprecated functions

This bumps the minimun curl version from 7.32.0 to 7.55.0.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
morganamilo 2021-01-02 00:00:02 +00:00 committed by Allan McRae
parent bc1591a0b8
commit f5b373788f
3 changed files with 8 additions and 9 deletions

View file

@ -391,7 +391,8 @@ static int curl_check_finished_download(CURLM *curlm, CURLMsg *msg,
CURLcode curlerr; CURLcode curlerr;
char *effective_url; char *effective_url;
long timecond; long timecond;
double remote_size, bytes_dl = 0; curl_off_t remote_size;
curl_off_t bytes_dl = 0;
long remote_time = -1; long remote_time = -1;
struct stat st; struct stat st;
char hostname[HOSTNAME_SIZE]; char hostname[HOSTNAME_SIZE];
@ -476,8 +477,8 @@ static int curl_check_finished_download(CURLM *curlm, CURLMsg *msg,
/* retrieve info about the state of the transfer */ /* retrieve info about the state of the transfer */
curl_easy_getinfo(curl, CURLINFO_FILETIME, &remote_time); curl_easy_getinfo(curl, CURLINFO_FILETIME, &remote_time);
curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &remote_size); curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &remote_size);
curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &bytes_dl); curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &bytes_dl);
curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &timecond); curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &timecond);
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url); curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url);
@ -539,7 +540,7 @@ static int curl_check_finished_download(CURLM *curlm, CURLMsg *msg,
/* time condition was met and we didn't download anything. we need to /* time condition was met and we didn't download anything. we need to
* clean up the 0 byte .part file that's left behind. */ * clean up the 0 byte .part file that's left behind. */
if(timecond == 1 && DOUBLE_EQ(bytes_dl, 0)) { if(timecond == 1 && bytes_dl == 0) {
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: file met time condition\n", _alpm_log(handle, ALPM_LOG_DEBUG, "%s: file met time condition\n",
payload->remote_name); payload->remote_name);
ret = 1; ret = 1;
@ -550,8 +551,8 @@ static int curl_check_finished_download(CURLM *curlm, CURLMsg *msg,
/* remote_size isn't necessarily the full size of the file, just what the /* remote_size isn't necessarily the full size of the file, just what the
* server reported as remaining to download. compare it to what curl reported * server reported as remaining to download. compare it to what curl reported
* as actually being transferred during curl_easy_perform() */ * as actually being transferred during curl_easy_perform() */
if(!DOUBLE_EQ(remote_size, -1) && !DOUBLE_EQ(bytes_dl, -1) && if(remote_size != -1 && bytes_dl != -1 &&
!DOUBLE_EQ(bytes_dl, remote_size)) { bytes_dl != remote_size) {
_alpm_log(handle, ALPM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"), _alpm_log(handle, ALPM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"),
payload->remote_name, (intmax_t)bytes_dl, (intmax_t)remote_size); payload->remote_name, (intmax_t)bytes_dl, (intmax_t)remote_size);
GOTO_ERR(handle, ALPM_ERR_RETRIEVE, cleanup); GOTO_ERR(handle, ALPM_ERR_RETRIEVE, cleanup);

View file

@ -81,8 +81,6 @@ void _alpm_alloc_fail(size_t size);
(handle)->pm_errno = (err); \ (handle)->pm_errno = (err); \
return (ret); } while(0) return (ret); } while(0)
#define DOUBLE_EQ(x, y) (fabs((x) - (y)) < DBL_EPSILON)
#define CHECK_HANDLE(handle, action) do { if(!(handle)) { action; } (handle)->pm_errno = ALPM_ERR_OK; } while(0) #define CHECK_HANDLE(handle, action) do { if(!(handle)) { action; } (handle)->pm_errno = ALPM_ERR_OK; } while(0)
/** Standard buffer size used throughout the library. */ /** Standard buffer size used throughout the library. */

View file

@ -94,7 +94,7 @@ libarchive = dependency('libarchive',
static : get_option('buildstatic')) static : get_option('buildstatic'))
libcurl = dependency('libcurl', libcurl = dependency('libcurl',
version : '>=7.32.0', version : '>=7.55.0',
required : get_option('curl'), required : get_option('curl'),
static : get_option('buildstatic')) static : get_option('buildstatic'))
conf.set('HAVE_LIBCURL', libcurl.found()) conf.set('HAVE_LIBCURL', libcurl.found())