Important update:

- DataTreeCore:
  - Renamed Get/SetMemXxx() methods to Get/SetChXxx()
  - Renamed GetMember() to GetChild()
  - Updated: JSONparse, ApplicationCore, FunctionCore, SelectableCore,
             and WatchdogCore
  - Remove unused PrevChild & Last vars in GetChild (GetMember)
- JSONparseCore:
  - Use return values from write() and PrintXxx() methods to report fail
- SelectableCore:
  - Fix possible uninitialised FlowCtrl & Parity value
- DateTimeCore:
  - Fix possible memory overrun in temp buffer
- EventBufferCore:
  - Fix possible uninitialised value error in AddEvent
This commit is contained in:
Charl Wentzel
2018-11-20 11:27:09 +02:00
parent 278198171d
commit 6263c0f508
9 changed files with 248 additions and 213 deletions

View File

@@ -152,7 +152,7 @@ bool CApplication::LoadConfigData()
// Get debug level
pLogLevel = dlNone;
TempStr = (char*)ConfigMember->GetMemStr( "Log/Level", "Medium", true );
TempStr = (char*)ConfigMember->GetChStr( "Log/Level", "Medium", true );
if (TempStr)
{
if (!strcasecmp( TempStr, "Low" ))
@@ -165,7 +165,7 @@ bool CApplication::LoadConfigData()
// Set debug output
pLogOutput = 0;
if ((TempMember = ConfigMember->GetMember( "Log/Output", true )))
if ((TempMember = ConfigMember->GetChild( "Log/Output", true )))
{
TempMember = TempMember->GetFirstChild();
while (TempMember)
@@ -193,7 +193,7 @@ bool CApplication::LoadConfigData()
SetLogParam( pLogLevel, pLogOutput );
// Load Address List
if ((AddressFile = (char*)ConfigMember->GetMemStr( "AddressList/Path", NULL )))
if ((AddressFile = (char*)ConfigMember->GetChStr( "AddressList/Path", NULL )))
{
if (JSONparser->ReadFromFile( "address", AddressFile )) {
if (Log) Log->Message( dlLow, dlLow, "%s: Address file loaded (%s)", ProcessName, AddressFile );
@@ -204,10 +204,10 @@ bool CApplication::LoadConfigData()
}
// Configure Selector
if ((TempMember = ConfigMember->GetMember( "Selector" )))
if ((TempMember = ConfigMember->GetChild( "Selector" )))
{
// Create Selector
Selector = new CSelect( (int)TempMember->GetMemInt( "Wait", 5, true ), LogLevel );
Selector = new CSelect( (int)TempMember->GetChInt( "Wait", 5, true ), LogLevel );
}
return true;
}
@@ -235,7 +235,7 @@ bool CApplication::Init()
bool CApplication::InitConfig( const char * pConfigPath )
{
// Check if Datatree exists
if (!DataTree || !(ConfigMember = DataTree->GetMember( pConfigPath ))) {
if (!DataTree || !(ConfigMember = DataTree->GetChild( pConfigPath ))) {
return false;
}
@@ -254,7 +254,7 @@ bool CApplication::InitFunctions( const char * pConfigPath )
char * Type;
// Check of path exists
if (!DataTree || !(FunctionConfigMember = DataTree->GetMember( pConfigPath )))
if (!DataTree || !(FunctionConfigMember = DataTree->GetChild( pConfigPath )))
return false;
// Process each Channel
@@ -262,7 +262,7 @@ bool CApplication::InitFunctions( const char * pConfigPath )
while (TempMember)
{
// Get function parameters
Type = (char*)TempMember->GetMemStr( "Type", "Custom", true );
Type = (char*)TempMember->GetChStr( "Type", "Custom", true );
// Get or create function
if (!strcasecmp( Type, "WatchdogClient" )) {
@@ -297,7 +297,7 @@ bool CApplication::InitFunctionLinks( const char * pConfigPath )
CDataMember * TempMember;
// Check of path exists
if (!DataTree || !(LinkConfigMember = DataTree->GetMember( pConfigPath )))
if (!DataTree || !(LinkConfigMember = DataTree->GetChild( pConfigPath )))
return false;
// Process each Channel
@@ -305,7 +305,7 @@ bool CApplication::InitFunctionLinks( const char * pConfigPath )
while (FunctionItem)
{
// Build links for function
if ((TempMember = LinkConfigMember->GetMember( FunctionItem->Function->GetName() )))
if ((TempMember = LinkConfigMember->GetChild( FunctionItem->Function->GetName() )))
FunctionItem->Function->InitChannelLinks( TempMember );
// Next