made it pass stricter compiler flags with less warnings

This commit is contained in:
Daniel Stenberg 2002-03-19 07:32:35 +00:00
parent 1fe1e39a88
commit eaff1a344e
1 changed files with 14 additions and 10 deletions

View File

@ -639,7 +639,7 @@ FORMcode FormAdd(struct curl_httppost **httppost,
struct curl_httppost *post = NULL; struct curl_httppost *post = NULL;
CURLformoption option; CURLformoption option;
struct curl_forms *forms = NULL; struct curl_forms *forms = NULL;
const char *array_value; /* value read from an array */ char *array_value; /* value read from an array */
/* This is a state variable, that if TRUE means that we're parsing an /* This is a state variable, that if TRUE means that we're parsing an
array that we got passed to us. If FALSE we're parsing the input array that we got passed to us. If FALSE we're parsing the input
@ -670,7 +670,7 @@ FORMcode FormAdd(struct curl_httppost **httppost,
if ( array_state ) { if ( array_state ) {
/* get the upcoming option from the given array */ /* get the upcoming option from the given array */
option = forms->option; option = forms->option;
array_value = forms->value; array_value = (char *)forms->value;
forms++; /* advance this to next entry */ forms++; /* advance this to next entry */
if (CURLFORM_END == option) { if (CURLFORM_END == option) {
@ -709,7 +709,8 @@ FORMcode FormAdd(struct curl_httppost **httppost,
if (current_form->name) if (current_form->name)
return_value = FORMADD_OPTION_TWICE; return_value = FORMADD_OPTION_TWICE;
else { else {
char *name = array_state?array_value:va_arg(params, char *); char *name = array_state?
array_value:va_arg(params, char *);
if (name) if (name)
current_form->name = name; /* store for the moment */ current_form->name = name; /* store for the moment */
else else
@ -721,7 +722,7 @@ FORMcode FormAdd(struct curl_httppost **httppost,
return_value = FORMADD_OPTION_TWICE; return_value = FORMADD_OPTION_TWICE;
else else
current_form->namelength = current_form->namelength =
array_state?array_value:va_arg(params, long); array_state?(long)array_value:va_arg(params, long);
break; break;
/* /*
@ -733,7 +734,8 @@ FORMcode FormAdd(struct curl_httppost **httppost,
if (current_form->value) if (current_form->value)
return_value = FORMADD_OPTION_TWICE; return_value = FORMADD_OPTION_TWICE;
else { else {
char *value = array_state?array_value:va_arg(params, char *); char *value =
array_state?array_value:va_arg(params, char *);
if (value) if (value)
current_form->value = value; /* store for the moment */ current_form->value = value; /* store for the moment */
else else
@ -745,7 +747,7 @@ FORMcode FormAdd(struct curl_httppost **httppost,
return_value = FORMADD_OPTION_TWICE; return_value = FORMADD_OPTION_TWICE;
else else
current_form->contentslength = current_form->contentslength =
array_state?array_value:va_arg(params, long); array_state?(long)array_value:va_arg(params, long);
break; break;
/* Get contents from a given file name */ /* Get contents from a given file name */
@ -767,8 +769,8 @@ FORMcode FormAdd(struct curl_httppost **httppost,
/* We upload a file */ /* We upload a file */
case CURLFORM_FILE: case CURLFORM_FILE:
{ {
const char *filename = array_state?array_value: char *filename = array_state?array_value:
va_arg(params, const char *); va_arg(params, char *);
if (current_form->value) { if (current_form->value) {
if (current_form->flags & HTTPPOST_FILENAME) { if (current_form->flags & HTTPPOST_FILENAME) {
@ -794,8 +796,8 @@ FORMcode FormAdd(struct curl_httppost **httppost,
} }
case CURLFORM_CONTENTTYPE: case CURLFORM_CONTENTTYPE:
{ {
const char *contenttype = char *contenttype =
array_state?array_value:va_arg(params, const char *); array_state?array_value:va_arg(params, char *);
if (current_form->contenttype) { if (current_form->contenttype) {
if (current_form->flags & HTTPPOST_FILENAME) { if (current_form->flags & HTTPPOST_FILENAME) {
if (contenttype) { if (contenttype) {
@ -820,6 +822,8 @@ FORMcode FormAdd(struct curl_httppost **httppost,
} }
case CURLFORM_CONTENTHEADER: case CURLFORM_CONTENTHEADER:
{ {
/* this "cast increases required alignment of target type" but
we consider it OK anyway */
struct curl_slist* list = array_state? struct curl_slist* list = array_state?
(struct curl_slist*)array_value: (struct curl_slist*)array_value:
va_arg(params, struct curl_slist*); va_arg(params, struct curl_slist*);