mirror of
https://github.com/curl/curl.git
synced 2026-06-19 00:05:40 +03:00
curl_formdata: fix to pass long where missing, document CURLFORM_NAMELENGTH
- lib650: pass `long` to `CURLFORM_NAMELENGTH` in test. Spotted by Copilot. https://github.com/curl/curl/pull/22011#discussion_r3412407235 Follow-up to3620e569b3- lib650: drop an interim variable, and interim casts. Follow-up to60776a0515#2747 - curl_formdata.md: document `CURLFORM_NAMELENGTH` on man page. - curl_formdata.md: pass `long` to `CURLFORM_BUFFERLENGTH` on man page. - formdata: pass `long` to `CURLFORM_CONTENTSLENGTH` in comment. Closes #22017
This commit is contained in:
parent
0dae3b2690
commit
adb606eae7
3 changed files with 10 additions and 7 deletions
|
|
@ -48,7 +48,6 @@ static CURLcode test_lib650(const char *URL)
|
|||
struct curl_forms formarray[3];
|
||||
size_t formlength = 0;
|
||||
char flbuf[32];
|
||||
long contentlength = 0;
|
||||
|
||||
static const char testname[] = "fieldname";
|
||||
static char testdata[] = "this is what we post to the silly web server";
|
||||
|
|
@ -83,19 +82,17 @@ static CURLcode test_lib650(const char *URL)
|
|||
goto test_cleanup;
|
||||
}
|
||||
|
||||
contentlength = (long)(strlen(testdata) - 1);
|
||||
|
||||
/* Use a form array for the non-copy test. */
|
||||
formarray[0].option = CURLFORM_PTRCONTENTS;
|
||||
formarray[0].value = testdata;
|
||||
formarray[1].option = CURLFORM_CONTENTSLENGTH;
|
||||
formarray[1].value = (char *)(size_t)contentlength;
|
||||
formarray[1].value = (char *)(strlen(testdata) - 1);
|
||||
formarray[2].option = CURLFORM_END;
|
||||
formarray[2].value = NULL;
|
||||
formrc = curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_PTRNAME, testname,
|
||||
CURLFORM_NAMELENGTH, sizeof(testname) - 2,
|
||||
CURLFORM_NAMELENGTH, (long)(sizeof(testname) - 2),
|
||||
CURLFORM_ARRAY, formarray,
|
||||
CURLFORM_FILENAME, "remotefile.txt",
|
||||
CURLFORM_END);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue