clang compilation fixes

This commit is contained in:
Matej Sekoranja
2014-10-16 07:30:42 +02:00
parent 9f45bdfa75
commit f1c39ca5d2
15 changed files with 58 additions and 58 deletions

View File

@ -60,7 +60,7 @@ bool ArrayPerformance::init()
initPVRecord();
PVScalarArrayPtr pvScalarArray = getPVStructure()->getScalarArrayField("value",pvLong);
if(pvScalarArray==NULL) return false;
if(!pvScalarArray) return false;
pvValue = static_pointer_cast<PVLongArray>(pvScalarArray);
ArrayPerformancePtr xxx = dynamic_pointer_cast<ArrayPerformance>(getPtrSelf());
arrayPerformanceThread = ArrayPerformanceThreadPtr(new ArrayPerformanceThread(xxx));

View File

@ -266,9 +266,9 @@ void LongArrayChannelGet::channelGetConnect(
bool structureOK(true);
PVStructurePtr pvStructure = getPVDataCreate()->createPVStructure(structure);
PVFieldPtr pvField = pvStructure->getSubField("timeStamp");
if(pvField==NULL) structureOK = false;
if(!pvField) structureOK = false;
pvField = pvStructure->getSubField("value");
if(pvField==NULL) {
if(!pvField) {
structureOK = false;
} else {
FieldConstPtr field = pvField->getField();
@ -292,7 +292,7 @@ bool LongArrayChannelGet::init()
{
ChannelProvider::shared_pointer channelProvider =
getChannelProviderRegistry()->getProvider(providerName);
if(channelProvider==NULL) {
if(!channelProvider) {
cout << "provider " << providerName << " not found" << endl;
return false;
}
@ -305,7 +305,7 @@ bool LongArrayChannelGet::init()
if(!status.isOK()) return false;
CreateRequest::shared_pointer createRequest = CreateRequest::create();
PVStructurePtr pvRequest = createRequest->createRequest(request);
if(pvRequest==NULL) {
if(!pvRequest) {
cout << "request logic error " << createRequest->getMessage() << endl;
return false;
}
@ -334,10 +334,10 @@ void LongArrayChannelGet::destroy()
if(runReturned) break;
epicsThreadSleep(.01);
}
if(longArrayChannelRequester!=NULL) {
if(longArrayChannelRequester) {
longArrayChannelRequester->destroy();
}
if(longArrayChannelGetRequester!=NULL) {
if(longArrayChannelGetRequester) {
longArrayChannelGetRequester->destroy();
}
thread->exitWait();
@ -433,7 +433,7 @@ void LongArrayChannelGet::run()
CreateRequest::create();
PVStructurePtr pvRequest =
createRequest->createRequest(request);
if(pvRequest==NULL) {
if(!pvRequest) {
cout << "request logic error " << createRequest->getMessage() << endl;
return ;
}

View File

@ -138,9 +138,9 @@ void LAMMonitorRequester::monitorConnect(Status const & status,
}
bool structureOK(true);
FieldConstPtr field = structure->getField("timeStamp");
if(field==NULL) structureOK = false;
if(!field) structureOK = false;
field = structure->getField("value");
if(field==NULL) {
if(!field) {
structureOK = false;
} else {
if(field->getType()!=scalarArray) {
@ -179,9 +179,9 @@ void LAMMonitorRequester::run()
{
Lock xx(mutex);
monitorElement = longArrayMonitor->monitor->poll();
if(monitorElement!=NULL) pvStructure = monitorElement->pvStructurePtr;
if(monitorElement) pvStructure = monitorElement->pvStructurePtr;
}
if(monitorElement==NULL) break;
if(!monitorElement) break;
if(waitTime>0.0) epicsThreadSleep(waitTime);
pvTimeStamp.attach(pvStructure->getSubField("timeStamp"));
pvTimeStamp.get(timeStamp);
@ -268,7 +268,7 @@ bool LongArrayMonitor::init(
monitorRequester->init();
ChannelProvider::shared_pointer channelProvider =
getChannelProviderRegistry()->getProvider(providerName);
if(channelProvider==NULL) {
if(!channelProvider) {
cout << "provider " << providerName << " not found" << endl;
return false;
}
@ -282,7 +282,7 @@ bool LongArrayMonitor::init(
request += "]field(value,timeStamp,alarm)";
CreateRequest::shared_pointer createRequest = CreateRequest::create();
PVStructurePtr pvRequest = createRequest->createRequest(request);
if(pvRequest==NULL) {
if(!pvRequest) {
cout << "request logic error " << createRequest->getMessage() << endl;
return false;
}

View File

@ -110,7 +110,7 @@ private:
bool LongArrayChannelPut::init()
{
ChannelProvider::shared_pointer channelProvider = getChannelProviderRegistry()->getProvider(providerName);
if(channelProvider==NULL) {
if(!channelProvider) {
cout << "provider " << providerName << " not found" << endl;
return false;
}
@ -119,7 +119,7 @@ bool LongArrayChannelPut::init()
if(!status.isOK()) return false;
CreateRequest::shared_pointer createRequest = CreateRequest::create();
PVStructurePtr pvRequest = createRequest->createRequest(request);
if(pvRequest==NULL) {
if(!pvRequest) {
cout << "request logic error " << createRequest->getMessage() << endl;
return false;
}
@ -187,7 +187,7 @@ void LongArrayChannelPut::channelPutConnect(
bitSet = BitSetPtr(new BitSet(pvStructure->getNumberFields()));
bool structureOK(true);
PVFieldPtr pvField = pvStructure->getSubField("value");
if(pvField==NULL) {
if(!pvField) {
structureOK = false;
} else {
FieldConstPtr field = pvField->getField();
@ -294,7 +294,7 @@ void LongArrayChannelPut::run()
channelPut->destroy();
CreateRequest::shared_pointer createRequest = CreateRequest::create();
PVStructurePtr pvRequest = createRequest->createRequest(request);
if(pvRequest==NULL) {
if(!pvRequest) {
cout << "request logic error " << createRequest->getMessage() << endl;
return ;
}

View File

@ -150,7 +150,7 @@ void ExampleDatabase::create()
recordName = "examplePowerSupply";
PVStructurePtr pvStructure = createPowerSupply();
PowerSupplyPtr psr = PowerSupply::create(recordName,pvStructure);
if(psr==NULL) {
if(!psr) {
cout << "PowerSupply::create failed" << endl;
} else {
result = master->addRecord(psr);
@ -158,7 +158,7 @@ void ExampleDatabase::create()
}
recordName = "laptoprecordListPGRPC";
pvRecord = RecordListRecord::create(recordName);
if(pvRecord==NULL) {
if(!pvRecord) {
cout << "RecordListRecord::create failed" << endl;
} else {
result = master->addRecord(pvRecord);

View File

@ -42,10 +42,10 @@ public:
{
pvField = getPVDataCreate()->createPVField(field);
raiseMonitor = true;
if(pvFieldOptions!=NULL) {
if(pvFieldOptions) {
PVStringPtr pvString =
pvFieldOptions->getSubField<PVString>("raiseMonitor");
if(pvString!=NULL) {
if(pvString) {
string value = pvString->get();
if(value.compare("false")==0) raiseMonitor = false;
}
@ -90,7 +90,7 @@ void ExampleMonitorPlugin::create()
static OnChangePluginCreatorPtr plugin;
static Mutex mutex;
Lock xx(mutex);
if(plugin==NULL) {
if(!plugin) {
plugin = OnChangePluginCreatorPtr(new OnChangePluginCreator());
MonitorPluginManager::get()->addPlugin(pluginName,plugin);
}

View File

@ -65,12 +65,12 @@ bool ExampleLink::init()
pvAlarm.attach(pvStructure->getSubField("alarm"));
pvValue = static_pointer_cast<PVDoubleArray>(
pvStructure->getScalarArrayField("value",pvDouble));
if(pvValue==NULL) {
if(!pvValue) {
return false;
}
ChannelProvider::shared_pointer provider =
getChannelProviderRegistry()->getProvider(providerName);
if(provider==NULL) {
if(!provider) {
cout << getRecordName() << " provider "
<< providerName << " does not exist" << endl;
return false;
@ -97,7 +97,7 @@ bool ExampleLink::init()
}
getPVValue = static_pointer_cast<PVDoubleArray>(
getPVStructure->getScalarArrayField("value",pvDouble));
if(getPVValue==NULL) {
if(!getPVValue) {
cout << getRecordName() << " get value not PVDoubleArray" << endl;
return false;
}

View File

@ -70,8 +70,8 @@ static void exampleLinkCallFunc(const iocshArgBuf *args)
char *providerName = args[1].sval;
char *channelName = args[2].sval;
ExampleLinkPtr record = ExampleLink::create(recordName,providerName,channelName);
if(record!=NULL)
result = master->addRecord(record);
if(record)
result = master->addRecord(record);
if(!result) cout << "recordname" << " not added" << endl;
}

View File

@ -58,7 +58,7 @@ static void exampleServerCallFunc(const iocshArgBuf *args)
if(!result) cout << "recordname" << " not added" << endl;
PVRecordPtr pvRecord = RecordListRecord::create(
"laptoprecordListPGRPC");
if(pvRecord==NULL) {
if(!pvRecord) {
cout << "RecordListRecord::create failed" << endl;
} else {
result = master->addRecord(pvRecord);

View File

@ -371,7 +371,7 @@ void PVRecordField::init()
{
fullFieldName = pvField->getFieldName();
PVRecordStructurePtr pvParent = parent;
while(pvParent.get()!= NULL) {
while(pvParent) {
string parentName = pvParent->getPVField()->getFieldName();
if(parentName.size()>0) {
fullFieldName = pvParent->getPVField()->getFieldName()
@ -434,7 +434,7 @@ void PVRecordField::removeListener(PVListenerPtr const & pvListener)
void PVRecordField::postPut()
{
if(parent!=NULL) {
if(parent) {
parent->postParent(getPtrSelf());
}
postSubField();
@ -448,7 +448,7 @@ void PVRecordField::postParent(PVRecordFieldPtr const & subField)
{
(*iter)->dataPut(pvrs,subField);
}
if(parent!=NULL) parent->postParent(subField);
if(parent) parent->postParent(subField);
}
void PVRecordField::postSubField()

View File

@ -70,7 +70,7 @@ typedef std::tr1::shared_ptr<ChannelArrayLocal> ChannelArrayLocalPtr;
static bool getProcess(PVStructurePtr pvRequest,bool processDefault)
{
PVFieldPtr pvField = pvRequest->getSubField("record._options.process");
if(pvField==NULL || pvField->getField()->getType()!=scalar) {
if(!pvField || pvField->getField()->getType()!=scalar) {
return processDefault;
}
ScalarConstPtr scalar = static_pointer_cast<const Scalar>(
@ -146,13 +146,13 @@ ChannelProcessLocalPtr ChannelProcessLocal::create(
PVFieldPtr pvField;
PVStructurePtr pvOptions;
int nProcess = 1;
if(pvRequest!=NULL) pvField = pvRequest->getSubField("record._options");
if(pvField.get()!=NULL) {
if(pvRequest) pvField = pvRequest->getSubField("record._options");
if(pvField) {
pvOptions = static_pointer_cast<PVStructure>(pvField);
pvField = pvOptions->getSubField("nProcess");
if(pvField.get()!=NULL) {
if(pvField) {
PVStringPtr pvString = pvOptions->getStringField("nProcess");
if(pvString.get()!=NULL) {
if(pvString) {
int size;
std::stringstream ss;
ss << pvString->get();
@ -291,7 +291,7 @@ ChannelGetLocalPtr ChannelGetLocal::create(
pvRecord->getPVRecordStructure()->getPVStructure(),
pvRequest,
"");
if(pvCopy==NULL) {
if(!pvCopy) {
Status status(
Status::STATUSTYPE_ERROR,
"invalid pvRequest");
@ -442,7 +442,7 @@ ChannelPutLocalPtr ChannelPutLocal::create(
pvRecord->getPVRecordStructure()->getPVStructure(),
pvRequest,
"");
if(pvCopy==NULL) {
if(!pvCopy) {
Status status(
Status::STATUSTYPE_ERROR,
"invalid pvRequest");
@ -624,7 +624,7 @@ ChannelPutGetLocalPtr ChannelPutGetLocal::create(
pvRecord->getPVRecordStructure()->getPVStructure(),
pvRequest,
"getField");
if(pvPutCopy==NULL || pvGetCopy==NULL) {
if(!pvPutCopy || !pvGetCopy) {
Status status(
Status::STATUSTYPE_ERROR,
"invalid pvRequest");
@ -846,7 +846,7 @@ ChannelArrayLocalPtr ChannelArrayLocal::create(
fieldName = fieldName.substr(6);
}
pvField = pvRecord->getPVRecordStructure()->getPVStructure()->getSubField(fieldName);
if(pvField==NULL) {
if(!pvField) {
Status status(
Status::STATUSTYPE_ERROR,fieldName +" not found");
ChannelArrayLocalPtr channelArray;
@ -1190,7 +1190,7 @@ void ChannelLocal::getField(GetFieldRequester::shared_pointer const &requester,
}
PVFieldPtr pvField =
pvRecord->getPVRecordStructure()->getPVStructure()->getSubField(subField);
if(pvField.get()!=NULL) {
if(pvField) {
requester->getDone(Status::Ok,pvField->getField());
return;
}

View File

@ -178,7 +178,7 @@ MonitorElementPtr MonitorLocal::releaseActiveElement()
{
Lock xx(mutex);
MonitorElementPtr newActive = queue->getFree();
if(newActive==NULL) return activeElement;
if(!newActive) return activeElement;
pvCopy->updateCopyFromBitSet(activeElement->pvStructurePtr,activeElement->changedBitSet);
BitSetUtil::compress(activeElement->changedBitSet,activeElement->pvStructurePtr);
BitSetUtil::compress(activeElement->overrunBitSet,activeElement->pvStructurePtr);

View File

@ -77,17 +77,17 @@ void PVCopyMonitor::init(PVFieldPtr const &pvField)
size_t offset = pvCopy->getCopyOffset(pvField);
if(offset==string::npos) return;
PVStructurePtr pvOptions = pvCopy->getOptions(offset);
if(pvOptions!=NULL) {
if(pvOptions) {
PVStringPtr pvName = pvOptions->getSubField<PVString>("plugin");
if(pvName!=NULL) {
if(pvName) {
string pluginName = pvName->get();
MonitorPluginManagerPtr manager = MonitorPluginManager::get();
MonitorPluginCreatorPtr pluginCreator = manager->findPlugin(pluginName);
if(pluginCreator!=NULL) {
if(pluginCreator) {
StructureConstPtr top = pvCopy->getStructure();
FieldConstPtr field = pvField->getField();
MonitorPluginPtr monitorPlugin = pluginCreator->create(field,top,pvOptions);
if(monitorPlugin!=NULL) {
if(monitorPlugin) {
PVCopyMonitorFieldNodePtr fieldNode(new PVCopyMonitorFieldNode());
fieldNode->monitorPlugin = monitorPlugin;
fieldNode->offset = offset;
@ -207,7 +207,7 @@ void PVCopyMonitor::dataPut(PVRecordFieldPtr const & pvRecordField)
changedBitSet->set(offset);
if(isSet) overrunBitSet->set(offset);
MonitorPluginPtr monitorPlugin = getMonitorPlugin(offset);
if(monitorPlugin!=NULL) {
if(monitorPlugin) {
causeMonitor = monitorPlugin->causeMonitor(
pvRecordField->getPVField(),
pvRecord->getPVRecordStructure()->getPVStructure(),
@ -246,7 +246,7 @@ void PVCopyMonitor::dataPut(
changedBitSet->set(offset);
if(isSet) overrunBitSet->set(offset);
MonitorPluginPtr monitorPlugin = getMonitorPlugin(offsetCopyRequested);
if(monitorPlugin!=NULL) {
if(monitorPlugin) {
causeMonitor = monitorPlugin->causeMonitor(
requested->getPVField(),
pvRecord->getPVRecordStructure()->getPVStructure(),

View File

@ -63,11 +63,11 @@ bool TraceRecord::init()
initPVRecord();
PVStructurePtr pvStructure = getPVStructure();
pvRecordName = pvStructure->getStringField("argument.recordName");
if(pvRecordName==NULL) return false;
if(!pvRecordName) return false;
pvLevel = pvStructure->getIntField("argument.level");
if(pvLevel==NULL) return false;
if(!pvLevel) return false;
pvResult = pvStructure->getStringField("result.status");
if(pvResult==NULL) return false;
if(!pvResult) return false;
return true;
}
@ -75,7 +75,7 @@ void TraceRecord::process()
{
string name = pvRecordName->get();
PVRecordPtr pvRecord = pvDatabase->findRecord(name);
if(pvRecord==NULL) {
if(!pvRecord) {
pvResult->put(name + " not found");
return;
}

View File

@ -81,7 +81,7 @@ bool PowerSupply::init()
PVFieldPtr pvField;
bool result;
pvField = pvStructure->getSubField("timeStamp");
if(pvField==NULL) {
if(!pvField) {
cerr << "no timeStamp" << endl;
return false;
}
@ -91,7 +91,7 @@ bool PowerSupply::init()
return false;
}
pvField = pvStructure->getSubField("alarm");
if(pvField==NULL) {
if(!pvField) {
cerr << "no alarm" << endl;
return false;
}
@ -101,17 +101,17 @@ bool PowerSupply::init()
return false;
}
pvCurrent = pvStructure->getSubField<PVDouble>("current.value");
if(pvCurrent==NULL) {
if(!pvCurrent) {
cerr << "no current\n";
return false;
}
pvVoltage = pvStructure->getSubField<PVDouble>("voltage.value");
if(pvVoltage==NULL) {
if(!pvVoltage) {
cerr << "no current\n";
return false;
}
pvPower = pvStructure->getSubField<PVDouble>("power.value");
if(pvPower==NULL) {
if(!pvPower) {
cerr << "no powert\n";
return false;
}