summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commands/cmd_whowas.cpp4
-rw-r--r--src/dynamic.cpp4
-rw-r--r--src/helperfuncs.cpp4
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/extra/m_mssql.cpp2
-rw-r--r--src/modules/extra/m_mysql.cpp2
-rw-r--r--src/modules/extra/m_pgsql.cpp2
-rw-r--r--src/modules/extra/m_sqlite3.cpp2
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp14
-rw-r--r--src/socket.cpp4
-rw-r--r--src/socketengine.cpp8
-rw-r--r--src/threadengines/threadengine_pthread.cpp2
-rw-r--r--src/threadengines/threadengine_win32.cpp2
-rw-r--r--src/users.cpp2
14 files changed, 27 insertions, 27 deletions
diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp
index e20dc1b5e..71b228070 100644
--- a/src/commands/cmd_whowas.cpp
+++ b/src/commands/cmd_whowas.cpp
@@ -91,11 +91,11 @@ CmdResult CommandWhowas::HandleInternal(const unsigned int id, const std::deque<
switch (id)
{
case WHOWAS_ADD:
- AddToWhoWas((User*)parameters[0]);
+ AddToWhoWas(static_cast<User*>(parameters[0]));
break;
case WHOWAS_STATS:
- GetStats((Extensible*)parameters[0]);
+ GetStats(static_cast<Extensible*>(parameters[0]));
break;
case WHOWAS_PRUNE:
diff --git a/src/dynamic.cpp b/src/dynamic.cpp
index 511651941..704c4d9dd 100644
--- a/src/dynamic.cpp
+++ b/src/dynamic.cpp
@@ -32,7 +32,7 @@ DLLManager::DLLManager(InspIRCd*, const char *fname)
h = dlopen(fname, RTLD_NOW|RTLD_LOCAL);
if (!h)
{
- err = (char*)dlerror();
+ err = dlerror();
return;
}
}
@@ -57,7 +57,7 @@ bool DLLManager::GetSymbol(void** v, const char* sym_name)
{
dlerror(); // clear value
*v = dlsym(h, sym_name);
- err = (char*)dlerror();
+ err = dlerror();
if (!*v || err)
return false;
}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 26a5db07c..1d5bf574f 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -150,11 +150,11 @@ long InspIRCd::ChannelCount()
bool InspIRCd::IsValidMask(const std::string &mask)
{
- char* dest = (char*)mask.c_str();
+ const char* dest = mask.c_str();
int exclamation = 0;
int atsign = 0;
- for (char* i = dest; *i; i++)
+ for (const char* i = dest; *i; i++)
{
/* out of range character, bad mask */
if (*i < 32 || *i > 126)
diff --git a/src/modules.cpp b/src/modules.cpp
index aae65e816..b05452cff 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -82,7 +82,7 @@ Event::Event(char* anydata, Module* src, const std::string &eventid) : data(anyd
char* Event::GetData()
{
- return (char*)this->data;
+ return this->data;
}
Module* Event::GetSource()
diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp
index 9cc7a567c..1ad8a087a 100644
--- a/src/modules/extra/m_mssql.cpp
+++ b/src/modules/extra/m_mssql.cpp
@@ -35,7 +35,7 @@ typedef std::deque<MsSQLResult*> ResultQueue;
unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
- for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
+ for (const char *p = str; *p; ++p)
{
if (*p == '?')
++n;
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 224bf0f56..06c2a13b6 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -73,7 +73,7 @@ typedef std::deque<SQLresult*> ResultQueue;
unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
- for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
+ for (const char *p = str; *p; ++p)
{
if (*p == '?')
++n;
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index b417fc019..520450575 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -47,7 +47,7 @@ enum SQLstatus { CREAD, CWRITE, WREAD, WWRITE, RREAD, RWRITE };
unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
- for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
+ for (const char *p = str; *p; ++p)
{
if (*p == '?')
++n;
diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp
index 548af82cc..ea76fbc1d 100644
--- a/src/modules/extra/m_sqlite3.cpp
+++ b/src/modules/extra/m_sqlite3.cpp
@@ -34,7 +34,7 @@ typedef std::deque<SQLite3Result*> ResultQueue;
unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
- for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
+ for (const char *p = str; *p; ++p)
{
if (*p == '?')
++n;
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index b7b225384..665a6723f 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -301,7 +301,7 @@ class ModuleSSLGnuTLS : public Module
{
if(target_type == TYPE_USER)
{
- User* user = (User*)item;
+ User* user = static_cast<User*>(item);
if (user->GetIOHook() == this)
{
@@ -357,7 +357,7 @@ class ModuleSSLGnuTLS : public Module
virtual const char* OnRequest(Request* request)
{
- ISHRequest* ISR = (ISHRequest*)request;
+ ISHRequest* ISR = static_cast<ISHRequest*>(request);
if (strcmp("IS_NAME", request->GetId()) == 0)
{
return "gnutls";
@@ -367,7 +367,7 @@ class ModuleSSLGnuTLS : public Module
const char* ret = "OK";
try
{
- ret = ISR->Sock->AddIOHook((Module*)this) ? "OK" : NULL;
+ ret = ISR->Sock->AddIOHook(this) ? "OK" : NULL;
}
catch (ModuleException &e)
{
@@ -394,9 +394,9 @@ class ModuleSSLGnuTLS : public Module
issl_session* session = &sessions[ISR->Sock->GetFd()];
if (session->sess)
{
- if ((Extensible*)ServerInstance->SE->GetRef(ISR->Sock->GetFd()) == (Extensible*)(ISR->Sock))
+ if (static_cast<Extensible*>(ServerInstance->SE->GetRef(ISR->Sock->GetFd())) == static_cast<Extensible*>(ISR->Sock))
{
- VerifyCertificate(session, (BufferedSocket*)ISR->Sock);
+ VerifyCertificate(session, ISR->Sock);
return "OK";
}
}
@@ -438,7 +438,7 @@ class ModuleSSLGnuTLS : public Module
gnutls_credentials_set(session->sess, GNUTLS_CRD_CERTIFICATE, x509_cred);
gnutls_dh_set_prime_bits(session->sess, dh_bits);
- gnutls_transport_set_ptr(session->sess, (gnutls_transport_ptr_t) fd); // Give gnutls the fd for the socket.
+ gnutls_transport_set_ptr(session->sess, reinterpret_cast<gnutls_transport_ptr_t>(fd)); // Give gnutls the fd for the socket.
gnutls_certificate_server_set_request(session->sess, GNUTLS_CERT_REQUEST); // Request client certificate if any.
@@ -458,7 +458,7 @@ class ModuleSSLGnuTLS : public Module
gnutls_set_default_priority(session->sess); // Avoid calling all the priority functions, defaults are adequate.
gnutls_credentials_set(session->sess, GNUTLS_CRD_CERTIFICATE, x509_cred);
gnutls_dh_set_prime_bits(session->sess, dh_bits);
- gnutls_transport_set_ptr(session->sess, (gnutls_transport_ptr_t) fd); // Give gnutls the fd for the socket.
+ gnutls_transport_set_ptr(session->sess, reinterpret_cast<gnutls_transport_ptr_t>(fd)); // Give gnutls the fd for the socket.
Handshake(session, fd);
}
diff --git a/src/socket.cpp b/src/socket.cpp
index 092751ec8..c426f16e6 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -117,11 +117,11 @@ int irc::sockets::OpenTCPSocket(const char* addr, int socktype)
}
else
{
- setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on));
+ setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
/* This is BSD compatible, setting l_onoff to 0 is *NOT* http://web.irc.org/mla/ircd-dev/msg02259.html */
linger.l_onoff = 1;
linger.l_linger = 1;
- setsockopt(sockfd, SOL_SOCKET, SO_LINGER, (char*)&linger,sizeof(linger));
+ setsockopt(sockfd, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger));
return (sockfd);
}
}
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index 187a06541..9d54e8b66 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -211,25 +211,25 @@ int SocketEngine::GetSockName(EventHandler* fd, sockaddr *name, socklen_t* namel
int SocketEngine::RecvFrom(EventHandler* fd, void *buf, size_t len, int flags, sockaddr *from, socklen_t *fromlen)
{
this->UpdateStats(len, 0);
- return recvfrom(fd->GetFd(), (char*)buf, len, flags, from, fromlen);
+ return recvfrom(fd->GetFd(), buf, len, flags, from, fromlen);
}
int SocketEngine::Send(EventHandler* fd, const void *buf, size_t len, int flags)
{
this->UpdateStats(0, len);
- return send(fd->GetFd(), (const char*)buf, len, flags);
+ return send(fd->GetFd(), buf, len, flags);
}
int SocketEngine::Recv(EventHandler* fd, void *buf, size_t len, int flags)
{
this->UpdateStats(len, 0);
- return recv(fd->GetFd(), (char*)buf, len, flags);
+ return recv(fd->GetFd(), buf, len, flags);
}
int SocketEngine::SendTo(EventHandler* fd, const void *buf, size_t len, int flags, const sockaddr *to, socklen_t tolen)
{
this->UpdateStats(0, len);
- return sendto(fd->GetFd(), (const char*)buf, len, flags, to, tolen);
+ return sendto(fd->GetFd(), buf, len, flags, to, tolen);
}
int SocketEngine::Connect(EventHandler* fd, const sockaddr *serv_addr, socklen_t addrlen)
diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp
index 904efa0c9..6e32634c5 100644
--- a/src/threadengines/threadengine_pthread.cpp
+++ b/src/threadengines/threadengine_pthread.cpp
@@ -29,7 +29,7 @@ static void* entry_point(void* parameter)
sigaddset(&set, SIGPIPE);
pthread_sigmask(SIG_BLOCK, &set, NULL);
- Thread* pt = reinterpret_cast<Thread*>(parameter);
+ Thread* pt = static_cast<Thread*>(parameter);
pt->Run();
return parameter;
}
diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp
index 2676bc6f6..4bac4f5dc 100644
--- a/src/threadengines/threadengine_win32.cpp
+++ b/src/threadengines/threadengine_win32.cpp
@@ -40,7 +40,7 @@ ThreadEngine::~ThreadEngine()
DWORD WINAPI ThreadEngine::Entry(void* parameter)
{
- Thread* pt = reinterpret_cast<Thread*>(parameter);
+ Thread* pt = static_cast<Thread*>(parameter);
pt->Run();
return 0;
}
diff --git a/src/users.cpp b/src/users.cpp
index 8e45d1772..6be64fe1d 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -206,7 +206,7 @@ void User::DecrementModes()
User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance)
{
- server = (char*)Instance->FindServerNamePtr(Instance->Config->ServerName);
+ server = Instance->FindServerNamePtr(Instance->Config->ServerName);
age = ServerInstance->Time();
Penalty = 0;
lastping = signon = idle_lastmsg = nping = registered = 0;