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
1a422150
Commit
1a422150
authored
Aug 04, 2009
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use uni_atoi string instead c_str() in each call
parent
202f2fe6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
34 additions
and
18 deletions
+34
-18
admin.cc
Utilities/Admin/admin.cc
+3
-3
MBMaster.cc
extensions/MBTCPMaster/MBMaster.cc
+2
-2
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+18
-2
RTUExchange.cc
extensions/RTUExchange/RTUExchange.cc
+4
-4
UDPExchange.cc
extensions/UDPExchange/UDPExchange.cc
+1
-1
ModbusTCPTypes.cc
src/Communications/Modbus/ModbusTCPTypes.cc
+2
-2
ModbusTypes.cc
src/Communications/Modbus/ModbusTypes.cc
+2
-2
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+1
-1
NCRestorer_XML.cc
src/Various/NCRestorer_XML.cc
+1
-1
No files found.
Utilities/Admin/admin.cc
View file @
1a422150
...
...
@@ -1193,7 +1193,7 @@ int getValue(string args, UniversalInterface &ui )
// --------------------------------------------------------------------------------------
int
getCalibrate
(
string
arg
,
UniversalInterface
&
ui
)
{
UniSetTypes
::
ObjectId
sid
(
uni_atoi
(
arg
.
c_str
()
));
UniSetTypes
::
ObjectId
sid
(
uni_atoi
(
arg
));
if
(
sid
<=
0
)
{
cout
<<
"(getCalibrate): SensorId !!!!!!"
<<
endl
;
...
...
@@ -1219,7 +1219,7 @@ int getCalibrate(string arg, UniversalInterface &ui)
// --------------------------------------------------------------------------------------
int
getRawValue
(
string
arg
,
UniversalInterface
&
ui
)
{
UniSetTypes
::
ObjectId
sid
(
uni_atoi
(
arg
.
c_str
()
));
UniSetTypes
::
ObjectId
sid
(
uni_atoi
(
arg
));
if
(
sid
==
0
)
{
cout
<<
"(getRawValue): SensorId !!!!!!"
<<
endl
;
...
...
@@ -1296,7 +1296,7 @@ int configure(string arg, UniversalInterface &ui )
// --------------------------------------------------------------------------------------
int
oinfo
(
string
arg
,
UniversalInterface
&
ui
)
{
UniSetTypes
::
ObjectId
oid
(
uni_atoi
(
arg
.
c_str
()
));
UniSetTypes
::
ObjectId
oid
(
uni_atoi
(
arg
));
if
(
oid
==
0
)
{
cout
<<
"(oinfo): OID!"
<<
endl
;
...
...
extensions/MBTCPMaster/MBMaster.cc
View file @
1a422150
...
...
@@ -741,7 +741,7 @@ bool MBMaster::initItem( UniXML_iterator& it )
string
f
=
it
.
getProp
(
"mbfunc"
);
if
(
!
f
.
empty
()
)
{
p
.
mbfunc
=
(
ModbusRTU
::
SlaveFunctionCode
)
UniSetTypes
::
uni_atoi
(
f
.
c_str
()
);
p
.
mbfunc
=
(
ModbusRTU
::
SlaveFunctionCode
)
UniSetTypes
::
uni_atoi
(
f
);
if
(
p
.
mbfunc
==
ModbusRTU
::
fnUnknown
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem): mbfunc ='"
<<
f
...
...
@@ -765,7 +765,7 @@ bool MBMaster::initItem( UniXML_iterator& it )
return
false
;
}
p
.
nbit
=
UniSetTypes
::
uni_atoi
(
nb
.
c_str
()
);
p
.
nbit
=
UniSetTypes
::
uni_atoi
(
nb
);
}
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
1a422150
...
...
@@ -49,7 +49,7 @@ prefix(prefix)
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(init): read s_field='"
<<
s_field
<<
"' s_fvalue='"
<<
s_fvalue
<<
"'"
<<
endl
;
force
=
atoi
(
conf
->
getArgParam
(
"--"
+
prefix
+
"-force"
,
it
.
getProp
(
"force"
)).
c_str
(
));
force
=
uni_atoi
(
conf
->
getArgParam
(
"--"
+
prefix
+
"-force"
,
it
.
getProp
(
"force"
)
));
int
recv_timeout
=
atoi
(
conf
->
getArgParam
(
"--"
+
prefix
+
"-recv-timeout"
,
it
.
getProp
(
"recv_timeout"
)).
c_str
());
...
...
@@ -60,7 +60,7 @@ prefix(prefix)
else
addr
=
ModbusRTU
::
str2mbAddr
(
saddr
);
mbregFromID
=
atoi
(
conf
->
getArgParam
(
"--"
+
prefix
+
"-reg-from-id"
,
it
.
getProp
(
"reg_from_id"
)).
c_str
(
));
mbregFromID
=
uni_atoi
(
conf
->
getArgParam
(
"--"
+
prefix
+
"-reg-from-id"
,
it
.
getProp
(
"reg_from_id"
)
));
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(init): mbregFromID="
<<
mbregFromID
<<
endl
;
string
stype
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-type"
,
it
.
getProp
(
"type"
));
...
...
@@ -702,6 +702,22 @@ bool MBSlave::initItem( UniXML_iterator& it )
else
if
(
am
==
"rw"
)
p
.
amode
=
MBSlave
::
amRW
;
<<<<<<<
HEAD
:
extensions
/
ModbusSlave
/
MBSlave
.
cc
=======
string
f
=
it
.
getProp
(
"mbfunc"
);
if
(
!
f
.
empty
()
)
{
p
.
mbfunc
=
(
ModbusRTU
::
SlaveFunctionCode
)
UniSetTypes
::
uni_atoi
(
f
);
if
(
p
.
mbfunc
==
ModbusRTU
::
fnUnknown
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem): mbfunc ='"
<<
f
<<
"' "
<<
it
.
getProp
(
"name"
)
<<
endl
;
return
false
;
}
}
>>>>>>>
use
uni_atoi
string
instead
c_str
()
in
each
call
:
extensions
/
ModbusSlave
/
MBSlave
.
cc
iomap
[
p
.
mbreg
]
=
p
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
...
...
extensions/RTUExchange/RTUExchange.cc
View file @
1a422150
...
...
@@ -1050,7 +1050,7 @@ bool RTUExchange::initRSProperty( RSProperty& p, UniXML_iterator& it )
string
sbit
(
it
.
getProp
(
"nbit"
));
if
(
!
sbit
.
empty
()
)
{
p
.
nbit
=
UniSetTypes
::
uni_atoi
(
sbit
.
c_str
()
);
p
.
nbit
=
UniSetTypes
::
uni_atoi
(
sbit
);
if
(
p
.
nbit
<
0
||
p
.
nbit
>=
ModbusRTU
::
BitsPerData
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initRSProperty): BAD nbit="
<<
p
.
nbit
...
...
@@ -1070,7 +1070,7 @@ bool RTUExchange::initRSProperty( RSProperty& p, UniXML_iterator& it )
string
sbyte
(
it
.
getProp
(
"nbyte"
));
if
(
!
sbyte
.
empty
()
)
{
p
.
nbyte
=
UniSetTypes
::
uni_atoi
(
sbyte
.
c_str
()
);
p
.
nbyte
=
UniSetTypes
::
uni_atoi
(
sbyte
);
if
(
p
.
nbyte
<
0
||
p
.
nbyte
>
VTypes
::
Byte
::
bsize
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initRSProperty): BAD nbyte="
<<
p
.
nbyte
...
...
@@ -1159,7 +1159,7 @@ bool RTUExchange::initRegInfo( RegInfo* r, UniXML_iterator& it, RTUExchange::RT
string
f
=
it
.
getProp
(
"mbfunc"
);
if
(
!
f
.
empty
()
)
{
r
->
mbfunc
=
(
ModbusRTU
::
SlaveFunctionCode
)
UniSetTypes
::
uni_atoi
(
f
.
c_str
()
);
r
->
mbfunc
=
(
ModbusRTU
::
SlaveFunctionCode
)
UniSetTypes
::
uni_atoi
(
f
);
if
(
r
->
mbfunc
==
ModbusRTU
::
fnUnknown
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initRegInfo): Unknown mbfunc ='"
<<
f
...
...
@@ -1378,7 +1378,7 @@ bool RTUExchange::initRTU188item( UniXML_iterator& it, RegInfo* p )
return
false
;
}
p
->
rtuChan
=
UniSetTypes
::
uni_atoi
(
chan
.
c_str
()
);
p
->
rtuChan
=
UniSetTypes
::
uni_atoi
(
chan
);
if
(
dlog
.
debugging
(
Debug
::
LEVEL2
)
)
dlog
[
Debug
::
LEVEL2
]
<<
myname
<<
"(readRTU188Item): "
<<
p
<<
endl
;
...
...
extensions/UDPExchange/UDPExchange.cc
View file @
1a422150
...
...
@@ -567,7 +567,7 @@ bool UDPExchange::initItem( UniXML_iterator& it )
ObjectId
sid
;
if
(
!
tid
.
empty
()
)
{
sid
=
UniSetTypes
::
uni_atoi
(
tid
.
c_str
()
);
sid
=
UniSetTypes
::
uni_atoi
(
tid
);
if
(
sid
<=
0
)
sid
=
DefaultObjectId
;
}
...
...
src/Communications/Modbus/ModbusTCPTypes.cc
View file @
1a422150
...
...
@@ -2231,7 +2231,7 @@ ModbusAddr ModbusRTU::str2mbAddr( const std::string val )
if
(
val
.
empty
()
)
return
0
;
return
(
ModbusAddr
)
UniSetTypes
::
uni_atoi
(
val
.
c_str
()
);
return
(
ModbusAddr
)
UniSetTypes
::
uni_atoi
(
val
);
}
// -------------------------------------------------------------------------
ModbusData
ModbusRTU
::
str2mbData
(
const
std
::
string
val
)
...
...
@@ -2239,7 +2239,7 @@ ModbusData ModbusRTU::str2mbData( const std::string val )
if
(
val
.
empty
()
)
return
0
;
return
(
ModbusData
)
UniSetTypes
::
uni_atoi
(
val
.
c_str
()
);
return
(
ModbusData
)
UniSetTypes
::
uni_atoi
(
val
);
}
// -------------------------------------------------------------------------
std
::
string
ModbusRTU
::
dat2str
(
const
ModbusData
dat
)
...
...
src/Communications/Modbus/ModbusTypes.cc
View file @
1a422150
...
...
@@ -2248,7 +2248,7 @@ ModbusAddr ModbusRTU::str2mbAddr( const std::string val )
if
(
val
.
empty
()
)
return
0
;
return
(
ModbusAddr
)
UniSetTypes
::
uni_atoi
(
val
.
c_str
()
);
return
(
ModbusAddr
)
UniSetTypes
::
uni_atoi
(
val
);
}
// -------------------------------------------------------------------------
ModbusData
ModbusRTU
::
str2mbData
(
const
std
::
string
val
)
...
...
@@ -2256,7 +2256,7 @@ ModbusData ModbusRTU::str2mbData( const std::string val )
if
(
val
.
empty
()
)
return
0
;
return
(
ModbusData
)
UniSetTypes
::
uni_atoi
(
val
.
c_str
()
);
return
(
ModbusData
)
UniSetTypes
::
uni_atoi
(
val
);
}
// -------------------------------------------------------------------------
std
::
string
ModbusRTU
::
dat2str
(
const
ModbusData
dat
)
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
1a422150
...
...
@@ -193,7 +193,7 @@ using namespace UniSetTypes;
string
s
(
str
.
substr
(
prev
,
pos
-
prev
));
if
(
!
s
.
empty
()
)
{
l
.
add
(
uni_atoi
(
s
.
c_str
()
)
);
l
.
add
(
uni_atoi
(
s
)
);
prev
=
pos
+
1
;
}
}
...
...
src/Various/NCRestorer_XML.cc
View file @
1a422150
...
...
@@ -219,7 +219,7 @@ bool NCRestorer_XML::getBaseInfo( UniXML& xml, xmlNode* it, IOController_i::Sens
string
id
(
xml
.
getProp
(
it
,
"id"
));
if
(
!
id
.
empty
()
)
sid
=
uni_atoi
(
id
.
c_str
()
);
sid
=
uni_atoi
(
id
);
else
{
sname
=
conf
->
getSensorsSection
()
+
"/"
+
sname
;
...
...
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