Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
3fb92dd5
Commit
3fb92dd5
authored
Jun 13, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Очередная группа исправлений по результатам прогона cppcheck.
parent
36ff980c
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
38 additions
and
36 deletions
+38
-36
MBSlave.cc
Utilities/MBTester/MBSlave.cc
+1
-1
MBTCPServer.cc
Utilities/MBTester/MBTCPServer.cc
+1
-1
mbrtutester.cc
Utilities/MBTester/mbrtutester.cc
+1
-1
mbtcptester.cc
Utilities/MBTester/mbtcptester.cc
+1
-1
ctl-cpp-cc-alone.xsl
Utilities/codegen/ctl-cpp-cc-alone.xsl
+3
-3
ctl-cpp-cc-ask.xsl
Utilities/codegen/ctl-cpp-cc-ask.xsl
+4
-4
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+4
-4
DBInterface.cc
extensions/DBServer-MySQL/DBInterface.cc
+5
-5
DBInterface.h
extensions/DBServer-MySQL/DBInterface.h
+5
-5
DBServer_MySQL.cc
extensions/DBServer-MySQL/DBServer_MySQL.cc
+2
-0
SQLiteInterface.cc
extensions/DBServer-SQLite/SQLiteInterface.cc
+4
-5
LProcessor.h
extensions/LogicProcessor/LProcessor.h
+2
-2
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+1
-1
RTUStorage.cc
extensions/ModbusMaster/RTUStorage.cc
+1
-1
RTUStorage.h
extensions/ModbusMaster/RTUStorage.h
+1
-1
mtr-setup.cc
extensions/ModbusMaster/mtr-setup.cc
+1
-1
MBSlave.h
extensions/ModbusSlave/MBSlave.h
+1
-0
No files found.
Utilities/MBTester/MBSlave.cc
View file @
3fb92dd5
...
...
@@ -15,7 +15,7 @@ using namespace std;
using
namespace
UniSetTypes
;
using
namespace
ModbusRTU
;
// -------------------------------------------------------------------------
MBSlave
::
MBSlave
(
ModbusRTU
::
ModbusAddr
addr
,
const
std
::
string
dev
,
const
std
::
string
speed
,
bool
use485
)
:
MBSlave
::
MBSlave
(
ModbusRTU
::
ModbusAddr
addr
,
const
std
::
string
&
dev
,
const
std
::
string
&
speed
,
bool
use485
)
:
rscomm
(
NULL
),
addr
(
addr
),
// prev(ModbusRTU::erNoError),
...
...
Utilities/MBTester/MBTCPServer.cc
View file @
3fb92dd5
...
...
@@ -15,7 +15,7 @@ using namespace std;
using
namespace
UniSetTypes
;
using
namespace
ModbusRTU
;
// -------------------------------------------------------------------------
MBTCPServer
::
MBTCPServer
(
ModbusAddr
myaddr
,
const
string
inetaddr
,
int
port
,
bool
verb
)
:
MBTCPServer
::
MBTCPServer
(
ModbusAddr
myaddr
,
const
string
&
inetaddr
,
int
port
,
bool
verb
)
:
sslot
(
NULL
),
addr
(
myaddr
),
// prev(ModbusRTU::erNoError),
...
...
Utilities/MBTester/mbrtutester.cc
View file @
3fb92dd5
...
...
@@ -676,7 +676,7 @@ int main( int argc, char **argv )
catch
(
ModbusRTU
::
mbException
&
ex
)
{
if
(
ex
.
err
!=
ModbusRTU
::
erTimeOut
)
throw
ex
;
throw
;
cout
<<
"timeout..."
<<
endl
;
}
...
...
Utilities/MBTester/mbtcptester.cc
View file @
3fb92dd5
...
...
@@ -507,7 +507,7 @@ int main( int argc, char **argv )
catch
(
ModbusRTU
::
mbException
&
ex
)
{
if
(
ex
.
err
!=
ModbusRTU
::
erTimeOut
)
throw
ex
;
throw
;
cout
<<
"timeout..."
<<
endl
;
}
...
...
Utilities/codegen/ctl-cpp-cc-alone.xsl
View file @
3fb92dd5
...
...
@@ -256,7 +256,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
catch( Exception
&
ex )
{
unideb[Debug::CRIT]
<<
myname
<<
"(getdata): "
<<
ex
<<
endl;
throw
ex
;
throw;
}
</xsl:template>
...
...
@@ -306,7 +306,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
catch( Exception
&
ex )
{
unideb[Debug::CRIT]
<<
myname
<<
"(setdata): "
<<
ex
<<
endl;
throw
ex
;
throw;
}
</xsl:template>
...
...
@@ -336,7 +336,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
catch( Exception
&
ex )
{
unideb[Debug::CRIT]
<<
myname
<<
"(setdata): "
<<
ex
<<
endl;
throw
ex
;
throw;
}
</xsl:template>
...
...
Utilities/codegen/ctl-cpp-cc-ask.xsl
View file @
3fb92dd5
...
...
@@ -204,7 +204,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
catch(Exception
&
ex)
{
unideb[Debug::CRIT]
<<
myname
<<
"(getState): "
<<
ex
<<
endl;
throw
ex
;
throw;
}
return 0;
...
...
@@ -294,7 +294,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
catch( UniSetTypes::Exception
&
ex )
{
unideb[Debug::CRIT]
<<
myname
<<
"(getdata): "
<<
ex
<<
endl;
throw
ex
;
throw;
}
}
</xsl:template>
...
...
@@ -326,7 +326,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
catch( UniSetTypes::Exception
&
ex )
{
unideb[Debug::CRIT]
<<
myname
<<
"(setdata): "
<<
ex
<<
endl;
throw
ex
;
throw;
}
}
</xsl:template>
...
...
@@ -359,7 +359,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
catch( UniSetTypes::Exception
&
ex )
{
unideb[Debug::CRIT]
<<
myname
<<
"(setdata): "
<<
ex
<<
endl;
throw
ex
;
throw;
}
}
</xsl:template>
...
...
Utilities/codegen/ctl-cpp-common.xsl
View file @
3fb92dd5
...
...
@@ -235,9 +235,9 @@
xmlNode* confnode;
/*! получить числовое свойство из конф. файла по привязанной confnode */
int getIntProp(const std::string
&
name) { return UniSetTypes::conf->getIntProp(confnode, name); }
int getIntProp(const std::string
&
amp;
name) { return UniSetTypes::conf->getIntProp(confnode, name); }
/*! получить текстовое свойство из конф. файла по привязанной confnode */
inline const std::string getProp(const std::string name) { return UniSetTypes::conf->getProp(confnode, name); }
inline const std::string getProp(const std::string
&
name) { return UniSetTypes::conf->getProp(confnode, name); }
int smReadyTimeout; /*!
<
время ожидания готовности SM */
bool activated;
...
...
@@ -553,7 +553,7 @@ end_private(false)
}
// -----------------------------------------------------------------------------
// ( val, confval, default val )
static const std::string init3_str(
const std::string
&
s1, const std::string
&
s2, const std::string
&
s3 )
static const std::string init3_str(
const std::string
&
s1, const std::string
&
s2, const std::string
&
s3 )
{
if( !s1.empty() )
return s1;
...
...
@@ -872,7 +872,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::testMode( bool _state )
<xsl:template
name=
"COMMON-CC-ALONE-FUNCS"
>
// -----------------------------------------------------------------------------
// ( val, confval, default val )
static const std::string init3_str(
const std::string
&
s1, const std::string
&
s2, const std::string
&
s3 )
static const std::string init3_str(
const std::string
&
s1, const std::string
&
s2, const std::string
&
s3 )
{
if( !s1.empty() )
return s1;
...
...
extensions/DBServer-MySQL/DBInterface.cc
View file @
3fb92dd5
...
...
@@ -45,7 +45,7 @@ DBInterface::~DBInterface()
}
// -----------------------------------------------------------------------------------------
bool
DBInterface
::
connect
(
const
string
host
,
const
string
user
,
const
string
pswd
,
const
string
dbname
)
bool
DBInterface
::
connect
(
const
string
&
host
,
const
string
&
user
,
const
string
&
pswd
,
const
string
&
dbname
)
{
if
(
!
mysql_real_connect
(
mysql
,
host
.
c_str
(),
user
.
c_str
(),
pswd
.
c_str
(),
dbname
.
c_str
(),
0
,
NULL
,
0
))
{
...
...
@@ -65,7 +65,7 @@ bool DBInterface::close()
return
true
;
}
// -----------------------------------------------------------------------------------------
bool
DBInterface
::
insert
(
const
string
q
)
bool
DBInterface
::
insert
(
const
string
&
q
)
{
if
(
!
mysql
)
return
false
;
...
...
@@ -80,7 +80,7 @@ bool DBInterface::insert(const string q)
return
true
;
}
// -----------------------------------------------------------------------------------------
bool
DBInterface
::
query
(
const
string
q
)
bool
DBInterface
::
query
(
const
string
&
q
)
{
if
(
!
mysql
)
return
false
;
...
...
@@ -189,7 +189,7 @@ bool DBInterface::dropDB(const string dbname)
}
*/
// -----------------------------------------------------------------------------------------
MYSQL_RES
*
DBInterface
::
listFields
(
const
string
table
,
const
string
wild
)
MYSQL_RES
*
DBInterface
::
listFields
(
const
string
&
table
,
const
string
&
wild
)
{
if
(
!
mysql
||
!
result
)
return
0
;
...
...
@@ -233,7 +233,7 @@ bool DBInterface::isConnection()
return
ping
();
//!mysql;
}
// -----------------------------------------------------------------------------------------
string
DBInterface
::
addslashes
(
const
string
&
str
)
string
DBInterface
::
addslashes
(
const
string
&
str
)
{
ostringstream
tmp
;
for
(
unsigned
int
i
=
0
;
i
<
str
.
size
();
i
++
)
...
...
extensions/DBServer-MySQL/DBInterface.h
View file @
3fb92dd5
...
...
@@ -39,16 +39,16 @@ class DBInterface
// bool createDB(const std::string dbname);
// bool dropDB(const std::string dbname);
MYSQL_RES
*
listFields
(
const
std
::
string
table
,
const
std
::
string
wild
);
MYSQL_RES
*
listFields
(
const
std
::
string
&
table
,
const
std
::
string
&
wild
);
bool
connect
(
const
std
::
string
host
,
const
std
::
string
user
,
const
std
::
string
pswd
,
const
std
::
string
dbname
);
bool
connect
(
const
std
::
string
&
host
,
const
std
::
string
&
user
,
const
std
::
string
&
pswd
,
const
std
::
string
&
dbname
);
bool
close
();
bool
query
(
const
std
::
string
q
);
bool
query
(
const
std
::
string
&
q
);
const
std
::
string
lastQuery
();
bool
insert
(
const
std
::
string
q
);
bool
insert
(
const
std
::
string
&
q
);
std
::
string
addslashes
(
const
std
::
string
&
str
);
...
...
extensions/DBServer-MySQL/DBServer_MySQL.cc
View file @
3fb92dd5
...
...
@@ -44,6 +44,7 @@ DBServer_MySQL::DBServer_MySQL(ObjectId id):
ReconnectTime
(
180000
),
connect_ok
(
false
),
activate
(
true
),
qbufSize
(
200
),
lastRemove
(
false
)
{
if
(
getId
()
==
DefaultObjectId
)
...
...
@@ -61,6 +62,7 @@ DBServer_MySQL::DBServer_MySQL():
ReconnectTime
(
180000
),
connect_ok
(
false
),
activate
(
true
),
qbufSize
(
200
),
lastRemove
(
false
)
{
// init();
...
...
extensions/DBServer-SQLite/SQLiteInterface.cc
View file @
3fb92dd5
...
...
@@ -44,8 +44,7 @@ opCheckPause(50)
SQLiteInterface
::~
SQLiteInterface
()
{
close
();
if
(
db
)
delete
db
;
delete
db
;
}
// -----------------------------------------------------------------------------------------
...
...
@@ -54,7 +53,7 @@ bool SQLiteInterface::ping()
return
db
&&
(
sqlite3_db_status
(
db
,
0
,
NULL
,
NULL
,
0
)
==
SQLITE_OK
);
}
// -----------------------------------------------------------------------------------------
bool
SQLiteInterface
::
connect
(
const
string
dbfile
,
bool
create
)
bool
SQLiteInterface
::
connect
(
const
string
&
dbfile
,
bool
create
)
{
// т.к. sqlite3 по умолчанию, создаёт файл при открытии, то проверим "сами"
// if( !create && !UniSetTypes::file_exist(dbfile) )
...
...
@@ -97,7 +96,7 @@ void SQLiteInterface::setOperationTimeout( timeout_t msec )
sqlite3_busy_timeout
(
db
,
opTimeout
);
}
// -----------------------------------------------------------------------------------------
bool
SQLiteInterface
::
insert
(
const
string
q
)
bool
SQLiteInterface
::
insert
(
const
string
&
q
)
{
if
(
!
db
)
return
false
;
...
...
@@ -134,7 +133,7 @@ bool SQLiteInterface::checkResult( int rc )
return
true
;
}
// -----------------------------------------------------------------------------------------
SQLiteResult
SQLiteInterface
::
query
(
const
string
q
)
SQLiteResult
SQLiteInterface
::
query
(
const
string
&
q
)
{
if
(
!
db
)
return
SQLiteResult
();
...
...
extensions/LogicProcessor/LProcessor.h
View file @
3fb92dd5
...
...
@@ -94,10 +94,10 @@
class
LProcessor
{
public
:
LProcessor
(
const
std
::
string
name
=
""
);
LProcessor
(
const
std
::
string
&
name
=
""
);
virtual
~
LProcessor
();
virtual
void
execute
(
const
string
lfile
);
virtual
void
execute
(
const
string
&
lfile
);
protected
:
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
3fb92dd5
...
...
@@ -277,7 +277,7 @@ bool MBExchange::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
}
// ------------------------------------------------------------------------------------------
MBExchange
::
DeviceType
MBExchange
::
getDeviceType
(
const
std
::
string
dtype
)
MBExchange
::
DeviceType
MBExchange
::
getDeviceType
(
const
std
::
string
&
dtype
)
{
if
(
dtype
.
empty
()
)
return
dtUnknown
;
...
...
extensions/ModbusMaster/RTUStorage.cc
View file @
3fb92dd5
...
...
@@ -559,7 +559,7 @@ void RTUStorage::print()
cout
<<
this
;
}
// -----------------------------------------------------------------------------
RTUStorage
::
RTUJack
RTUStorage
::
s2j
(
const
std
::
string
jack
)
RTUStorage
::
RTUJack
RTUStorage
::
s2j
(
const
std
::
string
&
jack
)
{
if
(
jack
==
"J1"
||
jack
==
"j1"
)
return
nJ1
;
...
...
extensions/ModbusMaster/RTUStorage.h
View file @
3fb92dd5
...
...
@@ -38,7 +38,7 @@ class RTUStorage
nX5
// DI (8)
};
static
RTUJack
s2j
(
const
std
::
string
jack
);
static
RTUJack
s2j
(
const
std
::
string
&
jack
);
static
std
::
string
j2s
(
RTUJack
j
);
long
getInt
(
RTUJack
jack
,
unsigned
short
channel
,
UniversalIO
::
IOTypes
t
);
...
...
extensions/ModbusMaster/mtr-setup.cc
View file @
3fb92dd5
...
...
@@ -88,7 +88,7 @@ int main( int argc, char **argv )
ModbusRTU
::
ModbusAddr
end
=
255
;
int
tout
=
20
;
DebugStream
dlog
;
string
tofile
(
""
);
//
string tofile("");
int
use485
=
0
;
ComPort
::
StopBits
sbits
=
ComPort
::
OneBit
;
ComPort
::
Parity
parity
=
ComPort
::
NoParity
;
...
...
extensions/ModbusSlave/MBSlave.h
View file @
3fb92dd5
...
...
@@ -53,6 +53,7 @@ class MBSlave:
IOProperty
()
:
mbreg
(
0
),
amode
(
amRW
),
vtype
(
VTypes
::
vtUnknown
),
wnum
(
0
)
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment