summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_utctm.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2017-07-27 14:54:27 +1000
committerPauli <paul.dale@oracle.com>2017-07-27 14:54:27 +1000
commit52b6e17da4c8eea982a19d1a1f34ba24416fb73e (patch)
tree77ac375597ba0ad55487f06e26a6b10a44d790f4 /crypto/asn1/a_utctm.c
parentd67e755418b62fb451ec221c126c9935a06ea63b (diff)
Fix trivial coding style nits in a_time/a_tm files
Clean up some true/false returns Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4001)
Diffstat (limited to 'crypto/asn1/a_utctm.c')
-rw-r--r--crypto/asn1/a_utctm.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c
index 2a864180e3..668efa48bb 100644
--- a/crypto/asn1/a_utctm.c
+++ b/crypto/asn1/a_utctm.c
@@ -112,7 +112,7 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
if (!asn1_utctime_to_tm(&stm, s))
return -2;
- if (!OPENSSL_gmtime(&t, &ttm))
+ if (OPENSSL_gmtime(&t, &ttm) == NULL)
return -2;
if (!OPENSSL_gmtime_diff(&day, &sec, &ttm, &stm))
@@ -129,6 +129,11 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
return 0;
}
+static const char _asn1_mon[12][4] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
+
int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm)
{
const char *v;
@@ -159,11 +164,9 @@ int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm)
(v[10] >= '0') && (v[10] <= '9') && (v[11] >= '0') && (v[11] <= '9'))
s = (v[10] - '0') * 10 + (v[11] - '0');
- if (BIO_printf(bp, "%s %2d %02d:%02d:%02d %d%s",
- _asn1_mon[M - 1], d, h, m, s, y + 1900,
- (gmt) ? " GMT" : "") <= 0)
- return 0;
- return 1;
+ return BIO_printf(bp, "%s %2d %02d:%02d:%02d %d%s",
+ _asn1_mon[M - 1], d, h, m, s, y + 1900,
+ (gmt) ? " GMT" : "") > 0;
err:
BIO_write(bp, "Bad time value", 14);
return 0;