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 45ba5e1..65a253b 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 964f092..4e7c4fe 100644 (file)
@@ -366,7 +366,7 @@ bool Image::IsNinePatchFileName( const std::string& filename )
       break;
     }
 
-    iter++;
+    ++iter;
   }
   return match;
 }
index 4514cc9..5f90d7f 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 e6114fa..f3ffdb7 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 2b237d2..48cfca7 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 1bacd0d..2427916 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);
     }