From f479eab2271c06d73d2e473ce47b0fc6ab742cef Mon Sep 17 00:00:00 2001 From: FdaSilvaYY Date: Sat, 26 Aug 2017 17:56:44 +0200 Subject: [PATCH] style : fix some if(... Reviewed-by: Richard Levitte Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/4457) --- apps/s_client.c | 2 +- apps/s_server.c | 2 +- crypto/bio/b_print.c | 30 +++++++++++++++--------------- crypto/ocsp/ocsp_srv.c | 2 +- engines/e_dasync.c | 4 ++-- ssl/record/rec_layer_s3.c | 4 ++-- ssl/t1_enc.c | 2 +- test/testutil.h | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/apps/s_client.c b/apps/s_client.c index d4fb1a8554..d2aa01d76a 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -198,7 +198,7 @@ static int psk_use_session_cb(SSL *s, const EVP_MD *md, if (key_len == EVP_MD_size(EVP_sha256())) cipher = SSL_CIPHER_find(s, tls13_aes128gcmsha256_id); - else if(key_len == EVP_MD_size(EVP_sha384())) + else if (key_len == EVP_MD_size(EVP_sha384())) cipher = SSL_CIPHER_find(s, tls13_aes256gcmsha384_id); if (cipher == NULL) { diff --git a/apps/s_server.c b/apps/s_server.c index 311f4a217c..86fed6f593 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -208,7 +208,7 @@ static int psk_find_session_cb(SSL *ssl, const unsigned char *identity, if (key_len == EVP_MD_size(EVP_sha256())) cipher = SSL_CIPHER_find(ssl, tls13_aes128gcmsha256_id); - else if(key_len == EVP_MD_size(EVP_sha384())) + else if (key_len == EVP_MD_size(EVP_sha384())) cipher = SSL_CIPHER_find(ssl, tls13_aes256gcmsha384_id); if (cipher == NULL) { diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c index 056de86524..2180fd51a9 100644 --- a/crypto/bio/b_print.c +++ b/crypto/bio/b_print.c @@ -111,7 +111,7 @@ _dopr(char **sbuffer, if (ch == '%') state = DP_S_FLAGS; else - if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch)) + if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch)) return 0; ch = *format++; break; @@ -293,8 +293,8 @@ _dopr(char **sbuffer, return 0; break; case 'c': - if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, - va_arg(args, int))) + if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, + va_arg(args, int))) return 0; break; case 's': @@ -323,7 +323,7 @@ _dopr(char **sbuffer, } break; case '%': - if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch)) + if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch)) return 0; break; case 'w': @@ -354,7 +354,7 @@ _dopr(char **sbuffer, if (*truncated) currlen = *maxlen - 1; } - if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0')) + if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0')) return 0; *retlen = currlen - 1; return 1; @@ -392,19 +392,19 @@ fmtstr(char **sbuffer, padlen = -padlen; while ((padlen > 0) && (max < 0 || cnt < max)) { - if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --padlen; ++cnt; } while (strln > 0 && (max < 0 || cnt < max)) { - if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++)) + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++)) return 0; --strln; ++cnt; } while ((padlen < 0) && (max < 0 || cnt < max)) { - if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; ++padlen; ++cnt; @@ -472,19 +472,19 @@ fmtint(char **sbuffer, /* spaces */ while (spadlen > 0) { - if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --spadlen; } /* sign */ if (signvalue) - if(!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; /* prefix */ while (*prefix) { - if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix)) + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix)) return 0; prefix++; } @@ -492,7 +492,7 @@ fmtint(char **sbuffer, /* zeros */ if (zpadlen > 0) { while (zpadlen > 0) { - if(!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --zpadlen; } @@ -758,8 +758,8 @@ fmtfp(char **sbuffer, return 0; while (fplace > 0) { - if(!doapr_outch(sbuffer, buffer, currlen, maxlen, - fconvert[--fplace])) + if (!doapr_outch(sbuffer, buffer, currlen, maxlen, + fconvert[--fplace])) return 0; } } @@ -913,7 +913,7 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) size_t retlen; int truncated; - if(!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args)) + if (!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args)) return -1; if (truncated) diff --git a/crypto/ocsp/ocsp_srv.c b/crypto/ocsp/ocsp_srv.c index 46a4bf7852..51b27bddff 100644 --- a/crypto/ocsp/ocsp_srv.c +++ b/crypto/ocsp/ocsp_srv.c @@ -265,7 +265,7 @@ int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert) return (ASN1_STRING_length(respid->value.byKey) == SHA_DIGEST_LENGTH) && (memcmp(ASN1_STRING_get0_data(respid->value.byKey), md, SHA_DIGEST_LENGTH) == 0); - } else if(respid->type == V_OCSP_RESPID_NAME) { + } else if (respid->type == V_OCSP_RESPID_NAME) { if (respid->value.byName == NULL) return 0; diff --git a/engines/e_dasync.c b/engines/e_dasync.c index 9211ab783b..6fc7a7d0fa 100644 --- a/engines/e_dasync.c +++ b/engines/e_dasync.c @@ -437,8 +437,8 @@ static void dummy_pause_job(void) { #endif *writefd = pipefds[1]; - if(!ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_dasync_id, pipefds[0], - writefd, wait_cleanup)) { + if (!ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_dasync_id, pipefds[0], + writefd, wait_cleanup)) { wait_cleanup(waitctx, engine_dasync_id, pipefds[0], writefd); return; } diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c index d10b91b24f..c1101a6735 100644 --- a/ssl/record/rec_layer_s3.c +++ b/ssl/record/rec_layer_s3.c @@ -920,8 +920,8 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf, * This will be at most one cipher block or the tag length if using * AEAD. SSL_RT_MAX_CIPHER_BLOCK_SIZE covers either case. */ - if(!WPACKET_reserve_bytes(thispkt, SSL_RT_MAX_CIPHER_BLOCK_SIZE, - NULL) + if (!WPACKET_reserve_bytes(thispkt, SSL_RT_MAX_CIPHER_BLOCK_SIZE, + NULL) /* * We also need next the amount of bytes written to this * sub-packet diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c index 9839e1dc54..8fe2dfd3aa 100644 --- a/ssl/t1_enc.c +++ b/ssl/t1_enc.c @@ -448,7 +448,7 @@ int tls1_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p, */ if (!ssl3_digest_cached_records(s, 1)) return 0; - if(!ssl_handshake_hash(s, hash, sizeof(hash), &hashlen)) + if (!ssl_handshake_hash(s, hash, sizeof(hash), &hashlen)) return 0; #ifdef SSL_DEBUG fprintf(stderr, "Handshake hashes:\n"); diff --git a/test/testutil.h b/test/testutil.h index 006bfb3a68..8373bb8a09 100644 --- a/test/testutil.h +++ b/test/testutil.h @@ -282,7 +282,7 @@ void test_perror(const char *s); * a default description that indicates the file and line number of the error. * * The following macros guarantee to evaluate each argument exactly once. - * This allows constructs such as: if(!TEST_ptr(ptr = OPENSSL_malloc(..))) + * This allows constructs such as: if (!TEST_ptr(ptr = OPENSSL_malloc(..))) * to produce better contextual output than: * ptr = OPENSSL_malloc(..); * if (!TEST_ptr(ptr)) -- 2.34.1