From 80fe0a07bdc0e8b9bd8a3605bda07768c39d7b01 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Wed, 7 Aug 2019 21:57:06 +0100 Subject: [PATCH] add braces to unclear 'if' statements --- autocrypt/autocrypt.c | 4 ++++ autocrypt/autocrypt_db.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c index 855237992..bbe0a5f33 100644 --- a/autocrypt/autocrypt.c +++ b/autocrypt/autocrypt.c @@ -273,7 +273,9 @@ int mutt_autocrypt_process_autocrypt_header(struct Email *e, struct Envelope *en /* 1.1 spec also says to skip multipart/report emails */ if ((e->content->type == TYPE_MULTIPART) && !(mutt_str_strcasecmp(e->content->subtype, "report"))) + { return 0; + } /* Ignore emails that appear to be more than a week in the future, * since they can block all future updates during that time. */ @@ -593,12 +595,14 @@ enum AutocryptRec mutt_autocrypt_ui_recommendation(struct Email *e, char **keyli if (mutt_autocrypt_db_peer_get(recip, &peer) <= 0) { if (keylist) + { /* L10N: %s is an email address. Autocrypt is scanning for the keyids to use to encrypt, but it can't find a valid keyid for this address. The message is printed and they are returned to the compose menu. */ mutt_message(_("No (valid) autocrypt key found for %s."), recip->mailbox); + } goto cleanup; } diff --git a/autocrypt/autocrypt_db.c b/autocrypt/autocrypt_db.c index 38ed48ead..3746fb410 100644 --- a/autocrypt/autocrypt_db.c +++ b/autocrypt/autocrypt_db.c @@ -273,7 +273,9 @@ int mutt_autocrypt_db_account_get(struct Address *addr, struct AutocryptAccount "FROM account " "WHERE email_addr = ?", -1, SQLITE_PREPARE_PERSISTENT, &AccountGetStmt, NULL) != SQLITE_OK) + { goto cleanup; + } } if (sqlite3_bind_text(AccountGetStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK) @@ -330,7 +332,9 @@ int mutt_autocrypt_db_account_insert(struct Address *addr, const char *keyid, "enabled) " "VALUES (?, ?, ?, ?, ?);", -1, SQLITE_PREPARE_PERSISTENT, &AccountInsertStmt, NULL) != SQLITE_OK) + { goto cleanup; + } } if (sqlite3_bind_text(AccountInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK) @@ -375,7 +379,9 @@ int mutt_autocrypt_db_account_update(struct AutocryptAccount *acct) "enabled = ? " "WHERE email_addr = ?;", -1, SQLITE_PREPARE_PERSISTENT, &AccountUpdateStmt, NULL) != SQLITE_OK) + { goto cleanup; + } } if (sqlite3_bind_text(AccountUpdateStmt, 1, acct->keyid, -1, SQLITE_STATIC) != SQLITE_OK) @@ -415,7 +421,9 @@ int mutt_autocrypt_db_account_delete(struct AutocryptAccount *acct) "DELETE from account " "WHERE email_addr = ?;", -1, SQLITE_PREPARE_PERSISTENT, &AccountDeleteStmt, NULL) != SQLITE_OK) + { goto cleanup; + } } if (sqlite3_bind_text(AccountDeleteStmt, 1, acct->email_addr, -1, SQLITE_STATIC) != SQLITE_OK) @@ -460,7 +468,9 @@ int mutt_autocrypt_db_account_get_all(struct AutocryptAccount ***accounts, int * "FROM account " "ORDER BY email_addr", -1, &stmt, NULL) != SQLITE_OK) + { goto cleanup; + } while ((result = sqlite3_step(stmt)) == SQLITE_ROW) { @@ -553,7 +563,9 @@ int mutt_autocrypt_db_peer_get(struct Address *addr, struct AutocryptPeer **peer "FROM peer " "WHERE email_addr = ?", -1, SQLITE_PREPARE_PERSISTENT, &PeerGetStmt, NULL) != SQLITE_OK) + { goto cleanup; + } } if (sqlite3_bind_text(PeerGetStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK) @@ -615,7 +627,9 @@ int mutt_autocrypt_db_peer_insert(struct Address *addr, struct AutocryptPeer *pe "gossip_keydata) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);", -1, SQLITE_PREPARE_PERSISTENT, &PeerInsertStmt, NULL) != SQLITE_OK) + { goto cleanup; + } } if (sqlite3_bind_text(PeerInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK) @@ -672,7 +686,9 @@ int mutt_autocrypt_db_peer_update(struct AutocryptPeer *peer) "gossip_keydata = ? " "WHERE email_addr = ?;", -1, SQLITE_PREPARE_PERSISTENT, &PeerUpdateStmt, NULL) != SQLITE_OK) + { goto cleanup; + } } if (sqlite3_bind_int64(PeerUpdateStmt, 1, peer->last_seen) != SQLITE_OK) @@ -753,7 +769,9 @@ int mutt_autocrypt_db_peer_history_insert(struct Address *addr, "VALUES (?, ?, ?, ?);", -1, SQLITE_PREPARE_PERSISTENT, &PeerHistoryInsertStmt, NULL) != SQLITE_OK) + { goto cleanup; + } } if (sqlite3_bind_text(PeerHistoryInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK) @@ -828,22 +846,32 @@ int mutt_autocrypt_db_gossip_history_insert(struct Address *addr, "VALUES (?, ?, ?, ?, ?);", -1, SQLITE_PREPARE_PERSISTENT, &GossipHistoryInsertStmt, NULL) != SQLITE_OK) + { goto cleanup; + } } if (sqlite3_bind_text(GossipHistoryInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK) + { goto cleanup; + } if (sqlite3_bind_text(GossipHistoryInsertStmt, 2, gossip_hist->sender_email_addr, -1, SQLITE_STATIC) != SQLITE_OK) + { if (sqlite3_bind_text(GossipHistoryInsertStmt, 3, gossip_hist->email_msgid, -1, SQLITE_STATIC) != SQLITE_OK) + { goto cleanup; + } + } if (sqlite3_bind_int64(GossipHistoryInsertStmt, 4, gossip_hist->timestamp) != SQLITE_OK) goto cleanup; if (sqlite3_bind_text(GossipHistoryInsertStmt, 5, gossip_hist->gossip_keydata, -1, SQLITE_STATIC) != SQLITE_OK) + { goto cleanup; + } if (sqlite3_step(GossipHistoryInsertStmt) != SQLITE_DONE) goto cleanup; -- 2.40.0