Important Update:
- ApplicationCore: - Rename ConfigParser -> JSONparser - Make JSONparser a public parameter - DataTreeCore: - Bug fix: Insufficient memory allocation on SetValue if Len = -1
This commit is contained in:
@@ -40,7 +40,7 @@ CApplication::CApplication( EDebugLevel pLogLevel )
|
||||
|
||||
// Create Configuration
|
||||
DataTree = new CDataTree();
|
||||
ConfigParser = new CJSONparse( DataTree );
|
||||
JSONparser = new CJSONparse( DataTree );
|
||||
|
||||
// Selector
|
||||
Selector = NULL;
|
||||
@@ -73,7 +73,7 @@ CApplication::~CApplication()
|
||||
if (Selector) delete Selector;
|
||||
if (Log) delete Log;
|
||||
if (DataTree) delete DataTree;
|
||||
if (ConfigParser) delete ConfigParser;
|
||||
if (JSONparser) delete JSONparser;
|
||||
|
||||
// Free Process Name
|
||||
if (ProcessName) free( ProcessName );
|
||||
@@ -119,13 +119,13 @@ bool CApplication::LoadConfig( int argc, char *argv[], const char * pConfigPath
|
||||
}
|
||||
|
||||
// Load Application List
|
||||
if (ConfigParser->ReadFromFile( pConfigPath, ConfigFile )) {
|
||||
if (JSONparser->ReadFromFile( pConfigPath, ConfigFile )) {
|
||||
if (Log) Log->Message( dlLow, dlLow, "%s: Config file loaded (%s)", ProcessName, ConfigFile );
|
||||
} else {
|
||||
if (Log) Log->Message( dlLow, dlLow, "%s: Fail to load config file (%s)- %s", ProcessName, ConfigFile, ConfigParser->GetError() );
|
||||
if (Log) Log->Message( dlLow, dlLow, "%s: Fail to load config file (%s)- %s", ProcessName, ConfigFile, JSONparser->GetError() );
|
||||
return false;
|
||||
}
|
||||
//ConfigParser->WriteToScreen( pConfigPath, 2 );
|
||||
//JSONparser->WriteToScreen( pConfigPath, 2 );
|
||||
|
||||
// Loaded successfully
|
||||
return true;
|
||||
@@ -136,9 +136,9 @@ bool CApplication::SaveConfig()
|
||||
{
|
||||
// Save updated configuration
|
||||
if (ConfigFile && *ConfigFile)
|
||||
ConfigParser->WriteToFile( "config", ConfigFile );
|
||||
JSONparser->WriteToFile( "config", ConfigFile );
|
||||
if (AddressFile && *AddressFile )
|
||||
ConfigParser->WriteToFile( "address", AddressFile );
|
||||
JSONparser->WriteToFile( "address", AddressFile );
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -192,12 +192,12 @@ bool CApplication::LoadConfigData()
|
||||
// Load Address List
|
||||
if ((AddressFile = (char*)DataTree->GetStr( ConfigMember, "AddressList/Path", NULL )))
|
||||
{
|
||||
if (ConfigParser->ReadFromFile( "address", AddressFile )) {
|
||||
if (JSONparser->ReadFromFile( "address", AddressFile )) {
|
||||
if (Log) Log->Message( dlLow, dlLow, "%s: Address file loaded (%s)", ProcessName, AddressFile );
|
||||
} else {
|
||||
if (Log) Log->Message( dlLow, dlLow, "%s: Fail to load Address file (%s) - %s", ProcessName, AddressFile, ConfigParser->GetError() );
|
||||
if (Log) Log->Message( dlLow, dlLow, "%s: Fail to load Address file (%s) - %s", ProcessName, AddressFile, JSONparser->GetError() );
|
||||
}
|
||||
//ConfigParser->WriteToScreen( pAddressListPath, 2 );
|
||||
//JSONparser->WriteToScreen( pAddressListPath, 2 );
|
||||
}
|
||||
|
||||
// Configure Selector
|
||||
|
||||
@@ -47,9 +47,6 @@ protected:
|
||||
// List
|
||||
TFunctionItem * FirstFunction;
|
||||
|
||||
// Configuration
|
||||
CJSONparse * ConfigParser = NULL;
|
||||
|
||||
// Output
|
||||
EDebugLevel LogLevel;
|
||||
int LogOutput;
|
||||
@@ -66,6 +63,7 @@ public:
|
||||
CDataTree * DataTree;
|
||||
CLogCore * Log;
|
||||
CSelect * Selector;
|
||||
CJSONparse * JSONparser = NULL;
|
||||
|
||||
// Life Cycle
|
||||
CApplication( EDebugLevel pDebugLevel );
|
||||
|
||||
@@ -371,7 +371,7 @@ bool CDataTree::SetValue( TDataMember * Member, EDataType Type, const char * Va
|
||||
|
||||
// Check Length
|
||||
if (Len == -1) {
|
||||
Len = strlen( Value );
|
||||
Len = strlen(Value)+1;
|
||||
}
|
||||
|
||||
// Create copy of value
|
||||
|
||||
Reference in New Issue
Block a user