summaryrefslogtreecommitdiff
path: root/imap/src/osdep/unix/mmdf.c
diff options
context:
space:
mode:
Diffstat (limited to 'imap/src/osdep/unix/mmdf.c')
-rw-r--r--imap/src/osdep/unix/mmdf.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/imap/src/osdep/unix/mmdf.c b/imap/src/osdep/unix/mmdf.c
index e962434e..994c34a3 100644
--- a/imap/src/osdep/unix/mmdf.c
+++ b/imap/src/osdep/unix/mmdf.c
@@ -537,12 +537,13 @@ long mmdf_rename (MAILSTREAM *stream,char *old,char *newname)
MM_CRITICAL (stream); /* get the c-client lock */
if (!dummy_file (file,old) ||
(newname && (!((s = mailboxfile (tmp,newname)) && *s) ||
- ((s = strrchr (tmp,'/')) && !s[1]))))
- sprintf (tmp,newname ?
- "Can't rename mailbox %.80s to %.80s: invalid name" :
- "Can't delete mailbox %.80s: invalid name",
- old,newname);
- /* lock out other c-clients */
+ ((s = strrchr (tmp,'/')) && !s[1])))){
+ if(newname) sprintf (tmp,
+ "Can't rename mailbox %.80s to %.80s: invalid name",
+ old,newname);
+ else
+ sprintf (tmp, "Can't delete mailbox %.80s: invalid name", old);
+ } /* lock out other c-clients */
else if ((ld = lockname (lock,file,LOCK_EX|LOCK_NB,&i)) < 0)
sprintf (tmp,"Mailbox %.80s is in use by another process",old);
@@ -554,7 +555,7 @@ long mmdf_rename (MAILSTREAM *stream,char *old,char *newname)
else {
if (newname) { /* want rename? */
/* found superior to destination name? */
- if (s = strrchr (s,'/')) {
+ if ((s = strrchr (s,'/')) != NULL) {
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* name doesn't exist, create it */
@@ -981,9 +982,9 @@ long mmdf_expunge (MAILSTREAM *stream,char *sequence,long options)
unsigned long i;
DOTLOCK lock;
char *msg = NIL;
- if (ret = (sequence ? ((options & EX_UID) ?
+ if ((ret = (sequence ? ((options & EX_UID) ?
mail_uid_sequence (stream,sequence) :
- mail_sequence (stream,sequence)) : LONGT) &&
+ mail_sequence (stream,sequence)) : LONGT) != 0L) &&
LOCAL && (LOCAL->ld >= 0) && !stream->lock &&
mmdf_parse (stream,&lock,LOCK_EX)) {
/* check expunged messages if not dirty */
@@ -1391,10 +1392,10 @@ int mmdf_append_msgs (MAILSTREAM *stream,FILE *sf,FILE *df,SEARCHSET *set)
if (i < (j = strlen (tmp))) fatal ("mmdf_append_msgs overrun");
i -= j; /* number of bytes left */
/* squish out ^A and CRs (note copies NUL) */
- for (x = tmp; x = strpbrk (x,"\01\r"); --j) memmove (x,x+1,j-(x-tmp));
+ for (x = tmp; (x = strpbrk (x,"\01\r")) != NULL; --j) memmove (x,x+1,j-(x-tmp));
if (!j) continue; /* do nothing if line emptied */
/* start of line? */
- if ((c == '\n')) switch (tmp[0]) {
+ if (c == '\n') switch (tmp[0]) {
case 'S': case 's': /* possible "Status:" */
if (hdrp && (j > 6) && ((tmp[1] == 't') || (tmp[1] == 'T')) &&
((tmp[2] == 'a') || (tmp[2] == 'A')) &&
@@ -1609,7 +1610,7 @@ int mmdf_parse (MAILSTREAM *stream,DOTLOCK *lock,int op)
}
/* new data? */
- else if (i = sbuf.st_size - LOCAL->filesize) {
+ else if ((i = sbuf.st_size - LOCAL->filesize) != 0L) {
d.fd = LOCAL->fd; /* yes, set up file descriptor */
d.pos = LOCAL->filesize; /* get to that position in the file */
d.chunk = LOCAL->buf; /* initial buffer chunk */
@@ -1931,7 +1932,7 @@ int mmdf_parse (MAILSTREAM *stream,DOTLOCK *lock,int op)
char err[MAILTMPLEN];
sprintf (err,"Discarding bogus continuation in msg %lu: %.80s",
elt->msgno,(char *) s);
- if (u = strpbrk (err,"\r\n")) *u = '\0';
+ if ((u = strpbrk (err,"\r\n")) != NULL) *u = '\0';
MM_LOG (err,WARN);
break; /* different case or something */
}
@@ -2175,7 +2176,7 @@ unsigned long mmdf_xstatus (MAILSTREAM *stream,char *status,MESSAGECACHE *elt,
while (n /= 10);
/* pop UID last digits from stack */
while (t > stack) *s++ = *--t;
- for (n = 0; n < NUSERFLAGS; ++n) if (t = stream->user_flags[n])
+ for (n = 0; n < NUSERFLAGS; ++n) if ((t = stream->user_flags[n]) != NULL)
for (*s++ = ' '; *t; *s++ = *t++);
*s++ = '\n';
pad += 30; /* increased padding if have IMAPbase */
@@ -2197,7 +2198,7 @@ unsigned long mmdf_xstatus (MAILSTREAM *stream,char *status,MESSAGECACHE *elt,
if (sticky) { /* only do this if UIDs sticky */
*s++ = 'X'; *s++ = '-'; *s++ = 'K'; *s++ = 'e'; *s++ = 'y'; *s++ = 'w';
*s++ = 'o'; *s++ = 'r'; *s++ = 'd'; *s++ = 's'; *s++ = ':';
- if (n = elt->user_flags) do {
+ if ((n = elt->user_flags) != 0L) do {
*s++ = ' ';
for (t = stream->user_flags[find_rightmost_bit (&n)]; *t; *s++ = *t++);
} while (n);
@@ -2261,7 +2262,7 @@ long mmdf_rewrite (MAILSTREAM *stream,unsigned long *nexp,DOTLOCK *lock,
size = mmdf_pseudo (stream,LOCAL->buf);
}
/* extend the file as necessary */
- if (ret = mmdf_extend (stream,size)) {
+ if ((ret = mmdf_extend (stream,size)) != 0L){
/* Set up buffered I/O file structure
* curpos current position being written through buffering
* filepos current position being written physically to the disk
@@ -2454,7 +2455,7 @@ void mmdf_write (MMDFFILE *f,char *buf,unsigned long size)
if (buf) { /* doing buffered write? */
i = f->bufpos - f->buf; /* yes, get size of current buffer data */
/* yes, have space in current buffer chunk? */
- if (j = i ? ((f->buflen - i) % OVERFLOWBUFLEN) : f->buflen) {
+ if ((j = i ? ((f->buflen - i) % OVERFLOWBUFLEN) : f->buflen) != 0L) {
/* yes, fill up buffer as much as we can */
memcpy (f->bufpos,buf,k = min (j,size));
f->bufpos += k; /* new buffer position */
@@ -2470,7 +2471,7 @@ void mmdf_write (MMDFFILE *f,char *buf,unsigned long size)
* chunks that will fit in unprotected space.
*/
/* any unprotected space we can write to? */
- if (j = min (i,f->protect - f->filepos)) {
+ if ((j = min (i,f->protect - f->filepos)) != 0L) {
/* yes, filepos not at chunk boundary? */
if ((k = f->filepos % OVERFLOWBUFLEN) && ((k = OVERFLOWBUFLEN - k) < j))
j -= k; /* yes, and can write out partial chunk */