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
2de094bf
Commit
2de094bf
authored
Jan 09, 2017
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправления предупреждений по результатам статического анализа в clion
parent
59bf1d78
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
40 additions
and
53 deletions
+40
-53
TODO
TODO
+0
-7
libuniset2.spec
conf/libuniset2.spec
+3
-0
Configuration.h
include/Configuration.h
+1
-1
DBInterface.h
include/DBInterface.h
+1
-1
Pulse.h
include/Pulse.h
+0
-1
USocket.h
include/USocket.h
+1
-2
UTCPCore.h
include/UTCPCore.h
+4
-4
UTCPStream.h
include/UTCPStream.h
+1
-1
UniSetTypes.h
include/UniSetTypes.h
+4
-4
TCPCheck.cc
src/Communications/TCP/TCPCheck.cc
+0
-2
USocket.cc
src/Communications/TCP/USocket.cc
+1
-2
UTCPCore.cc
src/Communications/TCP/UTCPCore.cc
+4
-4
UTCPStream.cc
src/Communications/TCP/UTCPStream.cc
+1
-1
LogServer.cc
src/Log/LogServer.cc
+2
-2
UniSetActivator.cc
src/ObjectRepository/UniSetActivator.cc
+2
-2
UniSetManager.cc
src/ObjectRepository/UniSetManager.cc
+1
-2
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+1
-1
IOController.cc
src/Processes/IOController.cc
+1
-1
IONotifyController.cc
src/Processes/IONotifyController.cc
+1
-1
NCRestorer.cc
src/Processes/NCRestorer.cc
+0
-2
NCRestorer_XML.cc
src/Processes/NCRestorer_XML.cc
+2
-2
DBInterface.cc
src/Services/DBInterface.cc
+3
-3
DBServer.cc
src/Services/DBServer.cc
+1
-1
PassiveTimer.cc
src/Timers/PassiveTimer.cc
+0
-1
Configuration.cc
src/Various/Configuration.cc
+1
-1
UniXML.cc
src/Various/UniXML.cc
+4
-4
No files found.
TODO
View file @
2de094bf
...
...
@@ -97,7 +97,6 @@ DB: Сделать регулируемый буфер на INSERT-ы БД, чт
-----
- ведение статистики по типам сообщений в каждом объекте (и в SM). Чтобы увидеть где происходит потеря пакетов (если происходит).
(т.е. идея в том, что сколько "успешно" послала SM столько должно придти и быть обработано (разные счётчики) в объекте)
- NoSQL база (в памяти) как буфер (держит интенсивную запись) перед "не спешной" записью в реляционную (MySQL,Postgre и т.п.)
...
...
@@ -106,10 +105,6 @@ DB: Сделать регулируемый буфер на INSERT-ы БД, чт
lock-free: mentomic
Но тогда стоит вводить и namespace uniset
=================
version 3
=========
- подумать нужен ли нам где-то ZeroMQ (zerorpc) (вместо omniORB?)
...
...
@@ -128,5 +123,3 @@ UResolver (или ObjectRepository) позволяющего манипулир
- Перепроектировать OIndex и Configure.. Инициализироват для Configure(объектом OIndex)
- подумать возможно стоит переходить на lockfree-библиотеку libcds..(актуально для многопроцессорных систем)
- Ввести namespace uniset:: ust:: uns:: ?
conf/libuniset2.spec
View file @
2de094bf
...
...
@@ -505,6 +505,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet2.pc
# history of current unpublished changes
# add tests for REST API (with RPC)
# python: refactoring UInterface (add UInterfaceModbus and UInterfaceUniSet)
# refactoring TCPCheck (use future)
%changelog
* Fri Dec 16 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt9
...
...
include/Configuration.h
View file @
2de094bf
...
...
@@ -106,7 +106,7 @@ namespace uniset
// net
size_t
getCountOfNet
()
const
noexcept
;
size
_t
getRepeatTimeout
()
const
noexcept
;
timeout
_t
getRepeatTimeout
()
const
noexcept
;
size_t
getRepeatCount
()
const
noexcept
;
uniset
::
ObjectId
getSensorID
(
const
std
::
string
&
name
)
const
noexcept
;
...
...
include/DBInterface.h
View file @
2de094bf
...
...
@@ -72,7 +72,7 @@ namespace uniset
static
int
as_int
(
const
DBResult
::
COL
::
iterator
&
it
);
static
double
as_double
(
const
DBResult
::
COL
::
iterator
&
it
);
static
std
::
string
as_string
(
const
DBResult
::
COL
::
iterator
&
it
);
static
in
t
num_cols
(
const
DBResult
::
iterator
&
it
);
static
size_
t
num_cols
(
const
DBResult
::
iterator
&
it
);
// ----------------------------------------------------------------------------
protected
:
...
...
include/Pulse.h
View file @
2de094bf
...
...
@@ -127,7 +127,6 @@ namespace uniset
protected
:
PassiveTimer
t1
;
// таймер "1"
PassiveTimer
t0
;
// таймер "0"
PassiveTimer
tCorr
;
// корректирующий таймер
bool
ostate
=
{
false
};
bool
isOn
=
{
false
};
timeout_t
t1_msec
=
{
0
};
...
...
include/USocket.h
View file @
2de094bf
...
...
@@ -13,8 +13,7 @@ namespace uniset
{
public
:
// dup and accept...raw socket
USocket
(
int
sock
);
USocket
();
virtual
~
USocket
();
// set keepalive params
...
...
include/UTCPCore.h
View file @
2de094bf
...
...
@@ -20,17 +20,17 @@ namespace uniset
// Buffer class - allow for output buffering such that it can be written out into async pieces
struct
Buffer
{
Buffer
(
const
unsigned
char
*
bytes
,
s
s
ize_t
nbytes
);
Buffer
(
const
unsigned
char
*
bytes
,
size_t
nbytes
);
Buffer
(
const
std
::
string
&
s
);
virtual
~
Buffer
();
unsigned
char
*
dpos
()
noexcept
;
s
s
ize_t
nbytes
()
noexcept
;
size_t
nbytes
()
noexcept
;
unsigned
char
*
data
=
{
0
};
s
s
ize_t
len
;
s
s
ize_t
pos
;
size_t
len
;
size_t
pos
;
};
}
// -------------------------------------------------------------------------
...
...
include/UTCPStream.h
View file @
2de094bf
...
...
@@ -37,7 +37,7 @@ namespace uniset
UTCPStream
();
virtual
~
UTCPStream
();
void
create
(
const
std
::
string
&
hname
,
in
t
port
,
timeout_t
tout_msec
=
1000
);
void
create
(
const
std
::
string
&
hname
,
uint16_
t
port
,
timeout_t
tout_msec
=
1000
);
bool
isConnected
()
noexcept
;
...
...
include/UniSetTypes.h
View file @
2de094bf
...
...
@@ -38,9 +38,10 @@
#include "IOController_i.hh"
#include "Mutex.h"
#include "UniXML.h"
#include "PassiveTimer.h" // for typedef timeout_t
// -----------------------------------------------------------------------------------------
/*! Задержка в миллисекундах */
inline
void
msleep
(
un
signed
in
t
m
)
inline
void
msleep
(
un
iset
::
timeout_
t
m
)
{
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
m
));
}
...
...
@@ -80,7 +81,6 @@ namespace uniset
typedef
std
::
list
<
std
::
string
>
ListObjectName
;
/*!< Список объектов типа ObjectName */
typedef
ObjectId
SysId
;
typedef
CORBA
::
Object_ptr
ObjectPtr
;
/*!< Ссылка на объект регистрируемый в ObjectRepository */
typedef
CORBA
::
Object_var
ObjectVar
;
/*!< Ссылка на объект регистрируемый в ObjectRepository */
...
...
@@ -114,7 +114,7 @@ namespace uniset
void
add
(
ObjectId
id
);
void
del
(
ObjectId
id
);
inline
in
t
size
()
const
noexcept
inline
size_
t
size
()
const
noexcept
{
return
lst
.
size
();
}
...
...
@@ -304,7 +304,7 @@ namespace uniset
{
while
(
begin
!=
end
)
{
if
(
p
(
*
begin
)
)
&
destBegin
++
=
*
begin
;
if
(
p
(
*
begin
)
)
&
(
destBegin
++
)
=
*
begin
;
++
begin
;
}
...
...
src/Communications/TCP/TCPCheck.cc
View file @
2de094bf
...
...
@@ -15,10 +15,8 @@
*/
// -----------------------------------------------------------------------------
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <future>
#include <thread>
#include <chrono>
#include "UniSetTypes.h"
#include "TCPCheck.h"
...
...
src/Communications/TCP/USocket.cc
View file @
2de094bf
...
...
@@ -15,8 +15,7 @@ namespace uniset
catch
(...)
{}
}
// -------------------------------------------------------------------------
USocket
::
USocket
(
int
sock
)
// Socket(sock)
USocket
::
USocket
()
{
init
();
}
...
...
src/Communications/TCP/UTCPCore.cc
View file @
2de094bf
...
...
@@ -27,19 +27,19 @@ namespace uniset
return
ok
;
}
// -------------------------------------------------------------------------
UTCPCore
::
Buffer
::
Buffer
(
const
unsigned
char
*
bytes
,
ssize_t
nbytes
)
UTCPCore
::
Buffer
::
Buffer
(
const
unsigned
char
*
bytes
,
size_t
nbytes
)
{
pos
=
0
;
len
=
nbytes
;
if
(
len
<
=
0
)
// ??!!
if
(
len
=
=
0
)
// ??!!
return
;
data
=
new
unsigned
char
[
nbytes
];
std
::
memcpy
(
data
,
bytes
,
nbytes
);
}
// -------------------------------------------------------------------------
UTCPCore
::
Buffer
::
Buffer
(
const
string
&
s
)
UTCPCore
::
Buffer
::
Buffer
(
const
string
&
s
)
{
pos
=
0
;
len
=
s
.
length
();
...
...
@@ -61,7 +61,7 @@ namespace uniset
return
data
+
pos
;
}
// -------------------------------------------------------------------------
s
s
ize_t
UTCPCore
::
Buffer
::
nbytes
()
noexcept
size_t
UTCPCore
::
Buffer
::
nbytes
()
noexcept
{
return
len
-
pos
;
}
...
...
src/Communications/TCP/UTCPStream.cc
View file @
2de094bf
...
...
@@ -107,7 +107,7 @@ namespace uniset
return
tm
.
totalMicroseconds
();
}
// -------------------------------------------------------------------------
void
UTCPStream
::
create
(
const
std
::
string
&
hname
,
in
t
port
,
timeout_t
tout_msec
)
void
UTCPStream
::
create
(
const
std
::
string
&
hname
,
uint16_
t
port
,
timeout_t
tout_msec
)
{
Poco
::
Net
::
SocketAddress
saddr
(
hname
,
port
);
connect
(
saddr
,
UniSetTimer
::
millisecToPoco
(
tout_msec
));
...
...
src/Log/LogServer.cc
View file @
2de094bf
...
...
@@ -331,14 +331,14 @@ namespace uniset
// -----------------------------------------------------------------------------
std
::
string
LogServer
::
help_print
(
const
std
::
string
&
prefix
)
{
ostringstream
h
;
std
::
ostringstream
h
;
h
<<
"--"
<<
prefix
<<
"-cmd-timeout msec - Timeout for wait command. Default: 2000 msec."
<<
endl
;
return
h
.
str
();
}
// -----------------------------------------------------------------------------
string
LogServer
::
getShortInfo
()
{
ostringstream
inf
;
std
::
ostringstream
inf
;
inf
<<
"LogServer: "
<<
myname
<<
" ["
...
...
src/ObjectRepository/UniSetActivator.cc
View file @
2de094bf
...
...
@@ -981,7 +981,7 @@ void UniSetActivator::normalexit()
ulogsys
<<
g_act
->
getName
()
<<
"(default exit): ..begin..."
<<
endl
<<
flush
;
if
(
g_term
==
false
)
if
(
!
g_term
)
{
// прежде чем вызывать notify_one(), мы должны освободить mutex!
{
...
...
@@ -1021,7 +1021,7 @@ void UniSetActivator::normalterminate()
ulogsys
<<
g_act
->
getName
()
<<
"(default terminate): ..begin..."
<<
endl
<<
flush
;
if
(
g_term
==
false
)
if
(
!
g_term
)
{
// прежде чем вызывать notify_one(), мы должны освободить mutex!
{
...
...
src/ObjectRepository/UniSetManager.cc
View file @
2de094bf
...
...
@@ -203,7 +203,7 @@ bool UniSetManager::removeObject( const std::shared_ptr<UniSetObject>& obj )
try
{
if
(
obj
)
if
(
obj
)
obj
->
deactivate
();
}
catch
(
const
uniset
::
Exception
&
ex
)
...
...
@@ -225,7 +225,6 @@ bool UniSetManager::removeObject( const std::shared_ptr<UniSetObject>& obj )
<<
" line: "
<<
fe
.
line
()
<<
" mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
catch
(...)
{}
olist
.
erase
(
li
);
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
2de094bf
...
...
@@ -202,7 +202,7 @@ bool uniset::file_exist( const std::string& filename )
#endif
bool
result
=
false
;
if
(
file
)
if
(
file
.
is_open
()
)
result
=
true
;
file
.
close
();
...
...
src/Processes/IOController.cc
View file @
2de094bf
...
...
@@ -811,7 +811,7 @@ void IOController::USensorInfo::checkDepend( std::shared_ptr<USensorInfo>& d_it,
uniset_rwmutex_wrlock
lock
(
val_lock
);
bool
prev
=
blocked
;
uniset_rwmutex_rlock
dlock
(
d_it
->
val_lock
);
blocked
=
(
d_it
->
value
==
d_value
)
?
false
:
true
;
blocked
=
(
d_it
->
value
!=
d_value
)
;
changed
=
(
prev
!=
blocked
);
sup_id
=
d_it
->
supplier
;
}
...
...
src/Processes/IONotifyController.cc
View file @
2de094bf
...
...
@@ -932,7 +932,7 @@ void IONotifyController::checkThreshold( std::shared_ptr<IOController::USensorIn
// если состояние не normal, значит порог сработал,
// не важно какой.. нижний или верхний (зависит от inverse)
sm
.
threshold
=
(
state
!=
IONotifyController_i
::
NormalThreshold
)
?
true
:
false
;
sm
.
threshold
=
(
state
!=
IONotifyController_i
::
NormalThreshold
);
// запоминаем время изменения состояния
it
->
tv_sec
=
tm
.
tv_sec
;
...
...
src/Processes/NCRestorer.cc
View file @
2de094bf
...
...
@@ -63,8 +63,6 @@ void NCRestorer::addlist( IONotifyController* ic, std::shared_ptr<IOController::
ucrit
<<
ic
->
getName
()
<<
"(askDumper::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА! -> "
<<
uniset_conf
()
->
oind
->
getNameById
(
inf
->
si
.
id
)
<<
endl
;
return
;
break
;
}
}
}
...
...
src/Processes/NCRestorer_XML.cc
View file @
2de094bf
...
...
@@ -391,7 +391,7 @@ void NCRestorer_XML::read_thresholds( const std::shared_ptr<UniXML>& xml, xmlNod
IONotifyController
::
ThresholdExtList
tlst
;
for
(
;
tit
;
tit
.
goNext
()
)
for
(
;
tit
.
getCurrent
();
tit
++
)
{
IONotifyController
::
ThresholdInfoExt
ti
(
0
,
0
,
0
,
false
);
...
...
@@ -471,7 +471,7 @@ bool NCRestorer_XML::getConsumerList( const std::shared_ptr<UniXML>& xml, xmlNod
{
UniXML
::
iterator
it
(
node
);
for
(;
it
;
it
.
goNext
()
)
for
(;
it
.
getCurrent
();
it
++
)
{
if
(
!
check_consumer_item
(
it
)
)
continue
;
...
...
src/Services/DBInterface.cc
View file @
2de094bf
...
...
@@ -9,7 +9,7 @@ namespace uniset
std
::
string
user
=
""
;
std
::
string
pswd
=
""
;
std
::
string
dbname
=
""
;
u
nsigned
int
port
=
0
;
uint
port
=
0
;
for
(;;)
{
...
...
@@ -42,7 +42,7 @@ namespace uniset
prev
=
pos
+
1
;
pos
=
param
.
find_first_of
(
":"
,
prev
);
port
=
atoi
(
param
.
substr
(
prev
,
pos
-
prev
).
c_str
()
);
port
=
(
uint
)
std
::
atoi
(
param
.
substr
(
prev
,
pos
-
prev
).
c_str
()
);
break
;
}
...
...
@@ -94,7 +94,7 @@ namespace uniset
return
((
*
it
)[
col
]);
}
// ----------------------------------------------------------------------------
in
t
DBResult
::
num_cols
(
const
DBResult
::
iterator
&
it
)
size_
t
DBResult
::
num_cols
(
const
DBResult
::
iterator
&
it
)
{
return
it
->
size
();
}
...
...
src/Services/DBServer.cc
View file @
2de094bf
...
...
@@ -90,7 +90,7 @@ void DBServer::processingMessage( const uniset::VoidMessage* msg )
switch
(
msg
->
type
)
{
case
Message
:
:
Confirm
:
confirmInfo
(
reinterpret_cast
<
const
ConfirmMessage
*>
(
msg
)
);
confirmInfo
(
reinterpret_cast
<
const
uniset
::
ConfirmMessage
*>
(
msg
)
);
break
;
default
:
...
...
src/Timers/PassiveTimer.cc
View file @
2de094bf
...
...
@@ -19,7 +19,6 @@
*/
// -----------------------------------------------------------------------------
#include <cstdio>
#include <unistd.h>
#include "PassiveTimer.h"
// -----------------------------------------------------------------------------
namespace
uniset
...
...
src/Various/Configuration.cc
View file @
2de094bf
...
...
@@ -1332,7 +1332,7 @@ namespace uniset
return
countOfNet
;
}
// -------------------------------------------------------------------------
size
_t
Configuration
::
getRepeatTimeout
()
const
noexcept
timeout
_t
Configuration
::
getRepeatTimeout
()
const
noexcept
{
return
repeatTimeout
;
}
...
...
src/Various/UniXML.cc
View file @
2de094bf
...
...
@@ -181,12 +181,12 @@ string UniXML::getProp(const xmlNode* node, const string& name) noexcept
{
// формально при конструировании строки может быть exception
const
string
t
(
(
const
char
*
)
text
);
xmlFree
(
(
xmlChar
*
)
text
);
xmlFree
(
text
);
return
t
;
}
catch
(...)
{}
xmlFree
(
(
xmlChar
*
)
text
);
xmlFree
(
text
);
return
""
;
}
// -----------------------------------------------------------------------------
...
...
@@ -282,7 +282,7 @@ xmlNode* UniXML::copyNode(xmlNode* node, int recursive)
return
0
;
}
// -----------------------------------------------------------------------------
bool
UniXML
::
save
(
const
string
&
filename
,
int
level
)
bool
UniXML
::
save
(
const
string
&
filename
,
int
level
)
{
string
fn
(
filename
);
...
...
@@ -450,7 +450,7 @@ bool UniXML_iterator::canPrev() const noexcept
// -------------------------------------------------------------------------
bool
UniXML_iterator
::
canNext
()
const
noexcept
{
if
(
!
curNode
||
!
curNode
->
next
)
if
(
!
curNode
||
!
curNode
->
next
)
return
false
;
return
true
;
...
...
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