diff --git a/src/factory/Compare.cpp b/src/factory/Compare.cpp index 06b4e27..19c0230 100644 --- a/src/factory/Compare.cpp +++ b/src/factory/Compare.cpp @@ -91,14 +91,14 @@ bool operator==(const Structure& a, const Structure& b) return false; // std::equals does not work, since FieldConstPtrArray is an array of shared_pointers - FieldConstPtrArray af = a.getFields(); - FieldConstPtrArray bf = b.getFields(); + FieldConstPtrArray const & af = a.getFields(); + FieldConstPtrArray const & bf = b.getFields(); for (size_t i = 0; i < nflds; i++) if (*(af[i].get()) != *(bf[i].get())) return false; - StringArray an = a.getFieldNames(); - StringArray bn = b.getFieldNames(); + StringArray const & an = a.getFieldNames(); + StringArray const & bn = b.getFieldNames(); return std::equal( an.begin(), an.end(), bn.begin() ); } @@ -118,14 +118,14 @@ bool operator==(const Union& a, const Union& b) return false; // std::equals does not work, since FieldConstPtrArray is an array of shared_pointers - FieldConstPtrArray af = a.getFields(); - FieldConstPtrArray bf = b.getFields(); + FieldConstPtrArray const & af = a.getFields(); + FieldConstPtrArray const & bf = b.getFields(); for (size_t i = 0; i < nflds; i++) if (*(af[i].get()) != *(bf[i].get())) return false; - StringArray an = a.getFieldNames(); - StringArray bn = b.getFieldNames(); + StringArray const & an = a.getFieldNames(); + StringArray const & bn = b.getFieldNames(); return std::equal( an.begin(), an.end(), bn.begin() ); } diff --git a/src/factory/Convert.cpp b/src/factory/Convert.cpp index 15a700a..026ccfe 100644 --- a/src/factory/Convert.cpp +++ b/src/factory/Convert.cpp @@ -282,8 +282,8 @@ bool Convert::isCopyScalarArrayCompatible(ScalarArrayConstPtr const &fromArray, bool Convert::isCopyStructureCompatible( StructureConstPtr const &fromStruct, StructureConstPtr const &toStruct) { - FieldConstPtrArray fromFields = fromStruct->getFields(); - FieldConstPtrArray toFields = toStruct->getFields(); + FieldConstPtrArray const & fromFields = fromStruct->getFields(); + FieldConstPtrArray const & toFields = toStruct->getFields(); size_t length = fromStruct->getNumberFields(); if(length!=toStruct->getNumberFields()) return false; for(size_t i=0; igetFieldNames(); - FieldConstPtrArray oldFields = structure->getFields(); + StringArray const & oldNames = structure->getFieldNames(); + FieldConstPtrArray const & oldFields = structure->getFields(); size_t oldLen = oldNames.size(); StringArray newNames(oldLen+1); FieldConstPtrArray newFields(oldLen+1); @@ -1008,8 +1008,8 @@ StructureConstPtr FieldCreate::appendFields( StringArray const & fieldNames, FieldConstPtrArray const & fields) const { - StringArray oldNames = structure->getFieldNames(); - FieldConstPtrArray oldFields = structure->getFields(); + StringArray const & oldNames = structure->getFieldNames(); + FieldConstPtrArray const & oldFields = structure->getFields(); size_t oldLen = oldNames.size(); size_t extra = fieldNames.size(); StringArray newNames(oldLen+extra); diff --git a/src/factory/PVDataCreateFactory.cpp b/src/factory/PVDataCreateFactory.cpp index e88543c..3a5c714 100644 --- a/src/factory/PVDataCreateFactory.cpp +++ b/src/factory/PVDataCreateFactory.cpp @@ -527,7 +527,7 @@ PVFieldPtr PVDataCreate::createPVField(PVFieldPtr const & fieldToClone) PVStructurePtr pvStructure = static_pointer_cast(fieldToClone); StringArray const & fieldNames = pvStructure->getStructure()->getFieldNames(); - PVFieldPtrArray pvFieldPtrArray = pvStructure->getPVFields(); + PVFieldPtrArray const & pvFieldPtrArray = pvStructure->getPVFields(); return createPVStructure(fieldNames,pvFieldPtrArray); } case structureArray: diff --git a/src/factory/PVField.cpp b/src/factory/PVField.cpp index fe6ed82..20db350 100644 --- a/src/factory/PVField.cpp +++ b/src/factory/PVField.cpp @@ -121,7 +121,7 @@ void PVField::computeOffset(const PVField * pvField) { } size_t offset = 0; size_t nextOffset = 1; - PVFieldPtrArray pvFields = pvTop->getPVFields(); + const PVFieldPtrArray & pvFields = pvTop->getPVFields(); for(size_t i=0; i < pvTop->getStructure()->getNumberFields(); i++) { offset = nextOffset; PVField *pvField = pvFields[i].get(); @@ -153,7 +153,7 @@ void PVField::computeOffset(const PVField * pvField,size_t offset) { size_t beginOffset = offset; size_t nextOffset = offset + 1; const PVStructure *pvStructure = static_cast(pvField); - const PVFieldPtrArray pvFields = pvStructure->getPVFields(); + const PVFieldPtrArray & pvFields = pvStructure->getPVFields(); for(size_t i=0; i < pvStructure->getStructure()->getNumberFields(); i++) { offset = nextOffset; PVField *pvSubField = pvFields[i].get(); diff --git a/src/factory/PVStructure.cpp b/src/factory/PVStructure.cpp index c08195a..e53e25f 100644 --- a/src/factory/PVStructure.cpp +++ b/src/factory/PVStructure.cpp @@ -55,8 +55,8 @@ PVStructure::PVStructure(StructureConstPtr const & structurePtr) extendsStructureName("") { size_t numberFields = structurePtr->getNumberFields(); - FieldConstPtrArray fields = structurePtr->getFields(); - StringArray fieldNames = structurePtr->getFieldNames(); + FieldConstPtrArray const & fields = structurePtr->getFields(); + StringArray const & fieldNames = structurePtr->getFieldNames(); // PVFieldPtrArray * xxx = const_cast(&pvFields); pvFields.reserve(numberFields); PVDataCreatePtr pvDataCreate = getPVDataCreate(); @@ -76,7 +76,7 @@ PVStructure::PVStructure(StructureConstPtr const & structurePtr, extendsStructureName("") { size_t numberFields = structurePtr->getNumberFields(); - StringArray fieldNames = structurePtr->getFieldNames(); + StringArray const & fieldNames = structurePtr->getFieldNames(); pvFields.reserve(numberFields); for(size_t i=0; igetPVFields(); + PVFieldPtrArray const & pvFields = pvStructure->getPVFields(); PVFieldPtr pvField; size_t numFields = pvStructure->getStructure()->getNumberFields(); for(size_t i=0; i(field); - StringArray names = structurePtr->getFieldNames(); + StringArray const & names = structurePtr->getFieldNames(); if(names.size()==2) { - FieldConstPtrArray fields = structurePtr->getFields(); + FieldConstPtrArray const & fields = structurePtr->getFields(); FieldConstPtr first = fields[0]; FieldConstPtr second = fields[1]; string nameFirst = names[0]; diff --git a/src/property/pvEnumerated.cpp b/src/property/pvEnumerated.cpp index b23a952..0ccee32 100644 --- a/src/property/pvEnumerated.cpp +++ b/src/property/pvEnumerated.cpp @@ -76,7 +76,7 @@ string PVEnumerated::getChoice() } size_t index = pvIndex->get(); const PVStringArray::const_svector& data(pvChoices->view()); - if(index<0 || index>=data.size()) { + if(/*index<0 ||*/ index>=data.size()) { string nullString; return nullString; }