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
f7e16de5
Commit
f7e16de5
authored
Oct 26, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Очередная порция исправлений по результатам проверки при помощи Coverity.
parent
ab7ab90a
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
108 additions
and
75 deletions
+108
-75
admin.cc
Utilities/Admin/admin.cc
+1
-1
DBServer_MySQL.cc
extensions/DBServer-MySQL/DBServer_MySQL.cc
+4
-1
IOControl.cc
extensions/IOControl/IOControl.cc
+5
-5
iocalibr.cc
extensions/IOControl/iocalibr.cc
+10
-1
LProcessor.cc
extensions/LogicProcessor/LProcessor.cc
+5
-3
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+5
-5
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+6
-6
MBTCPPersistentSlave.h
extensions/ModbusSlave/MBTCPPersistentSlave.h
+4
-4
RRDServer.cc
extensions/RRDServer/RRDServer.cc
+1
-1
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+5
-4
UNetExchange.h
extensions/UNetUDP/UNetExchange.h
+6
-6
UNetReceiver.h
extensions/UNetUDP/UNetReceiver.h
+10
-10
UNetSender.cc
extensions/UNetUDP/UNetSender.cc
+3
-1
test_unetudp.cc
extensions/UNetUDP/tests/test_unetudp.cc
+2
-2
unet-udp-tester.cc
extensions/UNetUDP/unet-udp-tester.cc
+11
-3
UniExchange.cc
extensions/UniNetwork/UniExchange.cc
+5
-3
MTR.h
extensions/include/MTR.h
+1
-1
IONotifyController.h
include/IONotifyController.h
+2
-1
ModbusTypes.h
include/modbus/ModbusTypes.h
+2
-2
PyUInterface.cc
python/lib/pyUniSet/PyUInterface.cc
+0
-2
ModbusClient.cc
src/Communications/Modbus/ModbusClient.cc
+1
-1
ModbusTypes.cc
src/Communications/Modbus/ModbusTypes.cc
+10
-9
Configuration.cc
src/Various/Configuration.cc
+1
-0
test_unixml.cc
tests/test_unixml.cc
+3
-2
tests_with_conf.cc
tests/tests_with_conf.cc
+5
-1
No files found.
Utilities/Admin/admin.cc
View file @
f7e16de5
...
...
@@ -136,7 +136,7 @@ int main(int argc, char** argv)
try
{
int
optindex
=
0
;
char
opt
=
0
;
int
opt
=
0
;
while
(
1
)
{
...
...
extensions/DBServer-MySQL/DBServer_MySQL.cc
View file @
f7e16de5
...
...
@@ -331,7 +331,10 @@ void DBServer_MySQL::createTables( MySQLInterface* db )
throw
Exception
();
}
for
(
it
.
goChildren
();
it
;
it
.
goNext
()
)
if
(
!
it
.
goChildren
()
)
return
;
for
(
;
it
;
it
.
goNext
()
)
{
if
(
it
.
getName
()
!=
"comment"
)
{
...
...
extensions/IOControl/IOControl.cc
View file @
f7e16de5
...
...
@@ -221,13 +221,14 @@ IOControl::IOControl(UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
int
blink3_msec
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-blink3-time"
,
it
.
getProp
(
"blink3-time"
),
100
);
ptBlink3
.
setTiming
(
blink3_msec
);
smReadyTime
out
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
it
.
getProp
(
"ready_timeout"
));
int
sm_t
out
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
it
.
getProp
(
"ready_timeout"
));
if
(
sm
ReadyTime
out
==
0
)
if
(
sm
_t
out
==
0
)
smReadyTimeout
=
15000
;
else
if
(
sm
ReadyTime
out
<
0
)
else
if
(
sm
_t
out
<
0
)
smReadyTimeout
=
UniSetTimer
::
WaitUpTime
;
else
smReadyTimeout
=
sm_tout
;
string
sm_ready_sid
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-sm-ready-test-sid"
,
it
.
getProp
(
"sm_ready_test_sid"
));
sidTestSMReady
=
conf
->
getSensorID
(
sm_ready_sid
);
...
...
@@ -1567,7 +1568,6 @@ void IOControl::buildCardsList()
xmlNode
*
mynode
=
0
;
UniXML
::
iterator
it1
(
nnode
);
it1
.
goChildren
();
if
(
it1
.
goChildren
()
)
{
...
...
extensions/IOControl/iocalibr.cc
View file @
f7e16de5
...
...
@@ -168,6 +168,13 @@ int main(int argc, char* argv[])
// insn_config(card,subdev,chan,100,range,aref);
int
fd
=
open
(
"/dev/stdin"
,
O_NONBLOCK
|
O_RDONLY
);
if
(
fd
==
-
1
)
{
cerr
<<
"can't open 'stdin'.. error: "
<<
strerror
(
errno
)
<<
endl
;
exit
(
EXIT_FAILURE
);
}
helpPrint
();
if
(
openFileXml
.
length
()
>
1
&&
nodeXml
.
length
()
>
1
)
...
...
@@ -480,6 +487,7 @@ void openXML()
// --------------------------------------------------------------------------
void
dispDiagram
()
{
std
::
ios_base
::
fmtflags
old_flags
=
cout
.
flags
();
cout
.
setf
(
ios
::
right
,
ios
::
adjustfield
);
cout
<<
endl
<<
"================================="
<<
endl
;
cout
<<
"| data | calibrated |"
<<
endl
;
...
...
@@ -494,6 +502,7 @@ void dispDiagram()
cout
<<
"================================="
<<
endl
;
cout
<<
sortedMass
.
size
()
<<
" "
<<
massDat
.
size
()
<<
endl
;
cout
.
setf
(
old_flags
);
}
// --------------------------------------------------------------------------
...
...
@@ -512,7 +521,7 @@ void sortData(bool rise, bool cal)
temp
.
sort
();
list
<
int
>::
iterator
itl
;
list
<
int
>::
iterator
ite
;
int
tt
=
*
(
temp
.
end
());
int
tt
=
*
(
--
temp
.
end
());
for
(
itl
=
temp
.
begin
();
itl
!=
temp
.
end
();
itl
++
)
{
...
...
extensions/LogicProcessor/LProcessor.cc
View file @
f7e16de5
...
...
@@ -14,12 +14,14 @@ LProcessor::LProcessor( const std::string& name ):
{
auto
conf
=
uniset_conf
();
sleepTime
=
conf
->
getArgPInt
(
"--sleepTime"
,
200
);
smReadyTime
out
=
conf
->
getArgInt
(
"--sm-ready-timeout"
,
""
);
int
t
out
=
conf
->
getArgInt
(
"--sm-ready-timeout"
,
""
);
if
(
smReadyTime
out
==
0
)
if
(
t
out
==
0
)
smReadyTimeout
=
60000
;
else
if
(
smReadyTime
out
<
0
)
else
if
(
t
out
<
0
)
smReadyTimeout
=
UniSetTimer
::
WaitUpTime
;
else
smReadyTimeout
=
tout
;
sch
=
make_shared
<
SchemaXML
>
();
}
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
f7e16de5
...
...
@@ -268,11 +268,11 @@ MBExchange::~MBExchange()
void
MBExchange
::
waitSMReady
()
{
// waiting for SM is ready...
timeout_t
ready_time
out
=
uniset_conf
()
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
"15000"
);
if
(
ready_timeout
==
0
)
ready_timeout
=
15000
;
else
if
(
ready_time
out
<
0
)
int
t
out
=
uniset_conf
()
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
"15000"
);
timeout_t
ready_timeout
=
15000
;
if
(
ready_timeout
>
0
)
ready_timeout
=
tout
;
else
if
(
t
out
<
0
)
ready_timeout
=
UniSetTimer
::
WaitUpTime
;
if
(
!
shm
->
waitSMready
(
ready_timeout
,
50
)
)
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
f7e16de5
...
...
@@ -243,7 +243,7 @@ MBSlave::MBSlave(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const
int
heartbeatTime
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-heartbeat-time"
,
it
.
getProp
(
"heartbeatTime"
),
conf
->
getHeartBeatTime
());
if
(
heartbeatTime
)
if
(
heartbeatTime
>
0
)
ptHeartBeat
.
setTiming
(
heartbeatTime
);
else
ptHeartBeat
.
setTiming
(
UniSetTimer
::
WaitUpTime
);
...
...
@@ -461,11 +461,11 @@ void MBSlave::finalThread()
void
MBSlave
::
waitSMReady
()
{
// waiting for SM is ready...
timeout_t
ready_time
out
=
uniset_conf
()
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
"15000"
);
if
(
ready_timeout
==
0
)
ready_timeout
=
15000
;
else
if
(
ready_time
out
<
0
)
int
t
out
=
uniset_conf
()
->
getArgInt
(
"--"
+
prefix
+
"-sm-ready-timeout"
,
"15000"
);
timeout_t
ready_timeout
=
15000
;
if
(
ready_timeout
>
0
)
ready_timeout
=
tout
;
else
if
(
t
out
<
0
)
ready_timeout
=
UniSetTimer
::
WaitUpTime
;
if
(
!
shm
->
waitSMready
(
ready_timeout
,
50
)
)
...
...
extensions/ModbusSlave/MBTCPPersistentSlave.h
View file @
f7e16de5
...
...
@@ -56,14 +56,14 @@ class MBTCPPersistentSlave:
std
::
string
iaddr
;
UniSetTypes
::
ObjectId
respond_s
;
UniSetTypes
::
ObjectId
respond_s
=
{
UniSetTypes
::
DefaultObjectId
}
;
IOController
::
IOStateList
::
iterator
respond_it
;
bool
invert
;
bool
invert
=
{
false
}
;
PassiveTimer
ptTimeout
;
timeout_t
tout
;
timeout_t
tout
=
{
2000
}
;
long
askCount
;
UniSetTypes
::
ObjectId
askcount_s
;
UniSetTypes
::
ObjectId
askcount_s
=
{
UniSetTypes
::
DefaultObjectId
}
;
IOController
::
IOStateList
::
iterator
askcount_it
;
inline
void
initIterators
(
const
std
::
shared_ptr
<
SMInterface
>&
shm
)
...
...
extensions/RRDServer/RRDServer.cc
View file @
f7e16de5
...
...
@@ -365,7 +365,7 @@ void RRDServer::timerInfo( const UniSetTypes::TimerMessage* tm )
mycrit
<<
err
.
str
()
<<
endl
;
}
delete
argv
;
delete
[]
argv
;
break
;
}
}
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
f7e16de5
...
...
@@ -454,11 +454,12 @@ void UNetExchange::startReceivers()
void
UNetExchange
::
waitSMReady
()
{
// waiting for SM is ready...
timeout_t
ready_time
out
=
uniset_conf
()
->
getArgInt
(
"--unet-sm-ready-timeout"
,
"15000"
);
int
t
out
=
uniset_conf
()
->
getArgInt
(
"--unet-sm-ready-timeout"
,
"15000"
);
if
(
ready_timeout
==
0
)
ready_timeout
=
15000
;
else
if
(
ready_timeout
<
0
)
timeout_t
ready_timeout
=
15000
;
if
(
tout
>
0
)
ready_timeout
=
tout
;
else
if
(
tout
<
0
)
ready_timeout
=
UniSetTimer
::
WaitUpTime
;
if
(
!
shm
->
waitSMready
(
ready_timeout
,
50
)
)
...
...
extensions/UNetUDP/UNetExchange.h
View file @
f7e16de5
...
...
@@ -160,15 +160,15 @@ class UNetExchange:
UniSetTypes
::
uniset_rwmutex
mutex_start
;
PassiveTimer
ptHeartBeat
;
UniSetTypes
::
ObjectId
sidHeartBeat
;
timeout_t
maxHeartBeat
;
UniSetTypes
::
ObjectId
sidHeartBeat
=
{
UniSetTypes
::
DefaultObjectId
}
;
timeout_t
maxHeartBeat
=
10
;
IOController
::
IOStateList
::
iterator
itHeartBeat
;
UniSetTypes
::
ObjectId
test_id
;
UniSetTypes
::
ObjectId
test_id
=
{
UniSetTypes
::
DefaultObjectId
}
;
timeout_t
steptime
;
/*!< периодичность вызова step, [мсек] */
timeout_t
steptime
=
{
1000
}
;
/*!< периодичность вызова step, [мсек] */
std
::
atomic_bool
activated
;
timeout_t
activateTimeout
;
std
::
atomic_bool
activated
=
{
false
}
;
timeout_t
activateTimeout
=
{
20000
};
// msec
struct
ReceiverInfo
{
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
f7e16de5
...
...
@@ -162,8 +162,8 @@ class UNetReceiver:
private
:
UNetReceiver
();
int
recvpause
;
/*!< пауза меджду приёмами пакетов, [мсек] */
int
updatepause
;
/*!< переодичность обновления данных в SM, [мсек] */
timeout_t
recvpause
=
{
10
}
;
/*!< пауза меджду приёмами пакетов, [мсек] */
timeout_t
updatepause
=
{
100
}
;
/*!< переодичность обновления данных в SM, [мсек] */
std
::
shared_ptr
<
ost
::
UDPReceive
>
udp
;
ost
::
IPV4Address
addr
;
...
...
@@ -173,11 +173,11 @@ class UNetReceiver:
UniSetTypes
::
uniset_rwmutex
pollMutex
;
PassiveTimer
ptRecvTimeout
;
PassiveTimer
ptPrepare
;
timeout_t
recvTimeout
;
timeout_t
prepareTime
;
timeout_t
lostTimeout
;
timeout_t
recvTimeout
=
{
5000
};
// msec
timeout_t
prepareTime
=
{
2000
}
;
timeout_t
lostTimeout
=
{
200
}
;
PassiveTimer
ptLostTimeout
;
unsigned
long
lostPackets
=
{
0
};
/*!< счётчик потерянных пакетов */
size_t
lostPackets
=
{
0
};
/*!< счётчик потерянных пакетов */
UniSetTypes
::
ObjectId
sidRespond
=
{
UniSetTypes
::
DefaultObjectId
};
IOController
::
IOStateList
::
iterator
itRespond
;
...
...
@@ -194,18 +194,18 @@ class UNetReceiver:
UniSetUDP
::
UDPMessage
pack
;
/*!< просто буфер для получения очередного сообщения */
UniSetUDP
::
UDPPacket
r_buf
;
UniSetTypes
::
uniset_rwmutex
packMutex
;
/*!< mutex для работы с очередью */
unsigned
long
pnum
;
/*!< текущий номер обработанного сообщения, для проверки непрерывности последовательности пакетов */
size_t
pnum
=
{
0
}
;
/*!< текущий номер обработанного сообщения, для проверки непрерывности последовательности пакетов */
/*! максимальная разница межд номерами пакетов, при которой считается, что счётчик пакетов
* прошёл через максимум или сбился...
*/
unsigned
long
maxDifferens
=
{
20
};
size_t
maxDifferens
=
{
20
};
PacketQueue
qtmp
;
/*!< очередь на время обработки(очистки) основной очереди */
bool
waitClean
=
{
false
};
/*!< флаг означающий, что ждём очистики очереди до конца */
unsigned
long
rnum
=
{
0
};
/*!< текущий номер принятого сообщения, для проверки "переполнения" или "сбоя" счётчика */
size_t
rnum
=
{
0
};
/*!< текущий номер принятого сообщения, для проверки "переполнения" или "сбоя" счётчика */
int
maxProcessingCount
;
/*!< максимальное число обрабатываемых за один раз сообщений */
size_t
maxProcessingCount
=
{
100
}
;
/*!< максимальное число обрабатываемых за один раз сообщений */
bool
lockUpdate
=
{
false
};
/*!< флаг блокировки сохранения принятых данных в SM */
UniSetTypes
::
uniset_rwmutex
lockMutex
;
...
...
extensions/UNetUDP/UNetSender.cc
View file @
f7e16de5
...
...
@@ -244,7 +244,9 @@ void UNetSender::real_send(UniSetUDP::UDPMessage& mypack)
#endif
if
(
packetnum
>
UniSetUDP
::
MaxPacketNum
)
// при переходе через ноль (когда счётчик перевалит через UniSetUDP::MaxPacketNum..
// делаем номер пакета "1"
if
(
packetnum
==
0
)
packetnum
=
1
;
if
(
!
udp
->
isPending
(
ost
::
Socket
::
pendingOutput
)
)
...
...
extensions/UNetUDP/tests/test_unetudp.cc
View file @
f7e16de5
...
...
@@ -164,8 +164,8 @@ TEST_CASE("[UNetUDP]: UDPMessage", "[unetudp][udpmessage]")
UniSetUDP
::
UDPPacket
p
;
size_t
len
=
u
.
transport_msg
(
p
);
CHECK
(
len
!=
0
);
CHECK
(
a
<
UniSetUDP
::
MaxACount
);
CHECK
(
a
<
UniSetUDP
::
MaxDCount
);
REQUIRE
(
a
<
UniSetUDP
::
MaxACount
);
REQUIRE
(
a
<
UniSetUDP
::
MaxDCount
);
UniSetUDP
::
UDPMessage
u2
(
p
);
REQUIRE
(
u2
.
a_dat
[
a
].
id
==
100
);
...
...
extensions/UNetUDP/unet-udp-tester.cc
View file @
f7e16de5
...
...
@@ -56,6 +56,14 @@ static bool split_addr( const string& addr, string& host, ost::tpport_t& port )
// --------------------------------------------------------------------------
int
main
(
int
argc
,
char
*
argv
[])
{
size_t
n
=
UniSetUDP
::
MaxPacketNum
;
cout
<<
"n="
<<
n
<<
endl
;
n
++
;
cout
<<
"n++="
<<
n
<<
endl
;
return
0
;
int
optindex
=
0
;
int
opt
=
0
;
Command
cmd
=
cmdNOP
;
...
...
@@ -70,7 +78,7 @@ int main(int argc, char* argv[])
size_t
count
=
50
;
bool
lost
=
false
;
bool
show
=
false
;
int
ncycles
=
-
1
;
size_t
ncycles
=
0
;
unsigned
int
nprof
=
0
;
while
(
1
)
...
...
@@ -311,11 +319,11 @@ int main(int argc, char* argv[])
mypack
.
addDData
(
i
,
i
);
udp
->
setPeer
(
host
,
port
);
unsigned
long
packetnum
=
0
;
size_t
packetnum
=
0
;
UniSetUDP
::
UDPPacket
s_buf
;
in
t
nc
=
1
;
size_
t
nc
=
1
;
if
(
ncycles
>
0
)
nc
=
ncycles
;
...
...
extensions/UniNetwork/UniExchange.cc
View file @
f7e16de5
...
...
@@ -57,12 +57,14 @@ UniExchange::UniExchange(UniSetTypes::ObjectId id, UniSetTypes::ObjectId shmID,
ptUpdate
.
setTiming
(
updatetime
);
smReadyTime
out
=
conf
->
getArgInt
(
"--io-sm-ready-timeout"
,
it
.
getProp
(
"ready_timeout"
));
int
sm_t
out
=
conf
->
getArgInt
(
"--io-sm-ready-timeout"
,
it
.
getProp
(
"ready_timeout"
));
if
(
sm
ReadyTime
out
==
0
)
if
(
sm
_t
out
==
0
)
smReadyTimeout
=
15000
;
else
if
(
sm
ReadyTime
out
<
0
)
else
if
(
sm
_t
out
<
0
)
smReadyTimeout
=
UniSetTimer
::
WaitUpTime
;
else
smReadyTimeout
=
sm_tout
;
dinfo
<<
myname
<<
"(init): smReadyTimeout="
<<
smReadyTimeout
<<
endl
;
...
...
extensions/include/MTR.h
View file @
f7e16de5
...
...
@@ -296,7 +296,7 @@ namespace MTR
val
=
raw
.
u2
.
val
*
pow
(
(
long
)
10
,
(
long
)
raw
.
u2
.
exp
);
}
T5
(
const
ModbusRTU
::
ModbusData
*
data
,
int
size
)
T5
(
const
ModbusRTU
::
ModbusData
*
data
,
int
size
)
:
val
(
0
)
{
if
(
size
>=
u2size
)
{
...
...
include/IONotifyController.h
View file @
f7e16de5
...
...
@@ -264,7 +264,8 @@ class IONotifyController:
si
(
si
),
type
(
t
),
list
(
std
::
move
(
list
)
)
{}
UniSetTypes
::
uniset_rwmutex
mut
;
IOController_i
::
SensorInfo
si
;
/*!< аналоговый датчик */
IOController_i
::
SensorInfo
si
=
{
UniSetTypes
::
DefaultObjectId
,
UniSetTypes
::
DefaultObjectId
};
std
::
shared_ptr
<
USensorInfo
>
ait
;
UniversalIO
::
IOType
type
=
{
UniversalIO
::
AI
};
ThresholdExtList
list
;
/*!< список порогов по данному аналоговому датчику */
...
...
include/modbus/ModbusTypes.h
View file @
f7e16de5
...
...
@@ -185,8 +185,8 @@ namespace ModbusRTU
struct
ErrorRetMessage
:
public
ModbusHeader
{
ModbusByte
ecode
;
ModbusCRC
crc
;
ModbusByte
ecode
=
{
erNoError
}
;
ModbusCRC
crc
=
{
0
}
;
// ------- from slave -------
ErrorRetMessage
(
ModbusMessage
&
m
);
...
...
python/lib/pyUniSet/PyUInterface.cc
View file @
f7e16de5
...
...
@@ -74,8 +74,6 @@ long pyUInterface::getValue( long id )throw(UException)
{
throw
UException
(
ex
.
what
());
}
throw
UException
(
"(getValue): unknown error"
);
}
//---------------------------------------------------------------------------
void
pyUInterface
::
setValue
(
long
id
,
long
val
)
throw
(
UException
)
...
...
src/Communications/Modbus/ModbusClient.cc
View file @
f7e16de5
...
...
@@ -994,7 +994,7 @@ mbErrCode ModbusClient::recv_pdu( ModbusByte qfunc, ModbusMessage& rbuf, timeout
{
size_t
onum
=
0
;
while
(
(
rlen
+
2
)
<
sizeof
(
rbuf
)
&&
onum
<
mPreRDI
.
objNum
)
while
(
(
rlen
+
2
)
<
sizeof
(
rbuf
.
data
)
&&
onum
<
mPreRDI
.
objNum
)
{
// сперва получаем два байта, для определения длины последующих данных
size_t
szDataLen
=
2
;
// object id + len
...
...
src/Communications/Modbus/ModbusTypes.cc
View file @
f7e16de5
...
...
@@ -1650,7 +1650,7 @@ size_t WriteOutputMessage::szData()
// -------------------------------------------------------------------------
int
WriteOutputMessage
::
getDataLen
(
ModbusMessage
&
m
)
{
if
(
m
.
len
<
0
)
if
(
m
.
len
==
0
)
return
0
;
// копируем только часть заголовка возвращаем count
...
...
@@ -1845,7 +1845,7 @@ size_t ForceSingleCoilMessage::szData()
// -------------------------------------------------------------------------
int
ForceSingleCoilMessage
::
getDataLen
(
ModbusMessage
&
m
)
{
if
(
m
.
len
<
0
)
if
(
m
.
len
==
0
)
return
0
;
return
sizeof
(
ModbusData
);
// data;
...
...
@@ -2017,7 +2017,7 @@ size_t WriteSingleOutputMessage::szData()
// -------------------------------------------------------------------------
int
WriteSingleOutputMessage
::
getDataLen
(
ModbusMessage
&
m
)
{
if
(
m
.
len
<
0
)
if
(
m
.
len
==
0
)
return
0
;
return
sizeof
(
ModbusData
);
// data;
...
...
@@ -3148,7 +3148,7 @@ size_t RemoteServiceMessage::szData()
// -------------------------------------------------------------------------
int
RemoteServiceMessage
::
getDataLen
(
ModbusMessage
&
m
)
{
if
(
m
.
len
<
0
)
if
(
m
.
len
==
0
)
return
0
;
// RemoteServiceMessage wm(m);
...
...
@@ -3297,7 +3297,7 @@ size_t ReadFileRecordMessage::szData()
// -------------------------------------------------------------------------
int
ReadFileRecordMessage
::
getDataLen
(
ModbusMessage
&
m
)
{
if
(
m
.
len
<
0
)
if
(
m
.
len
==
0
)
return
0
;
return
(
int
)(
m
.
data
[
0
]);
...
...
@@ -3409,16 +3409,17 @@ void FileTransferRetMessage::init( ModbusMessage& m )
memcpy
(
&
numfile
,
&
(
m
.
data
[
1
]),
sizeof
(
ModbusData
));
memcpy
(
&
numpacks
,
&
(
m
.
data
[
1
+
sizeof
(
ModbusData
)]),
sizeof
(
ModbusData
));
memcpy
(
&
packet
,
&
(
m
.
data
[
1
+
2
*
sizeof
(
ModbusData
)]),
sizeof
(
ModbusData
));
numfile
=
SWAPSHORT
(
numfile
);
numpacks
=
SWAPSHORT
(
numpacks
);
packet
=
SWAPSHORT
(
packet
);
dlen
=
m
.
data
[
7
];
numfile
=
SWAPSHORT
(
numfile
);
numpacks
=
SWAPSHORT
(
numpacks
);
packet
=
SWAPSHORT
(
packet
);
dlen
=
m
.
data
[
7
];
memcpy
(
data
,
&
(
m
.
data
[
8
]),
dlen
);
memcpy
(
&
crc
,
&
(
m
.
data
[
8
+
dlen
]),
szCRC
);
}
// -----------------------------------------------------------------------
FileTransferRetMessage
::
FileTransferRetMessage
(
ModbusAddr
_from
)
:
bcnt
(
0
),
numfile
(
0
),
numpacks
(
0
),
packet
(
0
),
...
...
src/Various/Configuration.cc
View file @
f7e16de5
...
...
@@ -99,6 +99,7 @@ namespace UniSetTypes
Configuration
::
Configuration
()
:
oind
(
NULL
),
_argv
(
nullptr
),
NSName
(
"NameService"
),
repeatCount
(
2
),
repeatTimeout
(
100
),
localDBServer
(
UniSetTypes
::
DefaultObjectId
),
...
...
tests/test_unixml.cc
View file @
f7e16de5
...
...
@@ -119,7 +119,7 @@ TEST_CASE("UniXML::iterator", "[unixml][iterator][basic]" )
CHECK
(
it
.
getName
()
==
"UNISETPLC"
);
it
=
uxml
.
begin
();
it
.
goChildren
(
);
REQUIRE
(
it
.
goChildren
()
==
true
);
it
.
goEnd
();
CHECK
(
it
.
getName
()
==
"EndSection"
);
it
.
goBegin
();
...
...
@@ -155,7 +155,8 @@ TEST_CASE("UniXML::iterator::find", "[unixml][iterator-find][basic]" )
// REQUIRE( it.getProp("name") == "Test4" );
UniXML
::
iterator
sIt
(
it
);
sIt
.
goChildren
();
REQUIRE
(
sIt
.
goChildren
()
==
true
);
CHECK
(
sIt
.
find
(
"subnode"
)
);
REQUIRE
(
sIt
.
getProp
(
"name"
)
==
"Test5"
);
...
...
tests/tests_with_conf.cc
View file @
f7e16de5
...
...
@@ -19,10 +19,14 @@ int main( int argc, char* argv[] )
return
session
.
run
();
}
catch
(
UniSetTypes
::
Exception
&
ex
)
catch
(
const
UniSetTypes
::
Exception
&
ex
)
{
std
::
cerr
<<
ex
<<
std
::
endl
;
}
catch
(
const
std
::
exception
&
ex
)
{
std
::
cerr
<<
ex
.
what
()
<<
std
::
endl
;
}
return
1
;
}
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