summaryrefslogtreecommitdiff
path: root/src/hashcomp.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 09:50:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 09:50:16 +0000
commita5833e654dd99fc2513b17100f0f06d50e75b4a9 (patch)
tree46dd719ddacf849a2e1e3a9bcf5da70a73cb1f39 /src/hashcomp.cpp
parent9ea40ce2f7f7c5d55bf22e4b39e9903509925f1a (diff)
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
Diffstat (limited to 'src/hashcomp.cpp')
-rw-r--r--src/hashcomp.cpp36
1 files changed, 25 insertions, 11 deletions
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:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
+ * E-mail:
+ * <brain@chatspike.net>
+ * <Craig@chatspike.net>
*
* 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<insp_inaddr>::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)'\\'] = '|';
+}
+