From: Bert Hubert Date: Tue, 28 Mar 2006 11:18:02 +0000 (+0000) Subject: Work around a bug in gcc 3.4.something, reported by Jorn Ekkelenkamp and X-Git-Tag: rec-3-0~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e984b465d319a6380108f360d61d15d3e063a370;p=pdns Work around a bug in gcc 3.4.something, reported by Jorn Ekkelenkamp and others git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@638 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/dnswriter.cc b/pdns/dnswriter.cc index ef09c98c9..1a4add9d0 100644 --- a/pdns/dnswriter.cc +++ b/pdns/dnswriter.cc @@ -23,6 +23,7 @@ DNSPacketWriter::DNSPacketWriter(vector& 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& 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::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; }