From: Bert Hubert Date: Sun, 6 Feb 2011 11:11:34 +0000 (+0000) Subject: big batch of 'using namespace std;' removal X-Git-Tag: auth-3.0~271 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10f4eea89298873340549973fc26b589c7020e34;p=thirdparty%2Fpdns.git big batch of 'using namespace std;' removal git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1976 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/modules/db2backend/DB2Backend.cc b/modules/db2backend/DB2Backend.cc index 33016dc6dd..d9a63522e1 100644 --- a/modules/db2backend/DB2Backend.cc +++ b/modules/db2backend/DB2Backend.cc @@ -5,7 +5,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include #include diff --git a/modules/db2backend/DB2Backend.hh b/modules/db2backend/DB2Backend.hh index 6ca98e128a..400e40da69 100644 --- a/modules/db2backend/DB2Backend.hh +++ b/modules/db2backend/DB2Backend.hh @@ -6,7 +6,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include diff --git a/modules/db2backend/DB2Exception.hh b/modules/db2backend/DB2Exception.hh index 78a95b9579..85eab98417 100644 --- a/modules/db2backend/DB2Exception.hh +++ b/modules/db2backend/DB2Exception.hh @@ -5,7 +5,7 @@ #include -using namespace std; +#include "namespaces.hh" #include diff --git a/modules/geobackend/geobackend.hh b/modules/geobackend/geobackend.hh index 9edf2af20c..8e2e9e6102 100644 --- a/modules/geobackend/geobackend.hh +++ b/modules/geobackend/geobackend.hh @@ -15,7 +15,7 @@ #include "ippreftree.hh" -using namespace std; +#include "namespaces.hh" class GeoRecord { public: diff --git a/modules/geobackend/ippreftree.hh b/modules/geobackend/ippreftree.hh index ce2e5c3705..54780f5e43 100644 --- a/modules/geobackend/ippreftree.hh +++ b/modules/geobackend/ippreftree.hh @@ -10,7 +10,7 @@ #include #include -using namespace std; +#include "namespaces.hh" // Use old style C structs for efficiency typedef struct node_t { diff --git a/modules/gmysqlbackend/gmysqlbackend.cc b/modules/gmysqlbackend/gmysqlbackend.cc index 9d98b01799..00029455ad 100644 --- a/modules/gmysqlbackend/gmysqlbackend.cc +++ b/modules/gmysqlbackend/gmysqlbackend.cc @@ -2,7 +2,7 @@ #include #include -using namespace std; +#include "pdns/namespaces.hh" #include "pdns/dns.hh" #include "pdns/dnsbackend.hh" diff --git a/modules/gmysqlbackend/gmysqlbackend.hh b/modules/gmysqlbackend/gmysqlbackend.hh index b9f0e7ca62..68356165cc 100644 --- a/modules/gmysqlbackend/gmysqlbackend.hh +++ b/modules/gmysqlbackend/gmysqlbackend.hh @@ -3,7 +3,7 @@ #include "pdns/backends/gsql/gsqlbackend.hh" -using namespace std; +#include "pdns/namespaces.hh" /** The gMySQLBackend is a DNSBackend that can answer DNS related questions. It looks up data in MySQL */ diff --git a/modules/gmysqlbackend/smysql.cc b/modules/gmysqlbackend/smysql.cc index ec666c5a10..f3fb16a77e 100644 --- a/modules/gmysqlbackend/smysql.cc +++ b/modules/gmysqlbackend/smysql.cc @@ -7,7 +7,7 @@ #include "pdns/misc.hh" #include "pdns/logger.hh" #include "pdns/dns.hh" -using namespace std; +#include "pdns/namespaces.hh" bool SMySQL::s_dolog; diff --git a/modules/goraclebackend/goraclebackend.cc b/modules/goraclebackend/goraclebackend.cc index adc4d78c14..8450a467db 100644 --- a/modules/goraclebackend/goraclebackend.cc +++ b/modules/goraclebackend/goraclebackend.cc @@ -2,7 +2,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include "pdns/dns.hh" #include "pdns/dnsbackend.hh" diff --git a/modules/goraclebackend/goraclebackend.hh b/modules/goraclebackend/goraclebackend.hh index 157bc79d53..0f408194bb 100644 --- a/modules/goraclebackend/goraclebackend.hh +++ b/modules/goraclebackend/goraclebackend.hh @@ -3,7 +3,7 @@ #include "pdns/backends/gsql/gsqlbackend.hh" -using namespace std; +#include "namespaces.hh" /** The gOracleBackend is a DNSBackend that can answer DNS related questions. It looks up data in PostgreSQL */ diff --git a/modules/goraclebackend/soracle.cc b/modules/goraclebackend/soracle.cc index a10646935c..fd5fa0ecd4 100644 --- a/modules/goraclebackend/soracle.cc +++ b/modules/goraclebackend/soracle.cc @@ -8,7 +8,7 @@ #include "pdns/logger.hh" #include "pdns/dns.hh" #include -using namespace std; +#include "namespaces.hh" bool SOracle::s_dolog; diff --git a/modules/gpgsqlbackend/gpgsqlbackend.cc b/modules/gpgsqlbackend/gpgsqlbackend.cc index 1e63db4ac4..c81f7ee023 100644 --- a/modules/gpgsqlbackend/gpgsqlbackend.cc +++ b/modules/gpgsqlbackend/gpgsqlbackend.cc @@ -1,7 +1,7 @@ #include #include -using namespace std; +#include "pdns/namespaces.hh" #include "pdns/dns.hh" #include "pdns/dnsbackend.hh" diff --git a/modules/gpgsqlbackend/gpgsqlbackend.hh b/modules/gpgsqlbackend/gpgsqlbackend.hh index 0d0dcc87e6..74f72bbcdb 100644 --- a/modules/gpgsqlbackend/gpgsqlbackend.hh +++ b/modules/gpgsqlbackend/gpgsqlbackend.hh @@ -2,7 +2,7 @@ #include #include "pdns/backends/gsql/gsqlbackend.hh" -using namespace std; +#include "pdns/namespaces.hh" /** The gPgSQLBackend is a DNSBackend that can answer DNS related questions. It looks up data in PostgreSQL */ diff --git a/modules/gpgsqlbackend/spgsql.cc b/modules/gpgsqlbackend/spgsql.cc index 4ff597fb77..1693b828b0 100644 --- a/modules/gpgsqlbackend/spgsql.cc +++ b/modules/gpgsqlbackend/spgsql.cc @@ -7,7 +7,7 @@ #include "pdns/logger.hh" #include "pdns/dns.hh" -using namespace std; +#include "pdns/namespaces.hh" bool SPgSQL::s_dolog; diff --git a/modules/gpgsqlbackend/spgsql.hh b/modules/gpgsqlbackend/spgsql.hh index 592b403078..d3606d5b6a 100644 --- a/modules/gpgsqlbackend/spgsql.hh +++ b/modules/gpgsqlbackend/spgsql.hh @@ -2,7 +2,7 @@ for more information. */ #ifndef SPGSQL_HH #define SPGSQL_HH -using namespace std; +#include "pdns/namespaces.hh" #include "pdns/backends/gsql/ssql.hh" #include diff --git a/modules/mydnsbackend/mydnsbackend.cc b/modules/mydnsbackend/mydnsbackend.cc index 79e6af66f3..ec4a6915fa 100644 --- a/modules/mydnsbackend/mydnsbackend.cc +++ b/modules/mydnsbackend/mydnsbackend.cc @@ -24,7 +24,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include #include diff --git a/modules/mydnsbackend/mydnsbackend.hh b/modules/mydnsbackend/mydnsbackend.hh index 5ce616cf1b..d7e4f19887 100644 --- a/modules/mydnsbackend/mydnsbackend.hh +++ b/modules/mydnsbackend/mydnsbackend.hh @@ -4,7 +4,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include diff --git a/modules/mysqlbackend/mysqlcbackend.cc b/modules/mysqlbackend/mysqlcbackend.cc index 027d03186d..900d3798c8 100644 --- a/modules/mysqlbackend/mysqlcbackend.cc +++ b/modules/mysqlbackend/mysqlcbackend.cc @@ -5,7 +5,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include #include diff --git a/modules/mysqlbackend/mysqlcbackend.hh b/modules/mysqlbackend/mysqlcbackend.hh index ca4c5b1b49..b0e7fb1d50 100644 --- a/modules/mysqlbackend/mysqlcbackend.hh +++ b/modules/mysqlbackend/mysqlcbackend.hh @@ -4,7 +4,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include diff --git a/modules/oraclebackend/oraclebackend.cc b/modules/oraclebackend/oraclebackend.cc index 92ca59f931..8b1d94a01f 100644 --- a/modules/oraclebackend/oraclebackend.cc +++ b/modules/oraclebackend/oraclebackend.cc @@ -11,7 +11,7 @@ #include -using namespace std; +#include "namespaces.hh" #include "pdns/dns.hh" #include "pdns/dnsbackend.hh" diff --git a/modules/oraclebackend/oraclebackend.hh b/modules/oraclebackend/oraclebackend.hh index d5c4d2eb44..58e5f8b90b 100644 --- a/modules/oraclebackend/oraclebackend.hh +++ b/modules/oraclebackend/oraclebackend.hh @@ -6,7 +6,7 @@ #include -using namespace std; +#include "namespaces.hh" class OracleException : public DBException { diff --git a/modules/pdnsbackend/pdnsbackend.cc b/modules/pdnsbackend/pdnsbackend.cc index 2f7bd6c4e4..e843ccfcc3 100644 --- a/modules/pdnsbackend/pdnsbackend.cc +++ b/modules/pdnsbackend/pdnsbackend.cc @@ -6,7 +6,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include #include diff --git a/modules/pdnsbackend/pdnsbackend.hh b/modules/pdnsbackend/pdnsbackend.hh index bfe2d0b278..4159c5cb8b 100644 --- a/modules/pdnsbackend/pdnsbackend.hh +++ b/modules/pdnsbackend/pdnsbackend.hh @@ -6,7 +6,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include diff --git a/modules/pipebackend/coprocess.hh b/modules/pipebackend/coprocess.hh index 2de739d996..c2cc454d62 100644 --- a/modules/pipebackend/coprocess.hh +++ b/modules/pipebackend/coprocess.hh @@ -5,7 +5,7 @@ #include #include -using namespace std; +#include "pdns/namespaces.hh" class CoProcess { diff --git a/modules/pipebackend/pipebackend.cc b/modules/pipebackend/pipebackend.cc index d82a5d9eac..0ed811b7d9 100644 --- a/modules/pipebackend/pipebackend.cc +++ b/modules/pipebackend/pipebackend.cc @@ -10,7 +10,7 @@ #include #include "coprocess.hh" -using namespace std; +#include "pdns/namespaces.hh" #include #include diff --git a/modules/pipebackend/pipebackend.hh b/modules/pipebackend/pipebackend.hh index 0c33f04fa6..c93c0b8774 100644 --- a/modules/pipebackend/pipebackend.hh +++ b/modules/pipebackend/pipebackend.hh @@ -11,9 +11,8 @@ #include #include #include -using namespace boost; -using namespace std; +#include "pdns/namespaces.hh" /** very small regex wrapper */ class Regex diff --git a/modules/xdbbackend/xgdbm.cc b/modules/xdbbackend/xgdbm.cc index 025d83098c..51edfbbd85 100644 --- a/modules/xdbbackend/xgdbm.cc +++ b/modules/xdbbackend/xgdbm.cc @@ -6,7 +6,7 @@ #include #include -using namespace std; +#include "namespaces.hh" GDBM_FILE XGDBMWrapper::s_db; int XGDBMWrapper::s_usecount; diff --git a/modules/xdbbackend/xtdb.cc b/modules/xdbbackend/xtdb.cc index 01b1a9eba9..01f6dbc958 100644 --- a/modules/xdbbackend/xtdb.cc +++ b/modules/xdbbackend/xtdb.cc @@ -9,7 +9,7 @@ #include -using namespace std; +#include "namespaces.hh" TDB_CONTEXT *XTDBWrapper::s_db; int XTDBWrapper::s_usecount; diff --git a/pdns/ahuexception.hh b/pdns/ahuexception.hh index ae020ae49f..57bd2aa658 100644 --- a/pdns/ahuexception.hh +++ b/pdns/ahuexception.hh @@ -22,7 +22,7 @@ #include -using namespace std; +#include "namespaces.hh" //! Generic Exception thrown class AhuException diff --git a/pdns/anadns.hh b/pdns/anadns.hh index 1c2e16fab8..4c53effbba 100644 --- a/pdns/anadns.hh +++ b/pdns/anadns.hh @@ -8,7 +8,7 @@ #include "dnsparser.hh" #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" struct QuestionIdentifier { diff --git a/pdns/argtng.hh b/pdns/argtng.hh index 7a931ef927..45489aefb7 100644 --- a/pdns/argtng.hh +++ b/pdns/argtng.hh @@ -6,7 +6,7 @@ #include #include #include -using namespace std; +#include "namespaces.hh" #include "namespaces.hh" #define decl(x,y) typeof((y)) (x) = (y) diff --git a/pdns/arguments.hh b/pdns/arguments.hh index c4e1e3e38a..5d6f508dee 100644 --- a/pdns/arguments.hh +++ b/pdns/arguments.hh @@ -32,7 +32,7 @@ # include #endif -using namespace std; +#include "namespaces.hh" typedef AhuException ArgException; diff --git a/pdns/backends/bind/bindbackend2.hh b/pdns/backends/bind/bindbackend2.hh index 00c6bff7c6..0974066db7 100644 --- a/pdns/backends/bind/bindbackend2.hh +++ b/pdns/backends/bind/bindbackend2.hh @@ -34,7 +34,7 @@ #include #include "misc.hh" -using namespace std; +#include "namespaces.hh" using namespace boost; using namespace ::boost::multi_index; diff --git a/pdns/backends/bind/bindparser.hh b/pdns/backends/bind/bindparser.hh index 250eb8cfac..10b0cfd6ae 100644 --- a/pdns/backends/bind/bindparser.hh +++ b/pdns/backends/bind/bindparser.hh @@ -23,7 +23,7 @@ #include #include -using namespace std; +#include "namespaces.hh" class BindDomainInfo { diff --git a/pdns/backends/bind/huffman.hh b/pdns/backends/bind/huffman.hh index 1ca1916e66..e31d514fcf 100644 --- a/pdns/backends/bind/huffman.hh +++ b/pdns/backends/bind/huffman.hh @@ -25,7 +25,7 @@ #include #include "../../ahuexception.hh" -using namespace std; +#include "namespaces.hh" class HuffmanCodec { diff --git a/pdns/backends/bind/zone2ldap.cc b/pdns/backends/bind/zone2ldap.cc index 7ae2244a1b..0ee9b699d1 100644 --- a/pdns/backends/bind/zone2ldap.cc +++ b/pdns/backends/bind/zone2ldap.cc @@ -154,7 +154,7 @@ int main( int argc, char* argv[] ) try { #if __GNUC__ >= 3 - ios_base::sync_with_stdio( false ); + std::ios_base::sync_with_stdio( false ); #endif reportAllTypes(); args.setCmd( "help", "Provide a helpful message" ); diff --git a/pdns/backends/bind/zone2sql.cc b/pdns/backends/bind/zone2sql.cc index a12adbc6f4..8af1ffc8c5 100644 --- a/pdns/backends/bind/zone2sql.cc +++ b/pdns/backends/bind/zone2sql.cc @@ -30,7 +30,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include "dns.hh" #include "arguments.hh" @@ -198,7 +198,7 @@ int main(int argc, char **argv) reportAllTypes(); reportFancyTypes(); #if __GNUC__ >= 3 - ios_base::sync_with_stdio(false); + std::ios_base::sync_with_stdio(false); #endif lastsoa_qname=" "; ::arg().setSwitch("mysql","Output in format suitable for mysqlbackend")="yes"; diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index 20e5c8f452..b246c6073b 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -6,7 +6,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include "pdns/dns.hh" #include "pdns/dnsbackend.hh" diff --git a/pdns/backends/gsql/gsqlbackend.hh b/pdns/backends/gsql/gsqlbackend.hh index 78ff4ae308..6876c37d0c 100644 --- a/pdns/backends/gsql/gsqlbackend.hh +++ b/pdns/backends/gsql/gsqlbackend.hh @@ -2,7 +2,7 @@ #include #include "ssql.hh" -using namespace std; +#include "../../namespaces.hh" /** The GSQLBackend is a DNSBackend that can answer DNS related questions. It looks up data in PostgreSQL */ diff --git a/pdns/backends/gsql/ssql.hh b/pdns/backends/gsql/ssql.hh index eb32bb53bb..2900381a6d 100644 --- a/pdns/backends/gsql/ssql.hh +++ b/pdns/backends/gsql/ssql.hh @@ -10,7 +10,7 @@ #include #include -using namespace std; +#include "../../namespaces.hh" class SSqlException diff --git a/pdns/base32.cc b/pdns/base32.cc index 0c41b07662..3655442e20 100644 --- a/pdns/base32.cc +++ b/pdns/base32.cc @@ -5,7 +5,7 @@ #include #include #include "base32.hh" -using namespace std; +#include "namespaces.hh" /* based on freebsd:src/contrib/opie/libopie/btoe.c extract: get bit ranges from a char* */ uint32_t extract_bits(const char *s, int start, int length) diff --git a/pdns/binpatch.cc b/pdns/binpatch.cc index 733f340e6b..586ca8b256 100644 --- a/pdns/binpatch.cc +++ b/pdns/binpatch.cc @@ -32,7 +32,7 @@ #include -using namespace std; +#include "namespaces.hh" static void imbue(char *pname, const char *search, const string &replace); static string stringerror(); diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 9e8a29655b..a21d7557c9 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -39,7 +39,7 @@ using namespace boost::multi_index; #include "lock.hh" #include "packethandler.hh" -using namespace std; +#include "namespaces.hh" struct SuckRequest { @@ -113,7 +113,7 @@ public: time_t earliest() { - time_t early=numeric_limits::max() - 1; + time_t early=std::numeric_limits::max() - 1; for(d_nqueue_t::const_iterator i=d_nqueue.begin();i!=d_nqueue.end();++i) early=min(early,i->next); return early-time(0); @@ -129,7 +129,7 @@ private: time_t next; }; - typedef listd_nqueue_t; + typedef std::listd_nqueue_t; d_nqueue_t d_nqueue; }; diff --git a/pdns/devpollmplexer.cc b/pdns/devpollmplexer.cc index 09f52d9497..e1cb4c1e0e 100644 --- a/pdns/devpollmplexer.cc +++ b/pdns/devpollmplexer.cc @@ -8,7 +8,7 @@ #include "syncres.hh" #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" class DevPollFDMultiplexer : public FDMultiplexer { diff --git a/pdns/dnsbackend.hh b/pdns/dnsbackend.hh index 1122238281..709a4dfde9 100644 --- a/pdns/dnsbackend.hh +++ b/pdns/dnsbackend.hh @@ -38,7 +38,7 @@ class DNSPacket; #include "qtype.hh" #include "dns.hh" #include -using namespace std; +#include "namespaces.hh" class DNSBackend; struct DomainInfo diff --git a/pdns/dnsdemog.cc b/pdns/dnsdemog.cc index 178ee65b3b..b4653d29cd 100644 --- a/pdns/dnsdemog.cc +++ b/pdns/dnsdemog.cc @@ -11,7 +11,7 @@ #include "anadns.hh" #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" StatBag S; diff --git a/pdns/dnsgram.cc b/pdns/dnsgram.cc index b7f41238c1..8c301c0a58 100644 --- a/pdns/dnsgram.cc +++ b/pdns/dnsgram.cc @@ -12,7 +12,7 @@ #include "anadns.hh" #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" StatBag S; diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index f8a84ef63f..bedc993f52 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -398,7 +398,7 @@ try if(getEDNSOpts(mdp, &edo)) { - d_maxreplylen=min(edo.d_packetsize, (uint16_t)1680); + d_maxreplylen=std::min(edo.d_packetsize, (uint16_t)1680); // cerr<& dest, uint16_t len) void PacketReader::copyRecord(unsigned char* dest, uint16_t len) { if(d_pos + len > d_content.size()) - throw out_of_range("Attempt to copy outside of packet"); + throw std::out_of_range("Attempt to copy outside of packet"); memcpy(dest, &d_content.at(d_pos), len); d_pos+=len; @@ -574,7 +574,7 @@ private: { d_notyouroffset += by; if(d_notyouroffset > d_packet.length()) - throw out_of_range("dns packet out of range: "+lexical_cast(d_notyouroffset) +" > " + throw std::out_of_range("dns packet out of range: "+lexical_cast(d_notyouroffset) +" > " + lexical_cast(d_packet.length()) ); } std::string& d_packet; diff --git a/pdns/dnsparser.hh b/pdns/dnsparser.hh index 052d0b01c8..6a94910c84 100644 --- a/pdns/dnsparser.hh +++ b/pdns/dnsparser.hh @@ -47,7 +47,7 @@ And we might be able to reverse 2 -> 3 as well */ -using namespace std; +#include "namespaces.hh" #include "namespaces.hh" class MOADNSException : public runtime_error diff --git a/pdns/dnspcap.hh b/pdns/dnspcap.hh index 9594700d2f..66e07b9188 100644 --- a/pdns/dnspcap.hh +++ b/pdns/dnspcap.hh @@ -13,7 +13,7 @@ #include #include #include -using namespace std; +#include "namespaces.hh" struct pdns_pcap_file_header { uint32_t magic; diff --git a/pdns/dnsproxy.hh b/pdns/dnsproxy.hh index ee002a3a3b..4be6226a36 100644 --- a/pdns/dnsproxy.hh +++ b/pdns/dnsproxy.hh @@ -31,7 +31,7 @@ #include "lock.hh" #include "iputils.hh" -using namespace std; +#include "namespaces.hh" /** diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 163a3aeee0..93cdceee2e 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -26,7 +26,7 @@ #include #include -using namespace std; +#include "namespaces.hh" #include "namespaces.hh" #define includeboilerplate(RNAME) RNAME##RecordContent(const DNSRecord& dr, PacketReader& pr); \ diff --git a/pdns/dnsreplay.cc b/pdns/dnsreplay.cc index be9633e3d8..ea119773bd 100644 --- a/pdns/dnsreplay.cc +++ b/pdns/dnsreplay.cc @@ -61,7 +61,7 @@ What to do with timeouts. We keep around at most 65536 outstanding answers. #include "namespaces.hh" using namespace ::boost::multi_index; -using namespace std; +#include "namespaces.hh" StatBag S; bool g_quiet=true; @@ -369,7 +369,7 @@ try { s_wednserrors++; } - catch(out_of_range &e) + catch(std::out_of_range &e) { s_wednserrors++; } @@ -551,7 +551,7 @@ bool sendPacketFromPR(PcapPacketReader& pr, const ComboAddress& remote) { s_origdnserrors++; } - catch(out_of_range &e) + catch(std::out_of_range &e) { s_origdnserrors++; } diff --git a/pdns/dnsscan.cc b/pdns/dnsscan.cc index fef7584c1a..e4dd608fa9 100644 --- a/pdns/dnsscan.cc +++ b/pdns/dnsscan.cc @@ -19,7 +19,7 @@ #include "namespaces.hh" using namespace ::boost::multi_index; -using namespace std; +#include "namespaces.hh" StatBag S; int main(int argc, char** argv) diff --git a/pdns/dnsscope.cc b/pdns/dnsscope.cc index a6a290419f..bb3a4b3287 100644 --- a/pdns/dnsscope.cc +++ b/pdns/dnsscope.cc @@ -11,7 +11,7 @@ #include "anadns.hh" #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" StatBag S; diff --git a/pdns/dnssecinfra.hh b/pdns/dnssecinfra.hh index ffba00a241..147d964496 100644 --- a/pdns/dnssecinfra.hh +++ b/pdns/dnssecinfra.hh @@ -87,7 +87,7 @@ private: -struct CanonicalCompare: public binary_function +struct CanonicalCompare: public std::binary_function { bool operator()(const std::string& a, const std::string& b) { std::vector avect, bvect; diff --git a/pdns/dnswasher.cc b/pdns/dnswasher.cc index 753d191bf8..0d85acb722 100644 --- a/pdns/dnswasher.cc +++ b/pdns/dnswasher.cc @@ -16,7 +16,7 @@ otherwise, obfuscate the response IP address #include "dnspcap.hh" #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" StatBag S; diff --git a/pdns/dnswriter.cc b/pdns/dnswriter.cc index 7e48b0908a..ddfd19cc2d 100644 --- a/pdns/dnswriter.cc +++ b/pdns/dnswriter.cc @@ -154,9 +154,9 @@ void DNSPacketWriter::xfrText(const string& text, bool) d_record.push_back(0); else for (unsigned int i = 0; i < beg->length(); i += 0xff){ - d_record.push_back(min((string::size_type)0xffU, beg->length()-i)); + d_record.push_back(std::min((string::size_type)0xffU, beg->length()-i)); const uint8_t* ptr=(uint8_t*)(beg->c_str()) + i; - d_record.insert(d_record.end(), ptr, ptr+min((string::size_type)0xffU, beg->length()-i)); + d_record.insert(d_record.end(), ptr, ptr+ std::min((string::size_type)0xffU, beg->length()-i)); } } } diff --git a/pdns/dnswriter.hh b/pdns/dnswriter.hh index dc4da6e9b3..3e97bd32a5 100644 --- a/pdns/dnswriter.hh +++ b/pdns/dnswriter.hh @@ -10,7 +10,7 @@ #include "utility.hh" #endif #include "dns.hh" -using namespace std; +#include "namespaces.hh" /** this class can be used to write DNS packets. It knows about DNS in the sense that it makes the packet header and record headers. diff --git a/pdns/dynhandler.hh b/pdns/dynhandler.hh index c64b239636..c2b6ffa396 100644 --- a/pdns/dynhandler.hh +++ b/pdns/dynhandler.hh @@ -31,7 +31,7 @@ # include "pdnsservice.hh" #endif // WIN32 -using namespace std; +#include "namespaces.hh" bool DLQuitPlease(); diff --git a/pdns/dynlistener.hh b/pdns/dynlistener.hh index 8914a772ea..218d07f686 100644 --- a/pdns/dynlistener.hh +++ b/pdns/dynlistener.hh @@ -37,7 +37,7 @@ #include #endif // WIN32 -using namespace std; +#include "namespaces.hh" class DynListener : public boost::noncopyable { diff --git a/pdns/dynloader.cc b/pdns/dynloader.cc index 0e2fd51768..d810278dd7 100644 --- a/pdns/dynloader.cc +++ b/pdns/dynloader.cc @@ -37,7 +37,7 @@ #include "config.h" #include "statbag.hh" #include "misc.hh" -using namespace std; +#include "namespaces.hh" #include "namespaces.hh" ArgvMap &arg() diff --git a/pdns/dynmessenger.hh b/pdns/dynmessenger.hh index 969b68ac01..ed9bc3e2b5 100644 --- a/pdns/dynmessenger.hh +++ b/pdns/dynmessenger.hh @@ -38,7 +38,7 @@ #include "iputils.hh" #include "ahuexception.hh" -using namespace std; +#include "namespaces.hh" //! The DynMessenger can send messages to UNIX domain sockets and TCP sockets class DynMessenger diff --git a/pdns/epollmplexer.cc b/pdns/epollmplexer.cc index fae71a49ca..b5e2276a3c 100644 --- a/pdns/epollmplexer.cc +++ b/pdns/epollmplexer.cc @@ -10,7 +10,7 @@ #endif #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" class EpollFDMultiplexer : public FDMultiplexer { diff --git a/pdns/htimer.cc b/pdns/htimer.cc index 393a833678..b2881c2aee 100644 --- a/pdns/htimer.cc +++ b/pdns/htimer.cc @@ -4,7 +4,7 @@ HTimer::timers_t HTimer::s_timers; -using namespace std; +#include "namespaces.hh" #include "namespaces.hh" diff --git a/pdns/inflighter.cc b/pdns/inflighter.cc index 4862107920..f8c2820c3c 100644 --- a/pdns/inflighter.cc +++ b/pdns/inflighter.cc @@ -10,7 +10,7 @@ #include "statbag.hh" #include -using namespace std; +#include "namespaces.hh" using namespace boost::multi_index; struct TimeTag{}; diff --git a/pdns/iputils.hh b/pdns/iputils.hh index cfc2671886..a8a44c7def 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -36,7 +36,7 @@ #include #include -using namespace std; +#include "namespaces.hh" union ComboAddress { struct sockaddr_in sin4; @@ -78,7 +78,7 @@ union ComboAddress { return memcmp(&sin6.sin6_addr.s6_addr, &rhs.sin6.sin6_addr.s6_addr, 16) > 0; } - struct addressOnlyLessThan: public binary_function + struct addressOnlyLessThan: public std::binary_function { bool operator()(const ComboAddress& a, const ComboAddress& b) const { diff --git a/pdns/kqueuemplexer.cc b/pdns/kqueuemplexer.cc index 4603b2a84c..9d286bd281 100644 --- a/pdns/kqueuemplexer.cc +++ b/pdns/kqueuemplexer.cc @@ -12,7 +12,7 @@ #include #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" class KqueueFDMultiplexer : public FDMultiplexer { diff --git a/pdns/logger.cc b/pdns/logger.cc index e60da9e5a7..22c2da75ba 100644 --- a/pdns/logger.cc +++ b/pdns/logger.cc @@ -23,7 +23,7 @@ extern StatBag S; #endif -using namespace std; +#include "namespaces.hh" Logger &theL(const string &pname) { diff --git a/pdns/logger.hh b/pdns/logger.hh index 861d2de900..83036c436b 100644 --- a/pdns/logger.hh +++ b/pdns/logger.hh @@ -36,7 +36,7 @@ typedef int pthread_mutex_t; typedef int pthread_t; #endif // WIN32 -using namespace std; +#include "namespaces.hh" //! The Logger class can be used to log messages in various ways. class Logger @@ -117,7 +117,7 @@ public: Logger& operator<<(Urgency); //!< set the urgency, << style #ifndef WIN32 - Logger& operator<<(ostream & (&)(ostream &)); //!< this is to recognise the endl, and to commit the log + Logger& operator<<(std::ostream & (&)(std::ostream &)); //!< this is to recognise the endl, and to commit the log #else // This is a hack to keep MSVC from generating a internal compiler error. Logger& operator<<(ostream & (hack)(ostream &)); //!< this is to recognise the endl, and to commit the log diff --git a/pdns/lua-pdns-recursor.cc b/pdns/lua-pdns-recursor.cc index 78230e7698..9abe0522dd 100644 --- a/pdns/lua-pdns-recursor.cc +++ b/pdns/lua-pdns-recursor.cc @@ -40,7 +40,7 @@ extern "C" { #include #include #include "logger.hh" -using namespace std; +#include "namespaces.hh" bool netmaskMatchTable(lua_State* lua, const std::string& ip) { diff --git a/pdns/lwres.hh b/pdns/lwres.hh index d69b884bd1..75da5f62e0 100644 --- a/pdns/lwres.hh +++ b/pdns/lwres.hh @@ -38,7 +38,7 @@ #include "ahuexception.hh" #include "dns.hh" -using namespace std; +#include "namespaces.hh" int asendto(const char *data, int len, int flags, const ComboAddress& ip, uint16_t id, const string& domain, uint16_t qtype, int* fd); diff --git a/pdns/md5.cc b/pdns/md5.cc index 244c96fa2b..aff85104ce 100644 --- a/pdns/md5.cc +++ b/pdns/md5.cc @@ -8,7 +8,7 @@ #include "md5.hh" -using namespace std; +#include "namespaces.hh" namespace { diff --git a/pdns/misc.hh b/pdns/misc.hh index 4c6169ca2c..ebcfa44305 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -68,7 +68,7 @@ struct TSCTimer #include #include -using namespace std; +#include "namespaces.hh" bool chopOff(string &domain); bool chopOffDotted(string &domain); @@ -414,7 +414,7 @@ private: }; -struct CIStringCompare: public binary_function +struct CIStringCompare: public std::binary_function { bool operator()(const string& a, const string& b) const { diff --git a/pdns/nameserver.hh b/pdns/nameserver.hh index 57f85a2b6f..30f164353c 100644 --- a/pdns/nameserver.hh +++ b/pdns/nameserver.hh @@ -1,6 +1,6 @@ /* PowerDNS Versatile Database Driven Nameserver - Copyright (C) 2005 PowerDNS.COM BV + Copyright (C) 2005 - 2011 PowerDNS.COM BV This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published @@ -32,7 +32,7 @@ #include #include "statbag.hh" -using namespace std; +#include "namespaces.hh" /** This is the main class. It opens a socket on udp port 53 and waits for packets. Those packets can be retrieved with the receive() member function, which returns a DNSPacket. diff --git a/pdns/notify.cc b/pdns/notify.cc index 8d3ded0517..ad1c3fce1c 100644 --- a/pdns/notify.cc +++ b/pdns/notify.cc @@ -15,7 +15,7 @@ #include "namespaces.hh" using namespace ::boost::multi_index; -using namespace std; +#include "namespaces.hh" namespace po = boost::program_options; po::variables_map g_vm; diff --git a/pdns/nproxy.cc b/pdns/nproxy.cc index 67f2fde34b..259d995eaf 100644 --- a/pdns/nproxy.cc +++ b/pdns/nproxy.cc @@ -18,7 +18,7 @@ #include "namespaces.hh" using namespace ::boost::multi_index; -using namespace std; +#include "namespaces.hh" namespace po = boost::program_options; po::variables_map g_vm; diff --git a/pdns/packetcache.hh b/pdns/packetcache.hh index a15c7a709b..04cd9bf049 100644 --- a/pdns/packetcache.hh +++ b/pdns/packetcache.hh @@ -25,7 +25,7 @@ #include #include "dns.hh" #include -using namespace std; +#include "namespaces.hh" using namespace ::boost::multi_index; #include "namespaces.hh" @@ -44,7 +44,7 @@ using namespace ::boost::multi_index; first marks and then sweeps, a second lock is present to prevent simultaneous inserts and deletes. */ -struct CIBackwardsStringCompare: public binary_function +struct CIBackwardsStringCompare: public std::binary_function { bool operator()(const string& str_a, const string& str_b) const { diff --git a/pdns/packethandler.hh b/pdns/packethandler.hh index 87c61b94bb..6afdde41e1 100644 --- a/pdns/packethandler.hh +++ b/pdns/packethandler.hh @@ -30,7 +30,7 @@ #include "packetcache.hh" #include "dnsseckeeper.hh" -using namespace std; +#include "namespaces.hh" // silly Solaris people define PC #undef PC diff --git a/pdns/pdns_hw.cc b/pdns/pdns_hw.cc index 0ecc773192..88299707b9 100644 --- a/pdns/pdns_hw.cc +++ b/pdns/pdns_hw.cc @@ -11,7 +11,7 @@ #include #include -using namespace std; +#include "namespaces.hh" int main() { ostringstream str; diff --git a/pdns/polarrsakeyinfra.cc b/pdns/polarrsakeyinfra.cc index ded8282a6d..5edd2d4b39 100644 --- a/pdns/polarrsakeyinfra.cc +++ b/pdns/polarrsakeyinfra.cc @@ -324,7 +324,7 @@ void RSADNSCryptoKeyEngine::fromPublicKeyString(const std::string& rawString) string RSADNSCryptoKeyEngine::getPublicKeyString() const { string keystring; - char tmp[max(mpi_size(&d_context.E), mpi_size(&d_context.N))]; + char tmp[std::max(mpi_size(&d_context.E), mpi_size(&d_context.N))]; mpi_write_binary(&d_context.E, (unsigned char*)tmp, mpi_size(&d_context.E) ); string exponent((char*)tmp, mpi_size(&d_context.E)); diff --git a/pdns/pollmplexer.cc b/pdns/pollmplexer.cc index 793bfb0c34..1613bbbb29 100644 --- a/pdns/pollmplexer.cc +++ b/pdns/pollmplexer.cc @@ -7,7 +7,7 @@ #include "syncres.hh" #include "utility.hh" #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" static FDMultiplexer* make() diff --git a/pdns/portsmplexer.cc b/pdns/portsmplexer.cc index 623ce88cb9..5a065a5c17 100644 --- a/pdns/portsmplexer.cc +++ b/pdns/portsmplexer.cc @@ -12,7 +12,7 @@ #include "syncres.hh" #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" class PortsFDMultiplexer : public FDMultiplexer { diff --git a/pdns/qtype.hh b/pdns/qtype.hh index 72b1e7c54a..611982532e 100644 --- a/pdns/qtype.hh +++ b/pdns/qtype.hh @@ -24,7 +24,7 @@ #include #include -using namespace std; +#include "namespaces.hh" /** The QType class is meant to deal easily with the different kind of resource types, like 'A', 'NS', * 'CNAME' etcetera. These types have both a name and a number. This class can seemlessly move between diff --git a/pdns/rcpgenerator.hh b/pdns/rcpgenerator.hh index 4363ae7d9e..f39e6aeebc 100644 --- a/pdns/rcpgenerator.hh +++ b/pdns/rcpgenerator.hh @@ -28,7 +28,7 @@ # include "utility.hh" #endif -using namespace std; +#include "namespaces.hh" class RecordTextException : public runtime_error { diff --git a/pdns/rec_channel.cc b/pdns/rec_channel.cc index 78e1c9bf59..bb6274604f 100644 --- a/pdns/rec_channel.cc +++ b/pdns/rec_channel.cc @@ -11,7 +11,7 @@ #include "ahuexception.hh" -using namespace std; +#include "namespaces.hh" RecursorControlChannel::RecursorControlChannel() { diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 233f193fc3..66fa661fcb 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -23,7 +23,7 @@ #include #endif -using namespace std; +#include "namespaces.hh" #include "namespaces.hh" map d_get32bitpointers; map d_get64bitpointers; diff --git a/pdns/rec_control.cc b/pdns/rec_control.cc index 3049dafd79..121bd0a0b0 100644 --- a/pdns/rec_control.cc +++ b/pdns/rec_control.cc @@ -21,7 +21,7 @@ #include "arguments.hh" #include "config.h" -using namespace std; +#include "namespaces.hh" #ifndef RECURSOR #include "statbag.hh" diff --git a/pdns/recursor_cache.cc b/pdns/recursor_cache.cc index dcbf23743f..38b2ce750e 100644 --- a/pdns/recursor_cache.cc +++ b/pdns/recursor_cache.cc @@ -8,7 +8,7 @@ #include "recursor_cache.hh" #include "cachecleaner.hh" -using namespace std; +#include "namespaces.hh" #include "namespaces.hh" #include "config.h" diff --git a/pdns/recursor_memcached.cc b/pdns/recursor_memcached.cc index 1b22437353..4cdf355a18 100644 --- a/pdns/recursor_memcached.cc +++ b/pdns/recursor_memcached.cc @@ -4,7 +4,7 @@ #include "recursor_memcached.hh" #include -using namespace std; +#include "namespaces.hh" using boost::lexical_cast; MemcachedCommunicator::MemcachedCommunicator(const std::string& servers) diff --git a/pdns/resolver.hh b/pdns/resolver.hh index e5f21585dc..63893d7df8 100644 --- a/pdns/resolver.hh +++ b/pdns/resolver.hh @@ -35,7 +35,7 @@ #include "ahuexception.hh" #include "dns.hh" -using namespace std; +#include "namespaces.hh" class ResolverException : public AhuException { diff --git a/pdns/selectmplexer.cc b/pdns/selectmplexer.cc index daad6f7c42..437ed3833e 100644 --- a/pdns/selectmplexer.cc +++ b/pdns/selectmplexer.cc @@ -8,7 +8,7 @@ #include "namespaces.hh" -using namespace std; +#include "namespaces.hh" static FDMultiplexer* make() { diff --git a/pdns/sstuff.hh b/pdns/sstuff.hh index d516ae7ce1..58afeeeed9 100644 --- a/pdns/sstuff.hh +++ b/pdns/sstuff.hh @@ -19,7 +19,7 @@ #include #include #include -using namespace std; +#include "namespaces.hh" #include "namespaces.hh" diff --git a/pdns/statbag.cc b/pdns/statbag.cc index e0a28cf4e2..39e6303630 100644 --- a/pdns/statbag.cc +++ b/pdns/statbag.cc @@ -26,7 +26,7 @@ #include "arguments.hh" #include "lock.hh" -using namespace std; +#include "namespaces.hh" StatBag::StatBag() { diff --git a/pdns/statbag.hh b/pdns/statbag.hh index fdd5efb6e5..37d8bfe173 100644 --- a/pdns/statbag.hh +++ b/pdns/statbag.hh @@ -23,7 +23,7 @@ #include #include #include "lock.hh" -using namespace std; +#include "namespaces.hh" class StatRing { diff --git a/pdns/tcpreceiver.hh b/pdns/tcpreceiver.hh index 250b351760..fd99bae579 100644 --- a/pdns/tcpreceiver.hh +++ b/pdns/tcpreceiver.hh @@ -39,7 +39,7 @@ # include #endif // WIN32 -using namespace std; +#include "namespaces.hh" class TCPNameserver { diff --git a/pdns/ueberbackend.hh b/pdns/ueberbackend.hh index d895fe1568..cdd4bea185 100644 --- a/pdns/ueberbackend.hh +++ b/pdns/ueberbackend.hh @@ -40,7 +40,7 @@ #include "dnspacket.hh" #include "dnsbackend.hh" -using namespace std; +#include "namespaces.hh" class BackendReporter; diff --git a/pdns/unix_utility.cc b/pdns/unix_utility.cc index 4e5ffdc92b..2f311c2105 100644 --- a/pdns/unix_utility.cc +++ b/pdns/unix_utility.cc @@ -35,7 +35,7 @@ const char *inet_ntop(int af, const void *src, char *dst, size_t cnt); #endif -using namespace std; +#include "namespaces.hh" // Closes a socket. int Utility::closesocket( Utility::sock_t socket ) diff --git a/pdns/utility.hh b/pdns/utility.hh index f3a9a44e3a..aeda2ce19e 100644 --- a/pdns/utility.hh +++ b/pdns/utility.hh @@ -71,7 +71,7 @@ typedef int socklen_t; #endif // WIN32 #include -using namespace std; +#include "namespaces.hh" //! A semaphore class. class Semaphore diff --git a/pdns/webserver.hh b/pdns/webserver.hh index ff58d0bbf0..878fbecdee 100644 --- a/pdns/webserver.hh +++ b/pdns/webserver.hh @@ -22,7 +22,7 @@ #include -using namespace std; +#include "namespaces.hh" class Server; class WebServer diff --git a/pdns/win32_dynloader.cc b/pdns/win32_dynloader.cc index 9bebbb7227..e65855a2d6 100644 --- a/pdns/win32_dynloader.cc +++ b/pdns/win32_dynloader.cc @@ -36,7 +36,7 @@ #include "arguments.hh" #include "statbag.hh" #include "misc.hh" -using namespace std; +#include "namespaces.hh" ArgvMap &arg() { diff --git a/pdns/win32_logger.cc b/pdns/win32_logger.cc index adc4b322f0..38e9ddcb82 100644 --- a/pdns/win32_logger.cc +++ b/pdns/win32_logger.cc @@ -21,7 +21,7 @@ #include "logger.hh" #include "ntservice.hh" #include "pdnsmsg.hh" -using namespace std; +#include "namespaces.hh" Logger &theL(const string &pname) { diff --git a/pdns/win32_rec_channel.cc b/pdns/win32_rec_channel.cc index 0628e41d7b..32a4dc2c1c 100644 --- a/pdns/win32_rec_channel.cc +++ b/pdns/win32_rec_channel.cc @@ -6,7 +6,7 @@ #include "ahuexception.hh" -using namespace std; +#include "namespaces.hh" RecursorControlChannel::RecursorControlChannel() { diff --git a/pdns/ws.hh b/pdns/ws.hh index be072cf183..bc887b5c30 100644 --- a/pdns/ws.hh +++ b/pdns/ws.hh @@ -34,7 +34,7 @@ #endif // HAVE_CONFIG_H #include "misc.hh" -using namespace std; +#include "namespaces.hh" class Ewma { diff --git a/pdns/zoneparser-tng.hh b/pdns/zoneparser-tng.hh index 8206c94004..9f5bc7821b 100644 --- a/pdns/zoneparser-tng.hh +++ b/pdns/zoneparser-tng.hh @@ -23,7 +23,7 @@ #include #include -using namespace std; +#include "namespaces.hh" class ZoneParserTNG { @@ -57,7 +57,7 @@ private: string d_filename; int d_lineno; }; - stack d_filestates; + std::stack d_filestates; }; #endif