Important Update:
- Implement Handle Address renaming: - Restructure JSON config, with address list and rename list - SelectableCore: - Add method GetHandleAddress() - lookup renamed handle - Add init values to all struct and classes declarations - Replace malloc()/strcpy() sequences with strdup()
This commit is contained in:
@@ -104,8 +104,7 @@ void CApplication::GetProcessName( char ** ProcessName, char * pFilePath )
|
||||
if (TempStr[0] == '/') TempStr++;
|
||||
|
||||
// Copy Process Name
|
||||
*ProcessName = (char*)malloc( strlen(TempStr)+1 );
|
||||
strcpy( *ProcessName, TempStr );
|
||||
*ProcessName = strdup( TempStr );
|
||||
|
||||
// Remove extension
|
||||
TempStr = strrchr( *ProcessName, '.' );
|
||||
@@ -163,7 +162,7 @@ bool CApplication::LoadConfig()
|
||||
}
|
||||
|
||||
// Load Address List
|
||||
if (!(AddressFile = (char*)Config->GetChStr( "Application/AddressList" ))) {
|
||||
if (!(AddressFile = (char*)Config->GetChStr( "Application/Addresses/List" ))) {
|
||||
if (Log) Log->Message( dlLow, dlLow, "%s: No Address List file specified", ProcessName );
|
||||
}
|
||||
else if (!JSONparser->ReadFromFile( "AddressList", AddressFile )) {
|
||||
@@ -235,7 +234,7 @@ bool CApplication::InitApplication()
|
||||
bool CApplication::InitFunction( CFunctionCore * Function )
|
||||
{
|
||||
char FunctionPath[100];
|
||||
CDataMember * FunctionConfig = NULL;
|
||||
CDataMember * FunctionConfig;
|
||||
|
||||
// Validate
|
||||
if (!Function)
|
||||
@@ -274,7 +273,7 @@ bool CApplication::InitFunctions()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Process each Channel
|
||||
// Process each Function
|
||||
FunctionConfig = FunctionList->GetFirstChild();
|
||||
while (FunctionConfig)
|
||||
{
|
||||
@@ -358,8 +357,7 @@ bool CApplication::AddFunctionType( const char * Type, FFuncConstructor Construc
|
||||
// Add new Type
|
||||
*FunctionType = (TFunctionType*)calloc( sizeof(TFunctionType), 1 );
|
||||
|
||||
(*FunctionType)->Name = (char*)malloc( strlen(Type)+1 );
|
||||
strcpy( (*FunctionType)->Name, Type );
|
||||
(*FunctionType)->Name = strdup( Type );
|
||||
(*FunctionType)->Constructor = Constructor;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user