From: zhanghu Date: Thu, 22 Apr 2021 09:10:00 +0000 (+0800) Subject: formdata: fix warning: 'CURLformoption' is promoted to 'int' X-Git-Tag: curl-7_86_0~242 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f52dd5fd5aa3592691a6f6d64f6acf2a07702c9;p=thirdparty%2Fcurl.git 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 --- diff --git a/.mailmap b/.mailmap index 5fe41e1574..a8f0cd716f 100644 --- a/.mailmap +++ b/.mailmap @@ -96,3 +96,4 @@ Oliver Roberts opensignature on github Cering on github a1346054 on github <36859588+a1346054@users.noreply.github.com> +zhanghu on xiaomi diff --git a/lib/formdata.c b/lib/formdata.c index f5ed3653df..3128f495b1 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; }