Commit a92eeafd authored by Pavel Vainerman's avatar Pavel Vainerman

minor fixes: used 'const' if possible..

parent e6b637c7
...@@ -227,10 +227,10 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID ) ...@@ -227,10 +227,10 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
int k = 0; int k = 0;
for( auto& i : rrdparamist ) for( const auto& i : rrdparamist )
argv[k++] = strdup(i.c_str()); argv[k++] = strdup(i.c_str());
for( auto& i : rralist ) for( const auto& i : rralist )
argv[k++] = strdup(i.c_str()); argv[k++] = strdup(i.c_str());
// for( k=0; k<argc; k++ ) // for( k=0; k<argc; k++ )
......
...@@ -288,7 +288,7 @@ IOController_i::ShortMapSeq* UniExchange::getSensors() ...@@ -288,7 +288,7 @@ IOController_i::ShortMapSeq* UniExchange::getSensors()
int i = 0; int i = 0;
for( auto& it : mymap ) for( const auto& it : mymap )
{ {
IOController_i::ShortMap m; IOController_i::ShortMap m;
{ {
...@@ -327,7 +327,7 @@ void UniExchange::updateLocalData() ...@@ -327,7 +327,7 @@ void UniExchange::updateLocalData()
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void UniExchange::initIterators() void UniExchange::initIterators()
{ {
for( auto& it : mymap ) for( auto&& it : mymap )
shm->initIterator(it.ioit); shm->initIterator(it.ioit);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
......
...@@ -100,7 +100,7 @@ namespace uniset ...@@ -100,7 +100,7 @@ namespace uniset
long val; long val;
long id; long id;
UniversalIO::IOType type; UniversalIO::IOType type;
uniset::uniset_rwmutex val_lock; mutable uniset::uniset_rwmutex val_lock;
}; };
typedef std::vector<SInfo> SList; typedef std::vector<SInfo> SList;
......
...@@ -348,7 +348,7 @@ namespace uniset ...@@ -348,7 +348,7 @@ namespace uniset
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
long Calibration::getRawValue( const long cal, bool range ) const long Calibration::getRawValue( const long cal, bool range ) const
{ {
for( auto& it : pvec ) for( const auto& it : pvec )
{ {
TypeOfValue q = it.getX(cal); TypeOfValue q = it.getX(cal);
...@@ -372,7 +372,7 @@ namespace uniset ...@@ -372,7 +372,7 @@ namespace uniset
{ {
os << "*******************" << endl; os << "*******************" << endl;
for( auto& it : c.pvec ) for( const auto& it : c.pvec )
{ {
os << "[" << it.leftPoint().x << " : " << it.rightPoint().x << " ] --> [" os << "[" << it.leftPoint().x << " : " << it.rightPoint().x << " ] --> ["
<< it.leftPoint().y << " : " << it.rightPoint().y << " ]" << it.leftPoint().y << " : " << it.rightPoint().y << " ]"
...@@ -387,7 +387,7 @@ namespace uniset ...@@ -387,7 +387,7 @@ namespace uniset
{ {
os << "*******************" << endl; os << "*******************" << endl;
for( auto& it : c->pvec ) for( const auto& it : c->pvec )
{ {
os << "[" << it.leftPoint().x << " : " << it.rightPoint().x << " ] --> [" os << "[" << it.leftPoint().x << " : " << it.rightPoint().x << " ] --> ["
<< it.leftPoint().y << " : " << it.rightPoint().y << " ]" << it.leftPoint().y << " : " << it.rightPoint().y << " ]"
......
...@@ -105,7 +105,7 @@ namespace uniset ...@@ -105,7 +105,7 @@ namespace uniset
// считаем среднее арифметическое // считаем среднее арифметическое
M = 0; M = 0;
for( auto& i : buf ) for( const auto& i : buf )
M = M + i; M = M + i;
M = M / buf.size(); M = M / buf.size();
...@@ -114,7 +114,7 @@ namespace uniset ...@@ -114,7 +114,7 @@ namespace uniset
S = 0; S = 0;
double r = 0; double r = 0;
for( auto& i : buf ) for( const auto& i : buf )
{ {
r = M - i; r = M - i;
S = S + r * r; S = S + r * r;
...@@ -130,7 +130,7 @@ namespace uniset ...@@ -130,7 +130,7 @@ namespace uniset
int n = 0; int n = 0;
double val = 0; // Конечное среднее значение double val = 0; // Конечное среднее значение
for( auto& i : buf ) for( const auto& i : buf )
{ {
if( fabs(M - i) < S * 2 ) // откидываем if( fabs(M - i) < S * 2 ) // откидываем
{ {
...@@ -209,7 +209,7 @@ namespace uniset ...@@ -209,7 +209,7 @@ namespace uniset
{ {
os << "(" << d.buf.size() << ")["; os << "(" << d.buf.size() << ")[";
for( auto& i : d.buf ) for( const auto& i : d.buf )
os << " " << setw(5) << i; os << " " << setw(5) << i;
os << " ]"; os << " ]";
...@@ -292,7 +292,7 @@ namespace uniset ...@@ -292,7 +292,7 @@ namespace uniset
add(newval); add(newval);
for( auto& i : buf ) for( const auto& i : buf )
aver += i; aver += i;
aver /= maxsize; aver /= maxsize;
......
...@@ -137,7 +137,7 @@ void TestProc::timerInfo( const TimerMessage* tm ) ...@@ -137,7 +137,7 @@ void TestProc::timerInfo( const TimerMessage* tm )
cerr << "======= TEST LOG PRINT ======" << endl; cerr << "======= TEST LOG PRINT ======" << endl;
cerr << "LOGLEVEL: [" << (int)(*lit) << "] " << (*lit) << endl; cerr << "LOGLEVEL: [" << (int)(*lit) << "] " << (*lit) << endl;
for( auto& it : loglevels ) for( const auto& it : loglevels )
mylog->debug(it) << myname << ": test log print..." << endl; mylog->debug(it) << myname << ": test log print..." << endl;
cerr << "======= END LOG PRINT ======" << endl; cerr << "======= END LOG PRINT ======" << endl;
......
...@@ -113,7 +113,7 @@ void TestProc::timerInfo( const TimerMessage* tm ) ...@@ -113,7 +113,7 @@ void TestProc::timerInfo( const TimerMessage* tm )
cerr << "======= TEST LOG PRINT ======" << endl; cerr << "======= TEST LOG PRINT ======" << endl;
cerr << "LOGLEVEL: [" << (int)(*lit) << "] " << (*lit) << endl; cerr << "LOGLEVEL: [" << (int)(*lit) << "] " << (*lit) << endl;
for( auto& it : loglevels ) for( const auto& it : loglevels )
mylog->debug(it) << myname << ": test log print..." << endl; mylog->debug(it) << myname << ": test log print..." << endl;
cerr << "======= END LOG PRINT ======" << endl; cerr << "======= END LOG PRINT ======" << endl;
......
...@@ -2750,7 +2750,7 @@ namespace uniset ...@@ -2750,7 +2750,7 @@ namespace uniset
{ {
os << endl; os << endl;
for( auto& it : m.dlist ) for( const auto& it : m.dlist )
os << " " << rdi2str(it.id) << " : " << it.val << endl; os << " " << rdi2str(it.id) << " : " << it.val << endl;
} }
...@@ -2766,7 +2766,7 @@ namespace uniset ...@@ -2766,7 +2766,7 @@ namespace uniset
{ {
if( !dlist.empty() ) if( !dlist.empty() )
{ {
for( auto& it : dlist ) for( const auto& it : dlist )
os << " " << rdi2str(it.id) << " : " << it.val << endl; os << " " << rdi2str(it.id) << " : " << it.val << endl;
} }
......
...@@ -389,7 +389,7 @@ namespace uniset ...@@ -389,7 +389,7 @@ namespace uniset
int i = 0; int i = 0;
// формируем новые, используя i в качестве индекса // формируем новые, используя i в качестве индекса
for( auto& it : lnodes ) for( const auto& it : lnodes )
{ {
// делаем uni_strdup чтобы потом не думая // делаем uni_strdup чтобы потом не думая
// "где мы выделяли, а где не мы" // "где мы выделяли, а где не мы"
...@@ -415,7 +415,7 @@ namespace uniset ...@@ -415,7 +415,7 @@ namespace uniset
assert( i < onum ); assert( i < onum );
} }
for( auto& p : omniParams ) for( const auto& p : omniParams )
{ {
// делаем uni_strdup чтобы потом не думая // делаем uni_strdup чтобы потом не думая
// "где мы выделяли, а где не мы" // "где мы выделяли, а где не мы"
......
...@@ -484,7 +484,7 @@ IOController_i::SensorInfoSeq* IOController::getSensorsMap() ...@@ -484,7 +484,7 @@ IOController_i::SensorInfoSeq* IOController::getSensorsMap()
unsigned int i = 0; unsigned int i = 0;
for( auto& it : ioList ) for( const auto& it : ioList )
{ {
uniset_rwmutex_rlock lock(it.second->val_lock); uniset_rwmutex_rlock lock(it.second->val_lock);
(*res)[i] = *(it.second.get()); (*res)[i] = *(it.second.get());
......
...@@ -73,7 +73,7 @@ bool ProxyManager::activateObject() ...@@ -73,7 +73,7 @@ bool ProxyManager::activateObject()
return false; return false;
// Регистрируемся от имени объектов // Регистрируемся от имени объектов
for( auto& it : omap ) for( const auto& it : omap )
{ {
try try
{ {
...@@ -163,7 +163,7 @@ void ProxyManager::processingMessage( const uniset::VoidMessage* msg ) ...@@ -163,7 +163,7 @@ void ProxyManager::processingMessage( const uniset::VoidMessage* msg )
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void ProxyManager::allMessage( const uniset::VoidMessage* msg ) void ProxyManager::allMessage( const uniset::VoidMessage* msg )
{ {
for( auto& o : omap ) for( const auto& o : omap )
{ {
try try
{ {
......
...@@ -147,7 +147,7 @@ TEST_CASE("uniset_rwmutex_{wr|r} thread lock", "[mutex][threadlock][basic]" ) ...@@ -147,7 +147,7 @@ TEST_CASE("uniset_rwmutex_{wr|r} thread lock", "[mutex][threadlock][basic]" )
msleep(10); msleep(10);
// read захватывают сразу без задержек.. // read захватывают сразу без задержек..
for( auto && i : vr ) for( auto& i : vr )
{ {
if( i.valid() ) if( i.valid() )
REQUIRE( i.get() == true ); REQUIRE( i.get() == true );
......
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