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
73b724ef
Commit
73b724ef
authored
Jun 13, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправления по результатам проверки утилитой cppcheck
parent
74c567df
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
168 additions
and
153 deletions
+168
-153
libuniset.spec
conf/libuniset.spec
+4
-1
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+2
-2
UNetExchange.h
extensions/UNetUDP/UNetExchange.h
+3
-2
UNetReceiver.cc
extensions/UNetUDP/UNetReceiver.cc
+1
-1
UNetReceiver.h
extensions/UNetUDP/UNetReceiver.h
+1
-1
unet-udp-tester.cc
extensions/UNetUDP/unet-udp-tester.cc
+1
-1
Extensions.h
extensions/include/Extensions.h
+2
-2
MTR.h
extensions/include/MTR.h
+4
-4
VTypes.h
extensions/include/VTypes.h
+1
-1
DigitalFilter.cc
extensions/lib/DigitalFilter.cc
+1
-1
Extensions.cc
extensions/lib/Extensions.cc
+2
-2
IOBase.cc
extensions/lib/IOBase.cc
+3
-3
MTR.cc
extensions/lib/MTR.cc
+8
-8
VTypes.cc
extensions/lib/VTypes.cc
+1
-1
Configuration.h
include/Configuration.h
+1
-1
ORepHelpers.h
include/ORepHelpers.h
+2
-2
UConnector.cc
python/lib/pyUniSet/UConnector.cc
+2
-2
UExceptions.h
python/lib/pyUniSet/UExceptions.h
+3
-3
UExceptions_wrap.cxx
python/lib/pyUniSet/UExceptions_wrap.cxx
+42
-54
UInterface.cc
python/lib/pyUniSet/UInterface.cc
+2
-2
UTypes.h
python/lib/pyUniSet/UTypes.h
+1
-1
pyUExceptions.py
python/lib/pyUniSet/pyUExceptions.py
+1
-1
ModbusClient.cc
src/Communications/Modbus/ModbusClient.cc
+1
-1
ModbusTCPTypes.cc
src/Communications/Modbus/ModbusTCPTypes.cc
+5
-5
ModbusTypes.cc
src/Communications/Modbus/ModbusTypes.cc
+5
-5
ORepHelpers.cc
src/ObjectRepository/ORepHelpers.cc
+2
-2
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+1
-1
Configuration.cc
src/Various/Configuration.cc
+4
-4
CycleStorage.cc
src/Various/CycleStorage.cc
+1
-1
RunLock.cc
src/Various/RunLock.cc
+7
-4
SViewer.cc
src/Various/SViewer.cc
+0
-2
TableBlockStorage.cc
src/Various/TableBlockStorage.cc
+1
-1
TableStorage.cc
src/Various/TableStorage.cc
+13
-0
UniXML.cc
src/Various/UniXML.cc
+5
-3
JrnTest.cc
tests/JrnTests/JrnTest.cc
+26
-26
iterator_test.cc
tests/iterator_test.cc
+1
-1
passivetimer.cc
tests/passivetimer.cc
+7
-0
umutex.cc
tests/umutex.cc
+1
-1
No files found.
conf/libuniset.spec
View file @
73b724ef
...
...
@@ -7,7 +7,7 @@
Name: libuniset
Version: 1.6
Release: alt1
0
Release: alt1
1
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -319,6 +319,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Thu Jun 13 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt11
- fixed after cppcheck checking
* Wed Jun 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt10
- add for ModbusMaster (RTU|TCP) --xxx--aftersend-pause
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
73b724ef
...
...
@@ -351,7 +351,7 @@ UNetExchange::~UNetExchange()
delete
shm
;
}
// -----------------------------------------------------------------------------
bool
UNetExchange
::
checkExistUNetHost
(
const
std
::
string
addr
,
ost
::
tpport_t
port
)
bool
UNetExchange
::
checkExistUNetHost
(
const
std
::
string
&
addr
,
ost
::
tpport_t
port
)
{
ost
::
IPV4Address
a1
(
addr
.
c_str
());
for
(
ReceiverList
::
iterator
it
=
recvlist
.
begin
();
it
!=
recvlist
.
end
();
++
it
)
...
...
@@ -424,7 +424,7 @@ void UNetExchange::step()
}
// -----------------------------------------------------------------------------
void
UNetExchange
::
ReceiverInfo
::
step
(
SMInterface
*
shm
,
const
std
::
string
myname
)
void
UNetExchange
::
ReceiverInfo
::
step
(
SMInterface
*
shm
,
const
std
::
string
&
myname
)
{
try
{
...
...
extensions/UNetUDP/UNetExchange.h
View file @
73b724ef
...
...
@@ -89,7 +89,7 @@ class UNetExchange:
/*! глобальная функция для вывода help-а */
static
void
help_print
(
int
argc
,
const
char
*
argv
[]
);
bool
checkExistUNetHost
(
const
std
::
string
host
,
ost
::
tpport_t
port
);
bool
checkExistUNetHost
(
const
std
::
string
&
host
,
ost
::
tpport_t
port
);
protected
:
...
...
@@ -142,6 +142,7 @@ class UNetExchange:
{
ReceiverInfo
()
:
r1
(
0
),
r2
(
0
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
respondInvert
(
false
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
)
{}
...
...
@@ -155,7 +156,7 @@ class UNetExchange:
UNetReceiver
*
r1
;
/*!< приём по первому каналу */
UNetReceiver
*
r2
;
/*!< приём по второму каналу */
void
step
(
SMInterface
*
shm
,
const
std
::
string
myname
);
void
step
(
SMInterface
*
shm
,
const
std
::
string
&
myname
);
inline
void
setRespondID
(
UniSetTypes
::
ObjectId
id
,
bool
invert
=
false
)
{
...
...
extensions/UNetUDP/UNetReceiver.cc
View file @
73b724ef
...
...
@@ -19,7 +19,7 @@ bool UNetReceiver::PacketCompare::operator()(const UniSetUDP::UDPMessage& lhs,
}
*/
// ------------------------------------------------------------------------------------------
UNetReceiver
::
UNetReceiver
(
const
std
::
string
s_host
,
const
ost
::
tpport_t
port
,
SMInterface
*
smi
)
:
UNetReceiver
::
UNetReceiver
(
const
std
::
string
&
s_host
,
const
ost
::
tpport_t
port
,
SMInterface
*
smi
)
:
shm
(
smi
),
recvpause
(
10
),
updatepause
(
100
),
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
73b724ef
...
...
@@ -50,7 +50,7 @@
class
UNetReceiver
{
public
:
UNetReceiver
(
const
std
::
string
host
,
const
ost
::
tpport_t
port
,
SMInterface
*
smi
);
UNetReceiver
(
const
std
::
string
&
host
,
const
ost
::
tpport_t
port
,
SMInterface
*
smi
);
~
UNetReceiver
();
void
start
();
...
...
extensions/UNetUDP/unet-udp-tester.cc
View file @
73b724ef
...
...
@@ -33,7 +33,7 @@ enum Command
cmdReceive
};
// --------------------------------------------------------------------------
static
bool
split_addr
(
const
string
addr
,
string
&
host
,
ost
::
tpport_t
&
port
)
static
bool
split_addr
(
const
string
&
addr
,
string
&
host
,
ost
::
tpport_t
&
port
)
{
string
::
size_type
pos
=
addr
.
rfind
(
':'
);
if
(
pos
!=
string
::
npos
)
...
...
extensions/include/Extensions.h
View file @
73b724ef
...
...
@@ -17,7 +17,7 @@ namespace UniSetExtensions
/*! Получение времени для подтверждения "живости" */
int
getHeartBeatTime
();
xmlNode
*
findNode
(
xmlNode
*
node
,
const
std
::
string
snode
,
const
std
::
string
field
);
xmlNode
*
findNode
(
xmlNode
*
node
,
const
std
::
string
&
snode
,
const
std
::
string
&
field
);
xmlNode
*
getCalibrationsSection
();
...
...
@@ -27,7 +27,7 @@ namespace UniSetExtensions
void
escape_string
(
std
::
string
&
s
);
/*! Загрузка калибровочной диаграммы */
Calibration
*
buildCalibrationDiagram
(
const
std
::
string
dname
);
Calibration
*
buildCalibrationDiagram
(
const
std
::
string
&
dname
);
extern
DebugStream
dlog
;
}
...
...
extensions/include/MTR.h
View file @
73b724ef
...
...
@@ -39,7 +39,7 @@ namespace MTR
};
// -------------------------------------------------------------------------
std
::
string
type2str
(
MTRType
t
);
/*!< преоразование строки в тип */
MTRType
str2type
(
const
std
::
string
s
);
/*!< преобразование названия в строку */
MTRType
str2type
(
const
std
::
string
&
s
);
/*!< преобразование названия в строку */
int
wsize
(
MTRType
t
);
/*!< длина данных в словах */
// -------------------------------------------------------------------------
// Информация
...
...
@@ -100,7 +100,7 @@ namespace MTR
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
MTRError
&
e
);
// Настройка из конф. файла
MTRError
update_configuration
(
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
addr
,
const
std
::
string
mtrconfile
,
int
verbose
=
0
);
const
std
::
string
&
mtrconfile
,
int
verbose
=
0
);
// ---------------------------
// вспомогательные функции и типы данных
typedef
std
::
list
<
ModbusRTU
::
ModbusData
>
DataList
;
...
...
@@ -109,8 +109,8 @@ namespace MTR
static
const
ModbusRTU
::
ModbusData
skip
[]
=
{
48
,
49
,
59
};
// registers which should not write
bool
send_param
(
ModbusRTUMaster
*
mb
,
DataMap
&
dmap
,
ModbusRTU
::
ModbusAddr
addr
,
int
verb
);
bool
read_param
(
const
std
::
string
str
,
std
::
string
&
str1
,
std
::
string
&
str2
);
DataMap
read_confile
(
const
std
::
string
f
);
bool
read_param
(
const
std
::
string
&
str
,
std
::
string
&
str1
,
std
::
string
&
str2
);
DataMap
read_confile
(
const
std
::
string
&
f
);
void
update_communication_params
(
ModbusRTU
::
ModbusAddr
reg
,
ModbusRTU
::
ModbusData
data
,
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
&
addr
,
int
verb
);
// -------------------------------------------------------------------------
...
...
extensions/include/VTypes.h
View file @
73b724ef
...
...
@@ -29,7 +29,7 @@ namespace VTypes
// -------------------------------------------------------------------------
std
::
string
type2str
(
VType
t
);
/*!< преобразование строки в тип */
VType
str2type
(
const
std
::
string
s
);
/*!< преобразование названия в строку */
VType
str2type
(
const
std
::
string
&
s
);
/*!< преобразование названия в строку */
int
wsize
(
VType
t
);
/*!< длина данных в словах */
// -------------------------------------------------------------------------
class
F2
...
...
extensions/lib/DigitalFilter.cc
View file @
73b724ef
...
...
@@ -250,7 +250,7 @@ int DigitalFilter::filterIIR( int newval )
}
else
{
double
aver
;
double
aver
=
0
;
add
(
newval
);
for
(
FIFOBuffer
::
iterator
i
=
buf
.
begin
();
i
!=
buf
.
end
();
++
i
)
...
...
extensions/lib/Extensions.cc
View file @
73b724ef
...
...
@@ -89,7 +89,7 @@ namespace UniSetExtensions
}
// -------------------------------------------------------------------------
xmlNode
*
findNode
(
xmlNode
*
node
,
const
string
snode
,
const
string
field
)
xmlNode
*
findNode
(
xmlNode
*
node
,
const
string
&
snode
,
const
string
&
field
)
{
if
(
!
node
)
return
0
;
...
...
@@ -107,7 +107,7 @@ namespace UniSetExtensions
return
0
;
}
// -------------------------------------------------------------------------
Calibration
*
buildCalibrationDiagram
(
const
std
::
string
dname
)
Calibration
*
buildCalibrationDiagram
(
const
std
::
string
&
dname
)
{
xmlNode
*
root
=
getCalibrationsSection
();
if
(
!
root
)
...
...
extensions/lib/IOBase.cc
View file @
73b724ef
...
...
@@ -503,15 +503,15 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
shm
->
initDIterator
(
b
->
d_dit
);
string
d_txt
(
it
.
getProp
(
"depend"
));
if
(
!
it
.
getProp
(
"depend"
)
.
empty
()
)
if
(
!
d_txt
.
empty
()
)
{
b
->
d_id
=
conf
->
getSensorID
(
it
.
getProp
(
"depend"
)
);
b
->
d_id
=
conf
->
getSensorID
(
d_txt
);
if
(
b
->
d_id
==
DefaultObjectId
)
{
if
(
dlog
)
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(IOBase::readItem): sensor='"
<<
it
.
getProp
(
"name"
)
<<
"' err: "
<<
" Unknown SensorID for depend='"
<<
it
.
getProp
(
"depend"
)
<<
" Unknown SensorID for depend='"
<<
d_txt
<<
endl
;
return
false
;
}
...
...
extensions/lib/MTR.cc
View file @
73b724ef
...
...
@@ -13,7 +13,7 @@ using namespace std;
namespace
MTR
{
MTRType
str2type
(
const
std
::
string
s
)
MTRType
str2type
(
const
std
::
string
&
s
)
{
if
(
s
==
"T1"
)
return
mtT1
;
...
...
@@ -227,13 +227,13 @@ std::string getSerialNumber( ModbusRTUMaster* mb, ModbusRTU::ModbusAddr addr )
return
""
;
}
// -----------------------------------------------------------------------------
DataMap
read_confile
(
const
std
::
string
f
)
DataMap
read_confile
(
const
std
::
string
&
f
)
{
bool
start
=
false
;
DataMap
dmap
;
std
::
ifstream
ifs
(
f
.
c_str
(),
std
::
ios
::
in
);
if
(
ifs
)
{
bool
start
=
false
;
while
(
!
ifs
.
eof
()
)
{
std
::
string
str
;
...
...
@@ -295,7 +295,7 @@ DataMap read_confile( const std::string f )
return
dmap
;
}
// --------------------------------------------------------------------------
bool
read_param
(
const
std
::
string
str
,
std
::
string
&
str1
,
std
::
string
&
str2
)
bool
read_param
(
const
std
::
string
&
str
,
std
::
string
&
str1
,
std
::
string
&
str2
)
{
string
::
size_type
pos
=
str
.
find
(
'='
);
if
(
pos
==
string
::
npos
)
...
...
@@ -385,7 +385,7 @@ bool send_param( ModbusRTUMaster* mb, DataMap& dmap, ModbusRTU::ModbusAddr addr,
// cout << "send reg=" << ModbusRTU::dat2str(it->first)
// << "(" << it->first << ")" << endl;
int
reg
=
it
->
first
;
bool
ok
=
false
;
//
bool ok = false;
for
(
DataList
::
iterator
it1
=
it
->
second
.
begin
();
it1
!=
it
->
second
.
end
();
++
it1
,
reg
++
)
{
...
...
@@ -406,7 +406,7 @@ bool send_param( ModbusRTUMaster* mb, DataMap& dmap, ModbusRTU::ModbusAddr addr,
if
(
verb
)
cout
<<
"(mtr-setup): write reply: "
<<
ret
<<
endl
;
update_communication_params
(
reg
,
*
it1
,
mb
,
addr
,
verb
);
ok
=
true
;
//
ok = true;
break
;
}
catch
(
ModbusRTU
::
mbException
&
ex
)
...
...
@@ -415,7 +415,7 @@ bool send_param( ModbusRTUMaster* mb, DataMap& dmap, ModbusRTU::ModbusAddr addr,
if
(
reg
==
56
&&
it
->
first
==
ModbusRTU
::
erTimeOut
)
{
update_communication_params
(
reg
,
*
it1
,
mb
,
addr
,
verb
);
ok
=
true
;
//
ok = true;
break
;
}
else
...
...
@@ -436,7 +436,7 @@ bool send_param( ModbusRTUMaster* mb, DataMap& dmap, ModbusRTU::ModbusAddr addr,
}
// ------------------------------------------------------------------------------------------
MTR
::
MTRError
update_configuration
(
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
slaveaddr
,
const
std
::
string
mtrconfile
,
int
verb
)
const
std
::
string
&
mtrconfile
,
int
verb
)
{
std
::
string
m
=
MTR
::
getModelNumber
(
mb
,
slaveaddr
);
if
(
m
!=
"MTR315Transducer"
)
...
...
extensions/lib/VTypes.cc
View file @
73b724ef
...
...
@@ -12,7 +12,7 @@ std::ostream& operator<<( std::ostream& os, const VType& vt )
return
os
<<
type2str
(
vt
);
}
VType
str2type
(
const
std
::
string
s
)
VType
str2type
(
const
std
::
string
&
s
)
{
if
(
s
==
"Byte"
||
s
==
"byte"
)
return
vtByte
;
...
...
include/Configuration.h
View file @
73b724ef
...
...
@@ -253,7 +253,7 @@ namespace UniSetTypes
// Инициализация UniSetTypes::conf.
// ( учитываются параметры командной строки --confile и --id-from-config )
void
uniset_init
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
xmlfile
=
"configure.xml"
);
void
uniset_init
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
&
xmlfile
=
"configure.xml"
);
}
// end of UniSetTypes namespace
...
...
include/ORepHelpers.h
View file @
73b724ef
...
...
@@ -50,10 +50,10 @@ namespace ORepHelpers
throw
(
UniSetTypes
::
ORepFailed
);
//! Функция отделяющая имя секции от полного имени
const
std
::
string
getSectionName
(
const
std
::
string
&
fullName
,
const
std
::
string
brk
=
"/"
);
const
std
::
string
getSectionName
(
const
std
::
string
&
fullName
,
const
std
::
string
&
brk
=
"/"
);
//! Функция выделения имени из полного имени
const
std
::
string
getShortName
(
const
std
::
string
&
fullName
,
const
std
::
string
brk
=
"/"
);
const
std
::
string
getShortName
(
const
std
::
string
&
fullName
,
const
std
::
string
&
brk
=
"/"
);
//! Проверка на наличие недопустимых символов
...
...
python/lib/pyUniSet/UConnector.cc
View file @
73b724ef
...
...
@@ -92,7 +92,7 @@ long UConnector::getValue( long id, long node )throw(UException)
}
catch
(
UException
&
ex
)
{
throw
ex
;
throw
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
...
...
@@ -146,7 +146,7 @@ void UConnector::setValue( long id, long val, long node )throw(UException)
}
catch
(
UException
&
ex
)
{
throw
ex
;
throw
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
...
...
python/lib/pyUniSet/UExceptions.h
View file @
73b724ef
...
...
@@ -4,7 +4,7 @@
struct
UException
{
UException
(){}
UException
(
const
std
::
string
e
)
:
err
(
e
){}
UException
(
const
std
::
string
&
e
)
:
err
(
e
){}
UException
(
const
char
*
e
)
:
err
(
std
::
string
(
e
)){}
~
UException
(){}
...
...
@@ -17,7 +17,7 @@ struct UTimeOut:
public
UException
{
UTimeOut
()
:
UException
(
"UTimeOut"
){}
UTimeOut
(
const
std
::
string
e
)
:
UException
(
e
){}
UTimeOut
(
const
std
::
string
&
e
)
:
UException
(
e
){}
~
UTimeOut
(){}
};
//---------------------------------------------------------------------------
...
...
@@ -25,7 +25,7 @@ struct USysError:
public
UException
{
USysError
()
:
UException
(
"UTimeOut"
){}
USysError
(
const
std
::
string
e
)
:
UException
(
e
){}
USysError
(
const
std
::
string
&
e
)
:
UException
(
e
){}
~
USysError
(){}
};
//---------------------------------------------------------------------------
...
...
python/lib/pyUniSet/UExceptions_wrap.cxx
View file @
73b724ef
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.
8
* Version 2.0.
9
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
...
...
@@ -927,6 +927,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
}
#endif
#if PY_VERSION_HEX < 0x02050000
#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
#endif
#if PY_VERSION_HEX < 0x02040000
#define Py_VISIT(op) \
do { \
...
...
@@ -1198,7 +1202,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
/* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(
clientdata
)
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
...
...
@@ -2637,7 +2641,7 @@ void *SWIG_ReturnGlobalTypeList(void *);
#endif
SWIGRUNTIME
swig_module_info
*
SWIG_Python_GetModule
(
void
)
{
SWIG_Python_GetModule
(
void
*
SWIGUNUSEDPARM
(
clientdata
)
)
{
static
void
*
type_pointer
=
(
void
*
)
0
;
/* first check if module already created */
if
(
!
type_pointer
)
{
...
...
@@ -2763,7 +2767,7 @@ SWIG_Python_TypeQuery(const char *type)
descriptor
=
(
swig_type_info
*
)
PyCObject_AsVoidPtr
(
obj
);
#endif
}
else
{
swig_module_info
*
swig_module
=
SWIG_
Python_GetModule
(
);
swig_module_info
*
swig_module
=
SWIG_
GetModule
(
0
);
descriptor
=
SWIG_TypeQueryModule
(
swig_module
,
swig_module
,
type
);
if
(
descriptor
)
{
#ifdef SWIGPY_USE_CAPSULE
...
...
@@ -2987,7 +2991,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
#endif
#define SWIG_name "_pyUExceptions"
#define SWIGVERSION 0x02000
8
#define SWIGVERSION 0x02000
9
#define SWIG_VERSION SWIGVERSION
...
...
@@ -3200,27 +3204,22 @@ fail:
SWIGINTERN
PyObject
*
_wrap_new_UException__SWIG_1
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
PyObject
*
resultobj
=
0
;
std
::
string
arg1
;
void
*
argp1
;
std
::
string
*
arg1
=
0
;
void
*
argp1
=
0
;
int
res1
=
0
;
PyObject
*
obj0
=
0
;
UException
*
result
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,(
char
*
)
"O:new_UException"
,
&
obj0
))
SWIG_fail
;
{
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_std__string
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"new_UException"
"', argument "
"1"" of type '"
"std::string const""'"
);
}
if
(
!
argp1
)
{
SWIG_exception_fail
(
SWIG_ValueError
,
"invalid null reference "
"in method '"
"new_UException"
"', argument "
"1"" of type '"
"std::string const""'"
);
}
else
{
std
::
string
*
temp
=
reinterpret_cast
<
std
::
string
*
>
(
argp1
);
arg1
=
*
temp
;
if
(
SWIG_IsNewObj
(
res1
))
delete
temp
;
}
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_std__string
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"new_UException"
"', argument "
"1"" of type '"
"std::string const &""'"
);
}
if
(
!
argp1
)
{
SWIG_exception_fail
(
SWIG_ValueError
,
"invalid null reference "
"in method '"
"new_UException"
"', argument "
"1"" of type '"
"std::string const &""'"
);
}
result
=
(
UException
*
)
new
UException
(
arg1
);
arg1
=
reinterpret_cast
<
std
::
string
*
>
(
argp1
);
result
=
(
UException
*
)
new
UException
((
std
::
string
const
&
)
*
arg1
);
resultobj
=
SWIG_NewPointerObj
(
SWIG_as_voidptr
(
result
),
SWIGTYPE_p_UException
,
SWIG_POINTER_NEW
|
0
);
return
resultobj
;
fail
:
...
...
@@ -3287,7 +3286,7 @@ fail:
SWIG_SetErrorMsg
(
PyExc_NotImplementedError
,
"Wrong number or type of arguments for overloaded function 'new_UException'.
\n
"
" Possible C/C++ prototypes are:
\n
"
" UException::UException()
\n
"
" UException::UException(std::string const)
\n
"
" UException::UException(std::string const
&
)
\n
"
" UException::UException(char const *)
\n
"
);
return
0
;
}
...
...
@@ -3418,27 +3417,22 @@ fail:
SWIGINTERN
PyObject
*
_wrap_new_UTimeOut__SWIG_1
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
PyObject
*
resultobj
=
0
;
std
::
string
arg1
;
void
*
argp1
;
std
::
string
*
arg1
=
0
;
void
*
argp1
=
0
;
int
res1
=
0
;
PyObject
*
obj0
=
0
;
UTimeOut
*
result
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,(
char
*
)
"O:new_UTimeOut"
,
&
obj0
))
SWIG_fail
;
{
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_std__string
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"new_UTimeOut"
"', argument "
"1"" of type '"
"std::string const""'"
);
}
if
(
!
argp1
)
{
SWIG_exception_fail
(
SWIG_ValueError
,
"invalid null reference "
"in method '"
"new_UTimeOut"
"', argument "
"1"" of type '"
"std::string const""'"
);
}
else
{
std
::
string
*
temp
=
reinterpret_cast
<
std
::
string
*
>
(
argp1
);
arg1
=
*
temp
;
if
(
SWIG_IsNewObj
(
res1
))
delete
temp
;
}
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_std__string
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"new_UTimeOut"
"', argument "
"1"" of type '"
"std::string const &""'"
);
}
result
=
(
UTimeOut
*
)
new
UTimeOut
(
arg1
);
if
(
!
argp1
)
{
SWIG_exception_fail
(
SWIG_ValueError
,
"invalid null reference "
"in method '"
"new_UTimeOut"
"', argument "
"1"" of type '"
"std::string const &""'"
);
}
arg1
=
reinterpret_cast
<
std
::
string
*
>
(
argp1
);
result
=
(
UTimeOut
*
)
new
UTimeOut
((
std
::
string
const
&
)
*
arg1
);
resultobj
=
SWIG_NewPointerObj
(
SWIG_as_voidptr
(
result
),
SWIGTYPE_p_UTimeOut
,
SWIG_POINTER_NEW
|
0
);
return
resultobj
;
fail
:
...
...
@@ -3472,7 +3466,7 @@ fail:
SWIG_SetErrorMsg
(
PyExc_NotImplementedError
,
"Wrong number or type of arguments for overloaded function 'new_UTimeOut'.
\n
"
" Possible C/C++ prototypes are:
\n
"
" UTimeOut::UTimeOut()
\n
"
" UTimeOut::UTimeOut(std::string const)
\n
"
);
" UTimeOut::UTimeOut(std::string const
&
)
\n
"
);
return
0
;
}
...
...
@@ -3520,27 +3514,22 @@ fail:
SWIGINTERN
PyObject
*
_wrap_new_USysError__SWIG_1
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
PyObject
*
resultobj
=
0
;
std
::
string
arg1
;
void
*
argp1
;
std
::
string
*
arg1
=
0
;
void
*
argp1
=
0
;
int
res1
=
0
;
PyObject
*
obj0
=
0
;
USysError
*
result
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,(
char
*
)
"O:new_USysError"
,
&
obj0
))
SWIG_fail
;
{
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_std__string
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"new_USysError"
"', argument "
"1"" of type '"
"std::string const""'"
);
}
if
(
!
argp1
)
{
SWIG_exception_fail
(
SWIG_ValueError
,
"invalid null reference "
"in method '"
"new_USysError"
"', argument "
"1"" of type '"
"std::string const""'"
);
}
else
{
std
::
string
*
temp
=
reinterpret_cast
<
std
::
string
*
>
(
argp1
);
arg1
=
*
temp
;
if
(
SWIG_IsNewObj
(
res1
))
delete
temp
;
}
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_std__string
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"new_USysError"
"', argument "
"1"" of type '"
"std::string const &""'"
);
}
if
(
!
argp1
)
{
SWIG_exception_fail
(
SWIG_ValueError
,
"invalid null reference "
"in method '"
"new_USysError"
"', argument "
"1"" of type '"
"std::string const &""'"
);
}
result
=
(
USysError
*
)
new
USysError
(
arg1
);
arg1
=
reinterpret_cast
<
std
::
string
*
>
(
argp1
);
result
=
(
USysError
*
)
new
USysError
((
std
::
string
const
&
)
*
arg1
);
resultobj
=
SWIG_NewPointerObj
(
SWIG_as_voidptr
(
result
),
SWIGTYPE_p_USysError
,
SWIG_POINTER_NEW
|
0
);
return
resultobj
;
fail
:
...
...
@@ -3574,7 +3563,7 @@ fail:
SWIG_SetErrorMsg
(
PyExc_NotImplementedError
,
"Wrong number or type of arguments for overloaded function 'new_USysError'.
\n
"
" Possible C/C++ prototypes are:
\n
"
" USysError::USysError()
\n
"
" USysError::USysError(std::string const)
\n
"
);
" USysError::USysError(std::string const
&
)
\n
"
);
return
0
;
}
...
...
@@ -3728,7 +3717,6 @@ SWIG_InitializeModule(void *clientdata) {
size_t
i
;
swig_module_info
*
module_head
,
*
iter
;
int
found
,
init
;
(
void
*
)
clientdata
;
/* check to see if the circular list has been setup, if not, set it up */
if
(
swig_module
.
next
==
0
)
{
...
...
python/lib/pyUniSet/UInterface.cc
View file @
73b724ef
...
...
@@ -64,7 +64,7 @@ long UInterface::getValue( long id )throw(UException)
}
catch
(
UException
&
ex
)
{
throw
ex
;
throw
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
...
...
@@ -114,7 +114,7 @@ void UInterface::setValue( long id, long val )throw(UException)
}
catch
(
UException
&
ex
)
{
throw
ex
;
throw
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
...
...
python/lib/pyUniSet/UTypes.h
View file @
73b724ef
...
...
@@ -11,7 +11,7 @@ namespace UTypes
{
static
const
int
max
=
20
;
Params
()
:
argc
(
0
){}
Params
()
:
argc
(
0
){
memset
(
argv
,
0
,
sizeof
(
argv
));
}
bool
add
(
char
*
s
)
{
...
...
python/lib/pyUniSet/pyUExceptions.py
View file @
73b724ef
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.
8
# Version 2.0.
9
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
...
...
src/Communications/Modbus/ModbusClient.cc
View file @
73b724ef
...
...
@@ -209,7 +209,7 @@ void ModbusClient::fileTransfer( ModbusAddr addr, ModbusData numfile,
mbErrCode
res
=
erNoError
;
FILE
*
fdsave
=
fopen
(
save2filename
,
"w"
);
if
(
fdsave
<=
0
)
if
(
fdsave
==
NULL
)
{
if
(
dlog
.
debugging
(
Debug
::
WARN
)
)
dlog
[
Debug
::
WARN
]
<<
"(fileTransfer): fopen '"
...
...
src/Communications/Modbus/ModbusTCPTypes.cc
View file @
73b724ef
...
...
@@ -949,7 +949,7 @@ ModbusMessage ReadOutputRetMessage::transport_msg()
// копируем
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
bcnt
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
bcnt
;
...
...
@@ -1151,7 +1151,7 @@ ModbusMessage ReadInputRetMessage::transport_msg()
// копируем
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
bcnt
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
bcnt
;
...
...
@@ -1264,7 +1264,7 @@ ModbusMessage ForceCoilsMessage::transport_msg()
// копируем данные
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
bcnt
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
bcnt
;
...
...
@@ -1509,7 +1509,7 @@ ModbusMessage WriteOutputMessage::transport_msg()
// копируем данные
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
bcnt
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
bcnt
;
...
...
@@ -2156,7 +2156,7 @@ ModbusMessage JournalCommandRetMessage::transport_msg()
// копируем
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
bcnt
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
bcnt
;
...
...
src/Communications/Modbus/ModbusTypes.cc
View file @
73b724ef
...
...
@@ -972,7 +972,7 @@ ModbusMessage ReadOutputRetMessage::transport_msg()
// копируем
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
bcnt
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
bcnt
;
...
...
@@ -1183,7 +1183,7 @@ ModbusMessage ReadInputRetMessage::transport_msg()
// копируем
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
bcnt
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
bcnt
;
...
...
@@ -1547,7 +1547,7 @@ ModbusMessage WriteOutputMessage::transport_msg()
// копируем данные
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
bcnt
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
bcnt
;
...
...
@@ -2250,7 +2250,7 @@ ModbusMessage DiagnosticMessage::transport_msg()
// копируем
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
sizeof
(
ModbusData
)
*
count
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
sizeof
(
ModbusData
)
*
count
;
...
...
@@ -2745,7 +2745,7 @@ ModbusMessage JournalCommandRetMessage::transport_msg()
// копируем
memcpy
(
&
(
mm
.
data
[
ind
]),
dtmp
,
bcnt
);
delete
dtmp
;
delete
[]
dtmp
;
ind
+=
bcnt
;
...
...
src/ObjectRepository/ORepHelpers.cc
View file @
73b724ef
...
...
@@ -202,7 +202,7 @@ namespace ORepHelpers
* \param fname - полное имя включающее в себя путь ("Root/Section1/name|Node:Alias")
* \param brk - используемый символ разделитель
*/
const
string
getShortName
(
const
string
&
fname
,
const
std
::
string
brk
)
const
string
getShortName
(
const
string
&
fname
,
const
std
::
string
&
brk
)
{
/*
string::size_type pos = fname.rfind(brk);
...
...
@@ -232,7 +232,7 @@ namespace ORepHelpers
* \param brk - используемый символ разделитель
* \note Функция возвращает путь без последнего символа разделителя ("Root/Section1/name" -> "Root/Section1")
*/
const
string
getSectionName
(
const
string
&
fullName
,
const
std
::
string
brk
)
const
string
getSectionName
(
const
string
&
fullName
,
const
std
::
string
&
brk
)
{
string
::
size_type
pos
=
fullName
.
rfind
(
brk
);
if
(
pos
==
string
::
npos
)
...
...
src/ObjectRepository/UniSetObject.cc
View file @
73b724ef
...
...
@@ -339,7 +339,7 @@ struct CInfo
if
(
value
!=
mi
.
value
)
return
value
<
mi
.
value
;
if
(
time
!=
time
)
if
(
time
!=
mi
.
time
)
return
time
<
mi
.
time
;
return
time_usec
<
mi
.
time_usec
;
...
...
src/Various/Configuration.cc
View file @
73b724ef
...
...
@@ -47,8 +47,8 @@ using namespace std;
// -------------------------------------------------------------------------
static
const
string
UniSetDefaultPort
=
"2809"
;
// -------------------------------------------------------------------------
static
ostream
&
print_help
(
ostream
&
os
,
int
width
,
const
string
cmd
,
const
string
help
,
const
string
tab
=
""
)
static
ostream
&
print_help
(
ostream
&
os
,
int
width
,
const
string
&
cmd
,
const
string
&
help
,
const
string
&
tab
=
""
)
{
// чтобы не менчять параметры основного потока
// создаём свой stream...
...
...
@@ -256,7 +256,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
catch
(
Exception
&
ex
)
{
unideb
[
Debug
::
CRIT
]
<<
"(Configuration:init): INIT FAILED! from "
<<
fileConfName
<<
endl
;
throw
ex
;
throw
;
}
}
}
...
...
@@ -1096,7 +1096,7 @@ UniversalIO::IOTypes Configuration::getIOType( const std::string name )
return
UniversalIO
::
UnknownIOType
;
}
// -------------------------------------------------------------------------
void
uniset_init
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
xmlfile
)
void
uniset_init
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
&
xmlfile
)
{
string
confile
=
UniSetTypes
::
getArgParam
(
"--confile"
,
argc
,
argv
,
xmlfile
);
UniSetTypes
::
conf
=
new
Configuration
(
argc
,
argv
,
confile
);
...
...
src/Various/CycleStorage.cc
View file @
73b724ef
...
...
@@ -251,7 +251,7 @@ bool CycleStorage::create(const char* name, int byte_sz, int inf_sz, int inf_cou
fflush
(
file
);
head
=
tail
=-
1
;
delete
jrn
;
delete
[]
jrn
;
return
true
;
}
...
...
src/Various/RunLock.cc
View file @
73b724ef
...
...
@@ -46,12 +46,13 @@ bool RunLock::isLocked(const string& name)
if
(
out
)
{
char
ptr
[
10
];
fscanf
(
out
,
"%s"
,
ptr
);
fscanf
(
out
,
"%9s"
,
ptr
);
DIR
*
d
=
opendir
(
"/proc"
);
dirent
*
dir
;
while
((
dir
=
readdir
(
d
)))
{
if
(
!
strcmp
(
ptr
,
dir
->
d_name
)
)
if
(
!
strcmp
(
ptr
,
dir
->
d_name
)
)
{
// по хорошему здесь надо бы проверять
// статус на зомби
...
...
@@ -71,14 +72,16 @@ bool RunLock::isLocked(const string& name)
}
}
*/
unideb
[
Debug
::
INFO
]
<<
"(RunLock): programm "
<<
name
<<
" already run"
<<
endl
;
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
unideb
[
Debug
::
INFO
]
<<
"(RunLock): programm "
<<
name
<<
" already run"
<<
endl
;
fclose
(
out
);
closedir
(
d
);
return
true
;
}
}
fclose
(
out
);
fclose
(
out
);
closedir
(
d
);
}
...
...
src/Various/SViewer.cc
View file @
73b724ef
...
...
@@ -161,13 +161,11 @@ void SViewer::readSection(const string section, const string secRoot)
void
SViewer
::
getInfo
(
ObjectId
id
)
{
CORBA
::
Object_var
oref
;
bool
c
(
false
);
try
{
try
{
oref
=
cache
.
resolve
(
id
,
conf
->
getLocalNode
());
c
=
true
;
}
catch
(
NameNotFound
){}
...
...
src/Various/TableBlockStorage.cc
View file @
73b724ef
...
...
@@ -198,7 +198,7 @@ bool TableBlockStorage::open(const char* name, int byte_sz, int key_sz, int inf_
fread
(
elemPointer
(
i
),(
full_size
),
1
,
file
);
if
(
elemPointer
(
i
)
->
count
>
max
)
max
=
elemPointer
(
i
)
->
count
;
}
delete
t
;
delete
[]
t
;
return
true
;
}
...
...
src/Various/TableStorage.cc
View file @
73b724ef
...
...
@@ -40,6 +40,7 @@ TableStorage::TableStorage( const char* name, int inf_sz, int sz, int seek ):
if
(
file
==
NULL
)
{
file
=
fopen
(
name
,
"w"
);
memset
(
t
,
0
,
sizeof
(
*
t
));
for
(
int
i
=
0
;
i
<
size
;
i
++
)
fwrite
(
t
,(
sizeof
(
TableStorageElem
)
+
inf_size
),
1
,
file
);
fclose
(
file
);
file
=
fopen
(
name
,
"r+"
);
...
...
@@ -102,6 +103,8 @@ TableStorage::TableStorage( const char* name, int inf_sz, int sz, int seek ):
else
head
=
size
-
1
;
}
}
free
(
t
);
}
TableStorage
::~
TableStorage
()
...
...
@@ -125,6 +128,7 @@ int TableStorage::addRow(char* key, char* value)
*
((
char
*
)(
tbl
)
+
sizeof
(
TableStorageElem
)
+
k
)
=*
(
value
+
k
);
fwrite
(
tbl
,(
sizeof
(
TableStorageElem
)
+
inf_size
),
1
,
file
);
head
=
0
;
free
(
tbl
);
return
0
;
}
fseek
(
file
,
seekpos
+
head
*
(
sizeof
(
TableStorageElem
)
+
inf_size
),
0
);
...
...
@@ -139,6 +143,7 @@ int TableStorage::addRow(char* key, char* value)
*
((
char
*
)(
tbl
)
+
sizeof
(
TableStorageElem
)
+
k
)
=*
(
value
+
k
);
fseek
(
file
,
seekpos
+
i
*
(
sizeof
(
TableStorageElem
)
+
inf_size
),
0
);
fwrite
(
tbl
,(
sizeof
(
TableStorageElem
)
+
inf_size
),
1
,
file
);
free
(
tbl
);
return
0
;
}
j
++
;
...
...
@@ -178,9 +183,12 @@ int TableStorage::addRow(char* key, char* value)
fwrite
(
tbl
,(
sizeof
(
TableStorageElem
)
+
inf_size
),
1
,
file
);
head
++
;
if
(
head
>=
size
)
head
=
0
;
free
(
tbl
);
return
0
;
}
}
free
(
tbl
);
return
1
;
}
...
...
@@ -203,6 +211,7 @@ int TableStorage::delRow(char* key)
else
tbl
->
status
=
5
;
fseek
(
file
,
seekpos
+
j
*
(
sizeof
(
TableStorageElem
)
+
inf_size
),
0
);
fwrite
(
tbl
,(
sizeof
(
TableStorageElem
)
+
inf_size
),
1
,
file
);
free
(
tbl
);
return
0
;
}
j
++
;
...
...
@@ -213,6 +222,8 @@ int TableStorage::delRow(char* key)
}
}
}
free
(
tbl
);
return
1
;
}
...
...
@@ -230,10 +241,12 @@ char* TableStorage::findKeyValue(char* key, char* val)
{
for
(
k
=
0
;
k
<
inf_size
;
k
++
)
*
(
val
+
k
)
=*
((
char
*
)(
tbl
)
+
sizeof
(
TableStorageElem
)
+
k
);
free
(
tbl
);
return
val
;
}
}
}
free
(
tbl
);
return
0
;
}
src/Various/UniXML.cc
View file @
73b724ef
...
...
@@ -179,7 +179,9 @@ xmlNode* UniXML::copyNode(xmlNode* node, int recursive)
\todo "Нужно тест написать на copyNode"
*/
copynode
->
properties
=
::
xmlCopyPropList
(
NULL
,
node
->
properties
);
if
(
copynode
)
copynode
->
properties
=
::
xmlCopyPropList
(
NULL
,
node
->
properties
);
if
(
copynode
!=
0
&&
node
->
parent
)
{
xmlNode
*
newnode
=
::
xmlNewChild
(
node
->
parent
,
NULL
,
(
const
xmlChar
*
)
""
,
(
const
xmlChar
*
)
""
);
...
...
@@ -411,7 +413,7 @@ int UniXML_iterator::getPIntProp( const string name, int def ) const
return
i
;
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
UniXML_iterator
::
setProp
(
const
string
name
,
const
string
text
)
{
UniXML
::
setProp
(
curNode
,
name
,
text
);
...
...
@@ -420,7 +422,7 @@ void UniXML_iterator::setProp( const string name, const string text )
// -------------------------------------------------------------------------
bool
UniXML_iterator
::
findName
(
const
std
::
string
node
,
const
std
::
string
searchname
)
{
while
(
find
(
node
)
)
while
(
this
->
find
(
node
)
)
{
if
(
searchname
==
getProp
(
"name"
)
)
return
true
;
...
...
tests/JrnTests/JrnTest.cc
View file @
73b724ef
...
...
@@ -95,7 +95,7 @@ bool testTable2(void)
t0
.
addRow
((
char
*
)
&
i
,
val
);
if
(
t
.
getCurBlock
()
!=
0
)
{
delete
val
;
delete
[]
val
;
return
false
;
}
for
(
i
=
1
;
i
<
11
;
i
++
)
...
...
@@ -105,7 +105,7 @@ bool testTable2(void)
}
if
(
t
.
getCurBlock
()
!=
0
)
{
delete
val
;
delete
[]
val
;
return
false
;
}
for
(
i
=
1
;
i
<
20
;
i
++
)
...
...
@@ -113,14 +113,14 @@ bool testTable2(void)
if
(
t
.
findKeyValue
(
&
i
,
val
)
!=
0
)
printf
(
"%s, "
,
val
);
if
(
val
[
0
]
==
0
)
{
delete
val
;
delete
[]
val
;
return
false
;
}
}
printf
(
"
\n
"
);
if
(
t
.
getCurBlock
()
!=
0
)
{
delete
val
;
delete
[]
val
;
return
false
;
}
for
(
i
=
1
;
i
<
8
;
i
++
)
...
...
@@ -140,20 +140,20 @@ bool testTable2(void)
printf
(
"%s, "
,
val
);
if
((
i
>
7
)
&&
(
i
<
11
))
{
delete
val
;
delete
[]
val
;
return
false
;
}
}
if
((
val
[
0
]
==
0
)
&&
(
i
<
8
))
{
delete
val
;
delete
[]
val
;
return
false
;
}
}
printf
(
"
\n
rewriting 3-10 elements with values=keys+40
\n
"
);
if
(
t
.
getCurBlock
()
!=
0
)
{
delete
val
;
delete
[]
val
;
return
false
;
}
for
(
i
=
3
;
i
<
11
;
i
++
)
...
...
@@ -166,18 +166,18 @@ bool testTable2(void)
if
(
t
.
findKeyValue
(
&
i
,
val
)
!=
0
)
printf
(
"%s, "
,
val
);
if
((
UniSetTypes
::
uni_atoi
(
val
)
!=
i
+
40
)
&&
(
i
>
2
)
&&
(
i
<
11
))
{
delete
val
;
delete
[]
val
;
return
false
;
}
if
((
UniSetTypes
::
uni_atoi
(
val
)
!=
i
+
10
)
&&
(
i
<
3
))
{
delete
val
;
delete
[]
val
;
return
false
;
}
}
if
(
t
.
getCurBlock
()
!=
0
)
{
delete
val
;
delete
[]
val
;
return
false
;
}
...
...
@@ -192,7 +192,7 @@ bool testTable2(void)
}
if
(
t
.
getCurBlock
()
!=
1
)
{
delete
val
;
delete
[]
val
;
return
false
;
}
printf
(
"after reopen:
\n
"
);
...
...
@@ -203,10 +203,10 @@ bool testTable2(void)
}
if
(
t
.
getCurBlock
()
!=
1
)
{
delete
val
;
delete
[]
val
;
return
false
;
}
delete
val
;
delete
[]
val
;
return
true
;
}
...
...
@@ -219,7 +219,7 @@ bool reOpen()
if
(
!
j
.
open
(
"big_file.test"
,
bj_size
,
30
,
33000
,
seek
))
{
printf
(
"Reopen file error
\n
"
);
delete
str
;
delete
[]
str
;
return
false
;
}
for
(
i
=
0
;
i
<
20
;
i
++
)
...
...
@@ -230,7 +230,7 @@ bool reOpen()
k
++
;
}
}
delete
str
;
delete
[]
str
;
if
(
k
!=
10
)
return
false
;
return
true
;
...
...
@@ -262,7 +262,7 @@ bool testJournal1(void)
}
if
(
k
<
30
)
{
delete
str
;
delete
[]
str
;
return
false
;
}
k
=
0
;
...
...
@@ -276,12 +276,12 @@ bool testJournal1(void)
if
(
t
.
findKeyValue
((
char
*
)
&
i
,
val
)
!=
0
)
printf
(
"%s, "
,
val
);
if
((
UniSetTypes
::
uni_atoi
(
val
)
!=
i
+
10
)
&&
(
i
<
3
))
{
delete
val
;
delete
str
;
delete
[]
val
;
delete
[]
str
;
return
false
;
}
}
delete
val
;
delete
[]
val
;
printf
(
"
\n
first 30 elements after deleting first 20:
\n
"
);
for
(
i
=
0
;
i
<
20
;
i
++
)
...
...
@@ -298,7 +298,7 @@ bool testJournal1(void)
}
if
(
k
!=
10
)
{
delete
str
;
delete
[]
str
;
return
false
;
}
k
=
0
;
...
...
@@ -319,15 +319,15 @@ bool testJournal1(void)
}
if
(
k
!=
10
)
{
delete
str
;
delete
[]
str
;
return
false
;
}
k
=
0
;
if
(
!
reOpen
())
return
false
;
if
(
!
reOpen
())
{
delete
[]
str
;
return
false
;
}
;
if
(
!
reOpen
())
return
false
;
if
(
!
reOpen
())
{
delete
[]
str
;
return
false
;
}
;
printf
(
"size changed back to 32000 rows
\n
"
);
j
.
setSize
(
32000
);
...
...
@@ -341,12 +341,12 @@ bool testJournal1(void)
}
if
(
k
!=
10
)
{
delete
str
;
delete
[]
str
;
return
false
;
}
k
=
0
;
delete
str
;
delete
[]
str
;
return
true
;
}
...
...
@@ -368,7 +368,7 @@ void testJournal2(void)
printf
(
"i=%d, iterations = %d
\n
"
,
i
,
j
.
getIter
());
}
printf
(
"
\n
"
);
delete
str
;
delete
[]
str
;
}
...
...
tests/iterator_test.cc
View file @
73b724ef
...
...
@@ -8,7 +8,7 @@ using namespace std;
#include "UniSetTypes.h"
void
check
(
const
std
::
string
name
,
const
std
::
string
true_res
,
const
std
::
string
your_res
)
void
check
(
const
std
::
string
&
name
,
const
std
::
string
&
true_res
,
const
std
::
string
&
your_res
)
{
cout
<<
name
<<
endl
;
cout
<<
"Correct result: "
<<
true_res
<<
endl
;
...
...
tests/passivetimer.cc
View file @
73b724ef
...
...
@@ -7,8 +7,15 @@ using namespace std;
PassiveTimer
pt
(
1000
);
void
func
(
const
std
::
string
&
s1
)
{
}
int
main
()
{
func
(
"test"
);
PassiveTimer
pt1
(
5000
);
cout
<<
" pt1.getInterval()="
<<
pt1
.
getInterval
()
<<
" TEST: "
<<
((
pt1
.
getInterval
()
==
5000
)
?
"OK"
:
"FAILED"
)
<<
endl
;
...
...
tests/umutex.cc
View file @
73b724ef
...
...
@@ -12,7 +12,7 @@ uniset_mutex m;
class
MyClass
{
public
:
MyClass
(
const
std
::
string
name
)
:
nm
(
name
)
MyClass
(
const
std
::
string
&
name
)
:
nm
(
name
)
{
thr
=
new
ThreadCreator
<
MyClass
>
(
this
,
&
MyClass
::
thread
);
}
...
...
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