From 36b68893df73fa2b2a9ab579172350cfd90c2e80 Mon Sep 17 00:00:00 2001 From: w00t Date: Mon, 8 Sep 2008 20:59:16 +0000 Subject: Remove crappy, unsafe (and now unneeded!) casts. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10476 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/listensocket.cpp | 8 ++++---- src/modules/m_httpd.cpp | 2 +- src/socket.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/listensocket.cpp b/src/listensocket.cpp index 3ecfbb432..961156ae6 100644 --- a/src/listensocket.cpp +++ b/src/listensocket.cpp @@ -24,15 +24,15 @@ sockaddr* ListenSocketBase::sock_us = NULL; sockaddr* ListenSocketBase::client = NULL; sockaddr* ListenSocketBase::raddr = NULL; -ListenSocketBase::ListenSocketBase(InspIRCd* Instance, int port, char* addr) : ServerInstance(Instance), desc("plaintext"), bind_addr(addr), bind_port(port) +ListenSocketBase::ListenSocketBase(InspIRCd* Instance, int port, const std::string &addr) : ServerInstance(Instance), desc("plaintext"), bind_addr(addr), bind_port(port) { - this->SetFd(irc::sockets::OpenTCPSocket(addr)); + this->SetFd(irc::sockets::OpenTCPSocket(addr.c_str())); if (this->GetFd() > -1) { - if (!Instance->BindSocket(this->fd,port,addr)) + if (!Instance->BindSocket(this->fd,port,addr.c_str())) this->fd = -1; #ifdef IPV6 - if ((!*addr) || (strchr(addr,':'))) + if ((!*addr.c_str()) || (strchr(addr.c_str(),':'))) this->family = AF_INET6; else #endif diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index ec4aec43c..9b59ea6bb 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -378,7 +378,7 @@ class HttpListener : public ListenSocketBase virtual void OnAcceptReady(const std::string &ipconnectedto, int nfd, const std::string &incomingip) { - new HttpServerSocket(ServerInstance, nfd, (char *)incomingip.c_str(), index); // XXX unsafe casts suck + new HttpServerSocket(ServerInstance, nfd, incomingip.c_str(), index); } }; diff --git a/src/socket.cpp b/src/socket.cpp index 01c07e2d0..d2090c3a2 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -143,7 +143,7 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) } // Open a TCP Socket -int irc::sockets::OpenTCPSocket(char* addr, int socktype) +int irc::sockets::OpenTCPSocket(const char* addr, int socktype) { int sockfd; int on = 1; -- cgit v1.2.3