Skip to content

Commit

Permalink
easygetopt: pass a valid enum to avoid compiler warning
Browse files Browse the repository at this point in the history
"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 879007f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/easygetopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

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.