Commit 70356296 authored by Pavel Vainerman's avatar Pavel Vainerman

Исправления по результатам проверки утилитой cppcheck

parent c5734c82
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
Name: libuniset Name: libuniset
Version: 1.6 Version: 1.6
Release: alt10 Release: alt11
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
...@@ -319,6 +319,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -319,6 +319,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet.pc %exclude %_pkgconfigdir/libUniSet.pc
%changelog %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 * Wed Jun 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt10
- add for ModbusMaster (RTU|TCP) --xxx--aftersend-pause - add for ModbusMaster (RTU|TCP) --xxx--aftersend-pause
......
...@@ -351,7 +351,7 @@ UNetExchange::~UNetExchange() ...@@ -351,7 +351,7 @@ UNetExchange::~UNetExchange()
delete shm; 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()); ost::IPV4Address a1(addr.c_str());
for( ReceiverList::iterator it=recvlist.begin(); it!=recvlist.end(); ++it ) for( ReceiverList::iterator it=recvlist.begin(); it!=recvlist.end(); ++it )
...@@ -424,7 +424,7 @@ void UNetExchange::step() ...@@ -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 try
{ {
......
...@@ -89,7 +89,7 @@ class UNetExchange: ...@@ -89,7 +89,7 @@ class UNetExchange:
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* argv[] ); 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: protected:
...@@ -142,6 +142,7 @@ class UNetExchange: ...@@ -142,6 +142,7 @@ class UNetExchange:
{ {
ReceiverInfo():r1(0),r2(0), ReceiverInfo():r1(0),r2(0),
sidRespond(UniSetTypes::DefaultObjectId), sidRespond(UniSetTypes::DefaultObjectId),
respondInvert(false),
sidLostPackets(UniSetTypes::DefaultObjectId) sidLostPackets(UniSetTypes::DefaultObjectId)
{} {}
...@@ -155,7 +156,7 @@ class UNetExchange: ...@@ -155,7 +156,7 @@ class UNetExchange:
UNetReceiver* r1; /*!< приём по первому каналу */ UNetReceiver* r1; /*!< приём по первому каналу */
UNetReceiver* r2; /*!< приём по второму каналу */ 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 ) inline void setRespondID( UniSetTypes::ObjectId id, bool invert=false )
{ {
......
...@@ -19,7 +19,7 @@ bool UNetReceiver::PacketCompare::operator()(const UniSetUDP::UDPMessage& lhs, ...@@ -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), shm(smi),
recvpause(10), recvpause(10),
updatepause(100), updatepause(100),
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
class UNetReceiver class UNetReceiver
{ {
public: 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(); ~UNetReceiver();
void start(); void start();
......
...@@ -33,7 +33,7 @@ enum Command ...@@ -33,7 +33,7 @@ enum Command
cmdReceive 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(':'); string::size_type pos = addr.rfind(':');
if( pos != string::npos ) if( pos != string::npos )
......
...@@ -39,7 +39,7 @@ namespace MTR ...@@ -39,7 +39,7 @@ namespace MTR
}; };
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
std::string type2str( MTRType t ); /*!< преоразование строки в тип */ std::string type2str( MTRType t ); /*!< преоразование строки в тип */
MTRType str2type( const std::string s ); /*!< преобразование названия в строку */ MTRType str2type( const std::string& s ); /*!< преобразование названия в строку */
int wsize( MTRType t ); /*!< длина данных в словах */ int wsize( MTRType t ); /*!< длина данных в словах */
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Информация // Информация
...@@ -100,7 +100,7 @@ namespace MTR ...@@ -100,7 +100,7 @@ namespace MTR
std::ostream& operator<<(std::ostream& os, MTRError& e ); std::ostream& operator<<(std::ostream& os, MTRError& e );
// Настройка из конф. файла // Настройка из конф. файла
MTRError update_configuration( ModbusRTUMaster* mb, ModbusRTU::ModbusAddr addr, 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; typedef std::list<ModbusRTU::ModbusData> DataList;
...@@ -109,8 +109,8 @@ namespace MTR ...@@ -109,8 +109,8 @@ namespace MTR
static const ModbusRTU::ModbusData skip[] = {48, 49, 59}; // registers which should not write 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 send_param( ModbusRTUMaster* mb, DataMap& dmap, ModbusRTU::ModbusAddr addr, int verb );
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 );
DataMap read_confile( const std::string f ); DataMap read_confile( const std::string& f );
void update_communication_params( ModbusRTU::ModbusAddr reg, ModbusRTU::ModbusData data, void update_communication_params( ModbusRTU::ModbusAddr reg, ModbusRTU::ModbusData data,
ModbusRTUMaster* mb, ModbusRTU::ModbusAddr& addr, int verb ); ModbusRTUMaster* mb, ModbusRTU::ModbusAddr& addr, int verb );
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
......
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org). * 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 * 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 * 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)) ...@@ -927,6 +927,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
} }
#endif #endif
#if PY_VERSION_HEX < 0x02050000
#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
#endif
#if PY_VERSION_HEX < 0x02040000 #if PY_VERSION_HEX < 0x02040000
#define Py_VISIT(op) \ #define Py_VISIT(op) \
do { \ do { \
...@@ -1198,7 +1202,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), ...@@ -1198,7 +1202,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
/* Runtime API */ /* 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_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
...@@ -2637,7 +2641,7 @@ void *SWIG_ReturnGlobalTypeList(void *); ...@@ -2637,7 +2641,7 @@ void *SWIG_ReturnGlobalTypeList(void *);
#endif #endif
SWIGRUNTIME swig_module_info * SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void) { SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
static void *type_pointer = (void *)0; static void *type_pointer = (void *)0;
/* first check if module already created */ /* first check if module already created */
if (!type_pointer) { if (!type_pointer) {
...@@ -2763,7 +2767,7 @@ SWIG_Python_TypeQuery(const char *type) ...@@ -2763,7 +2767,7 @@ SWIG_Python_TypeQuery(const char *type)
descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
#endif #endif
} else { } 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); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) { if (descriptor) {
#ifdef SWIGPY_USE_CAPSULE #ifdef SWIGPY_USE_CAPSULE
...@@ -2987,7 +2991,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; ...@@ -2987,7 +2991,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
#endif #endif
#define SWIG_name "_pyUExceptions" #define SWIG_name "_pyUExceptions"
#define SWIGVERSION 0x020008 #define SWIGVERSION 0x020009
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
...@@ -3200,27 +3204,22 @@ fail: ...@@ -3200,27 +3204,22 @@ fail:
SWIGINTERN PyObject *_wrap_new_UException__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { SWIGINTERN PyObject *_wrap_new_UException__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0; PyObject *resultobj = 0;
std::string arg1 ; std::string *arg1 = 0 ;
void *argp1 ; void *argp1 = 0 ;
int res1 = 0 ; int res1 = 0 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
UException *result = 0 ; UException *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_UException",&obj0)) SWIG_fail; if (!PyArg_ParseTuple(args,(char *)"O:new_UException",&obj0)) SWIG_fail;
{ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0); if (!SWIG_IsOK(res1)) {
if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UException" "', argument " "1"" of type '" "std::string const""'"); }
} if (!argp1) {
if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
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;
}
} }
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 ); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UException, SWIG_POINTER_NEW | 0 );
return resultobj; return resultobj;
fail: fail:
...@@ -3287,7 +3286,7 @@ fail: ...@@ -3287,7 +3286,7 @@ fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_UException'.\n" SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_UException'.\n"
" Possible C/C++ prototypes are:\n" " Possible C/C++ prototypes are:\n"
" UException::UException()\n" " UException::UException()\n"
" UException::UException(std::string const)\n" " UException::UException(std::string const &)\n"
" UException::UException(char const *)\n"); " UException::UException(char const *)\n");
return 0; return 0;
} }
...@@ -3418,27 +3417,22 @@ fail: ...@@ -3418,27 +3417,22 @@ fail:
SWIGINTERN PyObject *_wrap_new_UTimeOut__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { SWIGINTERN PyObject *_wrap_new_UTimeOut__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0; PyObject *resultobj = 0;
std::string arg1 ; std::string *arg1 = 0 ;
void *argp1 ; void *argp1 = 0 ;
int res1 = 0 ; int res1 = 0 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
UTimeOut *result = 0 ; UTimeOut *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_UTimeOut",&obj0)) SWIG_fail; if (!PyArg_ParseTuple(args,(char *)"O:new_UTimeOut",&obj0)) SWIG_fail;
{ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0); if (!SWIG_IsOK(res1)) {
if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
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;
}
} }
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 ); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UTimeOut, SWIG_POINTER_NEW | 0 );
return resultobj; return resultobj;
fail: fail:
...@@ -3472,7 +3466,7 @@ fail: ...@@ -3472,7 +3466,7 @@ fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_UTimeOut'.\n" SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_UTimeOut'.\n"
" Possible C/C++ prototypes are:\n" " Possible C/C++ prototypes are:\n"
" UTimeOut::UTimeOut()\n" " UTimeOut::UTimeOut()\n"
" UTimeOut::UTimeOut(std::string const)\n"); " UTimeOut::UTimeOut(std::string const &)\n");
return 0; return 0;
} }
...@@ -3520,27 +3514,22 @@ fail: ...@@ -3520,27 +3514,22 @@ fail:
SWIGINTERN PyObject *_wrap_new_USysError__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { SWIGINTERN PyObject *_wrap_new_USysError__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0; PyObject *resultobj = 0;
std::string arg1 ; std::string *arg1 = 0 ;
void *argp1 ; void *argp1 = 0 ;
int res1 = 0 ; int res1 = 0 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
USysError *result = 0 ; USysError *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_USysError",&obj0)) SWIG_fail; if (!PyArg_ParseTuple(args,(char *)"O:new_USysError",&obj0)) SWIG_fail;
{ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0); if (!SWIG_IsOK(res1)) {
if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const""'"); }
} if (!argp1) {
if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
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;
}
} }
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 ); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_USysError, SWIG_POINTER_NEW | 0 );
return resultobj; return resultobj;
fail: fail:
...@@ -3574,7 +3563,7 @@ fail: ...@@ -3574,7 +3563,7 @@ fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_USysError'.\n" SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_USysError'.\n"
" Possible C/C++ prototypes are:\n" " Possible C/C++ prototypes are:\n"
" USysError::USysError()\n" " USysError::USysError()\n"
" USysError::USysError(std::string const)\n"); " USysError::USysError(std::string const &)\n");
return 0; return 0;
} }
...@@ -3728,7 +3717,6 @@ SWIG_InitializeModule(void *clientdata) { ...@@ -3728,7 +3717,6 @@ SWIG_InitializeModule(void *clientdata) {
size_t i; size_t i;
swig_module_info *module_head, *iter; swig_module_info *module_head, *iter;
int found, init; int found, init;
(void *)clientdata;
/* check to see if the circular list has been setup, if not, set it up */ /* check to see if the circular list has been setup, if not, set it up */
if (swig_module.next==0) { if (swig_module.next==0) {
......
# This file was automatically generated by SWIG (http://www.swig.org). # 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 # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
......
...@@ -972,7 +972,7 @@ ModbusMessage ReadOutputRetMessage::transport_msg() ...@@ -972,7 +972,7 @@ ModbusMessage ReadOutputRetMessage::transport_msg()
// копируем // копируем
memcpy(&(mm.data[ind]),dtmp,bcnt); memcpy(&(mm.data[ind]),dtmp,bcnt);
delete dtmp; delete[] dtmp;
ind+=bcnt; ind+=bcnt;
...@@ -1183,7 +1183,7 @@ ModbusMessage ReadInputRetMessage::transport_msg() ...@@ -1183,7 +1183,7 @@ ModbusMessage ReadInputRetMessage::transport_msg()
// копируем // копируем
memcpy(&(mm.data[ind]),dtmp,bcnt); memcpy(&(mm.data[ind]),dtmp,bcnt);
delete dtmp; delete[] dtmp;
ind+=bcnt; ind+=bcnt;
...@@ -1547,7 +1547,7 @@ ModbusMessage WriteOutputMessage::transport_msg() ...@@ -1547,7 +1547,7 @@ ModbusMessage WriteOutputMessage::transport_msg()
// копируем данные // копируем данные
memcpy(&(mm.data[ind]),dtmp,bcnt); memcpy(&(mm.data[ind]),dtmp,bcnt);
delete dtmp; delete[] dtmp;
ind+=bcnt; ind+=bcnt;
...@@ -2250,7 +2250,7 @@ ModbusMessage DiagnosticMessage::transport_msg() ...@@ -2250,7 +2250,7 @@ ModbusMessage DiagnosticMessage::transport_msg()
// копируем // копируем
memcpy(&(mm.data[ind]),dtmp,sizeof(ModbusData)*count); memcpy(&(mm.data[ind]),dtmp,sizeof(ModbusData)*count);
delete dtmp; delete[] dtmp;
ind+=sizeof(ModbusData)*count; ind+=sizeof(ModbusData)*count;
...@@ -2745,7 +2745,7 @@ ModbusMessage JournalCommandRetMessage::transport_msg() ...@@ -2745,7 +2745,7 @@ ModbusMessage JournalCommandRetMessage::transport_msg()
// копируем // копируем
memcpy(&(mm.data[ind]),dtmp,bcnt); memcpy(&(mm.data[ind]),dtmp,bcnt);
delete dtmp; delete[] dtmp;
ind += bcnt; ind += bcnt;
......
...@@ -47,8 +47,8 @@ using namespace std; ...@@ -47,8 +47,8 @@ using namespace std;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
static const string UniSetDefaultPort = "2809"; static const string UniSetDefaultPort = "2809";
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
static ostream& print_help( ostream& os, int width, const string cmd, static ostream& print_help( ostream& os, int width, const string& cmd,
const string help, const string tab="" ) const string& help, const string& tab="" )
{ {
// чтобы не менчять параметры основного потока // чтобы не менчять параметры основного потока
// создаём свой stream... // создаём свой stream...
...@@ -256,7 +256,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv ) ...@@ -256,7 +256,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
catch(Exception& ex ) catch(Exception& ex )
{ {
unideb[Debug::CRIT] << "(Configuration:init): INIT FAILED! from " << fileConfName << endl; 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 ) ...@@ -1096,7 +1096,7 @@ UniversalIO::IOTypes Configuration::getIOType( const std::string name )
return UniversalIO::UnknownIOType; 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 ); string confile = UniSetTypes::getArgParam( "--confile", argc, argv, xmlfile );
UniSetTypes::conf = new Configuration(argc, argv, confile); UniSetTypes::conf = new Configuration(argc, argv, confile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment