Skip to content
Permalink
Browse files
easygetopt: pass a valid enum to avoid compiler warning
"integer constant not in range of enumerated type 'CURLoption'"

Reported-by: Gisle Vanem
Bug: 6ebe63f#commitcomment-42042843

Closes #5915
  • Loading branch information
bagder committed Sep 5, 2020
1 parent a86cc7e commit 879007f8118771f4896334731aaca5850a154675
Showing 1 changed file with 2 additions and 1 deletion.
@@ -51,7 +51,8 @@ static struct curl_easyoption *lookup(const char *name, CURLoption id)

const struct curl_easyoption *curl_easy_option_by_name(const char *name)
{
return lookup(name, 0);
/* when name is used, the id argument is ignored */
return lookup(name, CURLOPT_LASTENTRY);
}

const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)

1 comment on commit 879007f

@gvanem
Copy link
Contributor

@gvanem gvanem commented on 879007f Sep 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning is still there though:

easyoptions.c(335,10): warning: integer constant not in range of enumerated type 'CURLoption' [-Wassign-enum]
  {NULL, 0, 0, 0} /* end of table */
         ^

But a:

{NULL, (CURLoption)0, 0, 0} /* end of table */

squelches that warning.

Please sign in to comment.