From 5f5807d92f27e4e3e7ed83c9fc1463c01a553a8e Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 26 Oct 2018 12:53:55 +0100 Subject: [PATCH] pop: tidy --- pop/pop.c | 4 ++-- pop/pop_auth.c | 12 ++++++------ pop/pop_lib.c | 15 +++++++-------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/pop/pop.c b/pop/pop.c index 0313a9dbd..ded742261 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -686,7 +686,7 @@ void pop_fetch_mail(void) mx_msg_close(ctx, &msg); } - if (ret == 0 && delanswer == MUTT_YES) + if ((ret == 0) && (delanswer == MUTT_YES)) { /* delete the message on the server */ snprintf(buffer, sizeof(buffer), "DELE %d\r\n", i); @@ -910,7 +910,7 @@ static int pop_mbox_sync(struct Context *ctx, int *index_hint) hc = pop_hcache_open(adata, ctx->mailbox->path); #endif - for (i = 0, j = 0, ret = 0; ret == 0 && i < ctx->mailbox->msg_count; i++) + for (i = 0, j = 0, ret = 0; (ret == 0) && (i < ctx->mailbox->msg_count); i++) { struct PopEmailData *edata = ctx->mailbox->hdrs[i]->edata; if (ctx->mailbox->hdrs[i]->deleted && ctx->mailbox->hdrs[i]->refno != -1) diff --git a/pop/pop_auth.c b/pop/pop_auth.c index 31cd69ac6..4edc0f2fc 100644 --- a/pop/pop_auth.c +++ b/pop/pop_auth.c @@ -84,7 +84,7 @@ static enum PopAuthRes pop_auth_sasl(struct PopAccountData *adata, const char *m mutt_sasl_interact(interaction); } - if (rc != SASL_OK && rc != SASL_CONTINUE) + if ((rc != SASL_OK) && (rc != SASL_CONTINUE)) { mutt_debug( 1, "Failure starting authentication exchange. No shared mechanisms?\n"); @@ -125,7 +125,7 @@ static enum PopAuthRes pop_auth_sasl(struct PopAccountData *adata, const char *m * need to loop at least once more to send the pc/olen returned * by sasl_client_start(). */ - if (!client_start && rc != SASL_CONTINUE) + if (!client_start && (rc != SASL_CONTINUE)) break; if ((mutt_str_strncmp(inbuf, "+ ", 2) == 0) && @@ -154,7 +154,7 @@ static enum PopAuthRes pop_auth_sasl(struct PopAccountData *adata, const char *m /* Even if sasl_client_step() returns SASL_OK, we should send at * least one more line to the server. See #3862. */ - if (rc != SASL_CONTINUE && rc != SASL_OK) + if ((rc != SASL_CONTINUE) && (rc != SASL_OK)) break; /* send out response, or line break if none needed */ @@ -453,8 +453,8 @@ int pop_authenticate(struct PopAccountData *adata) if (ret != POP_A_UNAVAIL) attempts++; - if (ret == POP_A_SUCCESS || ret == POP_A_SOCKET || - (ret == POP_A_FAILURE && !PopAuthTryAll)) + if ((ret == POP_A_SUCCESS) || (ret == POP_A_SOCKET) || + ((ret == POP_A_FAILURE) && !PopAuthTryAll)) { comma = NULL; break; @@ -493,7 +493,7 @@ int pop_authenticate(struct PopAccountData *adata) if (ret != POP_A_UNAVAIL) attempts++; - if (ret == POP_A_SUCCESS || ret == POP_A_SOCKET || (ret == POP_A_FAILURE && !PopAuthTryAll)) + if ((ret == POP_A_SUCCESS) || (ret == POP_A_SOCKET) || ((ret == POP_A_FAILURE) && !PopAuthTryAll)) { break; } diff --git a/pop/pop_lib.c b/pop/pop_lib.c index 6fc38b665..1cd14ad87 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -75,7 +75,7 @@ int pop_parse_path(const char *path, struct ConnAccount *acct) char *c = mutt_str_strdup(path); url_parse(&url, c); - if ((url.scheme != U_POP && url.scheme != U_POPS) || !url.host || + if (((url.scheme != U_POP) && (url.scheme != U_POPS)) || !url.host || mutt_account_fromurl(acct, &url) < 0) { url_free(&url); @@ -87,14 +87,13 @@ int pop_parse_path(const char *path, struct ConnAccount *acct) if (url.scheme == U_POPS) acct->flags |= MUTT_ACCT_SSL; - struct servent *service = getservbyname(url.scheme == U_POP ? "pop3" : "pop3s", "tcp"); - if (!acct->port) + struct servent *service = getservbyname((url.scheme == U_POP) ? "pop3" : "pop3s", "tcp"); + if (acct->port == 0) { if (service) acct->port = ntohs(service->s_port); else - acct->port = url.scheme == U_POP ? POP_PORT : POP_SSL_PORT; - ; + acct->port = (url.scheme == U_POP) ? POP_PORT : POP_SSL_PORT; } url_free(&url); @@ -213,7 +212,7 @@ static int pop_capabilities(struct PopAccountData *adata, int mode) } /* Execute CAPA command */ - if (mode == 0 || adata->cmd_capa) + if ((mode == 0) || adata->cmd_capa) { mutt_str_strfcpy(buf, "CAPA\r\n", sizeof(buf)); switch (pop_fetch_data(adata, buf, NULL, fetch_capa, adata)) @@ -229,7 +228,7 @@ static int pop_capabilities(struct PopAccountData *adata, int mode) } /* CAPA not supported, use defaults */ - if (mode == 0 && !adata->cmd_capa) + if ((mode == 0) && !adata->cmd_capa) { adata->cmd_user = 2; adata->cmd_uidl = 2; @@ -553,7 +552,7 @@ int pop_fetch_data(struct PopAccountData *adata, const char *query, { if (progressbar) mutt_progress_update(progressbar, pos, -1); - if (ret == 0 && func(inbuf, data) < 0) + if ((ret == 0) && (func(inbuf, data) < 0)) ret = -3; lenbuf = 0; } -- 2.40.0