From: Kurt Roeckx Date: Sun, 15 Jan 2017 11:33:45 +0000 (+0100) Subject: Fix VC warnings about unary minus to an unsigned type. X-Git-Tag: OpenSSL_1_1_0d~45 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=39ff4d7adde80b87c994649559921b9189b9612f;p=oweals%2Fopenssl.git Fix VC warnings about unary minus to an unsigned type. Reviewed-by: Andy Polyakov GH: #2230 (cherry picked from commit 68d4bcfd0651c7ea5d37ca52abc0d2e6e6b3bd20) --- diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index 833322e89b..e0bcd6e502 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -289,7 +289,7 @@ static int asn1_get_int64(int64_t *pr, const unsigned char *b, size_t blen, ASN1err(ASN1_F_ASN1_GET_INT64, ASN1_R_TOO_SMALL); return 0; } - *pr = -(uint64_t)r; + *pr = 0 - (uint64_t)r; } else { if (r > INT64_MAX) { ASN1err(ASN1_F_ASN1_GET_INT64, ASN1_R_TOO_LARGE); diff --git a/crypto/asn1/x_long.c b/crypto/asn1/x_long.c index e86e4c72c7..c2844713cf 100644 --- a/crypto/asn1/x_long.c +++ b/crypto/asn1/x_long.c @@ -76,7 +76,7 @@ static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, * set. */ if (ltmp < 0) - utmp = -(unsigned long)ltmp - 1; + utmp = 0 - (unsigned long)ltmp - 1; else utmp = ltmp; clen = BN_num_bits_word(utmp); diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c index a46d8b160a..e91ab6de22 100644 --- a/crypto/bio/b_print.c +++ b/crypto/bio/b_print.c @@ -451,7 +451,7 @@ fmtint(char **sbuffer, if (!(flags & DP_F_UNSIGNED)) { if (value < 0) { signvalue = '-'; - uvalue = -(unsigned LLONG)value; + uvalue = 0 - (unsigned LLONG)value; } else if (flags & DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE)