]> granicus.if.org Git - pdns/commitdiff
Work around a bug in gcc 3.4.something, reported by Jorn Ekkelenkamp and
authorBert Hubert <bert.hubert@netherlabs.nl>
Tue, 28 Mar 2006 11:18:02 +0000 (11:18 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Tue, 28 Mar 2006 11:18:02 +0000 (11:18 +0000)
others

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@638 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/dnswriter.cc

index ef09c98c9d4ae1ad4ea66a33779f73a6696896a5..1a4add9d0263052f7733f673457135db8c57110e 100644 (file)
@@ -23,6 +23,7 @@ DNSPacketWriter::DNSPacketWriter(vector<uint8_t>& content, const string& qname,
   
   len=d_content.size();
   d_content.resize(len + d_record.size() + 4);
+
   ptr=&*d_record.begin();
   dptr=(&*d_content.begin()) + len;
   
@@ -32,10 +33,12 @@ DNSPacketWriter::DNSPacketWriter(vector<uint8_t>& content, const string& qname,
   d_record.clear();
 
   qtype=htons(qtype);
-  memcpy(&d_content[len], &qtype, 2);
-
   qclass=htons(qclass);
-  memcpy(&d_content[len+2], &qclass, 2);
+
+  vector<uint8_t>::iterator i=d_content.begin()+len; // this works around a gcc 3.4 bug
+  memcpy(&*i, &qtype, 2);
+  i+=2;
+  memcpy(&*i, &qclass, 2);
 
   d_stuff=0xffff;
 }