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