aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/dict.c2
-rw-r--r--lib/formdata.c24
-rw-r--r--lib/ftp.c8
-rw-r--r--lib/hostip4.c2
4 files changed, 19 insertions, 17 deletions
diff --git a/lib/dict.c b/lib/dict.c
index 86d00c961..6a5697952 100644
--- a/lib/dict.c
+++ b/lib/dict.c
@@ -106,7 +106,7 @@ static char *unescape_word(struct SessionHandle *data, char *inp)
/* According to RFC2229 section 2.2, these letters need to be escaped with
\[letter] */
for(ptr = newp;
- (byte = (unsigned char)*ptr);
+ (byte = (unsigned char)*ptr) != 0;
ptr++) {
if ((byte <= 32) || (byte == 127) ||
(byte == '\'') || (byte == '\"') || (byte == '\\')) {
diff --git a/lib/formdata.c b/lib/formdata.c
index 201bdcaa5..4c53045f2 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -528,8 +528,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if (current_form->value) {
if (current_form->flags & HTTPPOST_FILENAME) {
if (filename) {
- if (!(current_form = AddFormInfo(strdup(filename),
- NULL, current_form)))
+ if ((current_form = AddFormInfo(strdup(filename),
+ NULL, current_form)) == NULL)
return_value = CURL_FORMADD_MEMORY;
}
else
@@ -562,8 +562,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if (current_form->value) {
if (current_form->flags & HTTPPOST_BUFFER) {
if (filename) {
- if (!(current_form = AddFormInfo(strdup(filename),
- NULL, current_form)))
+ if ((current_form = AddFormInfo(strdup(filename),
+ NULL, current_form)) == NULL)
return_value = CURL_FORMADD_MEMORY;
}
else
@@ -614,9 +614,9 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if (current_form->contenttype) {
if (current_form->flags & HTTPPOST_FILENAME) {
if (contenttype) {
- if (!(current_form = AddFormInfo(NULL,
- strdup(contenttype),
- current_form)))
+ if ((current_form = AddFormInfo(NULL,
+ strdup(contenttype),
+ current_form)) == NULL)
return_value = CURL_FORMADD_MEMORY;
}
else
@@ -884,7 +884,7 @@ void Curl_formclean(struct FormData *form)
free(form->line); /* free the line */
free(form); /* free the struct */
- } while((form=next)); /* continue */
+ } while ((form = next) != NULL); /* continue */
}
/*
@@ -961,7 +961,7 @@ void curl_formfree(struct curl_httppost *form)
free(form->showfilename); /* free the faked file name */
free(form); /* free the struct */
- } while((form=next)); /* continue */
+ } while ((form = next) != NULL); /* continue */
}
#ifndef HAVE_BASENAME
@@ -1231,7 +1231,7 @@ CURLcode Curl_getFormData(struct FormData **finalform,
*/
size_t nread;
char buffer[512];
- while((nread = fread(buffer, 1, sizeof(buffer), fileread))) {
+ while ((nread = fread(buffer, 1, sizeof(buffer), fileread)) != 0) {
result = AddFormData(&form, FORM_DATA, buffer, nread, &size);
if (result)
break;
@@ -1268,7 +1268,7 @@ CURLcode Curl_getFormData(struct FormData **finalform,
if (result)
break;
}
- } while((file = file->more)); /* for each specified file for this field */
+ } while ((file = file->more) != NULL); /* for each specified file for this field */
if (result) {
Curl_formclean(firstform);
free(boundary);
@@ -1286,7 +1286,7 @@ CURLcode Curl_getFormData(struct FormData **finalform,
break;
}
- } while((post=post->next)); /* for each field */
+ } while ((post = post->next) != NULL); /* for each field */
if (result) {
Curl_formclean(firstform);
free(boundary);
diff --git a/lib/ftp.c b/lib/ftp.c
index bfa34bae8..bc069a2b0 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -138,8 +138,10 @@ static int ftp_need_type(struct connectdata *conn,
bool ascii);
/* easy-to-use macro: */
-#define FTPSENDF(x,y,z) if((result = Curl_ftpsendf(x,y,z))) return result
-#define NBFTPSENDF(x,y,z) if((result = Curl_nbftpsendf(x,y,z))) return result
+#define FTPSENDF(x,y,z) if ((result = Curl_ftpsendf(x,y,z)) != CURLE_OK) \
+ return result
+#define NBFTPSENDF(x,y,z) if ((result = Curl_nbftpsendf(x,y,z)) != CURLE_OK) \
+ return result
static void freedirs(struct FTP *ftp)
{
@@ -3878,7 +3880,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
return CURLE_OUT_OF_MEMORY;
/* parse the URL path into separate path components */
- while((slash_pos=strchr(cur_pos, '/'))) {
+ while ((slash_pos = strchr(cur_pos, '/')) != NULL) {
/* 1 or 0 to indicate absolute directory */
bool absolute_dir = (cur_pos - conn->path > 0) && (ftp->dirdepth == 0);
diff --git a/lib/hostip4.c b/lib/hostip4.c
index cbb00ab2d..08565cd86 100644
--- a/lib/hostip4.c
+++ b/lib/hostip4.c
@@ -348,7 +348,7 @@ Curl_addrinfo *Curl_he2ai(const struct hostent *he, int port)
/* no input == no output! */
return NULL;
- for(i=0; (curr = (struct in_addr *)he->h_addr_list[i]); i++) {
+ for(i=0; (curr = (struct in_addr *)he->h_addr_list[i]) != NULL; i++) {
ai = calloc(1, sizeof(Curl_addrinfo) + sizeof(struct sockaddr_in));