X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fhashcomp.cpp;h=a2b1eab0bbea81254959cd44faa0d893d0266ca9;hb=ee465c20b6841bce724fa5e1402b1c9ee60b788e;hp=a613a8073eab57502847d10326a65e883a8aa8c5;hpb=4579758c8f9051cf87b5bf06ba12e6125104d0eb;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index a613a8073..a2b1eab0b 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -2,11 +2,11 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -154,7 +154,7 @@ const char* irc::irc_char_traits::find(const char* s1, int n, char c) { while(n-- > 0 && national_case_insensitive_map[(unsigned char)*s1] != national_case_insensitive_map[(unsigned char)c]) s1++; - return s1; + return (n >= 0) ? s1 : NULL; } irc::tokenstream::tokenstream(const std::string &source) : tokens(source), last_pushed(false) @@ -290,7 +290,7 @@ std::string irc::hex(const unsigned char *raw, size_t rawsz) return ""; /* EWW! This used to be using sprintf, which is WAY inefficient. -Special */ - + const char *hex = "0123456789abcdef"; static char hexbuf[MAXBUF]; @@ -455,7 +455,7 @@ long irc::portparser::GetToken() { while (((Overlaps(in_range)) && (in_range <= range_end))) in_range++; - + if (in_range <= range_end) return in_range; } @@ -501,3 +501,24 @@ long irc::portparser::GetToken() } } +/*const std::basic_string& SearchAndReplace(std::string& text, const std::string& pattern, const std::string& replace) +{ + std::string replacement; + if ((!pattern.empty()) && (!text.empty())) + { + for (std::string::size_type n = 0; n != text.length(); ++n) + { + if (text.length() >= pattern.length() && text.substr(n, pattern.length()) == pattern) + { + replacement.append(replace); + n = n + pattern.length() - 1; + } + else + { + replacement += text[n]; + } + } + } + text = replacement; + return text; +}*/