[svn] commit: r392 - in /branches/jinmei-dnsmessageapi/src/lib/dns/cpp: name.cc name_unittest.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Sat Dec 19 03:24:09 UTC 2009
Author: jinmei
Date: Sat Dec 19 03:24:09 2009
New Revision: 392
Log:
throw IncompleteName (instead of BadLabelType) when the "from text" constructor
finds the name incomplete. This also covers the case an empty string is given.
Modified:
branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.cc
branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name_unittest.cc
Modified: branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.cc
==============================================================================
--- branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.cc (original)
+++ branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.cc Sat Dec 19 03:24:09 2009
@@ -66,6 +66,7 @@
static Initializer initialier;
}
+namespace {
typedef enum {
ft_init = 0,
ft_start,
@@ -75,6 +76,7 @@
ft_escdecimal,
ft_at
} ft_state;
+}
Name::Name(const std::string &namestring, bool downcase)
{
@@ -213,7 +215,7 @@
}
assert(s == send);
if (state != ft_ordinary && state != ft_at) {
- dns_throw(BadLabelType, "incomplete label");
+ dns_throw(IncompleteName, "incomplete textual name");
}
if (state == ft_ordinary) {
assert(count != 0);
Modified: branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name_unittest.cc
==============================================================================
--- branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name_unittest.cc (original)
+++ branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name_unittest.cc Sat Dec 19 03:24:09 2009
@@ -186,7 +186,7 @@
"123456789.123456789.123456789.123456789.123456789."
"123"));
// \DDD must consist of 3 digits.
- EXPECT_THROW(Name("\\12"), isc::dns::BadLabelType);
+ EXPECT_THROW(Name("\\12"), isc::dns::IncompleteName);
// a name with the max number of labels. should be constructed without
// an error, and its length should be the max value.
More information about the bind10-changes
mailing list