diff --git a/src/containers/pimap.h b/src/containers/pimap.h index 99c8f394..87c8fb99 100644 --- a/src/containers/pimap.h +++ b/src/containers/pimap.h @@ -82,7 +82,7 @@ public: public: iterator(): parent(0), pos(0) {} const Key & key() const {return const_cast * >(parent)->_key(pos);} - T & value() const {return const_cast * >(parent)->_value(pos);} + T & value() {return const_cast * >(parent)->_value(pos);} void operator ++() {++pos;} void operator ++(int) {++pos;} void operator --() {--pos;} diff --git a/src/core/pistring.cpp b/src/core/pistring.cpp index 36a23eee..2f6ba602 100755 --- a/src/core/pistring.cpp +++ b/src/core/pistring.cpp @@ -613,6 +613,14 @@ bool PIString::endsWith(const PIString & str) const { } +bool PIString::toBool() const { + PIString s(*this); + s = s.trimmed().toLowerCase(); + if ( atof(s.toNativeDecimalPoints().data()) > 0. || s == "true" || s == "yes" || s == "on" || s == "ok") return true; + return false; +} + + PIString PIString::takeSymbol() { PIString ret; int sz = size_s(), ss = -1; diff --git a/src/core/pistring.h b/src/core/pistring.h index e19f6a32..5249b68d 100755 --- a/src/core/pistring.h +++ b/src/core/pistring.h @@ -578,7 +578,7 @@ public: //! \brief Return \c true if string equal "true", "yes", "on" or positive not null numeric value - bool toBool() const {PIString s(*this); if (atof(s.toNativeDecimalPoints().data()) > 0. || s.trimmed().toLowerCase() == "true" || s.trimmed().toLowerCase() == "yes" || s.trimmed().toLowerCase() == "on") return true; return false;} + bool toBool() const; //! \brief Return \c char numeric value of string char toChar() const; diff --git a/src/io/pipeer.cpp b/src/io/pipeer.cpp index 91b9dece..3824299c 100755 --- a/src/io/pipeer.cpp +++ b/src/io/pipeer.cpp @@ -136,6 +136,7 @@ REGISTER_DEVICE(PIPeer) PIPeer::PIPeer(const PIString & n): PIIODevice(), eth_tcp_srv(PIEthernet::TCP_Server), eth_tcp_cli(PIEthernet::TCP_Client), diag_s(false), diag_d(false) { destroyed = false; + setDebug(false); PIMutexLocker mbl(mc_mutex); PIMutexLocker ethl(eth_mutex); PIMutexLocker pl(peers_mutex); @@ -527,7 +528,7 @@ bool PIPeer::dataRead(uchar * readed, int size) { bool PIPeer::mbcastRead(uchar * data, int size) { if (destroyed) { - piCout << "[PIPeer] SegFault"; + //piCout << "[PIPeer] SegFault"; return true; } if (size < 8) return true; diff --git a/src/thread/pithread.cpp b/src/thread/pithread.cpp index 060fb861..5b5b6e54 100755 --- a/src/thread/pithread.cpp +++ b/src/thread/pithread.cpp @@ -239,7 +239,9 @@ __THREAD_FUNC__ PIThread::thread_function(void * t) { ct.started(); while (!ct.terminating) { if (ct.lockRun) ct.mutex_.lock(); + //piCout << "thread" << ct.name() << "..."; ct.run(); + //piCout << "thread" << ct.name() << "done"; //printf("thread %p tick\n", &ct); if (ct.ret_func != 0) ct.ret_func(ct.data_); if (ct.lockRun) ct.mutex_.unlock();