[svn] commit: r1810 - /branches/trac49/src/lib/dns/name.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue May 11 08:33:48 UTC 2010
Author: jinmei
Date: Tue May 11 08:33:48 2010
New Revision: 1810
Log:
corrected/completed the function body so that the unit tests will pass.
Modified:
branches/trac49/src/lib/dns/name.cc
Modified: branches/trac49/src/lib/dns/name.cc
==============================================================================
--- branches/trac49/src/lib/dns/name.cc (original)
+++ branches/trac49/src/lib/dns/name.cc Tue May 11 08:33:48 2010
@@ -732,14 +732,24 @@
Name
createAncestorNameOf(const Name& source, const unsigned int level) {
- // return something that never matches "expected" one in unit tests
- return (source.concatenate(level == 0 ? Name("dummy") : Name("DUMMY")));
+ if (level >= source.getLabelCount()) {
+ isc_throw(OutOfRange, "createAncestorNameOf: invalid level (" << level
+ << ") for name " << source);
+ }
+
+ return (source.split(level, source.getLabelCount() - level));
}
Name
createSuffixNameOf(const Name& source, const unsigned int labels) {
- // return something that never matches "expected" one in unit tests
- return (source.concatenate(labels == 0 ? Name("dummy") : Name("DUMMY")));
+ const unsigned int source_labels = source.getLabelCount();
+
+ if (labels == 0 || labels > source_labels) {
+ isc_throw(OutOfRange, "createSuffixNameOf: invalid labels (" << labels
+ << ") for name " << source);
+ }
+
+ return (source.split(source_labels - labels, labels));
}
std::ostream&
More information about the bind10-changes
mailing list