debuginfod: Fix implicit conversion from 'CURLcode' to 'CURLMcode'
authorMark Wielaard <mark@klomp.org>
Tue, 3 Dec 2019 23:39:26 +0000 (00:39 +0100)
committerMark Wielaard <mark@klomp.org>
Mon, 9 Dec 2019 19:26:15 +0000 (20:26 +0100)
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
debuginfod/debuginfod-client.c

index 8aa2944..10b6bfe 100644 (file)
@@ -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
index 6e62b86..302ea2d 100644 (file)
@@ -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;