From: Otto Moerbeek Date: Wed, 2 Sep 2020 08:59:52 +0000 (+0200) Subject: Make comments less confusing X-Git-Tag: auth-4.4.0-alpha2~49^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9432%2Fhead;p=thirdparty%2Fpdns.git Make comments less confusing --- diff --git a/pdns/iputils.cc b/pdns/iputils.cc index cb737b9426..64f2138b6c 100644 --- a/pdns/iputils.cc +++ b/pdns/iputils.cc @@ -437,15 +437,15 @@ bool isTCPSocketUsable(int sock) return false; } /* mission in life: parse four cases - 1) 1.2.3.4 - 2) 1.2.3.4:5300 - 3) 2001::1 - 4) [2002::1]:53 + 1) [2002::1]:53 + 2) 1.2.3.4 + 3) 1.2.3.4:5300 + 4) 2001::1 no port allowed */ ComboAddress parseIPAndPort(const std::string& input, uint16_t port) { - if (input[0] == '[') { // case 4 + if (input[0] == '[') { // case 1 auto both = splitField(input.substr(1), ']'); return ComboAddress(both.first, both.second.empty() ? port : static_cast(pdns_stou(both.second.substr(1)))); } @@ -460,9 +460,9 @@ ComboAddress parseIPAndPort(const std::string& input, uint16_t port) } } switch (count) { - case 0: // case 1 + case 0: // case 2 return ComboAddress(input, port); - case 1: { // case 2 + case 1: { // case 3 string::size_type cpos = input.rfind(':'); pair both; both.first = input.substr(0, cpos); @@ -471,7 +471,7 @@ ComboAddress parseIPAndPort(const std::string& input, uint16_t port) uint16_t newport = static_cast(pdns_stou(both.second)); return ComboAddress(both.first, newport); } - default: // case 3 + default: // case 4 return ComboAddress(input, port); } }