From fdc3e27b40542cbd1dc1c21e3c4218ed284f30f5 Mon Sep 17 00:00:00 2001 From: Ruben d'Arco Date: Thu, 4 Jun 2015 13:20:19 +0200 Subject: [PATCH] It compiles. --- pdns/dnsname.cc | 4 ++++ pdns/dnsname.hh | 1 + pdns/packetcache.cc | 2 +- pdns/packetcache.hh | 8 ++++---- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pdns/dnsname.cc b/pdns/dnsname.cc index 329fa58de..b13c899d3 100644 --- a/pdns/dnsname.cc +++ b/pdns/dnsname.cc @@ -89,6 +89,10 @@ std::string DNSName::toDNSString() const return ret; } +const char* DNSName::toCString() const { + return this->toString().c_str(); +} + // are WE part of parent bool DNSName::isPartOf(const DNSName& parent) const { diff --git a/pdns/dnsname.hh b/pdns/dnsname.hh index af243d33b..3939fa9e0 100644 --- a/pdns/dnsname.hh +++ b/pdns/dnsname.hh @@ -37,6 +37,7 @@ public: std::string toString() const; //!< Our human-friendly, escaped, representation std::string toDNSString() const; //!< Our representation in DNS native format + const char* toCString() const; //!< Easy access to toString().c_str(); void appendRawLabel(const std::string& str); //!< Append this unescaped label void prependRawLabel(const std::string& str); //!< Prepend this unescaped label std::vector getRawLabels() const; //!< Individual raw unescaped labels diff --git a/pdns/packetcache.cc b/pdns/packetcache.cc index ced4b0e21..12cf7fe28 100644 --- a/pdns/packetcache.cc +++ b/pdns/packetcache.cc @@ -229,7 +229,7 @@ int PacketCache::purge(const string &match) cmap_t::const_iterator start=iter; for(; iter != mc.d_map.end(); ++iter) { - if(iter->qname.compare(0, zone.size(), zone) != 0) { + if(iter->qname.toString().compare(0, zone.size(), zone) != 0) { //TODO: check if there is a nicer method for this break; } delcount++; diff --git a/pdns/packetcache.hh b/pdns/packetcache.hh index 3b4e936db..fb8666c50 100644 --- a/pdns/packetcache.hh +++ b/pdns/packetcache.hh @@ -98,7 +98,7 @@ private: ordered_unique< composite_key< CacheEntry, - member, + member, member, member, member, @@ -107,7 +107,7 @@ private: member, member >, - composite_key_compare, std::less, std::less, std::less, std::less, + composite_key_compare, std::less, std::less, std::less, std::less, std::less, std::less, std::less > >, sequenced<> @@ -122,9 +122,9 @@ private: }; vector d_maps; - MapCombo& getMap(const std::string& qname) + MapCombo& getMap(const DNSName& qname) { - return d_maps[burtle((const unsigned char*)qname.c_str(), qname.length(), 0) % d_maps.size()]; + return d_maps[burtle((const unsigned char*)qname.toCString(), qname.toString().length(), 0) % d_maps.size()]; } -- 2.40.0