From a5833e654dd99fc2513b17100f0f06d50e75b4a9 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 11 Aug 2006 09:50:16 +0000 Subject: Move whowas into InspIRCd Tidy up lowermap extern (for now, we cant do much but have this as extern) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4876 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/hashcomp.cpp | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'src/hashcomp.cpp') diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index ac51cafe8..953997e5b 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -3,13 +3,13 @@ * +------------------------------------+ * * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * + * E-mail: + * + * * * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -25,8 +25,7 @@ using namespace std; #define nspace __gnu_cxx -// from helperfuncs.cpp -extern const char lowermap[255]; +char lowermap[255]; /****************************************************** * @@ -71,11 +70,11 @@ using namespace irc::sockets; */ void nspace::strlower(char *n) { - if (n) - { - for (char* t = n; *t; t++) - *t = lowermap[(unsigned char)*t]; - } + if (n) + { + for (char* t = n; *t; t++) + *t = lowermap[(unsigned char)*t]; + } } size_t nspace::hash::operator()(const insp_inaddr &a) const @@ -283,3 +282,18 @@ const std::string irc::commasepstream::GetToken() irc::commasepstream::~commasepstream() { } + +void InspIRCd::MakeLowerMap() +{ + // initialize the lowercase mapping table + for (unsigned char cn = 0; cn < 255; cn++) + lowermap[cn] = cn; + // lowercase the uppercase chars + for (unsigned char cn = 65; cn < 91; cn++) + lowermap[cn] = tolower(cn); + // now replace the specific chars for scandanavian comparison + lowermap[(unsigned char)'['] = '{'; + lowermap[(unsigned char)']'] = '}'; + lowermap[(unsigned char)'\\'] = '|'; +} + -- cgit v1.3.1-10-gc9f91