Klocwork fixes.
authorFrancisco Santos <f1.santos@samsung.com>
Fri, 11 Apr 2014 16:47:02 +0000 (17:47 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 16 Apr 2014 10:42:28 +0000 (11:42 +0100)
Change-Id: I8b5b701138565b76382993e8a9437c09d8644167
Signed-off-by: Francisco Santos <f1.santos@samsung.com>
20 files changed:
capi/dali/public-api/geometry/animatable-vertex.h
capi/dali/public-api/object/constrainable.h
dali/integration-api/events/event.h
dali/internal/event/actors/light-actor-impl.cpp
dali/internal/event/animation/property-input-accessor.h
dali/internal/event/common/projection.cpp
dali/internal/event/common/proxy-object.cpp
dali/internal/event/common/type-registry-impl.h
dali/internal/event/events/event-processor.cpp
dali/internal/event/events/gesture-event-processor.cpp
dali/internal/event/resources/resource-type-path.cpp
dali/internal/event/text/atlas/atlas-size.cpp
dali/internal/event/text/atlas/glyph-atlas-manager.cpp
dali/internal/update/common/scene-graph-property-notification.cpp
dali/internal/update/manager/process-render-tasks.cpp
dali/internal/update/modeling/scene-graph-animatable-mesh.h
dali/internal/update/resources/resource-manager.cpp
dali/internal/update/resources/resource-tracker.h
dali/internal/update/resources/sync-resource-tracker.h
dali/public-api/object/constrainable.cpp

index f339a43..f6acb41 100644 (file)
@@ -121,6 +121,11 @@ private:
    */
   AnimatableVertex(const AnimatableVertex& vertex);
 
+  /**
+   * @brief Undefined Assignment Operator
+   */
+  AnimatableVertex& operator=(const AnimatableVertex& vertex);
+
   int mVertex; ///< The index of this vertex in the parent mesh
   Internal::AnimatableMesh& mMesh;  ///< The parent mesh
 };
index 17e3998..b7e6706 100644 (file)
@@ -88,14 +88,6 @@ public:
   Constrainable(const Constrainable& handle);
 
   /**
-   * @brief This assignment operator is required for (smart) pointer semantics.
-   *
-   * @param [in] rhs  A reference to the copied handle
-   * @return A reference to this
-   */
-  Constrainable& operator=(const Handle& rhs);
-
-  /**
    * @copydoc Dali::BaseHandle::operator=
    */
   using BaseHandle::operator=;
index 8b6b2c7..8a71353 100644 (file)
@@ -45,7 +45,6 @@ struct Event
   {
     Touch,         ///< A touch event, when the user interacts with the screen.
     Key,           ///< A key pressed event, from the virtual or external keyboard.
-    Notification,  ///< @deprecated; Use Core::ProcessEvents() instead.
     Gesture,       ///< A Gesture event has been detected.
     MouseWheel     ///< A mouse wheel event, when the mouse wheel is being rolled from an external mouse.
   };
index 5b1b90a..04a5592 100644 (file)
@@ -105,35 +105,37 @@ LightType LightTypeEnum(const std::string &stringValue)
 
 std::string LightTypeString(const LightType type)
 {
-  std::string ret;
+  std::string ret("AMBIENT");
 
-  if(type == AMBIENT)
+  switch ( type )
   {
-    ret = "AMBIENT" ;
-  }
-  else if(type == DIRECTIONAL)
-  {
-    ret = "DIRECTIONAL" ;
-  }
-  else if(type == SPOT)
-  {
-    ret = "SPOT" ;
-  }
-  else if(type == POINT)
-  {
-    ret = "POINT" ;
-  }
-  else
-  {
-    DALI_LOG_WARNING("Unknown Light Type:%d\n", type);
-    ret = "AMBIENT";
-  }
+    case AMBIENT:
+    {
+      ret = "AMBIENT";
+      break;
+    }
+
+    case DIRECTIONAL:
+    {
+      ret = "DIRECTIONAL";
+      break;
+    }
 
+    case SPOT:
+    {
+      ret = "SPOT";
+      break;
+    }
+    case POINT:
+    {
+      ret = "POINT";
+      break;
+    }
+  }
   return ret;
 }
 
-
-}
+} // namespace
 
 
 LightActorPtr LightActor::New()
index a88e7c6..8cc0667 100644 (file)
@@ -56,6 +56,16 @@ public:
   }
 
   /**
+   * Copy from a PropertyInputAccessor
+   */
+  PropertyInputAccessor& operator=(const PropertyInputAccessor& accessor)
+  {
+    mInput = accessor.mInput;
+
+    return *this;
+  }
+
+  /**
    * Set the property input.
    */
   void SetInput( const PropertyInputImpl& input, int componentIndex )
@@ -190,6 +200,16 @@ public:
   }
 
   /**
+   * Assign from a PropertyInputComponentAccessor
+   */
+  PropertyInputComponentAccessor& operator=(const PropertyInputComponentAccessor& accessor)
+  {
+    mInput = accessor.mInput;
+    mComponentIndex = accessor.mComponentIndex;
+    return *this;
+  }
+
+  /**
    * Set the property input.
    */
   void SetInput( const PropertyInputImpl& input, int componentIndex )
index ad24cda..32b608a 100644 (file)
@@ -85,7 +85,7 @@ bool XyPlaneIntersect( const Vector4& pointA, const Vector4& pointB, Vector4& in
   const Vector4* near = NULL;
   const Vector4* far = NULL;
 
-  if ( true || (pointA.z > 0.0f && pointB.z < 0.0f ))
+  if ( pointA.z > 0.0f && pointB.z < 0.0f )
   {
     near = &pointA;
     far  = &pointB;
index d535e7e..47b4fb5 100644 (file)
@@ -185,9 +185,7 @@ const std::string& ProxyObject::GetPropertyName( Property::Index index ) const
 
 Property::Index ProxyObject::GetPropertyIndex(const std::string& name) const
 {
-  Property::Index index = Property::INVALID_INDEX;
-
-  index = GetDefaultPropertyIndex( name );
+  Property::Index index = GetDefaultPropertyIndex( name );
 
   if ( index == Property::INVALID_INDEX )
   {
index 7a13b73..1eba3ee 100644 (file)
@@ -156,8 +156,15 @@ private:
   TypeRegistry();
   ~TypeRegistry();
 
+  /**
+   * @brief Undefined Copy Constructor
+   */
   TypeRegistry(TypeRegistry &);
-  TypeRegistry &operator()(const TypeRegistry &);
+
+  /**
+   * @brief Undefined Assignment Operator
+   */
+  TypeRegistry& operator=(const TypeRegistry &);
 };
 
 
index 249ca29..29753bc 100644 (file)
@@ -124,23 +124,12 @@ void EventProcessor::QueueEvent( const Event& event )
       break;
     }
 
-    case Event::Notification:
-    {
-      // TODO - Remove this deprecated event
-      break;
-    }
-
     case Event::Gesture:
     {
       QueueGestureEvent( static_cast<const Integration::GestureEvent&>(event) );
       break;
     }
 
-    default:
-    {
-      DALI_ASSERT_ALWAYS( false && "Invalid event sent from Integration\n" );
-      break;
-    }
   }
 }
 
@@ -199,12 +188,6 @@ void EventProcessor::QueueGestureEvent(const Integration::GestureEvent& event)
 
       break;
     }
-
-    default:
-    {
-      DALI_ASSERT_ALWAYS( false && "Invalid event sent from Integration\n" );
-      break;
-    }
   }
 }
 
@@ -245,15 +228,9 @@ void EventProcessor::ProcessEvents()
         break;
       }
 
-      default:
-      {
-        DALI_ASSERT_ALWAYS( false && "Invalid event sent from Integration\n" );
-        break;
-      }
-
-      // Call virtual destructor explictly; since delete will not be called after placement new
-      event->~Event();
     }
+    // Call virtual destructor explictly; since delete will not be called after placement new
+    event->~Event();
   }
 
   queueToProcess->Reset();
index a29f250..1b6c4c6 100644 (file)
@@ -75,10 +75,6 @@ void GestureEventProcessor::ProcessGestureEvent(const Integration::GestureEvent&
     case Gesture::Tap:
       mTapGestureProcessor.Process(static_cast<const Integration::TapGestureEvent&>(event));
       break;
-
-    default:
-      DALI_ASSERT_ALWAYS( false && "Invalid gesture type sent from Integration\n" );
-      break;
   }
 }
 
@@ -113,10 +109,6 @@ void GestureEventProcessor::AddGestureDetector(GestureDetector* gestureDetector)
       mTapGestureProcessor.AddGestureDetector(tap);
       break;
     }
-
-    default:
-      DALI_ASSERT_DEBUG( false && "Invalid gesture detector type created\n" );
-      break;
   }
 }
 
@@ -151,10 +143,6 @@ void GestureEventProcessor::RemoveGestureDetector(GestureDetector* gestureDetect
       mTapGestureProcessor.RemoveGestureDetector(tap);
       break;
     }
-
-    default:
-      DALI_ASSERT_DEBUG( false && "Invalid gesture detector type removal request\n" );
-      break;
   }
 }
 
@@ -189,10 +177,6 @@ void GestureEventProcessor::GestureDetectorUpdated(GestureDetector* gestureDetec
       mTapGestureProcessor.GestureDetectorUpdated(tap);
       break;
     }
-
-    default:
-      DALI_ASSERT_DEBUG( false && "Invalid gesture type update request\n" );
-      break;
   }
 }
 
index 4ba83d8..8604350 100644 (file)
@@ -151,11 +151,6 @@ int ResourceTypeCompare(const ResourceType& lhs, const ResourceType& rhs)
         break; // result = 0
       }
 
-      default:
-      {
-        DALI_ASSERT_ALWAYS( false && "ResourceTypeId enumeration invalid" );
-        break;
-      }
     }
   }
   return result;
index 8f147c0..d471670 100644 (file)
@@ -82,7 +82,7 @@ unsigned int GlyphAtlasSize::GetInitialSize( unsigned int initialiCharacterCount
   return GetMaxSize();
 }
 
-unsigned int GlyphAtlasSize::GetNextSize( unsigned int currentSize)
+unsigned int GlyphAtlasSize::GetNextSize( unsigned int currentSize )
 {
   for( std::size_t i = 0; i <  ATLAS_SIZE_COUNT; ++i)
   {
index a011492..5e74ceb 100644 (file)
@@ -54,6 +54,8 @@ TextVertexBuffer* GlyphAtlasManager::TextRequired( const TextArray& text ,
   // find the atlas which is best suited to displaying the text string
   GlyphAtlas* atlas  = FindAtlas( text, format, fontId, bestRank);
 
+  DALI_ASSERT_DEBUG( atlas && "Find atlas should always return a valid atlas." );
+
   // if the atlas is full, create a new larger one
   if( bestRank.GetSpaceStatus() == AtlasRanking::FULL_CAN_BE_RESIZED )
   {
@@ -150,7 +152,10 @@ GlyphAtlas* GlyphAtlasManager::CreateAtlas( unsigned int size )
   return atlas;
 }
 
-GlyphAtlas* GlyphAtlasManager::FindAtlas( const TextArray& text ,  const TextFormat& format, FontId fontId,  AtlasRanking &bestRank)
+GlyphAtlas* GlyphAtlasManager::FindAtlas( const TextArray& text,
+                                          const TextFormat& format,
+                                          FontId fontId,
+                                          AtlasRanking &bestRank )
 {
   // if the text is underlined, add the underline character to the text string
   TextArray searchText( text );
index fc2e6bb..b92d3ad 100644 (file)
@@ -101,11 +101,6 @@ PropertyNotification::PropertyNotification(ProxyObject& proxy,
       mConditionFunction = PropertyNotification::EvalFalse;
       break;
     }
-    default:
-    {
-      DALI_ASSERT_ALWAYS(false && "Unrecognized ConditionType");
-      break;
-    }
   }
 
   mProperty = mProxy->GetSceneObjectInputProperty( mPropertyIndex );
index 40c4f9c..1a59e38 100644 (file)
@@ -211,8 +211,6 @@ void ProcessRenderTasks( BufferIndex updateBufferIndex,
   //   3) Traverse the scene-graph, filling the lists for the current render-task
   //   4) Prepare render-instructions
 
-  bool resourcesFinished = false;
-
   DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "ProcessRenderTasks() Offscreens first\n");
 
   // First process off screen render tasks - we may need the results of these for the on screen renders
@@ -250,7 +248,7 @@ void ProcessRenderTasks( BufferIndex updateBufferIndex,
       continue;
     }
 
-    resourcesFinished = false;
+    bool resourcesFinished = false;
     if( renderTask.IsRenderRequired() )
     {
       ClearRenderables( sortedLayers );
@@ -290,8 +288,6 @@ void ProcessRenderTasks( BufferIndex updateBufferIndex,
     renderTask.UpdateState(resourcesFinished);
   }
 
-  resourcesFinished = false;
-
   DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "ProcessRenderTasks() Onscreen\n");
 
   // Now that the off screen renders are done we can process on screen render tasks
@@ -327,7 +323,7 @@ void ProcessRenderTasks( BufferIndex updateBufferIndex,
       continue;
     }
 
-    resourcesFinished = false;
+    bool resourcesFinished = false;
     if( renderTask.IsRenderRequired() )
     {
       ClearRenderables( sortedLayers );
index 008adb2..a5f906e 100644 (file)
@@ -139,6 +139,9 @@ public:
     AnimatableProperty<Vector3> position;
     AnimatableProperty<Vector4> color;
     AnimatableProperty<Vector2> textureCoords;
+
+  private:
+    VertexProperties& operator=(const VertexProperties& rhs);
   };
 
   VertexProperties* mVertices;
index c51a233..10d2d3a 100644 (file)
@@ -585,6 +585,10 @@ void ResourceManager::HandleDiscardResourceRequest( ResourceId deadId, ResourceT
   }
 
   // ID should be in one of the live sets
+  if (foundLiveRequest)
+  {
+    DALI_LOG_WARNING("HandleDiscardResourceRequest: ID should be in one of the live sets!");
+  }
   DALI_ASSERT_DEBUG(foundLiveRequest);
 
   if (wasComplete)
index 0f939ae..2757a99 100644 (file)
@@ -101,9 +101,10 @@ protected:
 
 private:
   /**
-   * Undefined Copy Constructor
+   * Undefined Copy Constructor and assignment operator
    */
   ResourceTracker(const ResourceTracker& rhs);
+  ResourceTracker& operator=(const ResourceTracker& rhs);
 };
 
 
index fb35af6..ef4790d 100644 (file)
@@ -90,11 +90,17 @@ protected:
   virtual bool DoIsComplete();
 
 private:
+
   /**
    * Undefined Copy Constructor
    */
   SyncResourceTracker(const SyncResourceTracker& rhs);
 
+  /**
+   * @brief Undefined Assignment Operator
+   */
+  SyncResourceTracker& operator=(const SyncResourceTracker& rhs);
+
 private:
   Integration::GlSyncAbstraction& mGlSyncAbstraction; ///< The synchronisation interface
   SceneGraph::RenderMessageDispatcher& mRenderMessageDispatcher; ///< RenderManager message dispatcher
index 67f78d2..8ff96d7 100644 (file)
@@ -52,16 +52,6 @@ Constrainable::Constrainable(const Constrainable& handle)
 {
 }
 
-Constrainable& Constrainable::operator=(const Handle& rhs)
-{
-  if( this != &rhs )
-  {
-    Handle::operator=(rhs);
-  }
-
-  return *this;
-}
-
 ActiveConstraint Constrainable::ApplyConstraint( Constraint constraint )
 {
   return GetImplementation(*this).ApplyConstraint(GetImplementation(constraint));