Re-run clang-format with InsertBraces.
This CL runs the same command as in the preceding CL, but with
'IncludeBraces: true' added to .clang-format. I've split this out
separately because the documentation says:
> Setting this option to true could lead to incorrect code formatting
> due to clang-format’s lack of complete semantic information. As such,
> extra care should be taken to review code changes made by this option.
I've also kept InsertBraces out of .clang-format for now because it's a
fairly recent option, and clang-format fails when it sees unrecognized
options.
Change-Id: I305ea7bb2633704053a1f8de1e11b037b9fc8a76
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/53086
Commit-Queue: Bob Beck <bbe@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c
index 3a314f1..c0cc2f9 100644
--- a/crypto/asn1/a_utctm.c
+++ b/crypto/asn1/a_utctm.c
@@ -88,13 +88,15 @@
t.data = (unsigned char *)str;
if (ASN1_UTCTIME_check(&t)) {
if (s != NULL) {
- if (!ASN1_STRING_set((ASN1_STRING *)s, (unsigned char *)str, t.length))
+ if (!ASN1_STRING_set((ASN1_STRING *)s, (unsigned char *)str, t.length)) {
return 0;
+ }
s->type = V_ASN1_UTCTIME;
}
return (1);
- } else
+ } else {
return (0);
+ }
}
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) {
@@ -113,20 +115,24 @@
free_s = 1;
s = ASN1_UTCTIME_new();
}
- if (s == NULL)
+ if (s == NULL) {
goto err;
-
- ts = OPENSSL_gmtime(&t, &data);
- if (ts == NULL)
- goto err;
-
- if (offset_day || offset_sec) {
- if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
- goto err;
}
- if ((ts->tm_year < 50) || (ts->tm_year >= 150))
+ ts = OPENSSL_gmtime(&t, &data);
+ if (ts == NULL) {
goto err;
+ }
+
+ if (offset_day || offset_sec) {
+ if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) {
+ goto err;
+ }
+ }
+
+ if ((ts->tm_year < 50) || (ts->tm_year >= 150)) {
+ goto err;
+ }
p = (char *)s->data;
if ((p == NULL) || ((size_t)s->length < len)) {
@@ -135,8 +141,9 @@
OPENSSL_PUT_ERROR(ASN1, ERR_R_MALLOC_FAILURE);
goto err;
}
- if (s->data != NULL)
+ if (s->data != NULL) {
OPENSSL_free(s->data);
+ }
s->data = (unsigned char *)p;
}
@@ -147,8 +154,9 @@
s->type = V_ASN1_UTCTIME;
return (s);
err:
- if (free_s && s)
+ if (free_s && s) {
ASN1_UTCTIME_free(s);
+ }
return NULL;
}
@@ -156,22 +164,29 @@
struct tm stm, ttm;
int day, sec;
- if (!asn1_utctime_to_tm(&stm, s))
+ if (!asn1_utctime_to_tm(&stm, s)) {
return -2;
+ }
- if (!OPENSSL_gmtime(&t, &ttm))
+ if (!OPENSSL_gmtime(&t, &ttm)) {
return -2;
+ }
- if (!OPENSSL_gmtime_diff(&day, &sec, &ttm, &stm))
+ if (!OPENSSL_gmtime_diff(&day, &sec, &ttm, &stm)) {
return -2;
+ }
- if (day > 0)
+ if (day > 0) {
return 1;
- if (day < 0)
+ }
+ if (day < 0) {
return -1;
- if (sec > 0)
+ }
+ if (sec > 0) {
return 1;
- if (sec < 0)
+ }
+ if (sec < 0) {
return -1;
+ }
return 0;
}