mirror of
https://github.com/curl/curl.git
synced 2026-07-25 02:37:18 +03:00
removed space after if and while before the parenthesis for better source code
consistency
This commit is contained in:
parent
af29dcbafb
commit
ad6e28073c
24 changed files with 1070 additions and 1068 deletions
202
lib/formdata.c
202
lib/formdata.c
|
|
@ -187,7 +187,7 @@ AddHttpPost(char * name, size_t namelength,
|
|||
else
|
||||
return NULL;
|
||||
|
||||
if (parent_post) {
|
||||
if(parent_post) {
|
||||
/* now, point our 'more' to the original 'more' */
|
||||
post->more = parent_post->more;
|
||||
|
||||
|
|
@ -224,16 +224,16 @@ static FormInfo * AddFormInfo(char *value,
|
|||
form_info = (FormInfo *)malloc(sizeof(FormInfo));
|
||||
if(form_info) {
|
||||
memset(form_info, 0, sizeof(FormInfo));
|
||||
if (value)
|
||||
if(value)
|
||||
form_info->value = value;
|
||||
if (contenttype)
|
||||
if(contenttype)
|
||||
form_info->contenttype = contenttype;
|
||||
form_info->flags = HTTPPOST_FILENAME;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (parent_form_info) {
|
||||
if(parent_form_info) {
|
||||
/* now, point our 'more' to the original 'more' */
|
||||
form_info->more = parent_form_info->more;
|
||||
|
||||
|
|
@ -316,7 +316,7 @@ static char *memdup(const char *src, size_t buffer_length)
|
|||
bool add = FALSE;
|
||||
char *buffer;
|
||||
|
||||
if (buffer_length)
|
||||
if(buffer_length)
|
||||
length = buffer_length;
|
||||
else if(src) {
|
||||
length = strlen(src);
|
||||
|
|
@ -327,13 +327,13 @@ static char *memdup(const char *src, size_t buffer_length)
|
|||
return strdup((char *)"");
|
||||
|
||||
buffer = (char*)malloc(length+add);
|
||||
if (!buffer)
|
||||
if(!buffer)
|
||||
return NULL; /* fail */
|
||||
|
||||
memcpy(buffer, src, length);
|
||||
|
||||
/* if length unknown do null termination */
|
||||
if (add)
|
||||
if(add)
|
||||
buffer[length] = '\0';
|
||||
|
||||
return buffer;
|
||||
|
|
@ -418,16 +418,16 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
/*
|
||||
* Loop through all the options set. Break if we have an error to report.
|
||||
*/
|
||||
while (return_value == CURL_FORMADD_OK) {
|
||||
while(return_value == CURL_FORMADD_OK) {
|
||||
|
||||
/* first see if we have more parts of the array param */
|
||||
if ( array_state ) {
|
||||
if( array_state ) {
|
||||
/* get the upcoming option from the given array */
|
||||
option = forms->option;
|
||||
array_value = (char *)forms->value;
|
||||
|
||||
forms++; /* advance this to next entry */
|
||||
if (CURLFORM_END == option) {
|
||||
if(CURLFORM_END == option) {
|
||||
/* end of array state */
|
||||
array_state = FALSE;
|
||||
continue;
|
||||
|
|
@ -436,7 +436,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
else {
|
||||
/* This is not array-state, get next option */
|
||||
option = va_arg(params, CURLformoption);
|
||||
if (CURLFORM_END == option)
|
||||
if(CURLFORM_END == option)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
return_value = CURL_FORMADD_ILLEGAL_ARRAY;
|
||||
else {
|
||||
forms = va_arg(params, struct curl_forms *);
|
||||
if (forms)
|
||||
if(forms)
|
||||
array_state = TRUE;
|
||||
else
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
|
|
@ -465,19 +465,19 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
current_form->flags |= HTTPPOST_PTRNAME; /* fall through */
|
||||
#endif
|
||||
case CURLFORM_COPYNAME:
|
||||
if (current_form->name)
|
||||
if(current_form->name)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *name = array_state?
|
||||
array_value:va_arg(params, char *);
|
||||
if (name)
|
||||
if(name)
|
||||
current_form->name = name; /* store for the moment */
|
||||
else
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
break;
|
||||
case CURLFORM_NAMELENGTH:
|
||||
if (current_form->namelength)
|
||||
if(current_form->namelength)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->namelength =
|
||||
|
|
@ -490,19 +490,19 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
case CURLFORM_PTRCONTENTS:
|
||||
current_form->flags |= HTTPPOST_PTRCONTENTS; /* fall through */
|
||||
case CURLFORM_COPYCONTENTS:
|
||||
if (current_form->value)
|
||||
if(current_form->value)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *value =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
if (value)
|
||||
if(value)
|
||||
current_form->value = value; /* store for the moment */
|
||||
else
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
break;
|
||||
case CURLFORM_CONTENTSLENGTH:
|
||||
if (current_form->contentslength)
|
||||
if(current_form->contentslength)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->contentslength =
|
||||
|
|
@ -511,12 +511,12 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
|
||||
/* Get contents from a given file name */
|
||||
case CURLFORM_FILECONTENT:
|
||||
if (current_form->flags != 0)
|
||||
if(current_form->flags != 0)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
const char *filename = array_state?
|
||||
array_value:va_arg(params, char *);
|
||||
if (filename) {
|
||||
if(filename) {
|
||||
current_form->value = strdup(filename);
|
||||
if(!current_form->value)
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
|
|
@ -536,10 +536,10 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
const char *filename = array_state?array_value:
|
||||
va_arg(params, char *);
|
||||
|
||||
if (current_form->value) {
|
||||
if (current_form->flags & HTTPPOST_FILENAME) {
|
||||
if (filename) {
|
||||
if ((current_form = AddFormInfo(strdup(filename),
|
||||
if(current_form->value) {
|
||||
if(current_form->flags & HTTPPOST_FILENAME) {
|
||||
if(filename) {
|
||||
if((current_form = AddFormInfo(strdup(filename),
|
||||
NULL, current_form)) == NULL)
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
}
|
||||
|
|
@ -550,7 +550,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
}
|
||||
else {
|
||||
if (filename) {
|
||||
if(filename) {
|
||||
current_form->value = strdup(filename);
|
||||
if(!current_form->value)
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
|
|
@ -570,10 +570,10 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
const char *filename = array_state?array_value:
|
||||
va_arg(params, char *);
|
||||
|
||||
if (current_form->value) {
|
||||
if (current_form->flags & HTTPPOST_BUFFER) {
|
||||
if (filename) {
|
||||
if ((current_form = AddFormInfo(strdup(filename),
|
||||
if(current_form->value) {
|
||||
if(current_form->flags & HTTPPOST_BUFFER) {
|
||||
if(filename) {
|
||||
if((current_form = AddFormInfo(strdup(filename),
|
||||
NULL, current_form)) == NULL)
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
}
|
||||
|
|
@ -584,7 +584,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
}
|
||||
else {
|
||||
if (filename) {
|
||||
if(filename) {
|
||||
current_form->value = strdup(filename);
|
||||
if(!current_form->value)
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
|
|
@ -598,12 +598,12 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
|
||||
case CURLFORM_BUFFERPTR:
|
||||
current_form->flags |= HTTPPOST_PTRBUFFER;
|
||||
if (current_form->buffer)
|
||||
if(current_form->buffer)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *buffer =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
if (buffer)
|
||||
if(buffer)
|
||||
current_form->buffer = buffer; /* store for the moment */
|
||||
else
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
|
|
@ -611,7 +611,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
break;
|
||||
|
||||
case CURLFORM_BUFFERLENGTH:
|
||||
if (current_form->bufferlength)
|
||||
if(current_form->bufferlength)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->bufferlength =
|
||||
|
|
@ -622,10 +622,10 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
{
|
||||
const char *contenttype =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
if (current_form->contenttype) {
|
||||
if (current_form->flags & HTTPPOST_FILENAME) {
|
||||
if (contenttype) {
|
||||
if ((current_form = AddFormInfo(NULL,
|
||||
if(current_form->contenttype) {
|
||||
if(current_form->flags & HTTPPOST_FILENAME) {
|
||||
if(contenttype) {
|
||||
if((current_form = AddFormInfo(NULL,
|
||||
strdup(contenttype),
|
||||
current_form)) == NULL)
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
|
|
@ -637,7 +637,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
}
|
||||
else {
|
||||
if (contenttype) {
|
||||
if(contenttype) {
|
||||
current_form->contenttype = strdup(contenttype);
|
||||
if(!current_form->contenttype)
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
|
|
@ -692,7 +692,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
for(form = first_form;
|
||||
form != NULL;
|
||||
form = form->more) {
|
||||
if ( ((!form->name || !form->value) && !post) ||
|
||||
if( ((!form->name || !form->value) && !post) ||
|
||||
( (form->contentslength) &&
|
||||
(form->flags & HTTPPOST_FILENAME) ) ||
|
||||
( (form->flags & HTTPPOST_FILENAME) &&
|
||||
|
|
@ -709,7 +709,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
break;
|
||||
}
|
||||
else {
|
||||
if ( ((form->flags & HTTPPOST_FILENAME) ||
|
||||
if( ((form->flags & HTTPPOST_FILENAME) ||
|
||||
(form->flags & HTTPPOST_BUFFER)) &&
|
||||
!form->contenttype ) {
|
||||
/* our contenttype is missing */
|
||||
|
|
@ -721,23 +721,23 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
}
|
||||
form->contenttype_alloc = TRUE;
|
||||
}
|
||||
if ( !(form->flags & HTTPPOST_PTRNAME) &&
|
||||
if( !(form->flags & HTTPPOST_PTRNAME) &&
|
||||
(form == first_form) ) {
|
||||
/* copy name (without strdup; possibly contains null characters) */
|
||||
form->name = memdup(form->name, form->namelength);
|
||||
if (!form->name) {
|
||||
if(!form->name) {
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
break;
|
||||
}
|
||||
form->name_alloc = TRUE;
|
||||
}
|
||||
if ( !(form->flags & HTTPPOST_FILENAME) &&
|
||||
if( !(form->flags & HTTPPOST_FILENAME) &&
|
||||
!(form->flags & HTTPPOST_READFILE) &&
|
||||
!(form->flags & HTTPPOST_PTRCONTENTS) &&
|
||||
!(form->flags & HTTPPOST_PTRBUFFER) ) {
|
||||
/* copy value (without strdup; possibly contains null characters) */
|
||||
form->value = memdup(form->value, form->contentslength);
|
||||
if (!form->value) {
|
||||
if(!form->value) {
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
|
@ -756,7 +756,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
break;
|
||||
}
|
||||
|
||||
if (form->contenttype)
|
||||
if(form->contenttype)
|
||||
prevtype = form->contenttype;
|
||||
}
|
||||
}
|
||||
|
|
@ -780,7 +780,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
|
||||
/* always delete the allocated memory before returning */
|
||||
form = first_form;
|
||||
while (form != NULL) {
|
||||
while(form != NULL) {
|
||||
FormInfo *delete_form;
|
||||
|
||||
delete_form = form;
|
||||
|
|
@ -820,7 +820,7 @@ static CURLcode AddFormData(struct FormData **formp,
|
|||
{
|
||||
struct FormData *newform = (struct FormData *)
|
||||
malloc(sizeof(struct FormData));
|
||||
if (!newform)
|
||||
if(!newform)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
newform->next = NULL;
|
||||
|
||||
|
|
@ -829,7 +829,7 @@ static CURLcode AddFormData(struct FormData **formp,
|
|||
length = strlen((char *)line);
|
||||
|
||||
newform->line = (char *)malloc(length+1);
|
||||
if (!newform->line) {
|
||||
if(!newform->line) {
|
||||
free(newform);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
@ -845,7 +845,7 @@ static CURLcode AddFormData(struct FormData **formp,
|
|||
else
|
||||
*formp = newform;
|
||||
|
||||
if (size) {
|
||||
if(size) {
|
||||
if((type == FORM_DATA) || (type == FORM_CONTENT))
|
||||
*size += length;
|
||||
else {
|
||||
|
|
@ -896,7 +896,7 @@ void Curl_formclean(struct FormData **form_ptr)
|
|||
free(form->line); /* free the line */
|
||||
free(form); /* free the struct */
|
||||
|
||||
} while ((form = next) != NULL); /* continue */
|
||||
} while((form = next) != NULL); /* continue */
|
||||
|
||||
*form_ptr = NULL;
|
||||
}
|
||||
|
|
@ -920,13 +920,13 @@ CURLcode Curl_formconvert(struct SessionHandle *data, struct FormData *form)
|
|||
|
||||
do {
|
||||
next=form->next; /* the following form line */
|
||||
if (form->type == FORM_DATA) {
|
||||
if(form->type == FORM_DATA) {
|
||||
rc = Curl_convert_to_network(data, form->line, form->length);
|
||||
/* Curl_convert_to_network calls failf if unsuccessful */
|
||||
if (rc != CURLE_OK)
|
||||
if(rc != CURLE_OK)
|
||||
return rc;
|
||||
}
|
||||
} while ((form = next) != NULL); /* continue */
|
||||
} while((form = next) != NULL); /* continue */
|
||||
return CURLE_OK;
|
||||
}
|
||||
#endif /* CURL_DOES_CONVERSIONS */
|
||||
|
|
@ -944,11 +944,11 @@ int curl_formget(struct curl_httppost *form, void *arg,
|
|||
struct FormData *data, *ptr;
|
||||
|
||||
rc = Curl_getFormData(&data, form, NULL, &size);
|
||||
if (rc != CURLE_OK)
|
||||
if(rc != CURLE_OK)
|
||||
return (int)rc;
|
||||
|
||||
for (ptr = data; ptr; ptr = ptr->next) {
|
||||
if (ptr->type == FORM_FILE) {
|
||||
if(ptr->type == FORM_FILE) {
|
||||
char buffer[8192];
|
||||
size_t nread;
|
||||
struct Form temp;
|
||||
|
|
@ -957,16 +957,16 @@ int curl_formget(struct curl_httppost *form, void *arg,
|
|||
|
||||
do {
|
||||
nread = readfromfile(&temp, buffer, sizeof(buffer));
|
||||
if ((nread == (size_t) -1) || (nread != append(arg, buffer, nread))) {
|
||||
if (temp.fp) {
|
||||
if((nread == (size_t) -1) || (nread != append(arg, buffer, nread))) {
|
||||
if(temp.fp) {
|
||||
fclose(temp.fp);
|
||||
}
|
||||
Curl_formclean(&data);
|
||||
return -1;
|
||||
}
|
||||
} while (nread == sizeof(buffer));
|
||||
} while(nread == sizeof(buffer));
|
||||
} else {
|
||||
if (ptr->length != append(arg, ptr->line, ptr->length)) {
|
||||
if(ptr->length != append(arg, ptr->line, ptr->length)) {
|
||||
Curl_formclean(&data);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -1005,7 +1005,7 @@ void curl_formfree(struct curl_httppost *form)
|
|||
free(form->showfilename); /* free the faked file name */
|
||||
free(form); /* free the struct */
|
||||
|
||||
} while ((form = next) != NULL); /* continue */
|
||||
} while((form = next) != NULL); /* continue */
|
||||
}
|
||||
|
||||
#ifndef HAVE_BASENAME
|
||||
|
|
@ -1110,7 +1110,7 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
"Content-Type: multipart/form-data",
|
||||
boundary);
|
||||
|
||||
if (result) {
|
||||
if(result) {
|
||||
free(boundary);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1123,13 +1123,13 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
|
||||
if(size) {
|
||||
result = AddFormDataf(&form, &size, "\r\n");
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
|
||||
/* boundary */
|
||||
result = AddFormDataf(&form, &size, "--%s\r\n", boundary);
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
|
||||
/* Maybe later this should be disabled when a custom_content_type is
|
||||
|
|
@ -1138,16 +1138,16 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
*/
|
||||
result = AddFormDataf(&form, &size,
|
||||
"Content-Disposition: form-data; name=\"");
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
|
||||
result = AddFormData(&form, FORM_DATA, post->name, post->namelength,
|
||||
&size);
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
|
||||
result = AddFormDataf(&form, &size, "\"");
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
|
||||
if(post->more) {
|
||||
|
|
@ -1160,7 +1160,7 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
"\r\nContent-Type: multipart/mixed,"
|
||||
" boundary=%s\r\n",
|
||||
fileboundary);
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1183,9 +1183,9 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
fileboundary,
|
||||
(file->showfilename?file->showfilename:
|
||||
filebasename));
|
||||
if (filebasename)
|
||||
if(filebasename)
|
||||
free(filebasename);
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
else if((post->flags & HTTPPOST_FILENAME) ||
|
||||
|
|
@ -1198,10 +1198,10 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
"; filename=\"%s\"",
|
||||
(post->showfilename?post->showfilename:
|
||||
filebasename));
|
||||
if (filebasename)
|
||||
if(filebasename)
|
||||
free(filebasename);
|
||||
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1210,7 +1210,7 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
result = AddFormDataf(&form, &size,
|
||||
"\r\nContent-Type: %s",
|
||||
file->contenttype);
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1218,11 +1218,11 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
while( curList ) {
|
||||
/* Process the additional headers specified for this form */
|
||||
result = AddFormDataf( &form, &size, "\r\n%s", curList->data );
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
curList = curList->next;
|
||||
}
|
||||
if (result) {
|
||||
if(result) {
|
||||
Curl_formclean(&firstform);
|
||||
free(boundary);
|
||||
return result;
|
||||
|
|
@ -1240,13 +1240,13 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
/* this is not a text content, mention our binary encoding */
|
||||
result = AddFormDataf(&form, &size,
|
||||
"\r\nContent-Transfer-Encoding: binary");
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
result = AddFormDataf(&form, &size, "\r\n\r\n");
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
|
||||
if((post->flags & HTTPPOST_FILENAME) ||
|
||||
|
|
@ -1278,14 +1278,14 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
*/
|
||||
size_t nread;
|
||||
char buffer[512];
|
||||
while ((nread = fread(buffer, 1, sizeof(buffer), fileread)) != 0) {
|
||||
while((nread = fread(buffer, 1, sizeof(buffer), fileread)) != 0) {
|
||||
result = AddFormData(&form, FORM_CONTENT, buffer, nread, &size);
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result) {
|
||||
if(result) {
|
||||
Curl_formclean(&firstform);
|
||||
free(boundary);
|
||||
return result;
|
||||
|
|
@ -1305,11 +1305,11 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
}
|
||||
|
||||
}
|
||||
else if (post->flags & HTTPPOST_BUFFER) {
|
||||
else if(post->flags & HTTPPOST_BUFFER) {
|
||||
/* include contents of buffer */
|
||||
result = AddFormData(&form, FORM_CONTENT, post->buffer,
|
||||
post->bufferlength, &size);
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1317,11 +1317,11 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
/* include the contents we got */
|
||||
result = AddFormData(&form, FORM_CONTENT, post->contents,
|
||||
post->contentslength, &size);
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
} while ((file = file->more) != NULL); /* for each specified file for this field */
|
||||
if (result) {
|
||||
} while((file = file->more) != NULL); /* for each specified file for this field */
|
||||
if(result) {
|
||||
Curl_formclean(&firstform);
|
||||
free(boundary);
|
||||
return result;
|
||||
|
|
@ -1334,12 +1334,12 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
"\r\n--%s--",
|
||||
fileboundary);
|
||||
free(fileboundary);
|
||||
if (result)
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
|
||||
} while ((post = post->next) != NULL); /* for each field */
|
||||
if (result) {
|
||||
} while((post = post->next) != NULL); /* for each field */
|
||||
if(result) {
|
||||
Curl_formclean(&firstform);
|
||||
free(boundary);
|
||||
return result;
|
||||
|
|
@ -1349,7 +1349,7 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
|||
result = AddFormDataf(&form, &size,
|
||||
"\r\n--%s--\r\n",
|
||||
boundary);
|
||||
if (result) {
|
||||
if(result) {
|
||||
Curl_formclean(&firstform);
|
||||
free(boundary);
|
||||
return result;
|
||||
|
|
@ -1488,7 +1488,7 @@ int FormAddTest(const char * errormsg,
|
|||
int result;
|
||||
va_list arg;
|
||||
va_start(arg, last_post);
|
||||
if ((result = FormAdd(httppost, last_post, arg)))
|
||||
if((result = FormAdd(httppost, last_post, arg)))
|
||||
fprintf (stderr, "ERROR doing FormAdd ret: %d action: %s\n", result,
|
||||
errormsg);
|
||||
va_end(arg);
|
||||
|
|
@ -1539,11 +1539,11 @@ int main(int argc, argv_item_t argv[])
|
|||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
if (FormAddTest("simple COPYCONTENTS test", &httppost, &last_post,
|
||||
if(FormAddTest("simple COPYCONTENTS test", &httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name1, CURLFORM_COPYCONTENTS, value1,
|
||||
CURLFORM_END))
|
||||
++errors;
|
||||
if (FormAddTest("COPYCONTENTS + CONTENTTYPE test", &httppost, &last_post,
|
||||
if(FormAddTest("COPYCONTENTS + CONTENTTYPE test", &httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name2, CURLFORM_COPYCONTENTS, value2,
|
||||
CURLFORM_CONTENTTYPE, type2, CURLFORM_END))
|
||||
++errors;
|
||||
|
|
@ -1551,41 +1551,41 @@ int main(int argc, argv_item_t argv[])
|
|||
correctly */
|
||||
name3[1] = '\0';
|
||||
value3[1] = '\0';
|
||||
if (FormAddTest("PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH test",
|
||||
if(FormAddTest("PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH test",
|
||||
&httppost, &last_post,
|
||||
CURLFORM_PTRNAME, name3, CURLFORM_COPYCONTENTS, value3,
|
||||
CURLFORM_CONTENTSLENGTH, value3length,
|
||||
CURLFORM_NAMELENGTH, name3length, CURLFORM_END))
|
||||
++errors;
|
||||
if (FormAddTest("simple PTRCONTENTS test", &httppost, &last_post,
|
||||
if(FormAddTest("simple PTRCONTENTS test", &httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name4, CURLFORM_PTRCONTENTS, value4,
|
||||
CURLFORM_END))
|
||||
++errors;
|
||||
/* make null character at start to check that contentslength works
|
||||
correctly */
|
||||
value5[1] = '\0';
|
||||
if (FormAddTest("PTRCONTENTS + CONTENTSLENGTH test", &httppost, &last_post,
|
||||
if(FormAddTest("PTRCONTENTS + CONTENTSLENGTH test", &httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name5, CURLFORM_PTRCONTENTS, value5,
|
||||
CURLFORM_CONTENTSLENGTH, value5length, CURLFORM_END))
|
||||
++errors;
|
||||
/* make null character at start to check that contentslength works
|
||||
correctly */
|
||||
value6[1] = '\0';
|
||||
if (FormAddTest("PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE test",
|
||||
if(FormAddTest("PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE test",
|
||||
&httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name6, CURLFORM_PTRCONTENTS, value6,
|
||||
CURLFORM_CONTENTSLENGTH, value6length,
|
||||
CURLFORM_CONTENTTYPE, type6, CURLFORM_END))
|
||||
++errors;
|
||||
if (FormAddTest("FILE + CONTENTTYPE test", &httppost, &last_post,
|
||||
if(FormAddTest("FILE + CONTENTTYPE test", &httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name7, CURLFORM_FILE, value7,
|
||||
CURLFORM_CONTENTTYPE, type7, CURLFORM_END))
|
||||
++errors;
|
||||
if (FormAddTest("FILE1 + FILE2 test", &httppost, &last_post,
|
||||
if(FormAddTest("FILE1 + FILE2 test", &httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name8, CURLFORM_FILE, value7,
|
||||
CURLFORM_FILE, value8, CURLFORM_END))
|
||||
++errors;
|
||||
if (FormAddTest("FILE1 + FILE2 + FILE3 test", &httppost, &last_post,
|
||||
if(FormAddTest("FILE1 + FILE2 + FILE3 test", &httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name9, CURLFORM_FILE, value7,
|
||||
CURLFORM_FILE, value8, CURLFORM_FILE, value7, CURLFORM_END))
|
||||
++errors;
|
||||
|
|
@ -1596,11 +1596,11 @@ int main(int argc, argv_item_t argv[])
|
|||
forms[2].option = CURLFORM_FILE;
|
||||
forms[2].value = value7;
|
||||
forms[3].option = CURLFORM_END;
|
||||
if (FormAddTest("FILE1 + FILE2 + FILE3 ARRAY test", &httppost, &last_post,
|
||||
if(FormAddTest("FILE1 + FILE2 + FILE3 ARRAY test", &httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name10, CURLFORM_ARRAY, forms,
|
||||
CURLFORM_END))
|
||||
++errors;
|
||||
if (FormAddTest("FILECONTENT test", &httppost, &last_post,
|
||||
if(FormAddTest("FILECONTENT test", &httppost, &last_post,
|
||||
CURLFORM_COPYNAME, name11, CURLFORM_FILECONTENT, value7,
|
||||
CURLFORM_END))
|
||||
++errors;
|
||||
|
|
@ -1628,7 +1628,7 @@ int main(int argc, argv_item_t argv[])
|
|||
fprintf(stdout, "size: ");
|
||||
fprintf(stdout, CURL_FORMAT_OFF_T, size);
|
||||
fprintf(stdout, "\n");
|
||||
if (errors)
|
||||
if(errors)
|
||||
fprintf(stdout, "\n==> %d Test(s) failed!\n", errors);
|
||||
else
|
||||
fprintf(stdout, "\nAll Tests seem to have worked (please check output)\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue