1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

fixed some more size_t/int/long warnings and removed a few CMC comments

This commit is contained in:
Daniel Stenberg 2004-02-27 13:21:14 +00:00
parent 2b634be467
commit 6c78b4b7c0

View File

@ -398,12 +398,9 @@ int curl_formparse(char *input,
* *
***************************************************************************/ ***************************************************************************/
static struct curl_httppost * static struct curl_httppost *
AddHttpPost(char * name, long namelength, AddHttpPost(char * name, size_t namelength,
char * value, long contentslength, char * value, size_t contentslength,
char * buffer, size_t bufferlength,
/* CMC: Added support for buffer uploads */
char * buffer, long bufferlength,
char *contenttype, char *contenttype,
long flags, long flags,
struct curl_slist* contentHeader, struct curl_slist* contentHeader,
@ -417,14 +414,11 @@ AddHttpPost(char * name, long namelength,
if(post) { if(post) {
memset(post, 0, sizeof(struct curl_httppost)); memset(post, 0, sizeof(struct curl_httppost));
post->name = name; post->name = name;
post->namelength = name?(namelength?namelength:(long)strlen(name)):0; post->namelength = (long)(name?(namelength?namelength:strlen(name)):0);
post->contents = value; post->contents = value;
post->contentslength = contentslength; post->contentslength = contentslength;
/* CMC: Added support for buffer uploads */
post->buffer = buffer; post->buffer = buffer;
post->bufferlength = bufferlength; post->bufferlength = bufferlength;
post->contenttype = contenttype; post->contenttype = contenttype;
post->contentheader = contentHeader; post->contentheader = contentHeader;
post->showfilename = showfilename; post->showfilename = showfilename;
@ -794,7 +788,6 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
break; break;
} }
/* CMC: Added support for buffer uploads */
case CURLFORM_BUFFER: case CURLFORM_BUFFER:
{ {
char *filename = array_state?array_value: char *filename = array_state?array_value:
@ -823,7 +816,6 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
break; break;
} }
/* CMC: Added support for buffer uploads */
case CURLFORM_BUFFERPTR: case CURLFORM_BUFFERPTR:
current_form->flags |= HTTPPOST_PTRBUFFER; current_form->flags |= HTTPPOST_PTRBUFFER;
if (current_form->buffer) if (current_form->buffer)
@ -838,7 +830,6 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
} }
break; break;
/* CMC: Added support for buffer uploads */
case CURLFORM_BUFFERLENGTH: case CURLFORM_BUFFERLENGTH:
if (current_form->bufferlength) if (current_form->bufferlength)
return_value = CURL_FORMADD_OPTION_TWICE; return_value = CURL_FORMADD_OPTION_TWICE;
@ -917,7 +908,6 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
( (form->flags & HTTPPOST_FILENAME) && ( (form->flags & HTTPPOST_FILENAME) &&
(form->flags & HTTPPOST_PTRCONTENTS) ) || (form->flags & HTTPPOST_PTRCONTENTS) ) ||
/* CMC: Added support for buffer uploads */
( (!form->buffer) && ( (!form->buffer) &&
(form->flags & HTTPPOST_BUFFER) && (form->flags & HTTPPOST_BUFFER) &&
(form->flags & HTTPPOST_PTRBUFFER) ) || (form->flags & HTTPPOST_PTRBUFFER) ) ||
@ -947,8 +937,6 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if ( !(form->flags & HTTPPOST_FILENAME) && if ( !(form->flags & HTTPPOST_FILENAME) &&
!(form->flags & HTTPPOST_READFILE) && !(form->flags & HTTPPOST_READFILE) &&
!(form->flags & HTTPPOST_PTRCONTENTS) && !(form->flags & HTTPPOST_PTRCONTENTS) &&
/* CMC: Added support for buffer uploads */
!(form->flags & HTTPPOST_PTRBUFFER) ) { !(form->flags & HTTPPOST_PTRBUFFER) ) {
/* copy value (without strdup; possibly contains null characters) */ /* copy value (without strdup; possibly contains null characters) */
@ -959,10 +947,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
} }
post = AddHttpPost(form->name, form->namelength, post = AddHttpPost(form->name, form->namelength,
form->value, form->contentslength, form->value, form->contentslength,
/* CMC: Added support for buffer uploads */
form->buffer, form->bufferlength, form->buffer, form->bufferlength,
form->contenttype, form->flags, form->contenttype, form->flags,
form->contentheader, form->showfilename, form->contentheader, form->showfilename,
post, httppost, post, httppost,
@ -1188,8 +1173,6 @@ CURLcode Curl_getFormData(struct FormData **finalform,
file->contents)); file->contents));
} }
else if((post->flags & HTTPPOST_FILENAME) || else if((post->flags & HTTPPOST_FILENAME) ||
/* CMC: Added support for buffer uploads */
(post->flags & HTTPPOST_BUFFER)) { (post->flags & HTTPPOST_BUFFER)) {
size += AddFormDataf(&form, size += AddFormDataf(&form,
@ -1258,8 +1241,8 @@ CURLcode Curl_getFormData(struct FormData **finalform,
return CURLE_READ_ERROR; return CURLE_READ_ERROR;
} }
/* CMC: Added support for buffer uploads */ }
} else if (post->flags & HTTPPOST_BUFFER) { else if (post->flags & HTTPPOST_BUFFER) {
/* include contents of buffer */ /* include contents of buffer */
size += AddFormData(&form, post->buffer, post->bufferlength); size += AddFormData(&form, post->buffer, post->bufferlength);
} }