diff options
author | Eduardo Chappa <chappa@washington.edu> | 2015-07-24 22:13:59 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2015-07-24 22:13:59 -0600 |
commit | 9306e227fc7b1b096d4a58f8c06da66603a50a6a (patch) | |
tree | 0f4089b0487bb8d6514fcfb79fdd352ebcd527a9 /imap/src/c-client | |
parent | 28063ac494a640111f4483e85f968ee45b4213de (diff) | |
download | alpine-9306e227fc7b1b096d4a58f8c06da66603a50a6a.tar.xz |
* new version 2.20.9.
* Add command line argument -smimedir, which allows to specify
the default path for a directory that contains the public, private,
and ca directories. This is useful in case a user has a backup of
old certificates that cannot be installed in the ~/.alpine-smime
dir.
* Update to alpine man page to include documentation on missing command
line options such as -nowrite_password_cache, -passfile, -pwdcertdir,
and -smimedir.
* Various changes in the code to quell some compiler issued warnings in
Mac OSX. Reported by Joe St Sauver. This includes the removing
deprecated ldap functions from the code and the test in the configure
script. The switch to not deprecated functions is done by the use of
the belvar structure, which is not completely appropriate for what we
are doing, but it is sufficient for our needs. The berval structure
is more appropriate for binary data, but it works well with string
data, which is what we need.
* Various changes in the code to quell some warnings issued by clang
3.5.
Diffstat (limited to 'imap/src/c-client')
-rw-r--r-- | imap/src/c-client/auth_ext.c | 4 | ||||
-rw-r--r-- | imap/src/c-client/auth_gss.c | 4 | ||||
-rw-r--r-- | imap/src/c-client/auth_log.c | 10 | ||||
-rw-r--r-- | imap/src/c-client/auth_md5.c | 16 | ||||
-rw-r--r-- | imap/src/c-client/auth_pla.c | 6 | ||||
-rw-r--r-- | imap/src/c-client/imap4r1.c | 126 | ||||
-rw-r--r-- | imap/src/c-client/mail.c | 142 | ||||
-rw-r--r-- | imap/src/c-client/misc.c | 12 | ||||
-rw-r--r-- | imap/src/c-client/netmsg.c | 4 | ||||
-rw-r--r-- | imap/src/c-client/newsrc.c | 14 | ||||
-rw-r--r-- | imap/src/c-client/nntp.c | 66 | ||||
-rw-r--r-- | imap/src/c-client/pop3.c | 18 | ||||
-rw-r--r-- | imap/src/c-client/rfc822.c | 44 | ||||
-rw-r--r-- | imap/src/c-client/smanager.c | 10 | ||||
-rw-r--r-- | imap/src/c-client/smtp.c | 6 | ||||
-rw-r--r-- | imap/src/c-client/utf8.c | 16 | ||||
-rw-r--r-- | imap/src/c-client/utf8aux.c | 6 |
17 files changed, 253 insertions, 251 deletions
diff --git a/imap/src/c-client/auth_ext.c b/imap/src/c-client/auth_ext.c index 61dfc1b8..c8c5f4ac 100644 --- a/imap/src/c-client/auth_ext.c +++ b/imap/src/c-client/auth_ext.c @@ -59,11 +59,11 @@ long auth_external_client (authchallenge_t challenger,authrespond_t responder, unsigned long clen; long ret = NIL; *trial = 65535; /* never retry */ - if (challenge = (*challenger) (stream,&clen)) { + if ((challenge = (*challenger) (stream,&clen)) != NULL) { fs_give ((void **) &challenge); /* send authorization id (empty string OK) */ if ((*responder) (stream,strcpy (user,mb->user),strlen (mb->user))) { - if (challenge = (*challenger) (stream,&clen)) + if ((challenge = (*challenger) (stream,&clen)) != NULL) fs_give ((void **) &challenge); else ret = LONGT; /* check the authentication */ } diff --git a/imap/src/c-client/auth_gss.c b/imap/src/c-client/auth_gss.c index 26bf9e50..66be8cce 100644 --- a/imap/src/c-client/auth_gss.c +++ b/imap/src/c-client/auth_gss.c @@ -97,7 +97,7 @@ long auth_gssapi_client (authchallenge_t challenger,authrespond_t responder, long ret = NIL; *trial = 65535; /* never retry */ /* get initial (empty) challenge */ - if (chal.value = (*challenger) (stream,(unsigned long *) &chal.length)) { + if ((chal.value = (*challenger) (stream,(unsigned long *) &chal.length)) != NULL) { if (chal.length) { /* abort if challenge non-empty */ mm_log ("Server bug: non-empty initial GSSAPI challenge",WARN); (*responder) (stream,NIL,0); @@ -336,7 +336,7 @@ char *auth_gssapi_server (authresponse_t responder,int argc,char *argv[]) GSS_S_COMPLETE) { if ((smj = gss_acquire_cred (&smn,crname,0,NIL,GSS_C_ACCEPT,&crd,NIL,NIL)) == GSS_S_COMPLETE) { - if (resp.value = (*responder) ("",0,(unsigned long *) &resp.length)) { + if ((resp.value = (*responder) ("",0,(unsigned long *) &resp.length)) != NULL) { do { /* negotiate authentication */ smj = gss_accept_sec_context (&smn,&ctx,crd,&resp, GSS_C_NO_CHANNEL_BINDINGS,&name,&mech, diff --git a/imap/src/c-client/auth_log.c b/imap/src/c-client/auth_log.c index 1e1b1b5c..6615744f 100644 --- a/imap/src/c-client/auth_log.c +++ b/imap/src/c-client/auth_log.c @@ -63,7 +63,7 @@ long auth_login_client (authchallenge_t challenger,authrespond_t responder, unsigned long clen; long ret = NIL; /* get user name prompt */ - if (challenge = (*challenger) (stream,&clen)) { + if ((challenge = (*challenger) (stream,&clen)) != NULL) { fs_give ((void **) &challenge); pwd[0] = NIL; /* prompt user */ mm_login (mb,user,pwd,*trial); @@ -78,7 +78,7 @@ long auth_login_client (authchallenge_t challenger,authrespond_t responder, fs_give ((void **) &challenge); /* send password */ if ((*responder) (stream,pwd,strlen (pwd))) { - if (challenge = (*challenger) (stream,&clen)) + if ((challenge = (*challenger) (stream,&clen)) != NULL) fs_give ((void **) &challenge); else { ++*trial; /* can try again if necessary */ @@ -104,10 +104,10 @@ char *auth_login_server (authresponse_t responder,int argc,char *argv[]) { char *ret = NIL; char *user,*pass,*authuser; - if (user = (*responder) (PWD_USER,sizeof (PWD_USER),NIL)) { - if (pass = (*responder) (PWD_PWD,sizeof (PWD_PWD),NIL)) { + if ((user = (*responder) (PWD_USER,sizeof (PWD_USER),NIL)) != NULL) { + if ((pass = (*responder) (PWD_PWD,sizeof (PWD_PWD),NIL)) != NULL) { /* delimit user from possible admin */ - if (authuser = strchr (user,'*')) *authuser++ = '\0'; + if ((authuser = strchr (user,'*')) != NULL) *authuser++ = '\0'; if (server_login (user,pass,authuser,argc,argv)) ret = myusername (); fs_give ((void **) &pass); } diff --git a/imap/src/c-client/auth_md5.c b/imap/src/c-client/auth_md5.c index f32ebc88..9c81d308 100644 --- a/imap/src/c-client/auth_md5.c +++ b/imap/src/c-client/auth_md5.c @@ -100,7 +100,7 @@ long auth_md5_client (authchallenge_t challenger,authrespond_t responder, unsigned long clen; long ret = NIL; /* get challenge */ - if (challenge = (*challenger) (stream,&clen)) { + if ((challenge = (*challenger) (stream,&clen)) != NULL) { pwd[0] = NIL; /* prompt user */ mm_login (mb,user,pwd,*trial); if (!pwd[0]) { /* user requested abort */ @@ -115,7 +115,7 @@ long auth_md5_client (authchallenge_t challenger,authrespond_t responder, fs_give ((void **) &challenge); /* send credentials, allow retry if OK */ if ((*responder) (stream,pwd,strlen (pwd))) { - if (challenge = (*challenger) (stream,&clen)) + if ((challenge = (*challenger) (stream,&clen)) != NULL) fs_give ((void **) &challenge); else { ++*trial; /* can try again if necessary */ @@ -150,14 +150,14 @@ char *auth_md5_server (authresponse_t responder,int argc,char *argv[]) sprintf (chal,"<%lu.%lu@%s>",(unsigned long) getpid (), (unsigned long) time (0),mylocalhost ()); /* send challenge, get user and hash */ - if (user = (*responder) (chal,cl = strlen (chal),NIL)) { + if ((user = (*responder) (chal,cl = strlen (chal),NIL)) != NULL) { /* got user, locate hash */ - if (hash = strrchr (user,' ')) { + if ((hash = strrchr (user,' ')) != NULL) { *hash++ = '\0'; /* tie off user */ /* see if authentication user */ - if (authuser = strchr (user,'*')) *authuser++ = '\0'; + if ((authuser = strchr (user,'*')) != NULL) *authuser++ = '\0'; /* get password */ - if (p = auth_md5_pwd ((authuser && *authuser) ? authuser : user)) { + if ((p = auth_md5_pwd ((authuser && *authuser) ? authuser : user)) != NULL) { pl = strlen (p); u = (md5try && !strcmp (hash,hmac_md5 (hshbuf,chal,cl,p,pl))) ? user : NIL; @@ -234,9 +234,9 @@ char *apop_login (char *chal,char *user,char *md5,int argc,char *argv[]) MD5CONTEXT ctx; char *hex = "0123456789abcdef"; /* see if authentication user */ - if (authuser = strchr (user,'*')) *authuser++ = '\0'; + if ((authuser = strchr (user,'*')) != NULL) *authuser++ = '\0'; /* get password */ - if (s = auth_md5_pwd ((authuser && *authuser) ? authuser : user)) { + if ((s = auth_md5_pwd ((authuser && *authuser) ? authuser : user)) != NULL) { md5_init (&ctx); /* initialize MD5 context */ /* build string to get MD5 digest */ sprintf (tmp,"%.128s%.128s",chal,s); diff --git a/imap/src/c-client/auth_pla.c b/imap/src/c-client/auth_pla.c index 73ca2259..ef991f1d 100644 --- a/imap/src/c-client/auth_pla.c +++ b/imap/src/c-client/auth_pla.c @@ -63,7 +63,7 @@ long auth_plain_client (authchallenge_t challenger,authrespond_t responder, if (!mb->sslflag && !mb->tlsflag) mm_log ("SECURITY PROBLEM: insecure server advertised AUTH=PLAIN",WARN); /* get initial (empty) challenge */ - if (challenge = (*challenger) (stream,&clen)) { + if ((challenge = (*challenger) (stream,&clen)) != NULL) { fs_give ((void **) &challenge); if (clen) { /* abort if challenge non-empty */ mm_log ("Server bug: non-empty initial PLAIN challenge",WARN); @@ -91,7 +91,7 @@ long auth_plain_client (authchallenge_t challenger,authrespond_t responder, for (u = pwd; *u; *t++ = *u++); /* send credentials */ if ((*responder) (stream,response,rlen)) { - if (challenge = (*challenger) (stream,&clen)) + if ((challenge = (*challenger) (stream,&clen)) != NULL) fs_give ((void **) &challenge); else { ++*trial; /* can try again if necessary */ @@ -120,7 +120,7 @@ char *auth_plain_server (authresponse_t responder,int argc,char *argv[]) char *user,*aid,*pass; unsigned long len; /* get user name */ - if (aid = (*responder) ("",0,&len)) { + if ((aid = (*responder) ("",0,&len)) != NULL) { /* note: responders null-terminate */ if ((((unsigned long) ((user = aid + strlen (aid) + 1) - aid)) < len) && (((unsigned long) ((pass = user + strlen (user) + 1) - aid)) < len) && diff --git a/imap/src/c-client/imap4r1.c b/imap/src/c-client/imap4r1.c index f35b14b4..dbd945ec 100644 --- a/imap/src/c-client/imap4r1.c +++ b/imap/src/c-client/imap4r1.c @@ -504,10 +504,10 @@ void imap_lsub (MAILSTREAM *stream,char *ref,char *pat) if (ref && *ref) sprintf (mbx,"%s%s",ref,pat); else strcpy (mbx,pat); - if (s = sm_read (tmp,&sdb)) do if (imap_valid (s) && pmatch (s,mbx)) + if ((s = sm_read (tmp,&sdb)) != NULL) do if (imap_valid (s) && pmatch (s,mbx)) mm_lsub (stream,NIL,s,NIL); /* until no more subscriptions */ - while (s = sm_read (tmp,&sdb)); + while ((s = sm_read (tmp,&sdb)) != NULL); } /* IMAP find list of mailboxes @@ -849,7 +849,7 @@ MAILSTREAM *imap_open (MAILSTREAM *stream) * order, attempt to open via simap, tryssl, rimap, and finally TCP. */ /* try simap */ - else if (reply = imap_rimap (stream,"*imap",&mb,usr,tmp)); + else if ((reply = imap_rimap (stream,"*imap",&mb,usr,tmp)) != NULL); else if (ssld && /* try tryssl if enabled */ (stream->tryssl || mail_parameters (NIL,GET_TRYSSLFIRST,NIL)) && (LOCAL->netstream = @@ -1325,7 +1325,7 @@ void imap_close (MAILSTREAM *stream,long options) } if (LOCAL->threaddata) mail_free_threadnode (&LOCAL->threaddata); /* flush threaders */ - if (thr = LOCAL->cap.threader) while (t = thr) { + if ((thr = LOCAL->cap.threader) != NULL) while ((t = thr) != NULL) { fs_give ((void **) &t->name); thr = t->next; fs_give ((void **) &t); @@ -1507,8 +1507,8 @@ ENVELOPE *imap_structure (MAILSTREAM *stream,unsigned long msgno,BODY **body, set = set->next) { i = (set->first == 0xffffffff) ? stream->nmsgs : min (set->first,stream->nmsgs); - if (j = (set->last == 0xffffffff) ? stream->nmsgs : - min (set->last,stream->nmsgs)) { + if ((j = (set->last == 0xffffffff) ? stream->nmsgs : + min (set->last,stream->nmsgs)) != 0L) { if (i > j) { /* swap the range if backwards */ x = i; i = j; j = x; } @@ -1530,7 +1530,7 @@ ENVELOPE *imap_structure (MAILSTREAM *stream,unsigned long msgno,BODY **body, sprintf (s += strlen (s),",%lu:%lu",i,x); i = 1 + x - i; /* number of messages in this range */ /* still can look ahead some more? */ - if (k = (k > i) ? k - i : 0) + if ((k = (k > i) ? k - i : 0) != 0) /* yes, scan further in this range */ for (i = x + 2; (i <= j) && ((i == msgno) || @@ -1708,7 +1708,7 @@ long imap_msgdata (MAILSTREAM *stream,unsigned long msgno,char *section, else if (!section[0]) /* BODY[] becomes RFC822 */ aatt.text = (void *) ((flags & FT_PEEK) ? "RFC822.PEEK" : "RFC822"); /* nested header */ - else if (t = strstr (section,".HEADER")) { + else if ((t = strstr (section,".HEADER")) != NULL) { aatt.type = (flags & FT_PEEK) ? BODYPEEK : BODYTEXT; args[2] = &acls; /* will need to close section */ aatt.text = (void *) tmp; /* convert .HEADER to .0 */ @@ -1892,7 +1892,7 @@ unsigned long imap_uid (MAILSTREAM *stream,unsigned long msgno) aatt.type = ATOM; aatt.text = (void *) "UID"; args[0] = &aseq; args[1] = &aatt; args[2] = NIL; sprintf (seq,"%lu",msgno); - if (k = imap_uidlookahead) {/* build UID list */ + if ((k = imap_uidlookahead) != 0L) {/* build UID list */ for (i = msgno + 1, s = seq; k && (i <= stream->nmsgs); i++) if (!mail_elt (stream,i)->private.uid) { s += strlen (s); /* find string end, see if nearing end */ @@ -2056,7 +2056,7 @@ long imap_search (MAILSTREAM *stream,char *charset,SEARCHPGM *pgm,long flags) LOCAL->filter = T; /* retry, filtering SEARCH results */ for (i = 1; i <= stream->nmsgs; i++) mail_elt (stream,i)->private.filter = NIL; - for (set = ss; set; set = set->next) if (i = set->first) { + for (set = ss; set; set = set->next) if ((i = set->first) != 0L) { /* single message becomes one-message range */ if (!(j = set->last)) j = i; else if (j < i) { /* swap reversed range */ @@ -2658,7 +2658,7 @@ void imap_gc (MAILSTREAM *stream,long gcflags) (*mc) (stream,stream->nmsgs,CH_SIZE); if (gcflags & GC_TEXTS) { /* garbage collect texts? */ if (!stream->scache) for (i = 1; i <= stream->nmsgs; ++i) - if (elt = (MESSAGECACHE *) (*mc) (stream,i,CH_ELT)) + if ((elt = (MESSAGECACHE *) (*mc) (stream,i,CH_ELT)) != NULL) imap_gc_body (elt->private.msg.body); imap_gc_body (stream->body); } @@ -2713,7 +2713,7 @@ void imap_capability (MAILSTREAM *stream) imap_send (stream,"CAPABILITY",NIL); if (!LOCAL->gotcapability) { /* did server get any? */ /* no, flush threaders just in case */ - if (thr = LOCAL->cap.threader) while (t = thr) { + if ((thr = LOCAL->cap.threader) != NULL) while ((t = thr) != NULL) { fs_give ((void **) &t->name); thr = t->next; fs_give ((void **) &t); @@ -2935,7 +2935,7 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *stream,char *cmd,IMAPARG *args[]) if (LOCAL->referral) fs_give ((void **) &LOCAL->referral); sprintf (CMDBASE,"%s %s",tag,cmd); s = CMDBASE + strlen (CMDBASE); - if (arglst = args) while (arg = *arglst++) { + if ((arglst = args) != NULL) while ((arg = *arglst++) != NULL) { *s++ = ' '; /* delimit argument with space */ switch (arg->type) { case ATOM: /* atom */ @@ -2955,11 +2955,11 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *stream,char *cmd,IMAPARG *args[]) break; case ASTRING: /* atom or string, must be literal? */ st.size = strlen ((char *) (st.data = (unsigned char *) arg->text)); - if (reply = imap_send_astring (stream,tag,&s,&st,NIL,CMDBASE+MAXCOMMAND)) + if ((reply = imap_send_astring (stream,tag,&s,&st,NIL,CMDBASE+MAXCOMMAND)) != NULL) return reply; break; case LITERAL: /* literal, as a stringstruct */ - if (reply = imap_send_literal (stream,tag,&s,arg->text)) return reply; + if ((reply = imap_send_literal (stream,tag,&s,arg->text)) != NULL) return reply; break; case LIST: /* list of strings */ @@ -2967,16 +2967,16 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *stream,char *cmd,IMAPARG *args[]) c = '('; /* open paren */ do { /* for each list item */ *s++ = c; /* write prefix character */ - if (reply = imap_send_astring (stream,tag,&s,&list->text,NIL, - CMDBASE+MAXCOMMAND)) return reply; + if ((reply = imap_send_astring (stream,tag,&s,&list->text,NIL, + CMDBASE+MAXCOMMAND)) != NULL) return reply; c = ' '; /* prefix character for subsequent strings */ } - while (list = list->next); + while ((list = list->next) != NULL); *s++ = ')'; /* close list */ break; case SEARCHPROGRAM: /* search program */ - if (reply = imap_send_spgm (stream,tag,CMDBASE,&s,arg->text, - CMDBASE+MAXCOMMAND)) + if ((reply = imap_send_spgm (stream,tag,CMDBASE,&s,arg->text, + CMDBASE+MAXCOMMAND)) != NULL) return reply; break; case SORTPROGRAM: /* search program */ @@ -3061,7 +3061,7 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *stream,char *cmd,IMAPARG *args[]) break; case LISTMAILBOX: /* astring with wildcards */ st.size = strlen ((char *) (st.data = (unsigned char *) arg->text)); - if (reply = imap_send_astring (stream,tag,&s,&st,T,CMDBASE+MAXCOMMAND)) + if ((reply = imap_send_astring (stream,tag,&s,&st,T,CMDBASE+MAXCOMMAND)) != NULL) return reply; break; @@ -3083,7 +3083,7 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *stream,char *cmd,IMAPARG *args[]) MESSAGECACHE elt; STRING es; if (!map->date || mail_parse_date (&elt,map->date)) { - if (t = map->flags) { /* flags given? */ + if ((t = map->flags) != NULL) { /* flags given? */ if (*t != '(') { *s++ = '('; /* wrap parens around string */ while (*t) *s++ = *t++; @@ -3095,11 +3095,11 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *stream,char *cmd,IMAPARG *args[]) if (map->date) { /* date given? */ st.size = strlen ((char *) (st.data = (unsigned char *) mail_date (datetmp,&elt))); - if (reply = imap_send_astring (stream,tag,&s,&st,NIL, - CMDBASE+MAXCOMMAND)) return reply; + if ((reply = imap_send_astring (stream,tag,&s,&st,NIL, + CMDBASE+MAXCOMMAND)) != NULL) return reply; *s++ = ' '; /* delimit with space */ } - if (reply = imap_send_literal (stream,tag,&s,map->message)) + if ((reply = imap_send_literal (stream,tag,&s,map->message)) != NULL) return reply; /* get next message */ if ((*map->af) (stream,map->data,&map->flags,&map->date, @@ -3129,7 +3129,7 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *stream,char *cmd,IMAPARG *args[]) c = ' '; /* prefix character for subsequent strings */ } } - while (list = list->next); + while ((list = list->next) != NULL); *s++ = ')'; /* close list */ break; default: @@ -3363,26 +3363,26 @@ IMAPPARSEDREPLY *imap_send_spgm (MAILSTREAM *stream,char *tag,char *base, pgm->references,limit)))) return reply; /* all other headers */ - if (hdr = pgm->header) do { + if ((hdr = pgm->header) != NULL) do { *s = imap_send_spgm_trim (base,*s," HEADER "); - if (reply = imap_send_astring (stream,tag,s,&hdr->line,NIL,limit)) + if ((reply = imap_send_astring (stream,tag,s,&hdr->line,NIL,limit)) != NULL) return reply; *(*s)++ = ' '; - if (reply = imap_send_astring (stream,tag,s,&hdr->text,NIL,limit)) + if ((reply = imap_send_astring (stream,tag,s,&hdr->text,NIL,limit)) != NULL) return reply; - } while (hdr = hdr->next); + } while ((hdr = hdr->next) != NULL); for (pgo = pgm->or; pgo; pgo = pgo->next) { *s = imap_send_spgm_trim (base,*s," OR ("); - if (reply = imap_send_spgm (stream,tag,base,s,pgo->first,limit)) + if ((reply = imap_send_spgm (stream,tag,base,s,pgo->first,limit)) != NULL) return reply; for (t = ") ("; *t; *(*s)++ = *t++); - if (reply = imap_send_spgm (stream,tag,base,s,pgo->second,limit)) + if ((reply = imap_send_spgm (stream,tag,base,s,pgo->second,limit)) != NULL) return reply; *(*s)++ = ')'; } for (pgl = pgm->not; pgl; pgl = pgl->next) { *s = imap_send_spgm_trim (base,*s," NOT ("); - if (reply = imap_send_spgm (stream,tag,base,s,pgl->pgm,limit)) + if ((reply = imap_send_spgm (stream,tag,base,s,pgl->pgm,limit)) != NULL) return reply; *(*s)++ = ')'; } @@ -3460,9 +3460,9 @@ IMAPPARSEDREPLY *imap_send_sset (MAILSTREAM *stream,char *tag,char *base, for (t =" ((OR BCC FOO NOT BCC "; *t; *(*s)++ = *t++); /* but broken by a literal */ INIT (&st,mail_string,(void *) "FOO",3); - if (reply = imap_send_literal (stream,tag,s,&st)) return reply; + if ((reply = imap_send_literal (stream,tag,s,&st)) != NULL) return reply; *(*s)++ = ')'; /* close glue */ - if (reply = imap_send_sset (stream,tag,NIL,s,set,prefix,limit)) + if ((reply = imap_send_sset (stream,tag,NIL,s,set,prefix,limit)) != NULL) return reply; *(*s)++ = ')'; /* close second OR argument */ } @@ -3563,7 +3563,7 @@ IMAPPARSEDREPLY *imap_reply (MAILSTREAM *stream,char *tag) { IMAPPARSEDREPLY *reply; while (LOCAL->netstream) { /* parse reply from server */ - if (reply = imap_parse_reply (stream,net_getline (LOCAL->netstream))) { + if ((reply = imap_parse_reply (stream,net_getline (LOCAL->netstream))) != NULL) { /* continuation ready? */ if (!strcmp (reply->tag,"+")) return reply; /* untagged data? */ @@ -3814,7 +3814,7 @@ void imap_parse_unsolicited (MAILSTREAM *stream,IMAPPARSEDREPLY *reply) sprintf (LOCAL->tmp,"Unterminated header section: %.80s", (char *) t); /* point after the text */ - else if (t = strchr (s = t,' ')) *t++ = '\0'; + else if ((t = strchr (s = t,' ')) != NULL) *t++ = '\0'; } if (s && !LOCAL->tmp[0]) { *s++ = '\0'; /* tie off section specifier */ @@ -3918,11 +3918,11 @@ void imap_parse_unsolicited (MAILSTREAM *stream,IMAPPARSEDREPLY *reply) } else if (!stream->user_flags[i]) stream->user_flags[i++] = cpystr (s); } - while (s = strtok_r (NIL," )",&r)); + while ((s = strtok_r (NIL," )",&r)) != NULL); else if (!strcmp (reply->key,"SEARCH")) { /* only do something if have text */ if (reply->text && (t = strtok_r (reply->text," ",&r))) do - if (i = strtoul (t,NIL,10)) { + if ((i = strtoul (t,NIL,10)) != 0L) { /* UIDs always passed to main program */ if (LOCAL->uidsearch) mm_searched (stream,i); /* should be a msgno then */ @@ -3931,7 +3931,7 @@ void imap_parse_unsolicited (MAILSTREAM *stream,IMAPPARSEDREPLY *reply) mail_elt (stream,i)->searched = T; if (!stream->silent) mm_searched (stream,i); } - } while (t = strtok_r (NIL," ",&r)); + } while ((t = strtok_r (NIL," ",&r)) != NULL); } else if (!strcmp (reply->key,"SORT")) { sortresults_t sr = (sortresults_t) @@ -3955,7 +3955,7 @@ void imap_parse_unsolicited (MAILSTREAM *stream,IMAPPARSEDREPLY *reply) threadresults_t tr = (threadresults_t) mail_parameters (NIL,GET_THREADRESULTS,NIL); if (LOCAL->threaddata) mail_free_threadnode (&LOCAL->threaddata); - if (s = reply->text) { + if ((s = reply->text) != NULL) { LOCAL->threaddata = imap_parse_thread (stream,&s); if (tr) (*tr) (stream,LOCAL->threaddata); if (s && *s) { @@ -4019,7 +4019,7 @@ void imap_parse_unsolicited (MAILSTREAM *stream,IMAPPARSEDREPLY *reply) char delimiter = '\0'; *s++ = '\0'; /* tie off attribute list */ /* parse attribute list */ - if (t = strtok_r (reply->text+1," ",&r)) do { + if ((t = strtok_r (reply->text+1," ",&r)) != NULL) do { if (!compare_cstring (t,"\\NoInferiors")) i |= LATT_NOINFERIORS; else if (!compare_cstring (t,"\\NoSelect")) i |= LATT_NOSELECT; else if (!compare_cstring (t,"\\Marked")) i |= LATT_MARKED; @@ -4028,7 +4028,7 @@ void imap_parse_unsolicited (MAILSTREAM *stream,IMAPPARSEDREPLY *reply) else if (!compare_cstring (t,"\\HasNoChildren")) i |= LATT_HASNOCHILDREN; /* ignore extension flags */ } - while (t = strtok_r (NIL," ",&r)); + while ((t = strtok_r (NIL," ",&r)) != NULL); switch (*++s) { /* process delimiter */ case 'N': /* NIL */ case 'n': @@ -4039,7 +4039,7 @@ void imap_parse_unsolicited (MAILSTREAM *stream,IMAPPARSEDREPLY *reply) s += 3; /* skip over <delimiter><quote><space> */ } /* parse the mailbox name */ - if (t = imap_parse_astring (stream,&s,reply,&j)) { + if ((t = imap_parse_astring (stream,&s,reply,&j)) != NULL) { /* prepend prefix if requested */ if (LOCAL->prefix && ((strlen (LOCAL->prefix) + j) < IMAPTMPLEN)) sprintf (s = LOCAL->tmp,"%s%s",LOCAL->prefix,(char *) t); @@ -4057,7 +4057,7 @@ void imap_parse_unsolicited (MAILSTREAM *stream,IMAPPARSEDREPLY *reply) mail_free_namespace (&LOCAL->namespace[2]); } else LOCAL->namespace = (NAMESPACE **) fs_get (3 * sizeof (NAMESPACE *)); - if (s = reply->text) { /* parse namespace results */ + if ((s = reply->text) != NULL) { /* parse namespace results */ LOCAL->namespace[0] = imap_parse_namespace (stream,&s,reply); LOCAL->namespace[1] = imap_parse_namespace (stream,&s,reply); LOCAL->namespace[2] = imap_parse_namespace (stream,&s,reply); @@ -4177,10 +4177,10 @@ void imap_parse_unsolicited (MAILSTREAM *stream,IMAPPARSEDREPLY *reply) if ((qc->name = imap_parse_astring (stream,&s,reply,NIL)) && s && (*s++ == ' ') && (isdigit (*s) || (LOCAL->loser && (*s == '-')))) { if (isdigit (*s)) qc->usage = strtoul (s,(char **) &s,10); - else if (t = strchr (s,' ')) t = s; + else if ((t = strchr (s,' ')) != NULL) t = s; if ((*s++ == ' ') && (isdigit (*s) || (LOCAL->loser &&(*s == '-')))){ if (isdigit (*s)) qc->limit = strtoul (s,(char **) &s,10); - else if (t = strpbrk (s," )")) t = s; + else if ((t = strpbrk (s," )")) != NULL) t = s; /* another resource follows? */ if (*s == ' ') continue; /* end of resource list? */ @@ -4277,7 +4277,7 @@ void imap_parse_response (MAILSTREAM *stream,char *text,long errflg,long ntfy) if (text && (*text == '[') && (t = strchr (s = text + 1,']')) && ((i = t - s) < IMAPTMPLEN)) { LOCAL->tmp[i] = '\0'; /* make mungable copy of text code */ - if (s = strchr (strncpy (t = LOCAL->tmp,s,i),' ')) *s++ = '\0'; + if ((s = strchr (strncpy (t = LOCAL->tmp,s,i),' ')) != NULL) *s++ = '\0'; if (s) { /* have argument? */ ntfy = NIL; /* suppress mm_notify if normal SELECT data */ if (!compare_cstring (t,"CAPABILITY")) imap_parse_capabilities(stream,s); @@ -4287,7 +4287,7 @@ void imap_parse_response (MAILSTREAM *stream,char *text,long errflg,long ntfy) stream->perm_seen = stream->perm_deleted = stream->perm_answered = stream->perm_draft = stream->kwd_create = NIL; stream->perm_user_flags = NIL; - if (s = strtok_r (s+1," ",&r)) do { + if ((s = strtok_r (s+1," ",&r)) != NULL) do { if (*s == '\\') { /* system flags */ if (!compare_cstring (s,"\\Seen")) stream->perm_seen = T; else if (!compare_cstring (s,"\\Deleted")) @@ -4301,7 +4301,7 @@ void imap_parse_response (MAILSTREAM *stream,char *text,long errflg,long ntfy) } else stream->perm_user_flags |= imap_parse_user_flag (stream,s); } - while (s = strtok_r (NIL," ",&r)); + while ((s = strtok_r (NIL," ",&r)) != NULL); } else if (!compare_cstring (t,"UIDVALIDITY") && (j = strtoul (s,NIL,10))){ @@ -4311,7 +4311,7 @@ void imap_parse_response (MAILSTREAM *stream,char *text,long errflg,long ntfy) stream->uid_validity = j; /* purge any UIDs in cache */ for (j = 1; j <= stream->nmsgs; j++) - if (elt = (MESSAGECACHE *) (*mc) (stream,j,CH_ELT)) + if ((elt = (MESSAGECACHE *) (*mc) (stream,j,CH_ELT)) != NULL) elt->private.uid = 0; } } @@ -4864,7 +4864,7 @@ unsigned char *imap_parse_astring (MAILSTREAM *stream,unsigned char **txtptr, c && (c > ' ') && (c != '(') && (c != ')') && (c != '{') && (c != '%') && (c != '*') && (c != '"') && (c != '\\') && (c < 0x80); c = *++*txtptr); - if (i = *txtptr - s) { /* atom ends at atom_special */ + if ((i = *txtptr - s) != 0L) { /* atom ends at atom_special */ if (len) *len = i; /* return length of atom */ ret = strncpy ((char *) fs_get (i + 1),s,i); ret[i] = '\0'; /* tie off string */ @@ -4984,7 +4984,7 @@ unsigned char *imap_parse_string (MAILSTREAM *stream,unsigned char **txtptr, string = (char *) fs_get ((size_t) i + 1); *string = '\0'; /* init in case getbuffer fails */ /* get the literal */ - if (rp) for (k = 0; j = min ((long) MAILTMPLEN,(long) i); i -= j) { + if (rp) for (k = 0; (j = min ((long) MAILTMPLEN,(long) i)) != 0L; i -= j) { net_getbuffer (LOCAL->netstream,j,string + k); (*rp) (md,k += j); } @@ -4992,7 +4992,7 @@ unsigned char *imap_parse_string (MAILSTREAM *stream,unsigned char **txtptr, } fs_give ((void **) &reply->line); if (flags && string) /* need to filter newlines? */ - for (st = string; st = strpbrk (st,"\015\012\011"); *st++ = ' '); + for (st = string; (st = strpbrk (st,"\015\012\011")) != NULL; *st++ = ' '); /* get new reply text line */ if (!(reply->line = net_getline (LOCAL->netstream))) reply->line = cpystr (""); @@ -5142,7 +5142,7 @@ void imap_parse_body_structure (MAILSTREAM *stream,BODY *body, /* parse it */ imap_parse_body_structure (stream,&part->body,txtptr,reply); } while (**txtptr == '(');/* for each body part */ - if (body->subtype = imap_parse_string(stream,txtptr,reply,NIL,NIL,LONGT)) + if ((body->subtype = imap_parse_string(stream,txtptr,reply,NIL,NIL,LONGT)) != NULL) ucase (body->subtype); else { mm_notify (stream,"Missing multipart subtype",WARN); @@ -5182,7 +5182,7 @@ void imap_parse_body_structure (MAILSTREAM *stream,BODY *body, body->type = TYPEOTHER; /* assume unknown type */ body->encoding = ENCOTHER;/* and unknown encoding */ /* parse type */ - if (s = imap_parse_string (stream,txtptr,reply,NIL,NIL,LONGT)) { + if ((s = imap_parse_string (stream,txtptr,reply,NIL,NIL,LONGT)) != NULL) { ucase (s); /* application always gets uppercase form */ for (i = 0; /* look in existing table */ (i <= TYPEMAX) && body_types[i] && strcmp (s,body_types[i]); i++); @@ -5195,7 +5195,7 @@ void imap_parse_body_structure (MAILSTREAM *stream,BODY *body, } if (s) fs_give ((void **) &s); } - if (body->subtype = imap_parse_string(stream,txtptr,reply,NIL,NIL,LONGT)) + if ((body->subtype = imap_parse_string(stream,txtptr,reply,NIL,NIL,LONGT)) != NULL) ucase (body->subtype); /* parse subtype */ else { mm_notify (stream,"Missing body subtype",WARN); @@ -5206,7 +5206,7 @@ void imap_parse_body_structure (MAILSTREAM *stream,BODY *body, body->id = imap_parse_string (stream,txtptr,reply,NIL,NIL,LONGT); body->description = imap_parse_string (stream,txtptr,reply,NIL,NIL, LONGT); - if (s = imap_parse_string (stream,txtptr,reply,NIL,NIL,LONGT)) { + if ((s = imap_parse_string (stream,txtptr,reply,NIL,NIL,LONGT)) != NULL) { ucase (s); /* application always gets uppercase form */ for (i = 0; /* search for body encoding */ (i <= ENCMAX) && body_encodings[i] && strcmp(s,body_encodings[i]); @@ -5410,7 +5410,7 @@ STRINGLIST *imap_parse_language (MAILSTREAM *stream,unsigned char **txtptr, STRINGLIST *ret = NIL; /* language is a list */ if (*++*txtptr == '(') ret = imap_parse_stringlist (stream,txtptr,reply); - else if (s = imap_parse_string (stream,txtptr,reply,NIL,&i,LONGT)) { + else if ((s = imap_parse_string (stream,txtptr,reply,NIL,&i,LONGT)) != NULL) { (ret = mail_newstringlist ())->text.data = (unsigned char *) s; ret->text.size = i; } @@ -5479,7 +5479,7 @@ void imap_parse_extension (MAILSTREAM *stream,unsigned char **txtptr, break; case '{': /* get size of literal */ ++*txtptr; /* bump past open squiggle */ - if (i = strtoul (*txtptr,(char **) txtptr,10)) do + if ((i = strtoul (*txtptr,(char **) txtptr,10)) != 0L) do net_getbuffer (LOCAL->netstream,j = min (i,(long) IMAPTMPLEN - 1), LOCAL->tmp); while (i -= j); @@ -5515,7 +5515,7 @@ void imap_parse_capabilities (MAILSTREAM *stream,char *t) THREADER *thr,*th; if (!LOCAL->gotcapability) { /* need to save previous capabilities? */ /* no, flush threaders */ - if (thr = LOCAL->cap.threader) while (th = thr) { + if ((thr = LOCAL->cap.threader) != NULL) while ((th = thr) != NULL) { fs_give ((void **) &th->name); thr = th->next; fs_give ((void **) &th); @@ -5558,7 +5558,7 @@ void imap_parse_capabilities (MAILSTREAM *stream,char *t) ((t[2] == 'R') || (t[2] == 'r')) && ((t[3] == 'T') || (t[3] == 't'))) LOCAL->cap.sort = T; /* capability with value? */ - else if (s = strchr (t,'=')) { + else if ((s = strchr (t,'=')) != NULL) { *s++ = '\0'; /* separate token from value */ if (!compare_cstring (t,"THREAD") && !LOCAL->loser) { THREADER *thread = (THREADER *) fs_get (sizeof (THREADER)); @@ -5647,7 +5647,7 @@ char *imap_reform_sequence (MAILSTREAM *stream,char *sequence,long flags) /* flush old reformed sequence */ if (LOCAL->reform) fs_give ((void **) &LOCAL->reform); rs = LOCAL->reform = (char *) fs_get (1+ strlen (sequence)); - for (s = sequence; t = strpbrk (s,",:"); ) switch (*t++) { + for (s = sequence; (t = strpbrk (s,",:")) != NULL; ) switch (*t++) { case ',': /* single message */ strncpy (rs,s,i = t - s); /* copy string up to that point */ rs += i; /* advance destination pointer */ diff --git a/imap/src/c-client/mail.c b/imap/src/c-client/mail.c index da703a0d..1b6f93c3 100644 --- a/imap/src/c-client/mail.c +++ b/imap/src/c-client/mail.c @@ -210,7 +210,7 @@ void *mm_cache (MAILSTREAM *stream,unsigned long msgno,long op) break; case CH_EXPUNGE: /* expunge cache slot */ for (i = msgno - 1; msgno < stream->nmsgs; i++,msgno++) { - if (stream->cache[i] = stream->cache[msgno]) + if ((stream->cache[i] = stream->cache[msgno]) != NULL) stream->cache[i]->msgno = msgno; stream->sc[i] = stream->sc[msgno]; } @@ -388,32 +388,32 @@ void *mail_parameters (MAILSTREAM *stream,long function,void *value) case ENABLE_DRIVER: for (d = maildrivers; d && compare_cstring (d->name,(char *) value); d = d->next); - if (ret = (void *) d) d->flags &= ~DR_DISABLE; + if ((ret = (void *) d) != NULL) d->flags &= ~DR_DISABLE; break; case DISABLE_DRIVER: for (d = maildrivers; d && compare_cstring (d->name,(char *) value); d = d->next); - if (ret = (void *) d) d->flags |= DR_DISABLE; + if ((ret = (void *) d) != NULL) d->flags |= DR_DISABLE; break; case ENABLE_AUTHENTICATOR: for (a = mailauthenticators;/* scan authenticators */ a && compare_cstring (a->name,(char *) value); a = a->next); - if (ret = (void *) a) a->flags &= ~AU_DISABLE; + if ((ret = (void *) a) != NULL) a->flags &= ~AU_DISABLE; break; case DISABLE_AUTHENTICATOR: for (a = mailauthenticators;/* scan authenticators */ a && compare_cstring (a->name,(char *) value); a = a->next); - if (ret = (void *) a) a->flags |= AU_DISABLE; + if ((ret = (void *) a) != NULL) a->flags |= AU_DISABLE; break; case UNHIDE_AUTHENTICATOR: for (a = mailauthenticators;/* scan authenticators */ a && compare_cstring (a->name,(char *) value); a = a->next); - if (ret = (void *) a) a->flags &= ~AU_HIDE; + if ((ret = (void *) a) != NULL) a->flags &= ~AU_HIDE; break; case HIDE_AUTHENTICATOR: for (a = mailauthenticators;/* scan authenticators */ a && compare_cstring (a->name,(char *) value); a = a->next); - if (ret = (void *) a) a->flags |= AU_HIDE; + if ((ret = (void *) a) != NULL) a->flags |= AU_HIDE; break; case SET_EXTERNALAUTHID: if (value) { /* setting external authentication ID */ @@ -647,16 +647,16 @@ void *mail_parameters (MAILSTREAM *stream,long function,void *value) if (stream) ret = (void *) stream->snarf.name; break; default: - if (r = smtp_parameters (function,value)) ret = r; - if (r = env_parameters (function,value)) ret = r; - if (r = tcp_parameters (function,value)) ret = r; - if (r = utf8_parameters (function,value)) ret = r; + if ((r = smtp_parameters (function,value)) != NULL) ret = r; + if ((r = env_parameters (function,value)) != NULL) ret = r; + if ((r = tcp_parameters (function,value)) != NULL) ret = r; + if ((r = utf8_parameters (function,value)) != NULL) ret = r; if (stream && stream->dtb) {/* if have stream, do for its driver only */ - if (r = (*stream->dtb->parameters) (function,value)) ret = r; + if ((r = (*stream->dtb->parameters) (function,value)) != NULL) ret = r; } /* else do all drivers */ else for (d = maildrivers; d; d = d->next) - if (r = (d->parameters) (function,value)) ret = r; + if ((r = (d->parameters) (function,value)) != NULL) ret = r; break; } return ret; @@ -770,7 +770,7 @@ long mail_valid_net_parse_work (char *name,NETMBX *mb,char *service) break; case '/': /* switch */ /* find delimiter */ - if (t = strpbrk (s = t,"/:=")) { + if ((t = strpbrk (s = t,"/:=")) != NULL) { c = *t; /* remember delimiter for later */ *t++ = '\0'; /* tie off switch name */ } @@ -788,7 +788,7 @@ long mail_valid_net_parse_work (char *name,NETMBX *mb,char *service) arg[i] = '\0'; /* tie off argument */ } else { /* non-quoted argument */ - if (t = strpbrk (v = t,"/:")) { + if ((t = strpbrk (v = t,"/:")) != NULL) { c = *t; /* remember delimiter for later */ *t++ = '\0'; /* tie off switch name */ } @@ -937,7 +937,7 @@ void mail_list (MAILSTREAM *stream,char *ref,char *pat) else do if (!((d->flags & DR_DISABLE) || ((d->flags & DR_LOCAL) && remote))) (d->list) (NIL,ref,pat); - while (d = d->next); /* until at the end */ + while ((d = d->next) != NULL); /* until at the end */ } /* Mail list subscribed mailboxes @@ -970,7 +970,7 @@ void mail_lsub (MAILSTREAM *stream,char *ref,char *pat) else do if (!((d->flags & DR_DISABLE) || ((d->flags & DR_LOCAL) && remote))) (d->lsub) (NIL,ref,pat); - while (d = d->next); /* until at the end */ + while ((d = d->next) != NULL); /* until at the end */ } /* Mail subscribe to mailbox @@ -1014,7 +1014,7 @@ long mail_create (MAILSTREAM *stream,char *mailbox) size_t i; DRIVER *d; /* never allow names with newlines */ - if (s = strpbrk (mailbox,"\015\012")) { + if ((s = strpbrk (mailbox,"\015\012")) != NULL) { MM_LOG ("Can't create mailbox with such a name",ERROR); return NIL; } @@ -1030,7 +1030,7 @@ long mail_create (MAILSTREAM *stream,char *mailbox) return NIL; } /* validate name */ - if (s = mail_utf7_valid (mailbox)) { + if ((s = mail_utf7_valid (mailbox)) != NULL) { sprintf (tmp,"Can't create %s: %.80s",s,mailbox); MM_LOG (tmp,ERROR); return NIL; @@ -1110,7 +1110,7 @@ long mail_rename (MAILSTREAM *stream,char *old,char *newname) DRIVER *dtb = mail_valid (stream,old,"rename mailbox"); if (!dtb) return NIL; /* validate name */ - if (s = mail_utf7_valid (newname)) { + if ((s = mail_utf7_valid (newname)) != NULL) { sprintf (tmp,"Can't rename to %s: %.80s",s,newname); MM_LOG (tmp,ERROR); return NIL; @@ -1217,7 +1217,7 @@ MAILSTREAM *mail_open (MAILSTREAM *stream,char *name,long options) ((name[3] == 'V') || (name[3] == 'v')) && ((name[4] == 'E') || (name[4] == 'e')) && (c = name[5]) && (s = strchr (name+6,c)) && (i = s - (name + 6)) && (i < MAILTMPLEN)) { - if (stream = mail_open (stream,s+1,options)) { + if ((stream = mail_open (stream,s+1,options)) != NULL) { strncpy (tmp,name+6,i); /* copy snarf mailbox name */ tmp[i] = '\0'; /* tie off name */ mail_parameters (stream,SET_SNARFMAILBOXNAME,(void *) tmp); @@ -1234,7 +1234,7 @@ MAILSTREAM *mail_open (MAILSTREAM *stream,char *name,long options) ((name[3] == 'P') || (name[3] == 'p')) && mail_valid_net_parse_work (name+4,&mb,"pop3") && !strcmp (mb.service,"pop3") && !mb.anoflag && !mb.readonlyflag) { - if (stream = mail_open (stream,mb.mailbox,options)) { + if ((stream = mail_open (stream,mb.mailbox,options)) != NULL) { sprintf (tmp,"{%.255s",mb.host); if (mb.port) sprintf (tmp + strlen (tmp),":%lu",mb.port); if (mb.user[0]) sprintf (tmp + strlen (tmp),"/user=%.64s",mb.user); @@ -1265,7 +1265,7 @@ MAILSTREAM *mail_open (MAILSTREAM *stream,char *name,long options) ((name[6] == 'R') || (name[6] == 'r')) && (name[7] == '.')) { sprintf (tmp,"%.80s",name+8); /* tie off name at likely delimiter */ - if (s = strpbrk (tmp,"/\\:")) *s++ = '\0'; + if ((s = strpbrk (tmp,"/\\:")) != NULL) *s++ = '\0'; else { sprintf (tmp,"Can't resolve mailbox %.80s: bad driver syntax",name); MM_LOG (tmp,ERROR); @@ -1565,7 +1565,7 @@ ENVELOPE *mail_fetch_structure (MAILSTREAM *stream,unsigned long msgno, if (stream->dtb && stream->dtb->structure) return (*stream->dtb->structure) (stream,msgno,body,flags); if (flags & FT_UID) { /* UID form of call */ - if (msgno = mail_msgno (stream,msgno)) flags &= ~FT_UID; + if ((msgno = mail_msgno (stream,msgno)) != 0L) flags &= ~FT_UID; else return NIL; /* must get UID/msgno map first */ } elt = mail_elt (stream,msgno);/* get elt for real message number */ @@ -1747,7 +1747,7 @@ char *mail_fetch_header (MAILSTREAM *stream,unsigned long msgno,char *section, if (len) *len = 0; /* default return size */ if (section && (strlen (section) > (MAILTMPLEN - 20))) return ""; if (flags & FT_UID) { /* UID form of call */ - if (msgno = mail_msgno (stream,msgno)) flags &= ~FT_UID; + if ((msgno = mail_msgno (stream,msgno)) != 0L) flags &= ~FT_UID; else return ""; /* must get UID/msgno map first */ } elt = mail_elt (stream,msgno);/* get cache data */ @@ -1800,8 +1800,8 @@ char *mail_fetch_header (MAILSTREAM *stream,unsigned long msgno,char *section, else { /* top-level header fetch */ /* mark message seen */ markseen (stream,elt,flags); - if (rt.data = (unsigned char *) - (*stream->dtb->header) (stream,msgno,&rt.size,flags)) { + if ((rt.data = (unsigned char *) + (*stream->dtb->header) (stream,msgno,&rt.size,flags)) != NULL) { /* make a safe copy if need to filter */ if (lines) textcpy (t = &stream->text,&rt); else t = &rt; /* top level header */ @@ -1838,7 +1838,7 @@ char *mail_fetch_text (MAILSTREAM *stream,unsigned long msgno,char *section, memset (&stream->private.string,NIL,sizeof (STRING)); if (section && (strlen (section) > (MAILTMPLEN - 20))) return ""; if (flags & FT_UID) { /* UID form of call */ - if (msgno = mail_msgno (stream,msgno)) flags &= ~FT_UID; + if ((msgno = mail_msgno (stream,msgno)) != 0L) flags &= ~FT_UID; else return ""; /* must get UID/msgno map first */ } elt = mail_elt (stream,msgno);/* get cache data */ @@ -1893,7 +1893,7 @@ char *mail_fetch_mime (MAILSTREAM *stream,unsigned long msgno,char *section, if (len) *len = 0; /* default return size */ if (section && (strlen (section) > (MAILTMPLEN - 20))) return ""; if (flags & FT_UID) { /* UID form of call */ - if (msgno = mail_msgno (stream,msgno)) flags &= ~FT_UID; + if ((msgno = mail_msgno (stream,msgno)) != 0L) flags &= ~FT_UID; else return ""; /* must get UID/msgno map first */ } flags &= ~FT_INTERNAL; /* can't win with this set */ @@ -1976,7 +1976,7 @@ char *mail_fetch_body (MAILSTREAM *stream,unsigned long msgno,char *section, } if (len) *len = 0; /* default return size */ if (flags & FT_UID) { /* UID form of call */ - if (msgno = mail_msgno (stream,msgno)) flags &= ~FT_UID; + if ((msgno = mail_msgno (stream,msgno)) != 0L) flags &= ~FT_UID; else return ""; /* must get UID/msgno map first */ } /* must have body */ @@ -2034,7 +2034,7 @@ long mail_partial_text (MAILSTREAM *stream,unsigned long msgno,char *section, if (!mailgets) fatal ("mail_partial_text() called without a mailgets!"); if (section && (strlen (section) > (MAILTMPLEN - 20))) return NIL; if (flags & FT_UID) { /* UID form of call */ - if (msgno = mail_msgno (stream,msgno)) flags &= ~FT_UID; + if ((msgno = mail_msgno (stream,msgno)) != 0L) flags &= ~FT_UID; else return NIL; /* must get UID/msgno map first */ } elt = mail_elt (stream,msgno);/* get cache data */ @@ -2104,7 +2104,7 @@ long mail_partial_body (MAILSTREAM *stream,unsigned long msgno,char *section, return mail_partial_text (stream,msgno,NIL,first,last,flags); if (!mailgets) fatal ("mail_partial_body() called without a mailgets!"); if (flags & FT_UID) { /* UID form of call */ - if (msgno = mail_msgno (stream,msgno)) flags &= ~FT_UID; + if ((msgno = mail_msgno (stream,msgno)) != 0L) flags &= ~FT_UID; else return NIL; /* must get UID/msgno map first */ } /* must have body */ @@ -2254,7 +2254,7 @@ unsigned long mail_msgno (MAILSTREAM *stream,unsigned long uid) if (uid == firstuid) return first; if (uid == lastuid) return last; /* have anything between endpoints? */ - if (delta = ((last - first) / 2)) { + if ((delta = ((last - first) / 2)) != 0L){ if ((miduid = mail_elt (stream,middle = first + delta)->private.uid) == uid) return middle; /* found match in middle */ @@ -2408,7 +2408,7 @@ long mail_search_default (MAILSTREAM *stream,char *charset,SEARCHPGM *pgm, unsigned long i; char *msg; /* make sure that charset is good */ - if (msg = utf8_badcharset (charset)) { + if ((msg = utf8_badcharset (charset)) != NULL) { MM_LOG (msg,ERROR); /* output error */ fs_give ((void **) &msg); return NIL; @@ -2634,7 +2634,7 @@ long mail_append_multiple (MAILSTREAM *stream,char *mailbox,append_t af, } else ret = SAFE_APPEND (d,stream,mailbox + (s - tmp),af,data); } - else if (d = mail_valid (stream,mailbox,NIL)) + else if ((d = mail_valid (stream,mailbox,NIL)) != NULL) ret = SAFE_APPEND (d,stream,mailbox,af,data); /* No driver, try for TRYCREATE if no stream. Note that we use the * createProto here, not the appendProto, since the dummy driver already @@ -2672,7 +2672,7 @@ void mail_gc (MAILSTREAM *stream,long gcflags) } /* garbage collect per-message stuff */ for (i = 1; i <= stream->nmsgs; i++) - if (elt = (MESSAGECACHE *) (*mailcache) (stream,i,CH_ELT)) + if ((elt = (MESSAGECACHE *) (*mailcache) (stream,i,CH_ELT)) != NULL) mail_gc_msg (&elt->private.msg,gcflags); } @@ -2744,7 +2744,7 @@ BODY *mail_body_section (BODY *b, unsigned char *section) /* multipart content? */ if (b->type == TYPEMULTIPART) { /* yes, find desired part */ - if (pt = b->nested.part) while (--i && (pt = pt->next)); + if ((pt = b->nested.part) != NULL) while (--i && (pt = pt->next)); if (!pt) return NIL; /* bad specifier */ b = &pt->body; /* note new body */ } @@ -3122,7 +3122,7 @@ long mail_parse_date (MESSAGECACHE *elt,unsigned char *s) t = localtime (&tn); /* get local minutes since midnight */ mi = t->tm_hour * 60 + t->tm_min; ms = t->tm_yday; /* note Julian day */ - if (t = gmtime (&tn)) { /* minus UTC minutes since midnight */ + if ((t = gmtime (&tn)) != NULL) { /* minus UTC minutes since midnight */ mi -= t->tm_hour * 60 + t->tm_min; /* ms can be one of: * 36x local time is December 31, UTC is January 1, offset -24 hours @@ -3343,7 +3343,7 @@ long mail_uid_sequence (MAILSTREAM *stream,unsigned char *sequence) case ',': /* single message */ ++sequence; /* skip the delimiter, fall into end case */ case '\0': /* end of sequence, mark this message */ - if (x = mail_msgno (stream,i)) mail_elt (stream,x)->sequence = T; + if ((x = mail_msgno (stream,i)) != 0L) mail_elt (stream,x)->sequence = T; break; default: /* anything else is a syntax error! */ MM_LOG ("UID sequence syntax error",ERROR); @@ -3376,7 +3376,7 @@ long mail_match_lines (STRINGLIST *lines,STRINGLIST *msglines,long flags) } if (!m) return NIL; /* didn't find in the list */ } - while (lines = lines->next); + while ((lines = lines->next) != NULL); return T; /* all lines found */ } @@ -3408,7 +3408,7 @@ unsigned long mail_filter (char *text,unsigned long len,STRINGLIST *lines, *t++ = *s++); *t = '\0'; /* tie off */ notfound = T; /* not found yet */ - if (i = t - tmp) /* see if found in header */ + if ((i = t - tmp) != 0L) /* see if found in header */ for (hdrs = lines; hdrs && notfound; hdrs = hdrs->next) if ((hdrs->text.size == i) && !compare_csizedtext (tmp,&hdrs->text)) notfound = NIL; @@ -3660,7 +3660,7 @@ long mail_search_header_text (char *s,STRINGLIST *st) { SIZEDTEXT h; /* have any text? */ - if (h.data = (unsigned char *) s) { + if ((h.data = (unsigned char *) s) != NULL) { h.size = strlen (s); /* yes, get its size */ return mail_search_header (&h,st); } @@ -3711,7 +3711,7 @@ long mail_search_text (MAILSTREAM *stream,unsigned long msgno,char *section, for (stream->private.search.string = s; st;) { s->text.data = st->text.data; s->text.size = st->text.size; - if (st = st->next) s = s->next = mail_newstringlist (); + if ((st = st->next) != NULL) s = s->next = mail_newstringlist (); } stream->private.search.text = NIL; if (flags) { /* want header? */ @@ -3793,7 +3793,7 @@ long mail_search_body (MAILSTREAM *stream,unsigned long msgno,BODY *body, if (h.data != st.data) fs_give ((void **) &h.data); } } - if (body = body->nested.msg->body) + if ((body = body->nested.msg->body) != NULL) ret = (body->type == TYPEMULTIPART) ? mail_search_body (stream,msgno,body,(prefix ? prefix : ""), section - 1,flags) : @@ -3810,14 +3810,14 @@ long mail_search_body (MAILSTREAM *stream,unsigned long msgno,BODY *body, if (!strcmp (param->attribute,"CHARSET")) t = param->value; switch (body->encoding) { /* what encoding? */ case ENCBASE64: - if (st.data = (unsigned char *) - rfc822_base64 ((unsigned char *) s,i,&st.size)) { + if ((st.data = (unsigned char *) + rfc822_base64 ((unsigned char *) s,i,&st.size)) != NULL) { ret = mail_search_string (&st,t,&stream->private.search.string); fs_give ((void **) &st.data); } break; case ENCQUOTEDPRINTABLE: - if (st.data = rfc822_qprint ((unsigned char *) s,i,&st.size)) { + if ((st.data = rfc822_qprint ((unsigned char *) s,i,&st.size)) != NULL) { ret = mail_search_string (&st,t,&stream->private.search.string); fs_give ((void **) &st.data); } @@ -3898,7 +3898,7 @@ long mail_search_keyword (MAILSTREAM *stream,MESSAGECACHE *elt,STRINGLIST *st, break; } if (flag && !j) return NIL; - } while (st = st->next); + } while ((st = st->next) != NULL); tf = elt->user_flags & f; /* get set flags which match */ return flag ? (f == tf) : !tf; } @@ -3927,9 +3927,9 @@ long mail_search_addr (ADDRESS *adr,STRINGLIST *st) /* write address list */ for (txt.size = 0,a = adr; a; a = a->next) { k = (tadr.mailbox = a->mailbox) ? 4 + 2*strlen (a->mailbox) : 3; - if (tadr.personal = a->personal) k += 3 + 2*strlen (a->personal); - if (tadr.adl = a->adl) k += 3 + 2*strlen (a->adl); - if (tadr.host = a->host) k += 3 + 2*strlen (a->host); + if ((tadr.personal = a->personal) != NULL) k += 3 + 2*strlen (a->personal); + if ((tadr.adl = a->adl) != NULL) k += 3 + 2*strlen (a->adl); + if ((tadr.host = a->host) != NULL) k += 3 + 2*strlen (a->host); if (tadr.personal || tadr.adl) k += 2; if (k < (SENDBUFLEN-10)) {/* ignore ridiculous addresses */ tmp[0] = '\0'; @@ -4164,7 +4164,7 @@ int mail_criteria_string (STRINGLIST **s,char **r) if (strchr (c+1,'"')) end = "\""; else return NIL; /* falls through */ default: /* atomic string */ - if (d = strtok_r (c,end,r)) n = strlen (d); + if ((d = strtok_r (c,end,r)) != NULL) n = strlen (d); else return NIL; break; } @@ -4375,7 +4375,7 @@ SORTCACHE **mail_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm) else if ((t = mail_fetch_header (stream,i,NIL,&maildateline,NIL, FT_INTERNAL | FT_PEEK)) && (t = strchr (t,':'))) - for (x = ++t; x = strpbrk (x,"\012\015"); x++) + for (x = ++t; (x = strpbrk (x,"\012\015")) != NULL; x++) switch (*(v = ((*x == '\015') && (x[1] == '\012')) ? x+2 : x+1)){ case ' ': /* erase continuation newlines */ case '\t': @@ -4411,7 +4411,7 @@ SORTCACHE **mail_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm) else if ((t = mail_fetch_header (stream,i,NIL,&mailfromline,NIL, FT_INTERNAL | FT_PEEK)) && (t = strchr (t,':'))) { - for (x = ++t; x = strpbrk (x,"\012\015"); x++) + for (x = ++t; (x = strpbrk (x,"\012\015")) != NULL; x++) switch (*(v = ((*x == '\015') && (x[1] == '\012')) ? x+2 : x+1)){ case ' ': /* erase continuation newlines */ case '\t': @@ -4419,7 +4419,7 @@ SORTCACHE **mail_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm) break; case 'f': /* continuation but with extra "From:" */ case 'F': - if (v = strchr (v,':')) { + if ((v = strchr (v,':')) != NULL) { memmove (x,v+1,strlen (v+1)); break; } @@ -4445,7 +4445,7 @@ SORTCACHE **mail_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm) else if ((t = mail_fetch_header (stream,i,NIL,&mailtonline,NIL, FT_INTERNAL | FT_PEEK)) && (t = strchr (t,':'))) { - for (x = ++t; x = strpbrk (x,"\012\015"); x++) + for (x = ++t; (x = strpbrk (x,"\012\015")) != NULL; x++) switch (*(v = ((*x == '\015') && (x[1] == '\012')) ? x+2 : x+1)){ case ' ': /* erase continuation newlines */ case '\t': @@ -4453,7 +4453,7 @@ SORTCACHE **mail_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm) break; case 't': /* continuation but with extra "To:" */ case 'T': - if (v = strchr (v,':')) { + if ((v = strchr (v,':')) != NULL) { memmove (x,v+1,strlen (v+1)); break; } @@ -4479,7 +4479,7 @@ SORTCACHE **mail_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm) else if ((t = mail_fetch_header (stream,i,NIL,&mailccline,NIL, FT_INTERNAL | FT_PEEK)) && (t = strchr (t,':'))) { - for (x = ++t; x = strpbrk (x,"\012\015"); x++) + for (x = ++t; (x = strpbrk (x,"\012\015")) != NULL; x++) switch (*(v = ((*x == '\015') && (x[1] == '\012')) ? x+2 : x+1)){ case ' ': /* erase continuation newlines */ case '\t': @@ -4487,7 +4487,7 @@ SORTCACHE **mail_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm) break; case 'c': /* continuation but with extra "cc:" */ case 'C': - if (v = strchr (v,':')) { + if ((v = strchr (v,':')) != NULL) { memmove (x,v+1,strlen (v+1)); break; } @@ -4514,7 +4514,7 @@ SORTCACHE **mail_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm) else if ((t = mail_fetch_header (stream,i,NIL,&mailsubline, NIL,FT_INTERNAL | FT_PEEK)) && (t = strchr (t,':'))) - for (x = ++t; x = strpbrk (x,"\012\015"); x++) + for (x = ++t; (x = strpbrk (x,"\012\015")) != NULL; x++) switch (*(v = ((*x == '\015') && (x[1] == '\012')) ? x+2 : x+1)){ case ' ': /* erase continuation newlines */ case '\t': @@ -4548,7 +4548,7 @@ unsigned int mail_strip_subject (char *t,char **ret) unsigned long i,slen; char c,*s,*x; unsigned int refwd = NIL; - if (src.size = strlen (t)) { /* have non-empty subject? */ + if ((src.size = strlen (t)) != 0) { /* have non-empty subject? */ src.data = (unsigned char *) t; /* Step 1 */ /* make copy, convert MIME2 if needed */ @@ -4704,7 +4704,7 @@ int mail_sort_compare (const void *a1,const void *a2) } if (pgm->reverse) i = -i; /* flip results if necessary */ } - while (pgm = i ? NIL : pgm->next); + while ((pgm = i ? NIL : pgm->next) != NULL); /* return result, avoid 0 if at all possible */ return i ? i : compare_ulong (s1->num,s2->num); } @@ -4831,7 +4831,7 @@ THREADNODE *mail_thread_orderedsubject (MAILSTREAM *stream,char *charset, pgm.function = SORTSUBJECT; pgm.next = &pgm2; pgm2.function = SORTDATE; - if (lst = (*sorter) (stream,charset,spg,&pgm,flags & ~(SE_FREE | SE_UID))){ + if ((lst = (*sorter) (stream,charset,spg,&pgm,flags & ~(SE_FREE | SE_UID))) != NULL){ if (*(ls = lst)) { /* create thread */ /* note first subject */ cur = top = thr = mail_newthreadnode @@ -4945,7 +4945,7 @@ THREADNODE *mail_thread_references (MAILSTREAM *stream,char *charset, /* still missing data? */ if (!s->date || !s->subject || !s->message_id || !s->references) { /* try to load data from envelope */ - if (env = mail_fetch_structure (stream,s->num,NIL,NIL)) { + if ((env = mail_fetch_structure (stream,s->num,NIL,NIL)) != NULL) { if (!s->date && env->date && mail_parse_date (&telt,env->date)) s->date = mail_longdate (&telt); if (!s->subject && env->subject) @@ -4993,7 +4993,7 @@ THREADNODE *mail_thread_references (MAILSTREAM *stream,char *charset, /* Step 1A */ if ((st = (s = sc[i])->references) && st->text.data) for (con = hash_lookup_and_add (ht,(char *) st->text.data,NIL, - THREADLINKS); st = st->next; con = nxc) { + THREADLINKS); (st = st->next) != NULL; con = nxc) { nxc = hash_lookup_and_add (ht,(char *) st->text.data,NIL,THREADLINKS); /* only if no parent & won't introduce loop */ if (!PARENT (nxc) && !mail_thread_check_child (con,nxc)) { @@ -5231,11 +5231,11 @@ STRINGLIST *mail_thread_parse_references (char *s,long flag) STRINGLIST *ret = NIL; STRINGLIST *cur; /* found first reference? */ - if (t = mail_thread_parse_msgid (s,&s)) { + if ((t = mail_thread_parse_msgid (s,&s)) != NULL) { (ret = mail_newstringlist ())->text.data = (unsigned char *) t; ret->text.size = strlen (t); if (flag) /* parse subsequent references */ - for (cur = ret; t = mail_thread_parse_msgid (s,&s); cur = cur->next) { + for (cur = ret; (t = mail_thread_parse_msgid (s,&s)) != NULL; cur = cur->next) { (cur->next = mail_newstringlist ())->text.data = (unsigned char *) t; cur->next->text.size = strlen (t); } @@ -5337,7 +5337,7 @@ THREADNODE *mail_thread_c2node (MAILSTREAM *stream,container_t con,long flags) /* attach sequence or UID for non-dummy */ if (s) cur->num = (flags & SE_UID) ? mail_uid (stream,s->num) : s->num; /* attach the children */ - if (nxt = CHILD (con)) cur->next = mail_thread_c2node (stream,nxt,flags); + if ((nxt = CHILD (con)) != NULL) cur->next = mail_thread_c2node (stream,nxt,flags); } return ret; } @@ -5488,7 +5488,7 @@ long mail_parse_flags (MAILSTREAM *stream,char *flag,unsigned long *uf) tmp[j] = '\0'; while ((t = n) && *t) { /* parse the flags */ /* find end of flag */ - if (n = strchr (t,' ')) *n++ = '\0'; + if ((n = strchr (t,' ')) != NULL) *n++ = '\0'; if (*t == '\\') { /* system flag? */ if (!compare_cstring (t+1,"SEEN")) f |= fSEEN; else if (!compare_cstring (t+1,"DELETED")) f |= fDELETED; @@ -6256,7 +6256,7 @@ NETSTREAM *net_open_work (NETDRIVER *dv,char *host,char *service, service = NIL; /* yes, override service name */ port = portoverride; /* use that instead of default port */ } - if (tstream = (*dv->open) (host,service,port | flags)) { + if ((tstream = (*dv->open) (host,service,port | flags)) != NULL){ stream = (NETSTREAM *) fs_get (sizeof (NETSTREAM)); stream->stream = tstream; stream->dtb = dv; @@ -6278,7 +6278,7 @@ NETSTREAM *net_aopen (NETDRIVER *dv,NETMBX *mb,char *service,char *user) NETSTREAM *stream = NIL; void *tstream; if (!dv) dv = &tcpdriver; /* default to TCP driver */ - if (tstream = (*dv->aopen) (mb,service,user)) { + if ((tstream = (*dv->aopen) (mb,service,user)) != NULL) { stream = (NETSTREAM *) fs_get (sizeof (NETSTREAM)); stream->stream = tstream; stream->dtb = dv; diff --git a/imap/src/c-client/misc.c b/imap/src/c-client/misc.c index bcbc49e2..0f26a9c3 100644 --- a/imap/src/c-client/misc.c +++ b/imap/src/c-client/misc.c @@ -269,7 +269,7 @@ long ssearch (unsigned char *base,long basec,unsigned char *pat,long patc) for (i = 0; i < patc; i++) mask[pat[i]] = T; /* Boyer-Moore type search */ for (i = --patc, c = pat[i]; i < basec; i += (mask[c] ? 1 : (j + 1))) - for (j = patc,c = base[k = i]; (c == pat[j]); j--,c = base[--k]) + for (j = patc,c = base[k = i]; c == pat[j]; j--,c = base[--k]) if (!j) return T; /* found a match! */ } return NIL; /* pattern not found */ @@ -311,7 +311,7 @@ void hash_reset (HASHTAB *hashtab) size_t i; HASHENT *ent,*nxt; /* free each hash entry */ - for (i = 0; i < hashtab->size; i++) if (ent = hashtab->table[i]) + for (i = 0; i < hashtab->size; i++) if ((ent = hashtab->table[i]) != NULL) for (hashtab->table[i] = NIL; ent; ent = nxt) { nxt = ent->next; /* get successor */ fs_give ((void **) &ent); /* flush this entry */ @@ -328,7 +328,7 @@ unsigned long hash_index (HASHTAB *hashtab,char *key) { unsigned long i,ret; /* polynomial of letters of the word */ - for (ret = 0; i = (unsigned int) *key++; ret += i) ret *= HASHMULT; + for (ret = 0; (i = (unsigned int) *key++) != 0L; ret += i) ret *= HASHMULT; return ret % (unsigned long) hashtab->size; } @@ -447,7 +447,7 @@ int compare_string (unsigned char *s1,unsigned char *s2) int i; if (!s1) return s2 ? -1 : 0; /* empty string cases */ else if (!s2) return 1; - for (; *s1 && *s2; s1++,s2++) if (i = (compare_ulong (*s1,*s2))) return i; + for (; *s1 && *s2; s1++,s2++) if ((i = (compare_ulong (*s1,*s2))) != 0) return i; if (*s1) return 1; /* first string is longer */ return *s2 ? -1 : 0; /* second string longer : strings identical */ } @@ -466,7 +466,7 @@ int compare_cstring (unsigned char *s1,unsigned char *s2) int i; if (!s1) return s2 ? -1 : 0; /* empty string cases */ else if (!s2) return 1; - for (; *s1 && *s2; s1++,s2++) if (i = (compare_uchar (*s1,*s2))) return i; + for (; *s1 && *s2; s1++,s2++) if ((i = (compare_uchar (*s1,*s2))) != 0) return i; if (*s1) return 1; /* first string is longer */ return *s2 ? -1 : 0; /* second string longer : strings identical */ } @@ -486,7 +486,7 @@ int compare_csizedtext (unsigned char *s1,SIZEDTEXT *s2) if (!s1) return s2 ? -1 : 0; /* null string cases */ else if (!s2) return 1; for (s = (char *) s2->data,j = s2->size; *s1 && j; ++s1,++s,--j) - if (i = (compare_uchar (*s1,*s))) return i; + if ((i = (compare_uchar (*s1,*s))) != 0) return i; if (*s1) return 1; /* first string is longer */ return j ? -1 : 0; /* second string longer : strings identical */ } diff --git a/imap/src/c-client/netmsg.c b/imap/src/c-client/netmsg.c index 187e4ebb..4454c3be 100644 --- a/imap/src/c-client/netmsg.c +++ b/imap/src/c-client/netmsg.c @@ -61,7 +61,7 @@ FILE *netmsg_slurp (NETSTREAM *stream,unsigned long *size,unsigned long *hsiz) FILE *f = tmpfile (); if (!f) { sprintf (tmp,".%lx.%lx",(unsigned long) time (0),(unsigned long)getpid ()); - if (f = fopen (tmp,"wb+")) unlink (tmp); + if ((f = fopen (tmp,"wb+")) != NULL) unlink (tmp); else { sprintf (tmp,"Unable to create scratch file: %.80s",strerror (errno)); MM_LOG (tmp,ERROR); @@ -70,7 +70,7 @@ FILE *netmsg_slurp (NETSTREAM *stream,unsigned long *size,unsigned long *hsiz) } *size = 0; /* initially emtpy */ if (hsiz) *hsiz = 0; - while (s = net_getline (stream)) { + while ((s = net_getline (stream)) != NULL) { if (*s == '.') { /* possible end of text? */ if (s[1]) t = s + 1; /* pointer to true start of line */ else { diff --git a/imap/src/c-client/newsrc.c b/imap/src/c-client/newsrc.c index 41f1fd24..ce694c61 100644 --- a/imap/src/c-client/newsrc.c +++ b/imap/src/c-client/newsrc.c @@ -123,9 +123,10 @@ long newsrc_newmessages (FILE *f,MAILSTREAM *stream,char *nl) } else if (j) { /* unread message, ending a range */ /* calculate end of range */ - if (k = elt->private.uid - 1) { + if ((k = elt->private.uid - 1) != 0L) { /* dump range */ - sprintf (tmp,(j == k) ? "%c%ld" : "%c%ld-%ld",c,j,k); + if(j == k) sprintf (tmp, "%c%ld",c,j); + else sprintf (tmp, "%c%ld-%ld",c,j,k); if (fputs (tmp,f) == EOF) return NIL; c = ','; /* need a comma after the first time */ } @@ -133,7 +134,8 @@ long newsrc_newmessages (FILE *f,MAILSTREAM *stream,char *nl) } } if (j) { /* dump trailing range */ - sprintf (tmp,(j == k) ? "%c%ld" : "%c%ld-%ld",c,j,k); + if(j == k) sprintf (tmp, "%c%ld",c,j); + else sprintf (tmp,"%c%ld-%ld",c,j,k); if (fputs (tmp,f) == EOF) return NIL; } } @@ -340,7 +342,7 @@ long newsrc_write (char *group,MAILSTREAM *stream) char *s,tmp[MAILTMPLEN],backup[MAILTMPLEN],nl[3]; FILE *f,*bf; nl[0] = nl[1] = nl[2] = '\0'; /* no newline known yet */ - if (f = fopen (newsrc,"rb")) {/* have existing newsrc file? */ + if ((f = fopen (newsrc,"rb")) != NULL) {/* have existing newsrc file? */ if (!(bf = fopen ((strcat (strcpy (backup,newsrc),OLDFILESUFFIX)),"wb"))) { fclose (f); /* punt input file */ return newsrc_error("Can't create backup news state %.80s",backup,ERROR); @@ -365,7 +367,7 @@ long newsrc_write (char *group,MAILSTREAM *stream) return newsrc_error ("Error closing backup news state %.80s", newsrc,ERROR); if (d == EOF) { /* open for write if empty file */ - if (f = newsrc_create (stream,NIL)) bf = NIL; + if ((f = newsrc_create (stream,NIL)) != NULL) bf = NIL; else return NIL; } else if (!nl[0]) /* make sure newlines valid */ @@ -381,7 +383,7 @@ long newsrc_write (char *group,MAILSTREAM *stream) } } else { /* create new newsrc file */ - if (f = newsrc_create (stream,T)) bf = NIL; + if ((f = newsrc_create (stream,T)) != NULL) bf = NIL; else return NIL; /* can't create newsrc */ } diff --git a/imap/src/c-client/nntp.c b/imap/src/c-client/nntp.c index dd2b8604..8fa32df1 100644 --- a/imap/src/c-client/nntp.c +++ b/imap/src/c-client/nntp.c @@ -352,12 +352,12 @@ void nntp_list (MAILSTREAM *stream,char *ref,char *pat) /* namespace format name? */ if (*(lcl = strchr (strcpy (name,pattern),'}') + 1) == '#') lcl += 6; /* process data until we see final dot */ - while (s = net_getline (LOCAL->nntpstream->netstream)) { + while ((s = net_getline (LOCAL->nntpstream->netstream)) != NULL) { if ((*s == '.') && !s[1]){/* end of text */ fs_give ((void **) &s); break; } - if (t = strchr (s,' ')) { /* tie off after newsgroup name */ + if ((t = strchr (s,' ')) != NULL) { /* tie off after newsgroup name */ *t = '\0'; strcpy (lcl,s); /* make full form of name */ /* report if match */ @@ -396,10 +396,10 @@ void nntp_lsub (MAILSTREAM *stream,char *ref,char *pat) if (ref && *ref) sprintf (mbx,"%s%s",ref,pat); else strcpy (mbx,pat); - if (s = sm_read (tmp,&sdb)) do if (nntp_valid (s) && pmatch (s,mbx)) + if ((s = sm_read (tmp,&sdb)) != NULL) do if (nntp_valid (s) && pmatch (s,mbx)) mm_lsub (stream,NIL,s,NIL); /* until no more subscriptions */ - while (s = sm_read (tmp,&sdb)); + while ((s = sm_read (tmp,&sdb)) != NULL); } /* NNTP canonicalize newsgroup name @@ -430,7 +430,7 @@ long nntp_canonicalize (char *ref,char *pat,char *pattern,char *wildmat) /* don't return wildmat if specials present */ if (strpbrk (wildmat,",?![\\]")) wildmat[0] = '\0'; /* replace all % with * */ - for (s = wildmat; s = strchr (s,'%'); *s = '*'); + for (s = wildmat; (s = strchr (s,'%')) != NULL; *s = '*'); } return ret ? LONGT : NIL; } @@ -556,7 +556,7 @@ long nntp_status (MAILSTREAM *stream,char *mbx,long flags) else if (!(flags & (SA_RECENT | SA_UNSEEN))) status.messages = k; /* have newsrc state? */ - else if (state = newsrc_state (stream,name)) { + else if ((state = newsrc_state (stream,name)) != NULL) { /* yes, get the UID/sequence map */ if (nntp_getmap (stream,name,i,status.uidnext - 1,rnmsgs, status.messages,tmp)) { @@ -938,15 +938,15 @@ long nntp_overview (MAILSTREAM *stream,overview_t ofn) (j <= stream->nmsgs) && (elt = mail_elt (stream,j))->sequence && !elt->private.spare.ptr; j++); /* make NNTP range */ - sprintf (tmp,(i == (j - 1)) ? "%lu" : "%lu-%lu",mail_uid (stream,i), - mail_uid (stream,j - 1)); + if(i == (j - 1)) sprintf (tmp, "%lu", mail_uid (stream,i)); + else sprintf (tmp, "%lu-%lu",mail_uid (stream,i), mail_uid (stream,j - 1)); i = j; /* advance beyond gap */ /* ask server for overview data to cache */ if (nntp_over (stream,tmp)) { while ((s = net_getline (LOCAL->nntpstream->netstream)) && strcmp (s,".")) { /* death to embedded newlines */ - for (t = v = s; c = *v++;) + for (t = v = s; (c = *v++) != '\0';) if ((c != '\012') && (c != '\015')) *t++ = c; *t++ = '\0'; /* tie off string in case it was shortened */ /* cache the overview if found its sequence */ @@ -1056,34 +1056,34 @@ long nntp_parse_overview (OVERVIEW *ov,char *text,MESSAGECACHE *elt) if (!(text && *text)) return NIL; ov->subject = cpystr (text); /* make hackable copy of overview */ /* find end of Subject */ - if (t = strchr (ov->subject,'\t')) { + if ((t = strchr (ov->subject,'\t')) != NULL) { *t++ = '\0'; /* tie off Subject, point to From */ /* find end of From */ - if (ov->date = strchr (t,'\t')) { + if ((ov->date = strchr (t,'\t')) != NULL) { *ov->date++ = '\0'; /* tie off From, point to Date */ /* load internaldate too */ if (!elt->day) mail_parse_date (elt,ov->date); /* parse From */ rfc822_parse_adrlist (&ov->from,t,BADHOST); /* find end of Date */ - if (ov->message_id = strchr (ov->date,'\t')) { + if ((ov->message_id = strchr (ov->date,'\t')) != NULL) { /* tie off Date, point to Message-ID */ *ov->message_id++ = '\0'; /* find end of Message-ID */ - if (ov->references = strchr (ov->message_id,'\t')) { + if ((ov->references = strchr (ov->message_id,'\t')) != NULL) { /* tie off Message-ID, point to References */ *ov->references++ = '\0'; /* fine end of References */ - if (t = strchr (ov->references,'\t')) { + if ((t = strchr (ov->references,'\t')) != NULL) { *t++ = '\0'; /* tie off References, point to octet size */ /* parse size of message in octets */ ov->optional.octets = atol (t); /* find end of size */ - if (t = strchr (t,'\t')) { + if ((t = strchr (t,'\t')) != NULL) { /* parse size of message in lines */ ov->optional.lines = atol (++t); /* find Xref */ - if (ov->optional.xref = strchr (t,'\t')) + if ((ov->optional.xref = strchr (t,'\t')) != NULL) *ov->optional.xref++ = '\0'; } } @@ -1116,7 +1116,7 @@ char *nntp_header (MAILSTREAM *stream,unsigned long msgno,unsigned long *size, /* get header text */ switch (nntp_send (LOCAL->nntpstream,"HEAD",tmp)) { case NNTPHEAD: - if (f = netmsg_slurp (LOCAL->nntpstream->netstream,size,NIL)) { + if ((f = netmsg_slurp (LOCAL->nntpstream->netstream,size,NIL)) != NULL) { fread (elt->private.msg.header.text.data = (unsigned char *) fs_get ((size_t) *size + 3), (size_t) 1,(size_t) *size,f); @@ -1168,8 +1168,8 @@ long nntp_text (MAILSTREAM *stream,unsigned long msgno,STRING *bs,long flags) sprintf (tmp,"%lu",elt->private.uid); switch (nntp_send (LOCAL->nntpstream,"BODY",tmp)) { case NNTPBODY: - if (LOCAL->txt = netmsg_slurp (LOCAL->nntpstream->netstream, - &LOCAL->txtsize,NIL)) break; + if ((LOCAL->txt = netmsg_slurp (LOCAL->nntpstream->netstream, + &LOCAL->txtsize,NIL)) != NULL) break; /* fall into default case */ default: /* failed, mark as deleted */ elt->deleted = T; @@ -1233,7 +1233,7 @@ long nntp_search (MAILSTREAM *stream,char *charset,SEARCHPGM *pgm,long flags) OVERVIEW ov; char *msg; /* make sure that charset is good */ - if (msg = utf8_badcharset (charset)) { + if ((msg = utf8_badcharset (charset)) != NULL) { MM_LOG (msg,ERROR); /* output error */ fs_give ((void **) &msg); return NIL; @@ -1286,7 +1286,7 @@ long nntp_search_msg (MAILSTREAM *stream,unsigned long msgno,SEARCHPGM *pgm, if (pgm->msgno || pgm->uid) { /* message set searches */ SEARCHSET *set; /* message sequences */ - if (set = pgm->msgno) { /* must be inside this sequence */ + if ((set = pgm->msgno) != NULL) { /* must be inside this sequence */ while (set) { /* run down until find matching range */ if (set->last ? ((msgno < set->first) || (msgno > set->last)) : msgno != set->first) set = set->next; @@ -1294,7 +1294,7 @@ long nntp_search_msg (MAILSTREAM *stream,unsigned long msgno,SEARCHPGM *pgm, } if (!set) return NIL; /* not found within sequence */ } - if (set = pgm->uid) { /* must be inside this sequence */ + if ((set = pgm->uid) != NULL) { /* must be inside this sequence */ unsigned long uid = mail_uid (stream,msgno); while (set) { /* run down until find matching range */ if (set->last ? ((uid < set->first) || (uid > set->last)) : @@ -1530,7 +1530,7 @@ SORTCACHE **nntp_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm, if (!nntp_over (stream,tmp)) return mail_sort_loadcache (stream,pgm); while ((s = net_getline (LOCAL->nntpstream->netstream)) && strcmp (s,".")){ /* death to embedded newlines */ - for (t = v = s; c = *v++;) if ((c != '\012') && (c != '\015')) *t++ = c; + for (t = v = s; (c = *v++) != '\0';) if ((c != '\012') && (c != '\015')) *t++ = c; *t++ = '\0'; /* tie off resulting string */ /* parse OVER response */ if ((i = mail_msgno (stream,atol (s))) && @@ -1539,14 +1539,14 @@ SORTCACHE **nntp_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm, /* put stripped subject in sortcache */ r = (SORTCACHE *) (*mailcache) (stream,i,CH_SORTCACHE); r->refwd = mail_strip_subject (t,&r->subject); - if (t = strchr (v,'\t')) { + if ((t = strchr (v,'\t')) != NULL) { *t++ = '\0'; /* tie off from */ - if (adr = rfc822_parse_address (&adr,adr,&v,BADHOST,0)) { + if ((adr = rfc822_parse_address (&adr,adr,&v,BADHOST,0)) != NULL) { r->from = adr->mailbox; adr->mailbox = NIL; mail_free_address (&adr); } - if (v = strchr (t,'\t')) { + if ((v = strchr (t,'\t')) != NULL) { *v++ = '\0'; /* tie off date */ if (mail_parse_date (&telt,t)) r->date = mail_longdate (&telt); if ((v = strchr (v,'\t')) && (v = strchr (++v,'\t'))) @@ -1696,10 +1696,10 @@ SENDSTREAM *nntp_open_full (NETDRIVER *dv,char **hostlist,char *service, /* default port */ if (mb.port) port = mb.port; else if (!port) port = nntp_port ? nntp_port : NNTPTCPPORT; - if (netstream = /* try to open ordinary connection */ + if ((netstream = /* try to open ordinary connection */ net_open (&mb,dv,port, (NETDRIVER *) mail_parameters (NIL,GET_SSLDRIVER,NIL), - "*nntps",nntp_sslport ? nntp_sslport : NNTPSSLPORT)) { + "*nntps",nntp_sslport ? nntp_sslport : NNTPSSLPORT)) != NULL) { stream = (SENDSTREAM *) fs_get (sizeof (SENDSTREAM)); /* initialize stream */ memset ((void *) stream,0,sizeof (SENDSTREAM)); @@ -1737,9 +1737,9 @@ SENDSTREAM *nntp_open_full (NETDRIVER *dv,char **hostlist,char *service, mb.tlsflag = T; /* TLS OK, get into TLS at this end */ stream->netstream->dtb = ssld; /* negotiate TLS */ - if (stream->netstream->stream = + if ((stream->netstream->stream = (*stls) (stream->netstream->stream,mb.host, - SSL_MTHD(mb) | (mb.novalidate ? NET_NOVALIDATECERT:NIL))) + SSL_MTHD(mb) | (mb.novalidate ? NET_NOVALIDATECERT:NIL))) != NULL) extok = nntp_extensions (stream,(mb.secflag ? AU_SECURE : NIL) | (mb.authuser[0] ? AU_AUTHUSER : NIL)); else { @@ -1834,7 +1834,7 @@ long nntp_extensions (SENDSTREAM *stream,long flags) while ((t = net_getline (stream->netstream)) && (t[1] || (*t != '.'))) { if (stream->debug) mm_dlog (t); /* get optional capability arguments */ - if (args = strchr (t,' ')) *args++ = '\0'; + if ((args = strchr (t,' ')) != NULL) *args++ = '\0'; if (!compare_cstring (t,"LISTGROUP")) NNTP.ext.listgroup = T; else if (!compare_cstring (t,"OVER")) NNTP.ext.over = T; else if (!compare_cstring (t,"HDR")) NNTP.ext.hdr = T; @@ -1933,7 +1933,7 @@ long nntp_mail (SENDSTREAM *stream,ENVELOPE *env,BODY *body) env->sender ? env->sender->mailbox : (env->from ? env->from->mailbox : "not-for-mail")); /* here's another cretinism */ - if (s = strstr (env->date," (")) *s = NIL; + if ((s = strstr (env->date," (")) != NULL) *s = NIL; do if ((ret = nntp_send_work (stream,"POST",NIL)) == NNTPREADY) /* output data, return success status */ ret = (net_soutr (stream->netstream, @@ -2231,7 +2231,7 @@ long nntp_soutr (void *stream,char *s) /* "." on first line */ if (s[0] == '.') net_soutr (stream,"."); /* find lines beginning with a "." */ - while (t = strstr (s,"\015\012.")) { + while ((t = strstr (s,"\015\012.")) != NULL) { c = *(t += 3); /* remember next character after "." */ *t = '\0'; /* tie off string */ /* output prefix */ diff --git a/imap/src/c-client/pop3.c b/imap/src/c-client/pop3.c index 52573f52..46c050ee 100644 --- a/imap/src/c-client/pop3.c +++ b/imap/src/c-client/pop3.c @@ -273,10 +273,10 @@ void pop3_lsub (MAILSTREAM *stream,char *ref,char *pat) if (ref && *ref) sprintf (mbx,"%s%s",ref,pat); else strcpy (mbx,pat); - if (s = sm_read (tmp,&sdb)) do if (pop3_valid (s) && pmatch (s,mbx)) + if ((s = sm_read (tmp,&sdb)) != NULL) do if (pop3_valid (s) && pmatch (s,mbx)) mm_lsub (stream,NIL,s,NIL); /* until no more subscriptions */ - while (s = sm_read (tmp,&sdb)); + while ((s = sm_read (tmp,&sdb)) != NULL); } @@ -428,7 +428,7 @@ MAILSTREAM *pop3_open (MAILSTREAM *stream) if (mb.notlsflag) strcat (tmp,"/notls"); if (mb.sslflag) strcat (tmp,"/ssl"); if (mb.novalidate) strcat (tmp,"/novalidate-cert"); - if (LOCAL->loser = mb.loser) strcat (tmp,"/loser"); + if ((LOCAL->loser = mb.loser) != 0) strcat (tmp,"/loser"); if (stream->secure) strcat (tmp,"/secure"); sprintf (tmp + strlen (tmp),"/user=\"%s\"}%s",usr,mb.mailbox); stream->inbox = T; /* always INBOX */ @@ -498,7 +498,7 @@ long pop3_capa (MAILSTREAM *stream,long flags) while ((t = net_getline (LOCAL->netstream)) && (t[1] || (*t != '.'))) { if (stream->debug) mm_dlog (t); /* get optional capability arguments */ - if (args = strchr (t,' ')) *args++ = '\0'; + if ((args = strchr (t,' ')) != NULL) *args++ = '\0'; if (!compare_cstring (t,"STLS")) LOCAL->cap.stls = T; else if (!compare_cstring (t,"PIPELINING")) LOCAL->cap.pipelining = T; else if (!compare_cstring (t,"RESP-CODES")) LOCAL->cap.respcodes = T; @@ -509,7 +509,7 @@ long pop3_capa (MAILSTREAM *stream,long flags) LOCAL->cap.implementation = cpystr (args); else if (!compare_cstring (t,"EXPIRE") && args) { LOCAL->cap.expire = T; /* note that it is present */ - if (s = strchr(args,' ')){/* separate time from possible USER */ + if ((s = strchr(args,' ')) != NULL){/* separate time from possible USER */ *s++ = '\0'; /* in case they add something after USER */ if ((strlen (s) > 4) && (s[4] == ' ')) s[4] = '\0'; @@ -520,7 +520,7 @@ long pop3_capa (MAILSTREAM *stream,long flags) } else if (!compare_cstring (t,"LOGIN-DELAY") && args) { LOCAL->cap.logindelay = T;/* note that it is present */ - if (s = strchr(args,' ')){/* separate time from possible USER */ + if ((s = strchr(args,' ')) != NULL){/* separate time from possible USER */ *s++ = '\0'; /* in case they add something after USER */ if ((strlen (s) > 4) && (s[4] == ' ')) s[4] = '\0'; @@ -841,7 +841,7 @@ char *pop3_header (MAILSTREAM *stream,unsigned long msgno,unsigned long *size, &elt->private.msg.header.text.size); } /* otherwise load the cache with the message */ - else if (elt->private.msg.header.text.size = pop3_cache (stream,elt)) + else if ((elt->private.msg.header.text.size = pop3_cache (stream,elt)) != 0L) f = LOCAL->txt; if (f) { /* got it, make sure at start of file */ fseek (f,(unsigned long) 0,SEEK_SET); @@ -945,10 +945,10 @@ long pop3_expunge (MAILSTREAM *stream,char *sequence,long options) MESSAGECACHE *elt; unsigned long i = 1,n = 0; long ret; - if (ret = sequence ? ((options & EX_UID) ? + if ((ret = sequence ? ((options & EX_UID) ? mail_uid_sequence (stream,sequence) : mail_sequence (stream,sequence)) : - LONGT) { /* build selected sequence if needed */ + LONGT) != 0L) { /* build selected sequence if needed */ while (i <= stream->nmsgs) { elt = mail_elt (stream,i); if (elt->deleted && (sequence ? elt->sequence : T) && diff --git a/imap/src/c-client/rfc822.c b/imap/src/c-client/rfc822.c index 133f9e67..de919b3c 100644 --- a/imap/src/c-client/rfc822.c +++ b/imap/src/c-client/rfc822.c @@ -156,7 +156,7 @@ void rfc822_parse_msg_full (ENVELOPE **en,BODY **bdy,char *s,unsigned long i, } /* find header item type */ - if (t = d = strchr (tmp,':')) { + if ((t = d = strchr (tmp,':')) != NULL) { *d++ = '\0'; /* tie off header item, point at its data */ while (*d == ' ') d++; /* flush whitespace */ while ((tmp < t--) && (*t == ' ')) *t = '\0'; @@ -205,7 +205,7 @@ void rfc822_parse_msg_full (ENVELOPE **en,BODY **bdy,char *s,unsigned long i, if (!strcmp (tmp+1,"ROM")) rfc822_parse_adrlist (&env->from,d,host); else if (!strcmp (tmp+1,"OLLOWUP-TO")) { t = env->followup_to = (char *) fs_get (1 + strlen (d)); - while (c = *d++) if (c != ' ') *t++ = c; + while ((c = *d++) != '\0') if (c != ' ') *t++ = c; *t++ = '\0'; } break; @@ -219,7 +219,7 @@ void rfc822_parse_msg_full (ENVELOPE **en,BODY **bdy,char *s,unsigned long i, env->message_id = cpystr (d); else if (!strcmp (tmp+1,"IME-VERSION")) { /* tie off at end of phrase */ - if (t = rfc822_parse_phrase (d)) *t = '\0'; + if ((t = rfc822_parse_phrase (d)) != NULL) *t = '\0'; rfc822_skipws (&d); /* skip whitespace */ /* known version? */ if (strcmp (d,"1.0") && strcmp (d,"RFC-XXXX")) @@ -230,7 +230,7 @@ void rfc822_parse_msg_full (ENVELOPE **en,BODY **bdy,char *s,unsigned long i, case 'N': /* possible Newsgroups: */ if (!env->newsgroups && !strcmp (tmp+1,"EWSGROUPS")) { t = env->newsgroups = (char *) fs_get (1 + strlen (d)); - while (c = *d++) if (c != ' ') *t++ = c; + while ((c = *d++) != '\0') if (c != ' ') *t++ = c; *t++ = '\0'; } break; @@ -443,7 +443,7 @@ void rfc822_parse_content (BODY *body,STRING *bs,char *h,unsigned long depth, j = strlen (s1) + 2; /* length of cookie and header */ c = '\012'; /* initially at beginning of line */ while (i > j) { /* examine data */ - if (m = GETPOS (bs)) m--; /* get position in front of character */ + if ((m = GETPOS (bs)) != 0L) m--; /* get position in front of character */ switch (c) { /* examine each line */ case '\015': /* handle CRLF form */ if (CHR (bs) == '\012'){/* following LF? */ @@ -453,7 +453,7 @@ void rfc822_parse_content (BODY *body,STRING *bs,char *h,unsigned long depth, if (!(i && i-- && ((c = SNX (bs)) == '-') && i-- && ((c = SNX (bs)) == '-'))) break; /* see if cookie matches */ - if (k = j - 2) for (s = s1; i-- && *s++ == (c = SNX (bs)) && --k;); + if ((k = j - 2) != 0L) for (s = s1; i-- && *s++ == (c = SNX (bs)) && --k;); if (k) break; /* strings didn't match if non-zero */ /* terminating delimiter? */ if ((c = ((i && i--) ? (SNX (bs)) : '\012')) == '-') { @@ -509,7 +509,7 @@ void rfc822_parse_content (BODY *body,STRING *bs,char *h,unsigned long depth, /* parse non-empty body parts */ for (part = body->nested.part; part; part = part->next) { /* part non-empty (header and/or content)? */ - if (i = part->body.mime.text.size) { + if ((i = part->body.mime.text.size) != 0L) { /* move to that part of the body */ SETPOS (bs,part->body.mime.offset); /* until end of header */ @@ -610,7 +610,7 @@ void rfc822_parse_content_header (BODY *body,char *name,char *s) STRINGLIST *stl; rfc822_skipws (&s); /* skip leading comments */ /* flush whitespace */ - if (t = strchr (name,' ')) *t = '\0'; + if ((t = strchr (name,' ')) != NULL) *t = '\0'; switch (*name) { /* see what kind of content */ case 'I': /* possible Content-ID */ if (!(strcmp (name+1,"D") || body->id)) body->id = cpystr (s); @@ -800,7 +800,7 @@ void rfc822_parse_adrlist (ADDRESS **lst,char *string,char *host) } if (!*string) string = NIL; /* punt if ran out of string */ /* got an address? */ - else if (adr = rfc822_parse_address (lst,last,&string,host,0)) { + else if ((adr = rfc822_parse_address (lst,last,&string,host,0)) != NULL) { last = adr; /* new tail address */ if (string) { /* analyze what follows */ rfc822_skipws (&string); @@ -854,9 +854,9 @@ ADDRESS *rfc822_parse_address (ADDRESS **lst,ADDRESS *last,char **string, if (!*string) return NIL; /* no string */ rfc822_skipws (string); /* skip leading WS */ if (!**string) return NIL; /* empty string */ - if (adr = rfc822_parse_group (lst,last,string,defaulthost,depth)) last = adr; + if ((adr = rfc822_parse_group (lst,last,string,defaulthost,depth)) != NULL) last = adr; /* got an address? */ - else if (adr = rfc822_parse_mailbox (string,defaulthost)) { + else if ((adr = rfc822_parse_mailbox (string,defaulthost)) != NULL) { if (!*lst) *lst = adr; /* yes, first time through? */ else last->next = adr; /* no, append to the list */ /* set for subsequent linking */ @@ -902,7 +902,7 @@ ADDRESS *rfc822_parse_group (ADDRESS **lst,ADDRESS *last,char **string, last = adr; /* set for subsequent linking */ *string = p; /* continue after this point */ while (*string && **string && (**string != ';')) { - if (adr = rfc822_parse_address (lst,last,string,defaulthost,depth+1)) { + if ((adr = rfc822_parse_address (lst,last,string,defaulthost,depth+1)) != NULL) { last = adr; /* new tail address */ if (*string) { /* anything more? */ rfc822_skipws (string); /* skip whitespace */ @@ -961,7 +961,7 @@ ADDRESS *rfc822_parse_mailbox (char **string,char *defaulthost) if (*(s = *string) == '<') /* note start, handle case of phraseless RA */ adr = rfc822_parse_routeaddr (s,string,defaulthost); /* otherwise, expect at least one word */ - else if (end = rfc822_parse_phrase (s)) { + else if ((end = rfc822_parse_phrase (s)) != NULL) { if ((adr = rfc822_parse_routeaddr (end,string,defaulthost))) { /* phrase is a personal name */ if (adr->personal) fs_give ((void **) &adr->personal); @@ -1090,7 +1090,7 @@ ADDRESS *rfc822_parse_addrspec (char *string,char **ret,char *defaulthost) string = ++t; /* skip past the dot and any WS */ rfc822_skipws (&string); /* get next word of mailbox */ - if (t = rfc822_parse_word (string,wspecials)) { + if ((t = rfc822_parse_word (string,wspecials)) != NULL) { end = t; /* remember new end of mailbox */ c = *t; /* remember delimiter */ *t = '\0'; /* tie off word */ @@ -1158,7 +1158,7 @@ char *rfc822_parse_domain (char *string,char **end) } } /* search for end of host */ - else if (t = rfc822_parse_word (string,wspecials)) { + else if ((t = rfc822_parse_word (string,wspecials)) != NULL) { c = *t; /* remember delimiter */ *t = '\0'; /* tie off host */ ret = rfc822_cpy (string); /* copy host */ @@ -1168,7 +1168,7 @@ char *rfc822_parse_domain (char *string,char **end) while (*t == '.') { /* some cretin taking RFC 822 too seriously? */ string = ++t; /* skip past the dot and any WS */ rfc822_skipws (&string); - if (string = rfc822_parse_domain (string,&t)) { + if ((string = rfc822_parse_domain (string,&t)) != NULL) { *end = t; /* remember new end of domain */ c = *t; /* remember delimiter */ *t = '\0'; /* tie off host */ @@ -1235,7 +1235,7 @@ char *rfc822_parse_word (char *s,const char *delimiters) case I2CS_94x94_JIS_OLD:/* old JIS (1978) */ case I2CS_94x94_JIS_NEW:/* new JIS (1983) */ str = ++st; /* skip past the shift to JIS */ - while (st = strchr (st,I2C_ESC)) + while ((st = strchr (st,I2C_ESC)) != NULL) if ((*++st == I2C_G0_94) && ((st[1] == I2CS_94_ASCII) || (st[1] == I2CS_94_JIS_ROMAN) || (st[1] == I2CS_94_JIS_BUGROM))) { @@ -1434,7 +1434,7 @@ static long rfc822_output_data (RFC822BUFFER *buf,char *string,long len) { while (len) { /* until request satified */ long i; - if (i = min (len,buf->end - buf->cur)) { + if ((i = min (len,buf->end - buf->cur)) != 0L) { memcpy (buf->cur,string,i); buf->cur += i; /* blat data */ string += i; @@ -1682,7 +1682,7 @@ long rfc822_output_cat (RFC822BUFFER *buf,char *src,const char *specials) /* yes, write as quoted string*/ if (!rfc822_output_char (buf,'"')) return NIL; /* embedded quote characters? */ - for (; s = strpbrk (src,"\\\""); src = s + 1) { + for (; (s = strpbrk (src,"\\\"")) != NULL; src = s + 1) { /* yes, insert quoting */ if (!(rfc822_output_data (buf,src,s-src) && rfc822_output_char (buf,'\\') && @@ -1800,7 +1800,7 @@ void rfc822_encode_body_7bit (ENVELOPE *env,BODY *body) } part = body->nested.part; /* encode body parts */ do rfc822_encode_body_7bit (env,&part->body); - while (part = part->next); /* until done */ + while ((part = part->next) != NULL); /* until done */ break; case TYPEMESSAGE: /* encapsulated message */ switch (body->encoding) { @@ -1868,7 +1868,7 @@ void rfc822_encode_body_8bit (ENVELOPE *env,BODY *body) } part = body->nested.part; /* encode body parts */ do rfc822_encode_body_8bit (env,&part->body); - while (part = part->next); /* until done */ + while ((part = part->next) != NULL); /* until done */ break; case TYPEMESSAGE: /* encapsulated message */ switch (body->encoding) { @@ -2024,7 +2024,7 @@ void *rfc822_base64 (unsigned char *src,unsigned long srcl,unsigned long *len) */ sprintf (tmp,"Possible data truncation in rfc822_base64(): %.80s", (char *) src - 1); - if (s = strpbrk (tmp,"\015\012")) *s = NIL; + if ((s = strpbrk (tmp,"\015\012")) != NULL) *s = NIL; mm_log (tmp,PARSE); srcl = 1; /* don't issue any more messages */ break; diff --git a/imap/src/c-client/smanager.c b/imap/src/c-client/smanager.c index 1f9b508c..437e1079 100644 --- a/imap/src/c-client/smanager.c +++ b/imap/src/c-client/smanager.c @@ -41,9 +41,9 @@ long sm_subscribe (char *mailbox) /* canonicalize INBOX */ if (!compare_cstring (mailbox,"INBOX")) mailbox = "INBOX"; SUBSCRIPTIONFILE (db); /* open subscription database */ - if (f = fopen (db,"r")) { /* make sure not already there */ + if ((f = fopen (db,"r")) != NULL) { /* make sure not already there */ while (fgets (tmp,MAILTMPLEN,f)) { - if (s = strchr (tmp,'\n')) *s = '\0'; + if ((s = strchr (tmp,'\n')) != NULL) *s = '\0'; if (!strcmp (tmp,mailbox)) {/* already subscribed? */ sprintf (tmp,"Already subscribed to mailbox %.80s",mailbox); MM_LOG (tmp,ERROR); @@ -83,7 +83,7 @@ long sm_unsubscribe (char *mailbox) } else { while (fgets (tmp,MAILTMPLEN,f)) { - if (s = strchr (tmp,'\n')) *s = '\0'; + if ((s = strchr (tmp,'\n')) != NULL) *s = '\0'; if (strcmp (tmp,mailbox)) fprintf (tf,"%s\n",tmp); else found = T; /* found the name */ } @@ -113,11 +113,11 @@ char *sm_read (char *sbname,void **sdb) if (!f) { /* first time through? */ SUBSCRIPTIONFILE (sbname); /* open subscription database */ /* make sure not already there */ - if (f = fopen (sbname,"r")) *sdb = (void *) f; + if ((f = fopen (sbname,"r")) != NULL) *sdb = (void *) f; else return NIL; } if (fgets (sbname,MAILTMPLEN,f)) { - if (s = strchr (sbname,'\n')) *s = '\0'; + if ((s = strchr (sbname,'\n')) != NULL) *s = '\0'; return sbname; } fclose (f); /* all done */ diff --git a/imap/src/c-client/smtp.c b/imap/src/c-client/smtp.c index 1a79d28d..405f8738 100644 --- a/imap/src/c-client/smtp.c +++ b/imap/src/c-client/smtp.c @@ -167,10 +167,10 @@ SENDSTREAM *smtp_open_full (NETDRIVER *dv,char **hostlist,char *service, } /* else port argument overrides SMTP port */ else if (!port) port = smtp_port ? smtp_port : SMTPTCPPORT; - if (netstream = /* try to open ordinary connection */ + if ((netstream = /* try to open ordinary connection */ net_open (&mb,dv,port, (NETDRIVER *) mail_parameters (NIL,GET_SSLDRIVER,NIL), - "*smtps",smtp_sslport ? smtp_sslport : SMTPSSLPORT)) { + "*smtps",smtp_sslport ? smtp_sslport : SMTPSSLPORT)) != NULL) { stream = (SENDSTREAM *) memset (fs_get (sizeof (SENDSTREAM)),0, sizeof (SENDSTREAM)); stream->netstream = netstream; @@ -788,7 +788,7 @@ long smtp_soutr (void *stream,char *s) /* "." on first line */ if (s[0] == '.') net_sout (stream,".",1); /* find lines beginning with a "." */ - while (t = strstr (s,"\015\012.")) { + while ((t = strstr (s,"\015\012.")) != NULL) { c = *(t += 3); /* remember next character after "." */ *t = '\0'; /* tie off string */ /* output prefix */ diff --git a/imap/src/c-client/utf8.c b/imap/src/c-client/utf8.c index cad4a7c7..844abefd 100644 --- a/imap/src/c-client/utf8.c +++ b/imap/src/c-client/utf8.c @@ -657,7 +657,7 @@ unsigned short *utf8_rmap_cs (const CHARSET *cs) unsigned short *ret = NIL; if (!cs); /* have charset? */ else if (cs == currmapcs) ret = currmap; - else if (ret = utf8_rmap_gen (cs,currmap)) { + else if ((ret = utf8_rmap_gen (cs,currmap)) != NULL) { currmapcs = cs; currmap = ret; } @@ -789,7 +789,7 @@ long utf8_rmaptext (SIZEDTEXT *text,unsigned short *rmap,SIZEDTEXT *ret, { unsigned long i,u,c; /* get size of buffer */ - if (i = utf8_rmapsize (text,rmap,errch,iso2022jp)) { + if ((i = utf8_rmapsize (text,rmap,errch,iso2022jp)) != 0L) { unsigned char *s = text->data; unsigned char *t = ret->data = (unsigned char *) fs_get (i); ret->size = i - 1; /* number of octets in destination buffer */ @@ -1320,7 +1320,7 @@ unsigned long *utf8_csvalidmap (char *charsets[]) /* substitute EUC-JP for ISO-2022-JP */ if (!compare_cstring (s,"ISO-2022-JP")) s = "EUC-JP"; /* look up charset */ - if (cs = utf8_charset (s)) { + if ((cs = utf8_charset (s)) != NULL) { csb = 1 << csi; /* charset bit */ switch (cs->type) { case CT_ASCII: /* 7-bit ASCII no table */ @@ -2424,7 +2424,7 @@ unsigned long ucs4_decompose (unsigned long c,void **more) struct decomposemore *m; if (c & U8G_ERROR) { /* want to chase more? */ /* do sanity check */ - if (m = (struct decomposemore *) *more) switch (m->type) { + if ((m = (struct decomposemore *) *more) != NULL) switch (m->type) { case MORESINGLE: /* single value */ ret = m->data.single; fs_give (more); /* no more decomposition */ @@ -2447,7 +2447,7 @@ unsigned long ucs4_decompose (unsigned long c,void **more) else if (c == UCS4_BMPLOMIN) ret = ucs4_dbmplotab[0]; else if (c <= UCS4_BMPLOMAX) { /* within range - have a decomposition? */ - if (i = ucs4_dbmploixtab[c - UCS4_BMPLOMIN]) { + if ((i = ucs4_dbmploixtab[c - UCS4_BMPLOMIN]) != 0L) { /* get first value of decomposition */ ret = ucs4_dbmplotab[ix = i & UCS4_BMPLOIXMASK]; /* has continuation? */ @@ -2477,7 +2477,7 @@ unsigned long ucs4_decompose (unsigned long c,void **more) else if (c < UCS4_BMPHIMIN) ret = c; else if (c <= UCS4_BMPHIMAX) { /* within range - have a decomposition? */ - if (i = ucs4_dbmphiixtab[c - UCS4_BMPHIMIN]) { + if ((i = ucs4_dbmphiixtab[c - UCS4_BMPHIMIN]) != 0L) { /* get first value of decomposition */ ret = ucs4_dbmphitab[ix = i & UCS4_BMPHIIXMASK]; /* has continuation? */ @@ -2542,7 +2542,7 @@ unsigned long ucs4_decompose_recursive (unsigned long c,void **more) RECURSIVEMORE *mr; if (c & U8G_ERROR) { /* want to chase more? */ mn = NIL; - if (mr = (RECURSIVEMORE *) *more) switch (mr->more->type) { + if ((mr = (RECURSIVEMORE *) *more) != NULL) switch (mr->more->type) { case MORESINGLE: /* decompose single value */ c = ucs4_decompose_recursive (mr->more->data.single,&mn); *more = mr->next; /* done with this more, remove it */ @@ -2562,7 +2562,7 @@ unsigned long ucs4_decompose_recursive (unsigned long c,void **more) fatal ("invalid more block argument to ucs4_decompose_recursive!"); } else fatal ("no more block provided to ucs4_decompose_recursive!"); - if (mr = mn) { /* did this value recurse on us? */ + if ((mr = mn) != NULL) { /* did this value recurse on us? */ mr->next = *more; /* yes, insert new more at head */ *more = mr; } diff --git a/imap/src/c-client/utf8aux.c b/imap/src/c-client/utf8aux.c index 5138987b..5241b9e1 100644 --- a/imap/src/c-client/utf8aux.c +++ b/imap/src/c-client/utf8aux.c @@ -44,7 +44,7 @@ static void utf8_stringlist (STRINGLIST *st,char *charset) fs_give ((void **) &st->text.data); st->text.data = txt.data; /* transfer this text */ st->text.size = txt.size; - } while (st = st->next); + } while ((st = st->next) != NULL); } @@ -133,7 +133,7 @@ long utf8_mime2text (SIZEDTEXT *src,SIZEDTEXT *dst,long flags) ((te - s) < MAXENCWORD)) { if (mime2_decode (e,t,te,&txt)) { *ce = '\0'; /* temporarily tie off charset */ - if (ls = strchr (cs,'*')) *ls = '\0'; + if ((ls = strchr (cs,'*')) != NULL) *ls = '\0'; /* convert to UTF-8 as best we can */ if (!utf8_text (&txt,cs,&rtxt,flags)) utf8_text (&txt,NIL,&rtxt,flags); if (dst->data) { /* make sure existing buffer fits */ @@ -238,7 +238,7 @@ long mime2_decode (unsigned char *e,unsigned char *t,unsigned char *te, txt->data[txt->size] = '\0'; break; case 'B': case 'b': /* BASE64 */ - if (txt->data = (unsigned char *) rfc822_base64 (t,te - t,&txt->size)) + if ((txt->data = (unsigned char *) rfc822_base64 (t,te - t,&txt->size)) != NULL) break; default: /* any other encoding is unknown */ return NIL; /* syntax error: unknown encoding */ |