]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2512] Add some comments
authorMukund Sivaraman <muks@isc.org>
Tue, 18 Feb 2014 12:21:45 +0000 (17:51 +0530)
committerMukund Sivaraman <muks@isc.org>
Tue, 18 Feb 2014 12:21:45 +0000 (17:51 +0530)
src/lib/dns/rdata/generic/detail/char_string.cc

index 16b281dae687b032f57bd701acc0d5e3f9e58a35..328fa7b406401b5dcb2419c403c455e5d072a66b 100644 (file)
@@ -105,7 +105,13 @@ stringToCharStringData(const MasterToken::StringRegion& str_region,
         int c = (*s & 0xff);
         if (escape && std::isdigit(c) != 0) {
             c = decimalToNumber(s, s_end);
+            // decimalToNumber() already throws if (s_end - s) is less
+            // than 3, so the following assertion is unnecessary. But we
+            // assert it anyway. 'n' is an unsigned type (size_t) and
+            // can underflow.
             assert(n >= 3);
+            // 'n' and 's' are also updated by 1 in the for statement's
+            // expression, so we update them by 2 instead of 3 here.
             n -= 2;
             s += 2;
         } else if (!escape && c == '\\') {