uhry
uintptr
uio
-uitoa
ulddquehrj
ulen
ulong
int err;
if ((err = mysql_query(&d_db, query.c_str())))
- throw sPerrorException("Failed to execute mysql_query '" + query + "' Err=" + itoa(err));
+ throw sPerrorException("Failed to execute mysql_query '" + query + "' Err=" + std::to_string(err));
}
void SMySQL::startTransaction()
int status;
int ret = waitpid(d_pid, &status, WNOHANG);
if (ret < 0)
- throw PDNSException("Unable to ascertain status of coprocess " + itoa(d_pid) + " from " + itoa(getpid()) + ": " + string(strerror(errno)));
+ throw PDNSException("Unable to ascertain status of coprocess " + std::to_string(d_pid) + " from " + std::to_string(getpid()) + ": " + string(strerror(errno)));
else if (ret) {
if (WIFEXITED(status)) {
int exitStatus = WEXITSTATUS(status);
- throw PDNSException("Coprocess exited with code " + itoa(exitStatus));
+ throw PDNSException("Coprocess exited with code " + std::to_string(exitStatus));
}
if (WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
- string reason = "CoProcess died on receiving signal " + itoa(sig);
+ string reason = "CoProcess died on receiving signal " + std::to_string(sig);
#ifdef WCOREDUMP
if (WCOREDUMP(status))
reason += ". Dumped core";
catch (PDNSException& ae) {
g_log << Logger::Error << kBackendId << " Error from coprocess: " << ae.reason << endl;
}
- d_qname = DNSName(itoa(inZoneId)); // why do we store a number here??
+ d_qname = DNSName(std::to_string(inZoneId)); // why do we store a number here??
return true;
}
int status;
int ret = waitpid(d_pid, &status, WNOHANG);
if (ret < 0)
- throw PDNSException("Unable to ascertain status of coprocess " + itoa(d_pid) + " from " + itoa(getpid()) + ": " + string(strerror(errno)));
+ throw PDNSException("Unable to ascertain status of coprocess " + std::to_string(d_pid) + " from " + std::to_string(getpid()) + ": " + string(strerror(errno)));
else if (ret) {
if (WIFEXITED(status)) {
int exitStatus = WEXITSTATUS(status);
- throw PDNSException("Coprocess exited with code " + itoa(exitStatus));
+ throw PDNSException("Coprocess exited with code " + std::to_string(exitStatus));
}
if (WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
- string reason = "CoProcess died on receiving signal " + itoa(sig);
+ string reason = "CoProcess died on receiving signal " + std::to_string(sig);
#ifdef WCOREDUMP
if (WCOREDUMP(status))
reason += ". Dumped core";
string line;
string pline;
- ifstream configFileStream(fname);
+ std::ifstream configFileStream(fname);
if (!configFileStream) {
return false;
}
// execute some kind of ping here
if (DLQuitPlease())
takedown(1); // needs a parameter..
- setStatus("Child running on pid " + itoa(pid));
+ setStatus("Child running on pid " + std::to_string(pid));
sleep(1);
}
}
g_log << Logger::Error << "Child requested a stop, exiting" << endl;
exit(1);
}
- setStatus("Child died with code " + itoa(ret));
+ setStatus("Child died with code " + std::to_string(ret));
g_log << Logger::Error << "Our pdns instance exited with code " << ret << ", respawning" << endl;
sleep(1);
}
if (WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
- setStatus("Child died because of signal " + itoa(sig));
+ setStatus("Child died because of signal " + std::to_string(sig));
g_log << Logger::Error << "Our pdns instance (" << pid << ") exited after signal " << sig << endl;
#ifdef WCOREDUMP
if (WCOREDUMP(status))
reset();
}
catch(SSqlException &e) {
- throw PDNSException("GSQLBackend unable to refresh domain_id "+itoa(domain_id)+": "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to refresh domain_id "+std::to_string(domain_id)+": "+e.txtReason());
}
}
d_UpdateLastCheckOfZoneQuery_stmt->bind("last_check", lastcheck)->bind("domain_id", domain_id)->execute()->reset();
}
catch (SSqlException &e) {
- throw PDNSException("GSQLBackend unable to update last_check for domain_id " + itoa(domain_id) + ": " + e.txtReason());
+ throw PDNSException("GSQLBackend unable to update last_check for domain_id " + std::to_string(domain_id) + ": " + e.txtReason());
}
}
reset();
}
catch(SSqlException &e) {
- throw PDNSException("GSQLBackend unable to update ordername and auth for " + qname.toLogString() + " for domain_id "+itoa(domain_id)+", domain name '" + qname.toLogString() + "': "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to update ordername and auth for " + qname.toLogString() + " for domain_id "+std::to_string(domain_id)+", domain name '" + qname.toLogString() + "': "+e.txtReason());
}
} else {
try {
reset();
}
catch(SSqlException &e) {
- throw PDNSException("GSQLBackend unable to update ordername and auth for " + qname.toLogString() + "|" + QType(qtype).toString() + " for domain_id "+itoa(domain_id)+": "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to update ordername and auth for " + qname.toLogString() + "|" + QType(qtype).toString() + " for domain_id "+std::to_string(domain_id)+": "+e.txtReason());
}
}
} else {
reset();
}
catch(SSqlException &e) {
- throw PDNSException("GSQLBackend unable to nullify ordername and update auth for " + qname.toLogString() + " for domain_id "+itoa(domain_id)+": "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to nullify ordername and update auth for " + qname.toLogString() + " for domain_id "+std::to_string(domain_id)+": "+e.txtReason());
}
} else {
try {
reset();
}
catch(SSqlException &e) {
- throw PDNSException("GSQLBackend unable to nullify ordername and update auth for " + qname.toLogString() + "|" + QType(qtype).toString() + " for domain_id "+itoa(domain_id)+": "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to nullify ordername and update auth for " + qname.toLogString() + "|" + QType(qtype).toString() + " for domain_id "+std::to_string(domain_id)+": "+e.txtReason());
}
}
}
reset();
}
catch (SSqlException &e) {
- throw PDNSException("GSQLBackend unable to delete empty non-terminal records from domain_id "+itoa(domain_id)+": "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to delete empty non-terminal records from domain_id "+std::to_string(domain_id)+": "+e.txtReason());
}
}
else
reset();
}
catch (SSqlException &e) {
- throw PDNSException("GSQLBackend unable to delete empty non-terminal rr '"+qname.toLogString()+"' from domain_id "+itoa(domain_id)+": "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to delete empty non-terminal rr '"+qname.toLogString()+"' from domain_id "+std::to_string(domain_id)+": "+e.txtReason());
}
}
}
reset();
}
catch (SSqlException &e) {
- throw PDNSException("GSQLBackend unable to insert empty non-terminal rr '"+qname.toLogString()+"' in domain_id "+itoa(domain_id)+": "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to insert empty non-terminal rr '"+qname.toLogString()+"' in domain_id "+std::to_string(domain_id)+": "+e.txtReason());
}
}
d_afterOrderQuery_stmt->reset();
}
catch(SSqlException &e) {
- throw PDNSException("GSQLBackend unable to find before/after (after) for domain_id "+itoa(id)+" and qname '"+ qname.toLogString() +"': "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to find before/after (after) for domain_id "+std::to_string(id)+" and qname '"+ qname.toLogString() +"': "+e.txtReason());
}
if(after.empty()) {
d_firstOrderQuery_stmt->reset();
}
catch(SSqlException &e) {
- throw PDNSException("GSQLBackend unable to find before/after (first) for domain_id "+itoa(id)+" and qname '"+ qname.toLogString() + "': "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to find before/after (first) for domain_id "+std::to_string(id)+" and qname '"+ qname.toLogString() + "': "+e.txtReason());
}
}
d_beforeOrderQuery_stmt->reset();
}
catch(SSqlException &e) {
- throw PDNSException("GSQLBackend unable to find before/after (before) for domain_id "+itoa(id)+" and qname '"+ qname.toLogString() + ": "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to find before/after (before) for domain_id "+std::to_string(id)+" and qname '"+ qname.toLogString() + ": "+e.txtReason());
}
if(! unhashed.empty())
d_lastOrderQuery_stmt->reset();
}
catch(SSqlException &e) {
- throw PDNSException("GSQLBackend unable to find before/after (last) for domain_id "+itoa(id)+" and qname '"+ qname.toLogString() + ": "+e.txtReason());
+ throw PDNSException("GSQLBackend unable to find before/after (last) for domain_id "+std::to_string(id)+" and qname '"+ qname.toLogString() + ": "+e.txtReason());
}
} else {
before=qname;
d_DeleteRRSetQuery_stmt->
bind("domain_id", domain_id)->
bind("qname", qname)->
- bind("qtype", "TYPE"+itoa(qt.getCode()))->
+ bind("qtype", "TYPE"+std::to_string(qt.getCode()))->
execute()->
reset();
}
static void yyerror(const char *str)
{
extern char *current_filename;
- throw PDNSException("Error in bind configuration '"+string(current_filename)+"' on line "+itoa(linenumber)+": "+str);
+ throw PDNSException("Error in bind configuration '"+string(current_filename)+"' on line "+std::to_string(linenumber)+": "+str);
}
extern FILE *yyin;
}
if (total != notified)
- return itoa(notified)+" out of "+itoa(total)+" zones added to queue - see log";
- return "Added " + itoa(total) + " MASTER/SLAVE/PRODUCER/CONSUMER zones to queue";
+ return std::to_string(notified)+" out of "+std::to_string(total)+" zones added to queue - see log";
+ return "Added " + std::to_string(total) + " MASTER/SLAVE/PRODUCER/CONSUMER zones to queue";
} else {
DNSName domain;
try {
return *hostname;
}
-string itoa(int i)
-{
- ostringstream o;
- o<<i;
- return o.str();
-}
-
-string uitoa(unsigned int i) // MSVC 6 doesn't grok overloading (un)signed
-{
- ostringstream o;
- o<<i;
- return o.str();
-}
-
string bitFlip(const string &str)
{
string::size_type pos=0, epos=str.size();
string U32ToIP(uint32_t);
string stringerror(int);
string stringerror();
-string itoa(int i);
-string uitoa(unsigned int i);
string bitFlip(const string &str);
void dropPrivs(int uid, int gid);
if (name != numbers.cend()) {
return name->second;
}
- return "TYPE" + itoa(code);
+ return "TYPE" + std::to_string(code);
}
uint16_t QType::chartocode(const char *p)
if(mdp.d_header.id != id)
throw ResolverException("Remote nameserver replied with wrong id");
if(mdp.d_header.qdcount != 1)
- throw ResolverException("resolver: received answer with wrong number of questions ("+itoa(mdp.d_header.qdcount)+")");
+ throw ResolverException("resolver: received answer with wrong number of questions ("+std::to_string(mdp.d_header.qdcount)+")");
if(mdp.d_qname != origQname)
throw ResolverException(string("resolver: received an answer to another question (")+mdp.d_qname.toLogString()+"!="+ origQname.toLogString()+".)");
}
if (! ::arg().mustDo("dnsupdate"))
return RCode::Refused;
- string msgPrefix="UPDATE (" + itoa(p.d.id) + ") from " + p.getRemoteString() + " for " + p.qdomain.toLogString() + ": ";
+ string msgPrefix="UPDATE (" + std::to_string(p.d.id) + ") from " + p.getRemoteString() + " for " + p.qdomain.toLogString() + ": ";
g_log<<Logger::Info<<msgPrefix<<"Processing started."<<endl;
// if there is policy, we delegate all checks to it
void setId(int id)
{
if(doLog())
- d_prefix="["+itoa(id)+"] ";
+ d_prefix="["+std::to_string(id)+"] ";
}
void setLogMode(LogMode lm)