From c335b7f1f7de3b49cb886c3ae12a0384e293832f Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Sat, 27 Oct 2018 15:04:50 +0200 Subject: x509asn1: suppress left shift on signed value Use an unsigned variable: as the signed operation behavior is undefined, this change silents clang-tidy about it. Ref: https://github.com/curl/curl/pull/3163 Reported-By: Daniel Stenberg --- lib/x509asn1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/x509asn1.c b/lib/x509asn1.c index a0be23d61..c1dcb05c6 100644 --- a/lib/x509asn1.c +++ b/lib/x509asn1.c @@ -223,7 +223,7 @@ static const char *bit2str(const char *beg, const char *end) static const char *int2str(const char *beg, const char *end) { - long val = 0; + unsigned long val = 0; size_t n = end - beg; /* Convert an ASN.1 integer value into its string representation. @@ -243,7 +243,7 @@ static const char *int2str(const char *beg, const char *end) do val = (val << 8) | *(const unsigned char *) beg++; while(beg < end); - return curl_maprintf("%s%lx", (val < 0 || val >= 10)? "0x": "", val); + return curl_maprintf("%s%lx", val >= 10? "0x": "", val); } static ssize_t -- cgit v1.2.3