diff options
author | Jelte Jansen <jelte@isc.org> | 2013-01-10 09:56:52 +0100 |
---|---|---|
committer | Jelte Jansen <jelte@isc.org> | 2013-01-10 12:35:11 +0100 |
commit | 82a1d5c34e951687d67a6313fb42d9e75768adbc (patch) | |
tree | 8151aecaebe177a8ec43f4a2e8f5d623432d7c04 /src/lib/dns/rdata/generic/naptr_35.cc | |
parent | [2498] Update HINFO and NAPTR to use new createFromText (diff) | |
download | kea-82a1d5c34e951687d67a6313fb42d9e75768adbc.tar.xz kea-82a1d5c34e951687d67a6313fb42d9e75768adbc.zip |
[2498] move out some common charstrings functions
And add a number of tests
Diffstat (limited to 'src/lib/dns/rdata/generic/naptr_35.cc')
-rw-r--r-- | src/lib/dns/rdata/generic/naptr_35.cc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/dns/rdata/generic/naptr_35.cc b/src/lib/dns/rdata/generic/naptr_35.cc index 611fc5b16d..4d891e6a6c 100644 --- a/src/lib/dns/rdata/generic/naptr_35.cc +++ b/src/lib/dns/rdata/generic/naptr_35.cc @@ -45,9 +45,9 @@ public: preference = buffer.readUint16(); rdata_len -= 4; - rdata_len -= readTextField(flags, buffer, rdata_len); - rdata_len -= readTextField(services, buffer, rdata_len); - rdata_len -= readTextField(regexp, buffer, rdata_len); + rdata_len -= detail::bufferToCharString(buffer, rdata_len, flags); + rdata_len -= detail::bufferToCharString(buffer, rdata_len, services); + rdata_len -= detail::bufferToCharString(buffer, rdata_len, regexp); replacement = Name(buffer); if (rdata_len < 1) { isc_throw(isc::dns::DNSMessageFORMERR, "Error in parsing " @@ -192,22 +192,22 @@ NAPTR::compare(const Rdata& other) const { return (1); } - if (impl_->flags < other_naptr.impl_->flags) { - return (-1); - } else if (impl_->flags > other_naptr.impl_->flags) { - return (1); + const int fcmp = detail::compareCharStrings(impl_->flags, + other_naptr.impl_->flags); + if (fcmp != 0) { + return (fcmp); } - if (impl_->services < other_naptr.impl_->services) { - return (-1); - } else if (impl_->services > other_naptr.impl_->services) { - return (1); + const int scmp = detail::compareCharStrings(impl_->services, + other_naptr.impl_->services); + if (scmp != 0) { + return (scmp); } - if (impl_->regexp < other_naptr.impl_->regexp) { - return (-1); - } else if (impl_->regexp > other_naptr.impl_->regexp) { - return (1); + const int rcmp = detail::compareCharStrings(impl_->regexp, + other_naptr.impl_->regexp); + if (rcmp != 0) { + return (rcmp); } return (compareNames(impl_->replacement, other_naptr.impl_->replacement)); |