* [PATCH] debuginfod: Fix implicit conversion from 'CURLcode' to 'CURLMcode'
@ 2019-12-04 1:43 Mark Wielaard
2019-12-09 19:45 ` Mark Wielaard
0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2019-12-04 1:43 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
GCC10 warns when converting the value of one enum type into another:
debuginfod-client.c:530:24: error: implicit conversion from âCURLcodeâ
to âCURLMcodeâ [-Werror=enum-conversion]
530 | curl_res = curl_easy_getinfo(target_handle,
| ^
libcurl has different error code enums. The "easy" interfaces return
a CURLcode error. The "multi" interface functions return a CURLMcode.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
debuginfod/ChangeLog | 5 +++++
debuginfod/debuginfod-client.c | 9 ++++-----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 8aa29443..10b6bfed 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-03 Mark Wielaard <mark@klomp.org>
+
+ * debuginfod-client.c (debuginfod_query_server): Use separate
+ local variables for CURLcode curl_res and CURLMcode curlm_res.
+
2019-11-26 Mark Wielaard <mark@klomp.org>
* Makefile.am (BUILD_STATIC): Add needed libraries for libdw and
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 6e62b86c..302ea2dc 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -509,8 +509,6 @@ debuginfod_query_server (debuginfod_client *c,
long loops = 0;
do
{
- CURLMcode curl_res;
-
if (c->progressfn) /* inform/check progress callback */
{
loops ++;
@@ -518,6 +516,7 @@ debuginfod_query_server (debuginfod_client *c,
long pb = 0;
if (target_handle) /* we've committed to a server; report its download progress */
{
+ CURLcode curl_res;
#ifdef CURLINFO_SIZE_DOWNLOAD_T
curl_off_t dl;
curl_res = curl_easy_getinfo(target_handle,
@@ -564,10 +563,10 @@ debuginfod_query_server (debuginfod_client *c,
if (data[i].handle != target_handle)
curl_multi_remove_handle(curlm, data[i].handle);
- curl_res = curl_multi_perform(curlm, &still_running);
- if (curl_res != CURLM_OK)
+ CURLMcode curlm_res = curl_multi_perform(curlm, &still_running);
+ if (curlm_res != CURLM_OK)
{
- switch (curl_res)
+ switch (curlm_res)
{
case CURLM_CALL_MULTI_PERFORM: continue;
case CURLM_OUT_OF_MEMORY: rc = -ENOMEM; break;
--
2.18.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] debuginfod: Fix implicit conversion from 'CURLcode' to 'CURLMcode'
2019-12-04 1:43 [PATCH] debuginfod: Fix implicit conversion from 'CURLcode' to 'CURLMcode' Mark Wielaard
@ 2019-12-09 19:45 ` Mark Wielaard
0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2019-12-09 19:45 UTC (permalink / raw)
To: elfutils-devel
On Wed, 2019-12-04 at 02:43 +0100, Mark Wielaard wrote:
> GCC10 warns when converting the value of one enum type into another:
>
> debuginfod-client.c:530:24: error: implicit conversion from ‘CURLcode’
> to ‘CURLMcode’ [-Werror=enum-conversion]
> 530 | curl_res = curl_easy_getinfo(target_handle,
> | ^
>
> libcurl has different error code enums. The "easy" interfaces return
> a CURLcode error. The "multi" interface functions return a CURLMcode.
GCC10 is not out yet for a couple of months, but getting the error code
types correct seems like a good idea anyway. Pushed to master.
Cheers,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-09 19:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 1:43 [PATCH] debuginfod: Fix implicit conversion from 'CURLcode' to 'CURLMcode' Mark Wielaard
2019-12-09 19:45 ` Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).