From: JINMEI Tatuya Date: Thu, 15 Nov 2012 03:16:04 +0000 (-0800) Subject: [2373] some more comment updates X-Git-Tag: trac2487_base^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d25a434d8e43ce6edd20be13fa2e0653fc23591d;p=thirdparty%2Fkea.git [2373] some more comment updates --- diff --git a/src/lib/dns/master_lexer.cc b/src/lib/dns/master_lexer.cc index 7d79e0d063..185df8b078 100644 --- a/src/lib/dns/master_lexer.cc +++ b/src/lib/dns/master_lexer.cc @@ -64,9 +64,13 @@ struct MasterLexer::MasterLexerImpl { } bool isTokenEnd(int c, bool escaped) { + // Special case of EOF (end of stream); this is not in the bitmaps if (c == InputSource::END_OF_STREAM) { return (true); } + // In this implementation we only ensure the behavior for unsigned + // range of characters, so we restrict the range of the values up to + // 0x7f = 127 return (escaped ? esc_separators_.test(c & 0x7f) : separators_.test(c & 0x7f)); } @@ -84,7 +88,7 @@ struct MasterLexer::MasterLexerImpl { // Bitmaps that gives whether a given (positive) character should be // considered a separator of a string/number token. The esc_ version // is a subset of the other, excluding characters that can be ignored - // if escaped by a backslash. + // if escaped by a backslash. See isTokenEnd() for the bitmap size. std::bitset<128> separators_; std::bitset<128> esc_separators_; }; diff --git a/src/lib/dns/tests/master_lexer_state_unittest.cc b/src/lib/dns/tests/master_lexer_state_unittest.cc index 5c3be03009..f64ab79af6 100644 --- a/src/lib/dns/tests/master_lexer_state_unittest.cc +++ b/src/lib/dns/tests/master_lexer_state_unittest.cc @@ -255,6 +255,8 @@ TEST_F(MasterLexerStateTest, crlf) { EXPECT_EQ(Token::END_OF_FILE, s_crlf.getToken(lexer).getType()); } +// Commonly used check for string related test cases, checking if the given +// token has expected values. void stringTokenCheck(const std::string& expected, const MasterLexer::Token& token, bool quoted = false)