From: Axel Viala Date: Sun, 11 Dec 2022 14:56:31 +0000 (+0100) Subject: clang-tidy: IsTimeSpec function: curly + implicit conversions. X-Git-Tag: dnsdist-1.8.0-rc1~140^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb914147bb88c0ce3eced048d12959759cce7da9;p=thirdparty%2Fpdns.git clang-tidy: IsTimeSpec function: curly + implicit conversions. Review Apply @omoerbeek suggestion fix cast to unsigned char. --- diff --git a/pdns/zoneparser-tng.cc b/pdns/zoneparser-tng.cc index bf7a519e9e..78389057ac 100644 --- a/pdns/zoneparser-tng.cc +++ b/pdns/zoneparser-tng.cc @@ -106,14 +106,21 @@ static string makeString(const string& line, const pair(*iter); + if (isdigit(current) != 0) { continue; - if(iter+1 != nextpart.end()) + } + + if (iter + 1 != nextpart.end()) { return false; - char c=tolower(*iter); + } + + char c = static_cast(tolower(current)); return (c=='s' || c=='m' || c=='h' || c=='d' || c=='w' || c=='y'); } return true; @@ -621,8 +628,9 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment) } rr.content.clear(); for(string::size_type n = 0; n < recparts.size(); ++n) { - if(n) + if (n != 0) { rr.content.append(1,' '); + } rr.content+=recparts[n]; } @@ -641,8 +649,9 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment) } rr.content.clear(); for(string::size_type n = 0; n < recparts.size(); ++n) { - if(n) + if (n != 0) { rr.content.append(1,' '); + } if(n > 1) rr.content+=std::to_string(makeTTLFromZone(recparts[n]));