Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/46926 )
Change subject: Fix compatibility with old libcurl ......................................................................
Fix compatibility with old libcurl
libcurl versions before 7.32.00 didn't have CURLOPT_XFERINFOFUNCTION. Put the code using that macro under version-dependant contitionals.
Signed-off-by: Alexander Amelkin a.amelkin@yadro.com Change-Id: Ib40a5ba9b5a52a82ad1e388b6fa46c854a10113e Reviewed-on: https://review.coreboot.org/c/em100/+/46926 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Georgi pgeorgi@google.com --- M curl.c 1 file changed, 5 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/curl.c b/curl.c index d13dfe8..e6ee8bb 100644 --- a/curl.c +++ b/curl.c @@ -36,6 +36,7 @@ #define TIMEOPT CURLINFO_TOTAL_TIME_T #define MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL 3000000
+#if LIBCURL_VERSION_NUM >= 0x073200 static int xferinfo(void *p __unused, curl_off_t dltotal __unused, curl_off_t dlnow __unused, curl_off_t ultotal __unused, curl_off_t ulnow __unused) @@ -51,6 +52,7 @@ pos = (pos + 1) % 4; return 0; } +#endif
static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) @@ -58,7 +60,7 @@ return fwrite(ptr, size, nmemb, (FILE *) stream); }
-static int curl_get(const char *id, const char *filename, int progress) +static int curl_get(const char *id, const char *filename, int progress __unused) { FILE *file; CURLcode res; @@ -97,6 +99,7 @@ /* Write data to this file handle */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
+#if LIBCURL_VERSION_NUM >= 0x073200 if (progress) { /* Simple progress indicator function */ curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferinfo); @@ -104,6 +107,7 @@ /* Enable progress indicator */ curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); } +#endif
/* Follow redirections (as used by Google Drive) */ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION , 1L);