Minor updates:

- Rename function ApplicationCore::GetProcessName -> GetFileName
- Correct misspelled variable "Persistent" in CSelectableCore::Init
- Clear compiler warning: Persistent not initialised
This commit is contained in:
2023-07-07 11:01:56 +02:00
parent 7dfdfdb4ce
commit 851a911c6d
3 changed files with 18 additions and 18 deletions

View File

@@ -94,7 +94,7 @@ CApplication::~CApplication()
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void CApplication::GetProcessName( char ** ProcessName, char * pFilePath ) void CApplication::GetFileName( char ** ProcessName, char * pFilePath )
{ {
char * TempStr; char * TempStr;
@@ -116,7 +116,7 @@ bool CApplication::ReadParam( int argc, char *argv[] )
// Read Parameters // Read Parameters
if ((argc != 2)) { if ((argc != 2)) {
// Get Process Name // Get Process Name
GetProcessName( &ProcessName, argv[0] ); GetFileName( &ProcessName, argv[0] );
// Incorrect no of parameters, show correct usage // Incorrect no of parameters, show correct usage
printf( "%s: Incorrect number of parameters\n", ProcessName ); printf( "%s: Incorrect number of parameters\n", ProcessName );
@@ -125,7 +125,7 @@ bool CApplication::ReadParam( int argc, char *argv[] )
} }
else { else {
// Load parameters // Load parameters
GetProcessName( &ProcessName, argv[1] ); GetFileName( &ProcessName, argv[1] );
ConfigFile = argv[1]; ConfigFile = argv[1];
return true; return true;
} }

View File

@@ -82,7 +82,7 @@ public:
// Manage Config File // Manage Config File
bool ReadParam( int argc, char *argv[] ); bool ReadParam( int argc, char *argv[] );
void GetProcessName( char ** ProcessName, char * pFilePath ); void GetFileName( char ** ProcessName, char * pFilePath );
bool LoadConfig(); bool LoadConfig();
bool SaveConfig(); bool SaveConfig();

View File

@@ -107,7 +107,7 @@ bool CSelectableCore::Init( CDataMember * FunctionConfig )
short Parity; short Parity;
short FlowCtrl; short FlowCtrl;
short Queue; short Queue;
bool Persitent; bool Persistent = false;
// Call Previous load config // Call Previous load config
if (!CFunctionCore::Init( FunctionConfig )) if (!CFunctionCore::Init( FunctionConfig ))
@@ -162,7 +162,7 @@ bool CSelectableCore::Init( CDataMember * FunctionConfig )
SerialConfig->GetChInt( "DataBits", 8, true ), SerialConfig->GetChInt( "DataBits", 8, true ),
Parity, SerialConfig->GetChInt( "StopBits", 1, true ), Parity, SerialConfig->GetChInt( "StopBits", 1, true ),
FlowCtrl, SerialConfig->GetChInt( "DataWait", 0, true )); FlowCtrl, SerialConfig->GetChInt( "DataWait", 0, true ));
Persitent = true; Persistent = true;
} }
} }
else if (!strcasecmp( Type, "LinePrinter" )) { else if (!strcasecmp( Type, "LinePrinter" )) {
@@ -173,7 +173,7 @@ bool CSelectableCore::Init( CDataMember * FunctionConfig )
Address = (char*)HandleConfig->GetChStr( "Port/Address", NULL, true ); // Get default value Address = (char*)HandleConfig->GetChStr( "Port/Address", NULL, true ); // Get default value
SetLinePrinterHandle( Handle, Address ); SetLinePrinterHandle( Handle, Address );
Persitent = true; Persistent = true;
} }
else if (!strcasecmp( Type, "UNIXserver" )) { else if (!strcasecmp( Type, "UNIXserver" )) {
// Get UNIX socket handle // Get UNIX socket handle
@@ -184,7 +184,7 @@ bool CSelectableCore::Init( CDataMember * FunctionConfig )
Queue = HandleConfig->GetChInt( "Socket/Queue", 2, true ); Queue = HandleConfig->GetChInt( "Socket/Queue", 2, true );
SetUnixHandle( Handle, ctUNIXserver, Address, Queue ); SetUnixHandle( Handle, ctUNIXserver, Address, Queue );
Persitent = true; Persistent = true;
} }
else if (!strcasecmp( Type, "UNIXclient" )) { else if (!strcasecmp( Type, "UNIXclient" )) {
// Get UNIX socket handle // Get UNIX socket handle
@@ -194,7 +194,7 @@ bool CSelectableCore::Init( CDataMember * FunctionConfig )
Address = (char*)HandleConfig->GetChStr( "Socket/Address", NULL, true ); // Get default Address value Address = (char*)HandleConfig->GetChStr( "Socket/Address", NULL, true ); // Get default Address value
SetUnixHandle( Handle, ctUNIXclient, Address, 0 ); SetUnixHandle( Handle, ctUNIXclient, Address, 0 );
Persitent = false; Persistent = false;
} }
else if (!strcasecmp( Type, "UDPserver" )) { else if (!strcasecmp( Type, "UDPserver" )) {
// Get UDP address & port // Get UDP address & port
@@ -207,7 +207,7 @@ bool CSelectableCore::Init( CDataMember * FunctionConfig )
Port = (char*)HandleConfig->GetChStr( "Socket/Port", "0", true ); // Get default Port value Port = (char*)HandleConfig->GetChStr( "Socket/Port", "0", true ); // Get default Port value
} }
SetSocketHandle( Handle, ctUDPserver, Address, strlcase(Port), 0 ); SetSocketHandle( Handle, ctUDPserver, Address, strlcase(Port), 0 );
Persitent = true; Persistent = true;
} }
else if (!strcasecmp( Type, "UDPclient" )) { else if (!strcasecmp( Type, "UDPclient" )) {
// Get UDP address & port // Get UDP address & port
@@ -220,7 +220,7 @@ bool CSelectableCore::Init( CDataMember * FunctionConfig )
Port = (char*)HandleConfig->GetChStr( "Socket/Port", "0", true ); // Get default Port value Port = (char*)HandleConfig->GetChStr( "Socket/Port", "0", true ); // Get default Port value
} }
SetSocketHandle( Handle, ctUDPclient, Address, strlcase(Port), 0 ); SetSocketHandle( Handle, ctUDPclient, Address, strlcase(Port), 0 );
Persitent = false; Persistent = false;
} }
else if (!strcasecmp( Type, "TCPserver" )) { else if (!strcasecmp( Type, "TCPserver" )) {
// Get TCP address & port // Get TCP address & port
@@ -234,7 +234,7 @@ bool CSelectableCore::Init( CDataMember * FunctionConfig )
} }
Queue = HandleConfig->GetChInt( "Socket/Queue", 2, true ); Queue = HandleConfig->GetChInt( "Socket/Queue", 2, true );
SetSocketHandle( Handle, ctTCPserver, Address, strlcase(Port), Queue ); SetSocketHandle( Handle, ctTCPserver, Address, strlcase(Port), Queue );
Persitent = true; Persistent = true;
} }
else if (!strcasecmp( Type, "TCPclient" )) { else if (!strcasecmp( Type, "TCPclient" )) {
// Get TCP address & port // Get TCP address & port
@@ -247,18 +247,18 @@ bool CSelectableCore::Init( CDataMember * FunctionConfig )
Port = (char*)HandleConfig->GetChStr( "Socket/Port", "0", true ); // Get default Port value Port = (char*)HandleConfig->GetChStr( "Socket/Port", "0", true ); // Get default Port value
} }
SetSocketHandle( Handle, ctTCPclient, Address, strlcase(Port), 0 ); SetSocketHandle( Handle, ctTCPclient, Address, strlcase(Port), 0 );
Persitent = false; Persistent = false;
} }
else if (!strcasecmp( Type, "ForkPipe" )) { else if (!strcasecmp( Type, "ForkPipe" )) {
// Get fork pipe handle // Get fork pipe handle
Address = (char*)HandleConfig->GetChStr( "Fork/ExecPath", NULL, true ); // Get default value Address = (char*)HandleConfig->GetChStr( "Fork/ExecPath", NULL, true ); // Get default value
SetForkPipeHandle( Handle, Address ); SetForkPipeHandle( Handle, Address );
Persitent = true; Persistent = true;
} }
// Set Auto Manage // Set Auto Manage
SetAutoManage( Handle, HandleConfig->GetChBool( "AutoManage/Enabled", true, true ), SetAutoManage( Handle, HandleConfig->GetChBool( "AutoManage/Enabled", true, true ),
HandleConfig->GetChBool( "AutoManage/Persistent", Persitent, true ), HandleConfig->GetChBool( "AutoManage/Persistent", Persistent, true ),
HandleConfig->GetChInt( "AutoManage/ReopenDelay", 2000, true ), HandleConfig->GetChInt( "AutoManage/ReopenDelay", 2000, true ),
HandleConfig->GetChInt( "AutoManage/CloseTimeout", 2000, true )); HandleConfig->GetChInt( "AutoManage/CloseTimeout", 2000, true ));