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
725c7cca
Commit
725c7cca
authored
Jan 06, 2021
by
Pavel Vainerman
Committed by
Pavel Vainerman
Jan 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some fixes after github codeql-analysis
parent
248791e2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
21 deletions
+27
-21
MBTCPTestServer.cc
extensions/ModbusMaster/tests/MBTCPTestServer.cc
+1
-1
test_restapi_uniset.cc
extensions/tests/test_restapi_uniset.cc
+1
-1
ModbusTypes.cc
src/Communications/Modbus/ModbusTypes.cc
+9
-8
UniSetTypes.cc
src/Core/UniSetTypes.cc
+10
-8
DebugStream.cc
src/Log/DebugStream.cc
+6
-3
No files found.
extensions/ModbusMaster/tests/MBTCPTestServer.cc
View file @
725c7cca
...
...
@@ -140,7 +140,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::readCoilStatus( ReadCoilMessage& query,
}
// Фомирование ответа:
ModbusData
num
=
0
;
// добавленное количество данных
size_t
num
=
0
;
// добавленное количество данных
size_t
bcnt
=
numBytes
(
query
.
count
);
for
(
;
num
<
bcnt
;
num
++
)
...
...
extensions/tests/test_restapi_uniset.cc
View file @
725c7cca
...
...
@@ -38,7 +38,7 @@ TEST_CASE("[REST API: conf]", "[restapi][configure]")
{
init_test
();
std
::
string
s
=
shm
->
apiRequest
(
"/configure/get?2,Input5_S¶ms=iotype"
);
std
::
string
s
=
shm
->
apiRequest
(
"/configure/get?2,Input5_S¶ms=iotype"
);
Poco
::
JSON
::
Parser
parser
;
auto
result
=
parser
.
parse
(
s
);
...
...
src/Communications/Modbus/ModbusTypes.cc
View file @
725c7cca
...
...
@@ -3167,14 +3167,15 @@ namespace uniset
func
=
fnSetDateTime
;
time_t
tm
=
time
(
0
);
struct
tm
*
tms
=
localtime
(
&
tm
);
hour
=
tms
->
tm_hour
;
min
=
tms
->
tm_min
;
sec
=
tms
->
tm_sec
;
day
=
tms
->
tm_mday
;
mon
=
tms
->
tm_mon
+
1
;
year
=
tms
->
tm_year
;
century
=
(
tms
->
tm_year
+
1900
>=
2000
)
?
20
:
19
;
std
::
tm
tms
;
gmtime_r
(
&
tm
,
&
tms
);
hour
=
tms
.
tm_hour
;
min
=
tms
.
tm_min
;
sec
=
tms
.
tm_sec
;
day
=
tms
.
tm_mday
;
mon
=
tms
.
tm_mon
+
1
;
year
=
tms
.
tm_year
;
century
=
(
tms
.
tm_year
+
1900
>=
2000
)
?
20
:
19
;
}
// -------------------------------------------------------------------------
SetDateTimeRetMessage
::
SetDateTimeRetMessage
(
const
SetDateTimeMessage
&
query
)
...
...
src/Core/UniSetTypes.cc
View file @
725c7cca
...
...
@@ -503,21 +503,23 @@ bool uniset::check_filter( UniXML::iterator& it, const std::string& f_prop, cons
// ------------------------------------------------------------------------------------------
string
uniset
::
timeToString
(
time_t
tm
,
const
std
::
string
&
brk
)
noexcept
{
struct
tm
*
tms
=
localtime
(
&
tm
);
std
::
tm
tms
;
gmtime_r
(
&
tm
,
&
tms
);
ostringstream
time
;
time
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
->
tm_hour
<<
brk
;
time
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
->
tm_min
<<
brk
;
time
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
->
tm_sec
;
time
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
.
tm_hour
<<
brk
;
time
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
.
tm_min
<<
brk
;
time
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
.
tm_sec
;
return
time
.
str
();
}
string
uniset
::
dateToString
(
time_t
tm
,
const
std
::
string
&
brk
)
noexcept
{
struct
tm
*
tms
=
localtime
(
&
tm
);
std
::
tm
tms
;
gmtime_r
(
&
tm
,
&
tms
);
ostringstream
date
;
date
<<
std
::
setw
(
4
)
<<
std
::
setfill
(
'0'
)
<<
tms
->
tm_year
+
1900
<<
brk
;
date
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
->
tm_mon
+
1
<<
brk
;
date
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
->
tm_mday
;
date
<<
std
::
setw
(
4
)
<<
std
::
setfill
(
'0'
)
<<
tms
.
tm_year
+
1900
<<
brk
;
date
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
.
tm_mon
+
1
<<
brk
;
date
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tms
.
tm_mday
;
return
date
.
str
();
}
...
...
src/Log/DebugStream.cc
View file @
725c7cca
...
...
@@ -210,7 +210,8 @@ std::ostream& DebugStream::printDate(Debug::type t, char brk) noexcept
uniset
::
ios_fmt_restorer
ifs
(
*
this
);
std
::
time_t
tv
=
std
::
chrono
::
system_clock
::
to_time_t
(
std
::
chrono
::
system_clock
::
now
());
std
::
tm
tms
=
*
std
::
localtime
(
&
tv
);
std
::
tm
tms
;
gmtime_r
(
&
tv
,
&
tms
);
#if __GNUC__ >= 5
std
::
ostringstream
fmt
;
...
...
@@ -233,7 +234,8 @@ std::ostream& DebugStream::printTime(Debug::type t, char brk) noexcept
uniset
::
ios_fmt_restorer
ifs
(
*
this
);
timespec
tv
=
uniset
::
now_to_timespec
();
// gettimeofday(tv,0);
std
::
tm
tms
=
*
std
::
localtime
(
&
tv
.
tv_sec
);
std
::
tm
tms
;
gmtime_r
(
&
tv
.
tv_sec
,
&
tms
);
#if __GNUC__ >= 5
std
::
ostringstream
fmt
;
...
...
@@ -263,7 +265,8 @@ std::ostream& DebugStream::printDateTime(Debug::type t) noexcept
uniset
::
ios_fmt_restorer
ifs
(
*
this
);
timespec
tv
=
uniset
::
now_to_timespec
();
// gettimeofday(tv,0);
std
::
tm
tms
=
*
std
::
localtime
(
&
tv
.
tv_sec
);
std
::
tm
tms
;
gmtime_r
(
&
tv
.
tv_sec
,
&
tms
);
#if __GNUC__ >= 5
*
this
<<
std
::
put_time
(
&
tms
,
"%Od/%Om/%Y %OH:%OM:%OS"
);
...
...
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