X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fhashcomp.cpp;h=6c0ce82b852a62cecb7bf304fdf37bf4eba31de5;hb=da1010f4077eae5d1602c9fe7d74a2426387b8b2;hp=0d036d528b9447c811d396a376df7452d4159553;hpb=a3fb932831ca09b2a931616f1701ea39429356c2;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 0d036d528..6c0ce82b8 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -3,7 +3,7 @@ * +------------------------------------+ * * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -60,14 +60,14 @@ void nspace::strlower(char *n) } } -#ifndef WIN32 +#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED) + size_t nspace::hash_compare >::operator()(const std::string &s) const +#else #ifdef HASHMAP_DEPRECATED - size_t nspace::insensitive::operator()(const std::string &s) const + size_t CoreExport nspace::insensitive::operator()(const std::string &s) const #else size_t nspace::hash::operator()(const std::string &s) const #endif -#else - size_t nspace::hash_compare >::operator()(const std::string &s) const #endif { /* XXX: NO DATA COPIES! :) @@ -83,10 +83,10 @@ void nspace::strlower(char *n) } -#ifndef WIN32 -size_t nspace::hash::operator()(const irc::string &s) const +#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED) + size_t nspace::hash_compare >::operator()(const irc::string &s) const #else -size_t nspace::hash_compare >::operator()(const irc::string &s) const + size_t CoreExport nspace::hash::operator()(const irc::string &s) const #endif { register size_t t = 0; @@ -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,7 +501,7 @@ long irc::portparser::GetToken() } } -const std::string& SearchAndReplace(std::string& text, const std::string& pattern, const std::string& replace) +/*const std::basic_string& SearchAndReplace(std::string& text, const std::string& pattern, const std::string& replace) { std::string replacement; if ((!pattern.empty()) && (!text.empty())) @@ -510,7 +510,6 @@ const std::string& SearchAndReplace(std::string& text, const std::string& patter { if (text.length() >= pattern.length() && text.substr(n, pattern.length()) == pattern) { - /* Found the pattern in the text, replace it, and advance */ replacement.append(replace); n = n + pattern.length() - 1; } @@ -522,5 +521,4 @@ const std::string& SearchAndReplace(std::string& text, const std::string& patter } text = replacement; return text; -} - +}*/