From a3fb932831ca09b2a931616f1701ea39429356c2 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 23 Jan 2009 13:20:57 +0000 Subject: Fix m_nationalchars using a copy and paste of my unsafe copy and paste algorithm, that will lock up if the string to replace contains the string to search for. Finally make this function a core utility function and remove the copies from 3 modules m_alias m_nationalchars and m_sqlauth git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10990 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_sqlauth.cpp | 12 ------------ src/modules/m_alias.cpp | 11 ----------- src/modules/m_nationalchars.cpp | 14 +------------- 3 files changed, 1 insertion(+), 36 deletions(-) (limited to 'src/modules') diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 0cd1ced24..f03ec08db 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -85,18 +85,6 @@ public: return 0; } - void SearchAndReplace(std::string& newline, const std::string &find, const std::string &replace) - { - std::string::size_type x = newline.find(find); - while (x != std::string::npos) - { - newline.erase(x, find.length()); - if (!replace.empty()) - newline.insert(x, replace); - x = newline.find(find); - } - } - bool CheckCredentials(User* user) { std::string thisquery = freeformquery; diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index c914aad66..76aceffc9 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -132,17 +132,6 @@ class ModuleAlias : public Module return word; } - void SearchAndReplace(std::string& newline, const std::string &find, const std::string &replace) - { - std::string::size_type x = newline.find(find); - while (x != std::string::npos) - { - newline.erase(x, find.length()); - newline.insert(x, replace); - x = newline.find(find); - } - } - virtual int OnPreCommand(std::string &command, std::vector ¶meters, User *user, bool validated, const std::string &original_line) { std::multimap::iterator i, upperbound; diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index cd88a02b0..6d6822d74 100755 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -6,7 +6,7 @@ * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -26,18 +26,6 @@ DEFINE_HANDLER2(lwbNickHandler, bool, const char*, size_t); /*,m_reverse_additionalUp[256];*/ static unsigned char m_reverse_additional[256],m_additionalMB[256],m_additionalUtf8[256],m_additionalUtf8range[256]; -void SearchAndReplace(std::string& newline, const std::string &find, const std::string &replace) -{ - std::string::size_type x = newline.find(find); - while (x != std::string::npos) - { - newline.erase(x, find.length()); - newline.insert(x, replace); - x = newline.find(find); - } -} - - char utf8checkrest(unsigned char * mb, unsigned char cnt) { for (unsigned char * tmp=mb; tmp