]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
I hate casts.
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 9 Mar 2006 23:32:31 +0000 (23:32 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 9 Mar 2006 23:32:31 +0000 (23:32 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3610 e03df62e-2008-0410-955e-edbf42e46eb7

src/inspircd_io.cpp
src/svn-rev.sh

index 9b554d3ef93ad5ad5e8a77757d4a034979dd7bc0..9bd6ce522b467cc91d09e8ae70847065bd9761e1 100644 (file)
@@ -157,8 +157,8 @@ struct InitialConfig {
        char* tag;
        char* value;
        void* val;
-       ConfigDataType datatype;
-       Validator validate_function;
+       int datatype;
+       Validator validation_function;
 };
 
 bool NoValidation(const char* tag, const char* value, void* data)
@@ -171,13 +171,13 @@ void ServerConfig::Read(bool bail, userrec* user)
 {
        char debug[MAXBUF];
 
-       InitialConfig Values[] = {
+       static InitialConfig Values[] = {
                {"options",     "softlimit",            &this->SoftLimit,               DT_INTEGER, NoValidation},
                {"options",     "somaxconn",            &this->MaxConn,                 DT_INTEGER, NoValidation},
                {"server",      "name",                 &this->ServerName,              DT_CHARPTR, NoValidation},
                {"server",      "description",          &this->ServerDesc,              DT_CHARPTR, NoValidation},
                {"server",      "network",              &this->Network,                 DT_CHARPTR, NoValidation},
-               {"admin"        "name",                 &this->AdminName,               DT_CHARPTR, NoValidation},
+               {"admin",       "name",                 &this->AdminName,               DT_CHARPTR, NoValidation},
                {"admin",       "email",                &this->AdminEmail,              DT_CHARPTR, NoValidation},
                {"admin",       "nick",                 &this->AdminNick,               DT_CHARPTR, NoValidation},
                {"files",       "motd",                 &this->motd,                    DT_CHARPTR, NoValidation},
@@ -259,27 +259,28 @@ void ServerConfig::Read(bool bail, userrec* user)
        }
 
        char* convert;
-       for (int Index = 0; Values[Index].datatype != DT_NOTHING; Index++)
+       for (int Index = 0; Values[Index].tag; Index++)
        {
-               void* val = Values[Index].val;
+               int* val_i = (int*) Values[Index].val;
+               char* val_c = (char*) Values[Index].val;
 
                switch (Values[Index].datatype)
                {
                        case DT_CHARPTR:
-                               ConfValue((char*)Values[Index].tag,(char*)Values[Index].value,(char*) val,this->config_f);
+                               ConfValue(Values[Index].tag, Values[Index].value, 0, val_c, &this->config_f);
                        break;
 
                        case DT_INTEGER:
                                convert = new char[MAXBUF];
-                               ConfValue(Values[Index].tag,Values[Index].value,convert,this->config_f);
-                               *val = atoi(convert);
+                               ConfValue(Values[Index].tag, Values[Index].value, 0, convert, &this->config_f);
+                               *val_i = atoi(convert);
                                delete[] convert;
                        break;
 
                        case DT_BOOLEAN:
                                convert = new char[MAXBUF];
-                               ConfValue(Values[Index].tag,Values[Index].value,convert,this->config_f);
-                               *val = ((*convert == tolower('y')) || (*convert == tolower('t')) || (*convert == '1'));
+                               ConfValue(Values[Index].tag, Values[Index].value, 0, convert, &this->config_f);
+                               *val_i = ((*convert == tolower('y')) || (*convert == tolower('t')) || (*convert == '1'));
                                delete[] convert;
                        break;
 
index 2ea11eca7872abe356e1c87bd09c461e24ec6cf9..ef5b10341c88d06ba2da0eeb16a894563c6ddd3e 100755 (executable)
@@ -1 +1 @@
-echo 3602
+echo 3609