Commit e3418768 authored by Vitaly Lipatov's avatar Vitaly Lipatov

fix code style (add missed spaces)

parent 8673fe98
...@@ -1194,7 +1194,7 @@ int getValue(string args, UniversalInterface &ui ) ...@@ -1194,7 +1194,7 @@ int getValue(string args, UniversalInterface &ui )
int getCalibrate(string arg, UniversalInterface &ui) int getCalibrate(string arg, UniversalInterface &ui)
{ {
UniSetTypes::ObjectId sid(uni_atoi(arg)); UniSetTypes::ObjectId sid(uni_atoi(arg));
if( sid<=0 ) if( sid <= 0 )
{ {
cout << "(getCalibrate): SensorId !!!!!!"<< endl; cout << "(getCalibrate): SensorId !!!!!!"<< endl;
return 1; return 1;
......
...@@ -341,7 +341,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer ...@@ -341,7 +341,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
std::string fname(it->second); std::string fname(it->second);
int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK ); int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK );
if( fd <=0 ) if( fd <= 0 )
{ {
dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl; dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
......
...@@ -341,7 +341,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage& ...@@ -341,7 +341,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
std::string fname(it->second); std::string fname(it->second);
int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK ); int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK );
if( fd <=0 ) if( fd <= 0 )
{ {
dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl; dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
......
...@@ -612,7 +612,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode ) ...@@ -612,7 +612,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
HistoryInfo hi; HistoryInfo hi;
hi.id = it.getIntProp("id"); hi.id = it.getIntProp("id");
hi.size = it.getIntProp("size"); hi.size = it.getIntProp("size");
if( hi.size <=0 ) if( hi.size <= 0 )
continue; continue;
hi.filter = it.getProp("filter"); hi.filter = it.getProp("filter");
......
...@@ -566,7 +566,7 @@ bool UDPExchange::initItem( UniXML_iterator& it ) ...@@ -566,7 +566,7 @@ bool UDPExchange::initItem( UniXML_iterator& it )
if( !tid.empty() ) if( !tid.empty() )
{ {
sid = UniSetTypes::uni_atoi(tid); sid = UniSetTypes::uni_atoi(tid);
if( sid<=0 ) if( sid <= 0 )
sid = DefaultObjectId; sid = DefaultObjectId;
} }
else else
......
...@@ -96,7 +96,7 @@ double DigitalFilter::firstLevel() ...@@ -96,7 +96,7 @@ double DigitalFilter::firstLevel()
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
int DigitalFilter::filterRC( int rawval ) int DigitalFilter::filterRC( int rawval )
{ {
if( Ti<=0 ) if( Ti <= 0 )
return rawval; return rawval;
return lroundf(secondLevel(rawval)); return lroundf(secondLevel(rawval));
...@@ -105,7 +105,7 @@ int DigitalFilter::filterRC( int rawval ) ...@@ -105,7 +105,7 @@ int DigitalFilter::filterRC( int rawval )
double DigitalFilter::secondLevel( double rawval ) double DigitalFilter::secondLevel( double rawval )
{ {
if( Ti<=0 ) if( Ti <= 0 )
return rawval; return rawval;
// //
......
...@@ -16,7 +16,7 @@ std::ostream& operator<<( std::ostream& os, IOBase& inf ) ...@@ -16,7 +16,7 @@ std::ostream& operator<<( std::ostream& os, IOBase& inf )
bool IOBase::check_channel_break( long val ) bool IOBase::check_channel_break( long val )
{ {
// ... ( ) // ... ( )
if( breaklim <=0 ) if( breaklim <= 0 )
return false; return false;
return ( val < breaklim ); return ( val < breaklim );
......
...@@ -205,7 +205,7 @@ unsigned char ComPort::m_receiveByte( bool wait ) ...@@ -205,7 +205,7 @@ unsigned char ComPort::m_receiveByte( bool wait )
} }
else else
bufLength=read(fd,buf,BufSize); bufLength=read(fd,buf,BufSize);
if(bufLength<=0) if(bufLength <= 0)
{ {
throw UniSetTypes::TimeOut(); throw UniSetTypes::TimeOut();
} }
......
...@@ -123,7 +123,7 @@ unsigned char ComPort485F::m_receiveByte( bool wait ) ...@@ -123,7 +123,7 @@ unsigned char ComPort485F::m_receiveByte( bool wait )
} }
} }
if( rc<=0 ) if( rc <= 0 )
throw UniSetTypes::TimeOut(); throw UniSetTypes::TimeOut();
} }
......
...@@ -222,7 +222,7 @@ void ModbusClient::fileTransfer( ModbusAddr addr, ModbusData numfile, ...@@ -222,7 +222,7 @@ void ModbusClient::fileTransfer( ModbusAddr addr, ModbusData numfile,
<< ret.numpacks << " curpack=" << curpack+1 << endl; << ret.numpacks << " curpack=" << curpack+1 << endl;
// save data... // save data...
if( fwrite(&ret.data,ret.dlen,1,fdsave) <=0 ) if( fwrite(&ret.data,ret.dlen,1,fdsave) <= 0 )
{ {
dlog[Debug::WARN] << "(fileTransfer): fwrite '" dlog[Debug::WARN] << "(fileTransfer): fwrite '"
<< save2filename << "' with error: " << save2filename << "' with error: "
......
...@@ -1121,7 +1121,7 @@ ModbusRTU::mbErrCode ModbusServer::replyFileTransfer( const std::string fname, ...@@ -1121,7 +1121,7 @@ ModbusRTU::mbErrCode ModbusServer::replyFileTransfer( const std::string fname,
(*dlog)[Debug::INFO] << "(replyFileTransfer): " << query << endl; (*dlog)[Debug::INFO] << "(replyFileTransfer): " << query << endl;
int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK ); int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK );
if( fd <=0 ) if( fd <= 0 )
{ {
if( dlog && dlog->debugging(Debug::WARN) ) if( dlog && dlog->debugging(Debug::WARN) )
(*dlog)[Debug::WARN] << "(replyFileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl; (*dlog)[Debug::WARN] << "(replyFileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
......
...@@ -16,7 +16,7 @@ int ModbusTCPCore::readNextData( ost::TCPStream* tcp, ...@@ -16,7 +16,7 @@ int ModbusTCPCore::readNextData( ost::TCPStream* tcp,
{ {
char c; char c;
tcp->read(&c,sizeof(c)); tcp->read(&c,sizeof(c));
if( tcp->gcount()<=0 ) if( tcp->gcount() <= 0 )
break; break;
qrecv.push( (unsigned char)(c) ); qrecv.push( (unsigned char)(c) );
...@@ -34,12 +34,12 @@ int ModbusTCPCore::getNextData( unsigned char* buf, int len, ...@@ -34,12 +34,12 @@ int ModbusTCPCore::getNextData( unsigned char* buf, int len,
if( qrecv.empty() ) if( qrecv.empty() )
{ {
if( len <=0 ) if( len <= 0 )
len = 7; len = 7;
int ret = ModbusTCPCore::readNextData(tcp,qrecv,len); int ret = ModbusTCPCore::readNextData(tcp,qrecv,len);
if( ret <=0 ) if( ret <= 0 )
return 0; return 0;
} }
......
...@@ -382,13 +382,13 @@ bool CycleStorage::delAllRows() ...@@ -382,13 +382,13 @@ bool CycleStorage::delAllRows()
/*! TODO: str, */ /*! TODO: str, */
void* CycleStorage::readRow(int num, void* str) void* CycleStorage::readRow(int num, void* str)
{ {
if( size<=0 ) return 0; if( size <= 0 ) return NULL;
/*! */ /*! */
int j=(head+num)%size; int j=(head+num)%size;
if((file==NULL)||(num>=size)) return 0; if((file==NULL)||(num>=size)) return NULL;
if((head!=tail+1)&&(num>tail)&&(head!=tail)) return 0; if((head!=tail+1)&&(num>tail)&&(head!=tail)) return NULL;
CycleStorageElem *jrn = (CycleStorageElem*)new char[full_size]; CycleStorageElem *jrn = (CycleStorageElem*)new char[full_size];
fseek(file,seekpos+j*full_size,0); fseek(file,seekpos+j*full_size,0);
......
...@@ -153,7 +153,7 @@ uniset_mutex::uniset_mutex( const uniset_mutex& r ): ...@@ -153,7 +153,7 @@ uniset_mutex::uniset_mutex( const uniset_mutex& r ):
uniset_mutex_lock::uniset_mutex_lock( uniset_mutex& m, int timeMS ): uniset_mutex_lock::uniset_mutex_lock( uniset_mutex& m, int timeMS ):
mutex(&m) mutex(&m)
{ {
if( timeMS<=0 || mutex->isRelease() ) if( timeMS <= 0 || mutex->isRelease() )
{ {
mutex->lock(); mutex->lock();
mutex_atomic_set(&mlock,1); mutex_atomic_set(&mlock,1);
......
...@@ -9,7 +9,6 @@ PassiveTimer pt(1000); ...@@ -9,7 +9,6 @@ PassiveTimer pt(1000);
int main() int main()
{ {
PassiveTimer pt1(5000); PassiveTimer pt1(5000);
cout << " pt1.getInterval()=" << pt1.getInterval() << endl; cout << " pt1.getInterval()=" << pt1.getInterval() << endl;
......
...@@ -13,7 +13,7 @@ int main( int argc, const char **argv ) ...@@ -13,7 +13,7 @@ int main( int argc, const char **argv )
uniset_init(argc,argv,"test.xml"); uniset_init(argc,argv,"test.xml");
int id = conf->getArgInt("--sid"); int id = conf->getArgInt("--sid");
if( id <=0 ) if( id <= 0 )
{ {
cerr << "unknown sensor ID. Use --sid " << endl; cerr << "unknown sensor ID. Use --sid " << endl;
return 1; return 1;
......
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