From 9324196112e391b0da6e8e01a6592f5966d44c08 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 9 Mar 2006 23:32:31 +0000 Subject: I hate casts. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3610 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd_io.cpp | 23 ++++++++++++----------- src/svn-rev.sh | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index 9b554d3ef..9bd6ce522 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -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; diff --git a/src/svn-rev.sh b/src/svn-rev.sh index 2ea11eca7..ef5b10341 100755 --- a/src/svn-rev.sh +++ b/src/svn-rev.sh @@ -1 +1 @@ -echo 3602 +echo 3609 -- cgit v1.2.3