Fix issues reported by cppcheck 93/30293/2
authorFrancisco Santos <f1.santos@samsung.com>
Thu, 13 Nov 2014 18:31:47 +0000 (18:31 +0000)
committerNick Holland <nick.holland@partner.samsung.com>
Fri, 14 Nov 2014 11:19:42 +0000 (03:19 -0800)
Issues include:
  Prefer prefix ++/-- operators for non-primitive types.
  Variable 'X' is reassigned a value before the old one has been used.

Change-Id: I15f15fec179a9eaa2253099690b9ac46b6189329

dali/internal/event/actor-attachments/mesh-attachment-impl.cpp
dali/internal/event/images/image-impl.cpp
dali/internal/event/modeling/model-data-impl.cpp
dali/internal/render/renderers/render-material.cpp
dali/internal/update/dynamics/scene-graph-dynamics-world.cpp
dali/internal/update/resources/resource-manager.cpp

index 45ba5e14c2e21dc54e1a68f15177395121a30e4e..65a253b665bf7d81f3ceee105bb126b5091a77e2 100644 (file)
@@ -82,7 +82,7 @@ void MeshAttachment::SetMesh( const MeshIPtr        meshPtr,
     // Copy bone names locally in order to perform actor binding later
 
     // Must keep names in same order (vertices reference into bone matrix array by index)
-    for ( BoneContainer::const_iterator iter = bones.begin(); iter != bones.end(); iter++ )
+    for ( BoneContainer::const_iterator iter = bones.begin(); iter != bones.end(); ++iter )
     {
       const Bone& bone = (*iter);
       mMesh.mBoneNames.push_back( bone.GetName() );
index 964f092efaf8a6a379ad56963585df3cb44177a5..4e7c4fe38e6a0c8b50fa79e06ea6edf171d82521 100644 (file)
@@ -366,7 +366,7 @@ bool Image::IsNinePatchFileName( const std::string& filename )
       break;
     }
 
-    iter++;
+    ++iter;
   }
   return match;
 }
index 4514cc93cbf44919e2d4553d766366acb6551133..5f90d7f84937c20055be491440dd42651aef67df 100644 (file)
@@ -164,7 +164,7 @@ const ModelAnimationMap* ModelData::GetAnimationMap (const std::string& name) co
 
   for(ModelAnimationMapContainer::const_iterator iter=mAnimationMaps.begin();
       iter != mAnimationMaps.end();
-      iter++)
+      ++iter)
   {
     const ModelAnimationMap& animData = *iter;
     if(animData.name == name)
@@ -184,7 +184,7 @@ bool ModelData::FindAnimation (const std::string& name, unsigned int& index) con
   index = 0;
   for(ModelAnimationMapContainer::const_iterator iter=mAnimationMaps.begin();
       iter != mAnimationMaps.end();
-      iter++, index++)
+      ++iter, ++index)
   {
     const ModelAnimationMap& animData(*iter);
     if(animData.name == name)
index e6114fa2ee563888ff44dbe3c9fda8a10735d964..f3ffdb79dc08cc61402d14dc73eceb9ff97d46e1 100644 (file)
@@ -44,9 +44,7 @@ void RenderMaterialUniforms::ResetCustomUniforms()
 
 void RenderMaterialUniforms::SetUniforms( const RenderMaterial& material, Program& program, ShaderSubTypes shaderType )
 {
-  GLint location = Program::UNIFORM_UNKNOWN;
-
-  location = mCustomUniform[ shaderType ][ 0 ].GetUniformLocation( program, "uMaterial.mOpacity" );
+  GLint location = mCustomUniform[ shaderType ][ 0 ].GetUniformLocation( program, "uMaterial.mOpacity" );
   if( Program::UNIFORM_UNKNOWN != location )
   {
     program.SetUniform1f( location, material.mOpacity );
index 2b237d27107b9359e2134e8fc63ca8ae60757fb9..48cfca7da08d0add387987d2ae9814fd58c650cc 100644 (file)
@@ -380,7 +380,7 @@ void DynamicsWorld::CheckForCollisions()
   /* ... and removed contacts */
   if (!mContacts.empty())
   {
-    for (it = mContacts.begin(); it != mContacts.end(); it++)
+    for (it = mContacts.begin(); it != mContacts.end(); ++it)
     {
       // signal end of collision
       Integration::DynamicsCollisionData& data = (*it).second;
index 1bacd0dda0ed385fcad403557dc6e6dbf6657773..242791637ca4e1c64c05dfdef2cd8fea64bc9da4 100644 (file)
@@ -564,10 +564,8 @@ void ResourceManager::HandleDiscardResourceRequest( ResourceId deadId, ResourceT
 
   // Search for the ID in one of the live containers
   // IDs are only briefly held in the new-completed or failed containers; check those last
-  bool foundLiveRequest = false;
-
   // Try removing from the old-completed requests
-  foundLiveRequest = wasComplete = RemoveId(mImpl->oldCompleteRequests, deadId);
+  bool foundLiveRequest = wasComplete = RemoveId(mImpl->oldCompleteRequests, deadId);
 
   // Try removing from the loading requests
   if (!foundLiveRequest)
@@ -964,9 +962,7 @@ void ResourceManager::ClearRequestedGlyphArea( ResourceId id, const ResourceType
            end = textResourceType->mCharacterList.end() ;
          iter != end ; iter ++ )
     {
-      Vector2 clearArea;
-      clearArea.x= iter->xPosition;
-      clearArea.y= iter->yPosition;
+      Vector2 clearArea( iter->xPosition, iter->yPosition );
       clearAreas.push_back(clearArea);
     }