formdata: fix warning: 'CURLformoption' is promoted to 'int'

curl/lib/formdata.c: In function 'FormAdd':
curl/lib/formdata.c:249:31: warning: 'CURLformoption' is promoted to 'int' when passed through '...'
  249 |       option = va_arg(params, CURLformoption);
      |                               ^
curl/lib/formdata.c:249:31: note: (so you should pass 'int' not 'CURLformoption' to 'va_arg')
curl/lib/formdata.c:249:31: note: if this code is reached, the program will abort

Closes #9484
This commit is contained in:
zhanghu 2021-04-22 17:10:00 +08:00 committed by Daniel Stenberg
parent dbaa1e17a6
commit 0f52dd5fd5
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 5 additions and 2 deletions

View File

@ -96,3 +96,4 @@ Oliver Roberts <oliver@futaura.co.uk>
opensignature on github <antonio@piumarossa.it>
Cering on github <gfypm@qq.com>
a1346054 on github <36859588+a1346054@users.noreply.github.com>
zhanghu on xiaomi <zhanghu6@xiaomi.com>

View File

@ -251,8 +251,10 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
}
}
else {
/* This is not array-state, get next option */
option = va_arg(params, CURLformoption);
/* This is not array-state, get next option. This gets an 'int' with
va_arg() because CURLformoption might be a smaller type than int and
might cause compiler warnings and wrong behavior. */
option = va_arg(params, int);
if(CURLFORM_END == option)
break;
}