From deb6822302cb9009adc3450dd405817cc0dae9cd Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:43:56 +0000 Subject: Cast rework: use C++ style static_cast<> instead of C-style casts git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11595 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_mssql.cpp | 2 +- src/modules/extra/m_mysql.cpp | 2 +- src/modules/extra/m_pgsql.cpp | 2 +- src/modules/extra/m_sqlite3.cpp | 2 +- src/modules/extra/m_ssl_gnutls.cpp | 14 +++++++------- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/modules') 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 ResultQueue; unsigned long count(const char * const str, char a) { unsigned long n = 0; - for (const char *p = reinterpret_cast(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 ResultQueue; unsigned long count(const char * const str, char a) { unsigned long n = 0; - for (const char *p = reinterpret_cast(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(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 ResultQueue; unsigned long count(const char * const str, char a) { unsigned long n = 0; - for (const char *p = reinterpret_cast(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(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(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(ServerInstance->SE->GetRef(ISR->Sock->GetFd())) == static_cast(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(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(fd)); // Give gnutls the fd for the socket. Handshake(session, fd); } -- cgit v1.2.3