osaf/services/saf/immsv/immloadd/imm_loader.cc |  20 ++++++++--------
 osaf/services/saf/immsv/immnd/ImmModel.cc      |  32 +++++++++++++-------------
 osaf/services/saf/immsv/immnd/ImmSearchOp.cc   |   4 +-
 osaf/tools/safimm/immcfg/imm_import.cc         |  28 +++++++++++-----------
 osaf/tools/safimm/immdump/imm_dumper.cc        |   6 ++--
 osaf/tools/safimm/immdump/imm_xmlw_dump.cc     |   4 +-
 6 files changed, 47 insertions(+), 47 deletions(-)


Fix cppcheck postfixOperator warnings.
For non-primitive types, pre-increment is faster than post-increment.

diff --git a/osaf/services/saf/immsv/immloadd/imm_loader.cc 
b/osaf/services/saf/immsv/immloadd/imm_loader.cc
--- a/osaf/services/saf/immsv/immloadd/imm_loader.cc
+++ b/osaf/services/saf/immsv/immloadd/imm_loader.cc
@@ -566,7 +566,7 @@ bool createImmObject(SaImmClassNameT cla
     {
         attrValues[i] = &(*it);
         i++;
-        it++;
+        ++it;
     }
 
     if(classRDNMap) {
@@ -631,7 +631,7 @@ freemem:
 
     for (it = attrValuesList->begin();
         it != attrValuesList->end();
-        it++)
+        ++it)
     {
         free(it->attrName);
         free(it->attrValues);
@@ -678,7 +678,7 @@ bool createImmClass(SaImmHandleT immHand
         attrDefinition[i] = &(*it);
 
         i++;
-        it++;
+        ++it;
     }
 
     int retries=0;
@@ -737,7 +737,7 @@ freemem:
         }
         free(it->attrName);
         it->attrName = NULL;
-        it++;
+        ++it;
     }
 
     /* Free the attrDefinition array and empty the list */
@@ -1255,7 +1255,7 @@ static void endElementHandler(void* user
         if(state->preloadEpochPtr) {
             if(strcmp(state->objectName, OPENSAF_IMM_OBJECT_DN) == 0) {
                 for(it = state->attrValuesList.begin();
-                    it != state->attrValuesList.end(); it++) {
+                    it != state->attrValuesList.end(); ++it) {
                     if(!strcmp(it->attrName, OPENSAF_IMM_ATTR_EPOCH)) {
                         osafassert(it->attrValuesNumber == 1);
                         osafassert(it->attrValueType == SA_IMM_ATTR_SAUINT32T);
@@ -1266,7 +1266,7 @@ static void endElementHandler(void* user
             }
 
             for(it = state->attrValuesList.begin();
-                it != state->attrValuesList.end(); it++) {
+                it != state->attrValuesList.end(); ++it) {
                 free(it->attrName);
                 free(it->attrValues);
             }
@@ -1973,7 +1973,7 @@ void addObjectAttributeDefinition(SaImmC
                            attrValues.attrValueType, 
                            *it);
         i++;
-        it++;
+        ++it;
     }
 
     /* Assign the name */
@@ -1994,7 +1994,7 @@ void addObjectAttributeDefinition(SaImmC
     /* Free unneeded data */
     for (it = attrValueBuffers->begin();
         it != attrValueBuffers->end();
-        it++)
+        ++it)
     {
         free(*it);
     }
@@ -2701,7 +2701,7 @@ int immsync(int maxBatchSize)
     while (it != classNamesList.end())
     {
         syncClassDescription(*it, immHandle);
-        it++;
+        ++it;
     }
     TRACE("Sync'ed %u class-descriptions", nrofClasses);
 
@@ -2713,7 +2713,7 @@ int immsync(int maxBatchSize)
         int objects = syncObjectsOfClass(*it, immHandle, maxBatchSize);
         TRACE("Synced %u objects of class %s", objects, (*it).c_str());
         nrofObjects += objects;
-        it++;
+        ++it;
     }
     LOG_IN("Synced %u objects in total", nrofObjects);
 
diff --git a/osaf/services/saf/immsv/immnd/ImmModel.cc 
b/osaf/services/saf/immsv/immnd/ImmModel.cc
--- a/osaf/services/saf/immsv/immnd/ImmModel.cc
+++ b/osaf/services/saf/immsv/immnd/ImmModel.cc
@@ -5105,7 +5105,7 @@ ImmModel::adminOwnerChange(const struct 
                         SaUint32T childCount = objectInfo->mChildCount;
                         // Find all sub objects to the root object
                         for (i1 = sObjectMap.begin(); 
-                             i1 != sObjectMap.end() && err == SA_AIS_OK && 
childCount; i1++){
+                             i1 != sObjectMap.end() && err == SA_AIS_OK && 
childCount; ++i1){
                             std::string subObjName = i1->first;
                             if (subObjName.length() > objectName.length()) {
                                 size_t pos = 
@@ -7408,7 +7408,7 @@ ImmModel::getAllWritableAttributes(const
     osafassert(hasLongDn);
     ClassInfo* classInfo = afim->mClassInfo;
     ai = classInfo->mAttrMap.begin();
-    for (; ai != classInfo->mAttrMap.end(); ai++) {
+    for (; ai != classInfo->mAttrMap.end(); ++ai) {
         if (ai->second->mFlags & SA_IMM_ATTR_WRITABLE) {
             immsv_attr_mods_list* attrMod = attrValueToAttrMod(afim, 
(std::string&) ai->first,
                                                                
ai->second->mValueType,
@@ -7860,7 +7860,7 @@ SaAisErrorT ImmModel::ccbObjectCreate(Im
         // Add attributes to object
         for (i4 = classInfo->mAttrMap.begin(); 
              i4 != classInfo->mAttrMap.end();
-             i4++) {
+             ++i4) {
             AttrInfo* attr = i4->second;
             
             ImmAttrValue* attrValue = NULL;
@@ -8834,7 +8834,7 @@ ImmModel::ccbObjectModify(const ImmsvOmC
         bool hasNoDanglingAttr = false;
         for(oavi = object->mAttrValueMap.begin(); 
             oavi != object->mAttrValueMap.end();
-            oavi++) {
+            ++oavi) {
             ImmAttrValue* oldValue = oavi->second;
             ImmAttrValue* newValue = NULL;
             
@@ -9789,7 +9789,7 @@ ImmModel::ccbObjectDelete(const ImmsvOmC
 
         // Find all sub objects to the deleted object and delete them
         for (oi2 = sObjectMap.begin(); 
-             oi2 != sObjectMap.end() && err == SA_AIS_OK && childCount; oi2++) 
{
+             oi2 != sObjectMap.end() && err == SA_AIS_OK && childCount; ++oi2) 
{
             std::string subObjName = oi2->first;
             if (subObjName.length() > objectName.length()) {
                 size_t pos = subObjName.length() - objectName.length();
@@ -11392,7 +11392,7 @@ ImmModel::accessorGet(const ImmsvOmSearc
         nameToExternal(objectName);
     }
     op.addObject(objectName);
-    for(j = obj->mAttrValueMap.begin(); j != obj->mAttrValueMap.end(); j++) {
+    for(j = obj->mAttrValueMap.begin(); j != obj->mAttrValueMap.end(); ++j) {
         if(searchOptions & SA_IMM_SEARCH_GET_SOME_ATTR) {
             bool notFound = true;
             ImmsvAttrNameList* list = req->attributeNames;
@@ -11931,7 +11931,7 @@ ImmModel::searchInitialize(ImmsvOmSearch
                         bool checkAttribute = false;
                         for (j = obj->mAttrValueMap.begin(); 
                              j != obj->mAttrValueMap.end(); 
-                             j++) {
+                             ++j) {
                             if(searchOptions & SA_IMM_SEARCH_GET_SOME_ATTR) {
                                 bool notFound = true;
                                 ImmsvAttrNameList* list = req->attributeNames;
@@ -12189,7 +12189,7 @@ SaAisErrorT ImmModel::nextSyncResult(Imm
     p->attrValuesList = NULL;
 
 
-    for (j = obj->mAttrValueMap.begin(); j != obj->mAttrValueMap.end(); j++) {
+    for (j = obj->mAttrValueMap.begin(); j != obj->mAttrValueMap.end(); ++j) {
         /*SA_IMM_SEARCH_GET_SOME_ATTR must have been set since this is sync. */
         IMMSV_ATTR_VALUES_LIST* attrl = NULL;
         IMMSV_ATTR_VALUES* attr = NULL;
@@ -14710,7 +14710,7 @@ SaAisErrorT ImmModel::objectImplementerS
             // Find all sub objects to the root object
             //Warning re-using iterator i1 inside this loop!!!
             SaUint32T childCount = rootObj->mChildCount;
-            for (i1 = sObjectMap.begin(); i1 != sObjectMap.end() && err == 
SA_AIS_OK && childCount; i1++){
+            for (i1 = sObjectMap.begin(); i1 != sObjectMap.end() && err == 
SA_AIS_OK && childCount; ++i1){
                 std::string subObjName = i1->first;
                 if (subObjName.length() > objectName.length()) {
                     size_t pos = subObjName.length() - objectName.length();
@@ -14820,7 +14820,7 @@ SaAisErrorT ImmModel::objectImplementerR
             // Warning re-using iterator i1 inside this loop
             SaUint32T childCount = rootObj->mChildCount;
             for (i1 = sObjectMap.begin(); 
-                 i1 != sObjectMap.end() && err == SA_AIS_OK && childCount; 
i1++) {
+                 i1 != sObjectMap.end() && err == SA_AIS_OK && childCount; 
++i1) {
                 std::string subObjName = i1->first;
                 if(subObjName.length() > objectName.length()) {
                     size_t pos = subObjName.length() - objectName.length();
@@ -15614,7 +15614,7 @@ ImmModel::rtObjectCreate(struct ImmsvOmC
         // Add attributes to object
         for (i4 = classInfo->mAttrMap.begin(); 
              i4 != classInfo->mAttrMap.end();
-             i4++) {
+             ++i4) {
             
             AttrInfo* attr = i4->second;
             ImmAttrValue* attrValue = NULL;
@@ -16809,7 +16809,7 @@ ImmModel::rtObjectUpdate(const ImmsvOmCc
             // Copy attribute values from existing object version to afim
             for(oavi = object->mAttrValueMap.begin(); 
                 oavi != object->mAttrValueMap.end();
-                oavi++) {
+                ++oavi) {
                 ImmAttrValue* oldValue = oavi->second;
                 ImmAttrValue* newValue = NULL;
 
@@ -17829,7 +17829,7 @@ ImmModel::objectSync(const ImmsvOmObject
         
         // Add attributes to object
         for (i4 = classInfo->mAttrMap.begin(); i4 != classInfo->mAttrMap.end();
-             i4++) {
+             ++i4) {
             AttrInfo* attr = i4->second;
             
             ImmAttrValue* attrValue = NULL;
@@ -18483,7 +18483,7 @@ ImmModel::finalizeSync(ImmsvOmFinalizeSy
             //Attach object implementers using the implementer-name attribute.
             ObjectMap::iterator oi;
             std::string implAttr(SA_IMM_ATTR_IMPLEMENTER_NAME);
-            for(oi = sObjectMap.begin(); oi != sObjectMap.end(); oi++) {
+            for(oi = sObjectMap.begin(); oi != sObjectMap.end(); ++oi) {
                 ObjectInfo* obj = oi->second;
                 //ImmAttrValueMap::iterator j;
                 ImmAttrValue* att = obj->mAttrValueMap[implAttr];
@@ -18982,7 +18982,7 @@ ImmModel::isolateThisNode(unsigned int t
         ImplementerInfo* info = (*i);
         otherNode = info->mNodeId;
         if(otherNode == thisNode || otherNode == 0) {
-            i++;
+            ++i;
         } else {
             info = NULL;
             this->discardNode(otherNode, cv, gv, isAtCoord, true);
@@ -19000,7 +19000,7 @@ ImmModel::isolateThisNode(unsigned int t
         otherNode = ainfo->mNodeId;
         if(otherNode == thisNode || otherNode == 0) {
             /* ??? (otherNode == 0) is that really correct ??? */
-            i2++;
+            ++i2;
         } else {
             ainfo = NULL;
             this->discardNode(otherNode, cv, gv, isAtCoord, true);
diff --git a/osaf/services/saf/immsv/immnd/ImmSearchOp.cc 
b/osaf/services/saf/immsv/immnd/ImmSearchOp.cc
--- a/osaf/services/saf/immsv/immnd/ImmSearchOp.cc
+++ b/osaf/services/saf/immsv/immnd/ImmSearchOp.cc
@@ -96,7 +96,7 @@ ImmSearchOp::testTopResult(void** implIn
 
         // Check for pure runtime attribute
         AttributeList::iterator i;
-        for (i = obj.attributeList.begin(); i != obj.attributeList.end(); i++) 
{
+        for (i = obj.attributeList.begin(); i != obj.attributeList.end(); ++i) 
{
             if(bRtsToFetch && obj.implInfo &&
                             ((*i).flags & SA_IMM_ATTR_RUNTIME) &&
                             ! ((*i).flags & SA_IMM_ATTR_CACHED)) {
@@ -134,7 +134,7 @@ ImmSearchOp::nextResult(IMMSV_OM_RSP_SEA
         
         // Get attribute values
         AttributeList::iterator i;
-        for (i = obj.attributeList.begin(); i != obj.attributeList.end(); i++) 
{
+        for (i = obj.attributeList.begin(); i != obj.attributeList.end(); ++i) 
{
             IMMSV_ATTR_VALUES_LIST* attrl = (IMMSV_ATTR_VALUES_LIST *)
                 calloc(1, sizeof(IMMSV_ATTR_VALUES_LIST));
             IMMSV_ATTR_VALUES* attr = &(attrl->n);
diff --git a/osaf/tools/safimm/immcfg/imm_import.cc 
b/osaf/tools/safimm/immcfg/imm_import.cc
--- a/osaf/tools/safimm/immcfg/imm_import.cc
+++ b/osaf/tools/safimm/immcfg/imm_import.cc
@@ -319,7 +319,7 @@ static void free_parserState(ParserState
                                free(it->attrDefaultValue);
                                it->attrDefaultValue = NULL;
                        }
-                       it++;
+                       ++it;
                }
 
                /* Free the attrDefinition array and empty the list */
@@ -330,7 +330,7 @@ static void free_parserState(ParserState
                std::list<SaImmAttrValuesT_2>::iterator it;
                int i;
 
-               for(it = state->attrValues.begin(); it != 
state->attrValues.end(); it++) {
+               for(it = state->attrValues.begin(); it != 
state->attrValues.end(); ++it) {
                        free(it->attrName);
                        for(i=0; it->attrValues[i]; i++) {
                                if(it->attrValueType == SA_IMM_ATTR_SASTRINGT
@@ -348,14 +348,14 @@ static void free_parserState(ParserState
 
        {
                std::list<char*>::iterator it;
-               for(it = state->attrValueBuffers.begin(); it != 
state->attrValueBuffers.end(); it++)
+               for(it = state->attrValueBuffers.begin(); it != 
state->attrValueBuffers.end(); ++it)
                        free(*it);
                state->attrValueBuffers.clear();
        }
 
        {
                std::map<std::string, SaImmAttrValuesT_2>::iterator it;
-               for(it = state->classRDNMap.begin(); it != 
state->classRDNMap.end(); it++)
+               for(it = state->classRDNMap.begin(); it != 
state->classRDNMap.end(); ++it)
                        free(it->second.attrName);
                state->classRDNMap.clear();
        }
@@ -722,7 +722,7 @@ static void createImmObject(ParserState*
                        attrValues[i] = &(*it);
 
                        i++;
-                       it++;
+                       ++it;
                }
 
                /* Do the actual creation */
@@ -840,7 +840,7 @@ done:
 
        for (it = state->attrValues.begin();
                it != state->attrValues.end();
-               it++) {
+               ++it) {
                free(it->attrName);
                for(i=0; it->attrValues[i]; i++) {
                        if(it->attrValueType == SA_IMM_ATTR_SASTRINGT
@@ -1038,7 +1038,7 @@ static void createImmClass(ParserState* 
                        new_attrDefinitions[i] = &(*it);
 
                        i++;
-                       it++;
+                       ++it;
                }
 
                errorCode = immutil_saImmOmClassCreate_2(state->immHandle,
@@ -1138,7 +1138,7 @@ static void createImmClass(ParserState* 
                        free(it->attrDefaultValue);
                        it->attrDefaultValue = NULL;
                }
-               it++;
+               ++it;
        }
 
        /* Free the attrDefinition array and empty the list */
@@ -2173,7 +2173,7 @@ static void addObjectAttributeDefinition
        }
 
        std::list<SaImmAttrValuesT_2>::iterator iter;
-       for(iter=state->attrValues.begin(); iter != state->attrValues.end(); 
iter++) {
+       for(iter=state->attrValues.begin(); iter != state->attrValues.end(); 
++iter) {
                if(!strcmp(state->attrName, (*iter).attrName)) {
                        LOG_ER("Attribute '%s' is defined more than once in 
object '%s'", state->attrName, state->objectName);
                        stopParser(state);
@@ -2224,7 +2224,7 @@ static void addObjectAttributeDefinition
                }
 
                i++;
-               it++;
+               ++it;
        }
 
        /* Assign the name */
@@ -2262,7 +2262,7 @@ static void addObjectAttributeDefinition
        /* Free unneeded data */
        for (it = state->attrValueBuffers.begin();
                it != state->attrValueBuffers.end();
-               it++) {
+               ++it) {
                free(*it);
        }
 
@@ -2394,7 +2394,7 @@ static void addClassAttributeDefinition(
        /* Set the name */
        if (state->attrName != NULL) {
                std::list<SaImmAttrDefinitionT_2>::iterator it;
-               for(it=state->attrDefinitions.begin(); it != 
state->attrDefinitions.end(); it++) {
+               for(it=state->attrDefinitions.begin(); it != 
state->attrDefinitions.end(); ++it) {
                        if(!strcmp(state->attrName, (*it).attrName)) {
                                LOG_ER("Attribute '%s' is defined more than 
once in class '%s'", state->attrName, state->className);
                                stopParser(state);
@@ -2722,7 +2722,7 @@ int loadImmXML(const char *xmlfile, int 
                free(state.className);
 
        std::map<std::string, SaImmAttrValuesT_2>::iterator it;
-       for(it = state.classRDNMap.begin(); it != state.classRDNMap.end(); it++)
+       for(it = state.classRDNMap.begin(); it != state.classRDNMap.end(); ++it)
                free(it->second.attrName);
        state.classRDNMap.clear();
 
@@ -2820,7 +2820,7 @@ int validateImmXML(const char *xmlfile, 
        }
 
        std::map<std::string, SaImmAttrValuesT_2>::iterator it;
-       for(it = state.classRDNMap.begin(); it != state.classRDNMap.end(); it++)
+       for(it = state.classRDNMap.begin(); it != state.classRDNMap.end(); ++it)
                free(it->second.attrName);
        state.classRDNMap.clear();
 
diff --git a/osaf/tools/safimm/immdump/imm_dumper.cc 
b/osaf/tools/safimm/immdump/imm_dumper.cc
--- a/osaf/tools/safimm/immdump/imm_dumper.cc
+++ b/osaf/tools/safimm/immdump/imm_dumper.cc
@@ -415,7 +415,7 @@ static std::map<std::string, std::string
         /* Avoid memory leaking */
         saImmOmClassDescriptionMemoryFree_2(immHandle, attrs);
 
-        it++;
+        ++it;
     }
 
     return classRDNMap;
@@ -433,10 +433,10 @@ int checkClassNames(SaImmHandleT immHand
                 found = true;
                 break;
             }
-            sub_it++;
+            ++sub_it;
         }
         if (found) {
-            it++;
+            ++it;
         } else {
             printf("Warning: Class '%s' doesn't exist\n", (*it).c_str());
             /* Remove invalid class from list */
diff --git a/osaf/tools/safimm/immdump/imm_xmlw_dump.cc 
b/osaf/tools/safimm/immdump/imm_xmlw_dump.cc
--- a/osaf/tools/safimm/immdump/imm_xmlw_dump.cc
+++ b/osaf/tools/safimm/immdump/imm_xmlw_dump.cc
@@ -248,7 +248,7 @@ void dumpObjectsXMLw(SaImmHandleT immHan
         }
 
         /* Next class */
-        it++;
+        ++it;
     }
 
     ObjectSetToXMLw(objectSet, writer);
@@ -275,7 +275,7 @@ void dumpClassesXMLw(SaImmHandleT immHan
     {
         classToXMLw(*it, immHandle, writer);
 
-        it++;
+        ++it;
     }
     TRACE_LEAVE();
 }

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to