]> granicus.if.org Git - pdns/commitdiff
prepare ourselves for an SSO string version of DNSName.
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 10 Mar 2015 15:17:39 +0000 (16:17 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 10 Mar 2015 15:17:39 +0000 (16:17 +0100)
pdns/dnsdist.cc
pdns/dnsname.cc
pdns/dnsname.hh

index 3782d04138311df9b4fa11b89045cd06b82c0444..8042a03fc9ec5a129d4697122b4fc84eb1848c74 100644 (file)
 #include "sstuff.hh"
 #include "misc.hh"
 #include <netinet/tcp.h>
-
-
-
 #include <limits>
-
 #include "dolog.hh"
 #include <readline/readline.h>
 #include <readline/history.h>
index ea446b2e5ea141dcc80ad605272b47f04fcc1295..be9821f1a1fe84f50e027b106ba373e87131f52c 100644 (file)
@@ -19,7 +19,7 @@ DNSName::DNSName(const char* p)
     if(e.size() > 63)
       throw std::range_error("label too long");
     d_storage.append(1, (char)e.size());
-    d_storage.append(e);
+    d_storage.append(e.c_str(), e.length());
   }
 }
 
@@ -67,7 +67,7 @@ std::string DNSName::toString() const
 
 std::string DNSName::toDNSString() const
 {
-  string ret(d_storage);
+  string ret(d_storage.c_str(), d_storage.length());
   ret.append(1,(char)0);
   return ret;
 }
@@ -92,7 +92,7 @@ void DNSName::appendRawLabel(const std::string& label)
   if(label.size() > 63)
     throw std::range_error("label too long");
   d_storage.append(1, (char)label.size());
-  d_storage.append(label);
+  d_storage.append(label.c_str(), label.length());
 }
 
 void DNSName::prependRawLabel(const std::string& label)
@@ -103,8 +103,8 @@ void DNSName::prependRawLabel(const std::string& label)
   if(label.size() > 63)
     throw std::range_error("label too long");
 
-  string prep(1, (char)label.size());
-  prep.append(label);
+  string_t prep(1, (char)label.size());
+  prep.append(label.c_str(), label.size());
   d_storage = prep+d_storage;
 }
 
index fb74061a64b48c5b5599b1b3ade70853bc69c3df..ec61a04d9f6ec14421d6de86cf52c101058fce5f 100644 (file)
@@ -5,6 +5,8 @@
 #include <deque>
 #include <strings.h>
 
+// #include <ext/vstring.h>
+
 /* Quest in life: 
      accept escaped ascii presentations of DNS names and store them "natively"
      accept a DNS packet with an offset, and extract a DNS name from it
@@ -51,7 +53,9 @@ public:
   }
 
 private:
-  std::string d_storage;
+  //  typedef __gnu_cxx::__sso_string string_t;
+  typedef std::string string_t;
+  string_t d_storage;
   static std::string escapeLabel(const std::string& orig);
   static std::string unescapeLabel(const std::string& orig);
 };