From eb914147bb88c0ce3eced048d12959759cce7da9 Mon Sep 17 00:00:00 2001 From: Axel Viala Date: Sun, 11 Dec 2022 15:56:31 +0100 Subject: [PATCH] clang-tidy: IsTimeSpec function: curly + implicit conversions. Review Apply @omoerbeek suggestion fix cast to unsigned char. --- pdns/zoneparser-tng.cc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) 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])); -- 2.47.2