summaryrefslogtreecommitdiff
path: root/lib/formdata.c
diff options
context:
space:
mode:
authorzhanghu <zhanghu6@xiaomi.com>2021-04-22 17:10:00 +0800
committerDaniel Stenberg <daniel@haxx.se>2022-09-13 11:24:40 +0200
commit0f52dd5fd5aa3592691a6f6d64f6acf2a07702c9 (patch)
treeb326fdc9c9400efec28b6af9e1497b1c4f946226 /lib/formdata.c
parentdbaa1e17a65ee2ca00a214280878845fcf81322a (diff)
downloadcurl-0f52dd5fd5aa3592691a6f6d64f6acf2a07702c9.tar.gz
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
Diffstat (limited to 'lib/formdata.c')
-rw-r--r--lib/formdata.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index f5ed3653d..3128f495b 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -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;
}