From 52acbb466b84a1cd161b1c111f855d6f0419fff3 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 9 Jun 2007 12:32:34 +0000 Subject: A ton more clear() and empty() stuff thats been lingering on the long term todo for too long a term :p git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7264 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_sqlauth.cpp | 2 +- src/modules/extra/m_ssl_gnutls.cpp | 11 ++++++----- src/modules/extra/m_ssl_openssl.cpp | 14 ++++++-------- src/modules/extra/m_ziplink.cpp | 6 +++--- 4 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 530d84c57..36dcb0952 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -88,7 +88,7 @@ public: virtual int OnUserRegister(userrec* user) { - if ((allowpattern != "") && (ServerInstance->MatchText(user->nick,allowpattern))) + if ((!allowpattern.empty()) && (ServerInstance->MatchText(user->nick,allowpattern))) { user->Extend("sqlauthed"); return 0; diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index a466eb66d..ce2239a42 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -128,7 +128,8 @@ class ModuleSSLGnuTLS : public Module for(int i = 0; i < Conf->Enumerate("bind"); i++) { // For each tag - if(((Conf->ReadValue("bind", "type", i) == "") || (Conf->ReadValue("bind", "type", i) == "clients")) && (Conf->ReadValue("bind", "ssl", i) == "gnutls")) + std::string x = Conf->ReadValue("bind", "type", i); + if(((x.empty()) || (x == "clients")) && (x == "gnutls")) { // Get the port we're meant to be listening on with SSL std::string port = Conf->ReadValue("bind", "port", i); @@ -171,16 +172,16 @@ class ModuleSSLGnuTLS : public Module dh_bits = Conf->ReadInteger("gnutls", "dhbits", 0, false); // Set all the default values needed. - if(cafile == "") + if (cafile.empty()) cafile = "ca.pem"; - if(crlfile == "") + if (crlfile.empty()) crlfile = "crl.pem"; - if(certfile == "") + if (certfile.empty()) certfile = "cert.pem"; - if(keyfile == "") + if (keyfile.empty()) keyfile = "key.pem"; if((dh_bits != 768) && (dh_bits != 1024) && (dh_bits != 2048) && (dh_bits != 3072) && (dh_bits != 4096)) diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 7090f1a01..4ac684843 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -172,7 +172,8 @@ class ModuleSSLOpenSSL : public Module for (int i = 0; i < Conf->Enumerate("bind"); i++) { // For each tag - if (((Conf->ReadValue("bind", "type", i) == "") || (Conf->ReadValue("bind", "type", i) == "clients")) && (Conf->ReadValue("bind", "ssl", i) == "openssl")) + std::string x = Conf->ReadValue("bind", "type", i); + if (((x.empty()) || (x == "clients")) && (x == "openssl")) { // Get the port we're meant to be listening on with SSL std::string port = Conf->ReadValue("bind", "port", i); @@ -214,25 +215,22 @@ class ModuleSSLOpenSSL : public Module dhfile = Conf->ReadValue("openssl", "dhfile", 0); // Set all the default values needed. - if (cafile == "") + if (cafile.empty()) cafile = "ca.pem"; - if (certfile == "") + if (certfile.empty()) certfile = "cert.pem"; - if (keyfile == "") + if (keyfile.empty()) keyfile = "key.pem"; - if (dhfile == "") + if (dhfile.empty()) dhfile = "dhparams.pem"; // Prepend relative paths with the path to the config directory. if (cafile[0] != '/') cafile = confdir + cafile; - //if(crlfile[0] != '/') - // crlfile = confdir + crlfile; - if (certfile[0] != '/') certfile = confdir + certfile; diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp index 1e9c32d26..e0b0afca6 100644 --- a/src/modules/extra/m_ziplink.cpp +++ b/src/modules/extra/m_ziplink.cpp @@ -419,13 +419,13 @@ class ModuleZLib : public Module return 0; else { - session->outbuf = ""; + session->outbuf.clear(); return 0; } } else { - session->outbuf = ""; + session->outbuf.clear(); return 0; } } @@ -441,7 +441,7 @@ class ModuleZLib : public Module if (session->status == IZIP_OPEN) { session->status = IZIP_CLOSED; - session->outbuf = ""; + session->outbuf.clear(); delete session->inbuf; } } -- cgit v1.2.3