X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhashcomp.cpp;h=04c24418c5424f7d0ac620ace63bf4fa4d4f2079;hb=219993bc9018d9f0d9568330d7a972b68b785d27;hp=a2b1eab0bbea81254959cd44faa0d893d0266ca9;hpb=29ee8ab0ad390e4a1f1cf2c86aea9d1b5d3411a0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index a2b1eab0b..04c24418c 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -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; @@ -343,26 +343,26 @@ void irc::modestacker::PushMinus() this->Push('-',""); } -int irc::modestacker::GetStackedLine(std::deque &result, int max_line_size) +int irc::modestacker::GetStackedLine(std::vector &result, int max_line_size) { if (sequence.empty()) { - result.clear(); return 0; } - int n = 0; + unsigned int n = 0; int size = 1; /* Account for initial +/- char */ int nextsize = 0; - result.clear(); - result.push_back(adding ? "+" : "-"); + int start = result.size(); + std::string modeline = adding ? "+" : "-"; + result.push_back(modeline); if (sequence.size() > 1) nextsize = sequence[1].length() + 2; - while (!sequence[0].empty() && (sequence.size() > 1) && (result.size() < ServerInstance->Config->Limits.MaxModes) && ((size + nextsize) < max_line_size)) + while (!sequence[0].empty() && (sequence.size() > 1) && (n < ServerInstance->Config->Limits.MaxModes) && ((size + nextsize) < max_line_size)) { - result[0] += *(sequence[0].begin()); + modeline += *(sequence[0].begin()); if (!sequence[1].empty()) { result.push_back(sequence[1]); @@ -376,6 +376,7 @@ int irc::modestacker::GetStackedLine(std::deque &result, int max_li n++; } + result[start] = modeline; return n; }