Fix some CppCheck errors 71/141471/2
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Mon, 31 Jul 2017 14:19:43 +0000 (15:19 +0100)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Mon, 31 Jul 2017 14:21:31 +0000 (14:21 +0000)
dali/internal/update/gestures/scene-graph-pan-gesture.h 138 operatorEqVarError
dali/integration-api/events/key-event-integ.cpp 42 passedByValue
dali/internal/event/actors/actor-impl.cpp 4867 redundantCopyLocalConst
dali/internal/event/animation/linear-constrainer-impl.h 113 arrayIndexThenCheck
dali/internal/event/events/key-event-processor.cpp 53 redundantAssignment
dali/internal/event/actors/actor-impl.h 1872 passedByValue
dali/internal/render/common/render-algorithms.cpp 203 duplicateBreak
dali/public-api/math/quaternion.cpp 54 useInitializationList

Change-Id: Ifa3b1cd65187d0e0c00f81368ba90a2988975739

dali/integration-api/events/key-event-integ.cpp
dali/integration-api/events/key-event-integ.h
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/actor-impl.h
dali/internal/event/animation/linear-constrainer-impl.h
dali/internal/event/events/key-event-processor.cpp
dali/internal/render/common/render-algorithms.cpp
dali/internal/render/renderers/render-texture.cpp
dali/internal/render/renderers/render-texture.h
dali/internal/update/gestures/scene-graph-pan-gesture.h

index 79da685..56dd3e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ KeyEvent::KeyEvent()
 }
 
 KeyEvent::KeyEvent( const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier,
-                    unsigned long timeStamp, const State& keyState, const std::string deviceName,
+                    unsigned long timeStamp, const State& keyState, const std::string& deviceName,
                     const DevelDevice::Class::Type deviceClass, const DevelDevice::Subclass::Type deviceSubclass )
 : Event( Key ),
   keyName( keyName ),
index 536d3ef..9040707 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTEGRATION_KEY_EVENT_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -71,7 +71,7 @@ struct KeyEvent : public Event
            int keyModifier,
            unsigned long timeStamp,
            const State& keyState,
-           const std::string deviceName,
+           const std::string& deviceName,
            const DevelDevice::Class::Type deviceClass,
            const DevelDevice::Subclass::Type deviceSubclass );
 
index e0e1604..ea7fe9f 100644 (file)
@@ -4742,7 +4742,7 @@ void Actor::NegotiateDimensions( const Vector2& allocatedSize )
   }
 }
 
-Vector2 Actor::ApplySizeSetPolicy( const Vector2 size )
+Vector2 Actor::ApplySizeSetPolicy( const Vector2& size )
 {
   switch( mRelayoutData->sizeSetPolicy )
   {
@@ -4864,8 +4864,6 @@ void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& cont
   SetNegotiatedSize( container );
 
   // Negotiate down to children
-  const Vector2 newBounds = mTargetSize.GetVectorXY();
-
   for( unsigned int i = 0, count = GetChildCount(); i < count; ++i )
   {
     ActorPtr child = GetChildAt( i );
@@ -4887,7 +4885,7 @@ void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& cont
     // Only relayout if required
     if( child->RelayoutRequired() )
     {
-      container.Add( Dali::Actor( child.Get() ), newBounds );
+      container.Add( Dali::Actor( child.Get() ), mTargetSize.GetVectorXY() );
     }
   }
   DALI_LOG_TIMER_END( NegSizeTimer1, gLogRelayoutFilter, Debug::Concise, "NegotiateSize() took: ");
index d931353..2f73da5 100644 (file)
@@ -1869,7 +1869,7 @@ private:
    * @param[in] size The size to apply the policy to
    * @return Return the adjusted size
    */
-  Vector2 ApplySizeSetPolicy( const Vector2 size );
+  Vector2 ApplySizeSetPolicy( const Vector2& size );
 
   /**
    * Retrieve the parent object of an Actor.
index 6a6d78d..22cec38 100644 (file)
@@ -110,7 +110,7 @@ struct LinearConstraintFunctor
       }
       else
       {
-        while( t >= mProgress[min] && min < valueCount-1 )
+        while( ( min < valueCount-1 )&&( t >= mProgress[min] ) )
         {
           min++;
         }
@@ -118,7 +118,7 @@ struct LinearConstraintFunctor
         min--;
         max = min+1;
 
-        if( min >= valueCount-1)
+        if( min >= valueCount-1 )
         {
           min = max = valueCount-1;
           tLocal = 0.0f;
index 5afb81b..92daa90 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -42,7 +42,6 @@ KeyEventProcessor::~KeyEventProcessor()
 
 void KeyEventProcessor::ProcessKeyEvent(const Integration::KeyEvent& event)
 {
-  bool consumed = false;
   KeyEvent keyEvent(event.keyName, event.keyString, event.keyCode, event.keyModifier, event.time, static_cast<Dali::KeyEvent::State>(event.state));
 
   GetImplementation( &keyEvent )->SetDeviceName( event.deviceName );
@@ -50,7 +49,7 @@ void KeyEventProcessor::ProcessKeyEvent(const Integration::KeyEvent& event)
   GetImplementation( &keyEvent )->SetDeviceSubclass( event.deviceSubclass );
 
   // Emit the key event signal from stage.
-  consumed = mStage.EmitKeyEventGeneratedSignal( keyEvent );
+  bool consumed = mStage.EmitKeyEventGeneratedSignal( keyEvent );
 
   if( !consumed )
   {
index 0c50ce4..e31b8fe 100644 (file)
@@ -199,8 +199,7 @@ inline void SetupStencilBuffer( const RenderItem& item, Context& context, bool&
 
       // Setup the color buffer based on the RenderMode.
       context.ColorMask( renderMode == RenderMode::COLOR );
-      return;
-      break; // Break statement for consistency (although return will be called instead).
+      break;
     }
 
     case RenderMode::STENCIL:
index b4646d5..572e4f2 100644 (file)
 // CLASS HEADER
 #include <dali/internal/render/renderers/render-texture.h>
 
+// EXTERNAL INCLUDES
+#include <math.h>   //floor, log2
+
 // INTERNAL INCLUDES
 #include <dali/devel-api/images/pixel-devel.h>
 #include <dali/devel-api/images/native-image-interface-extension.h>
 
-// EXTERNAL INCLUDES
-#include <math.h>   //floor, log2
-
 namespace Dali
 {
 namespace Internal
index f96ca9d..d9192e0 100644 (file)
@@ -21,6 +21,7 @@
 #include <string>
 
 // INTERNAL INCLUDES
+#include <dali/public-api/images/image-operations.h> // Dali::ImageDimensions
 #include <dali/public-api/rendering/sampler.h>
 #include <dali/public-api/rendering/texture.h>
 #include <dali/internal/event/rendering/texture-impl.h>
index 459c8fe..ad4e5e0 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_SCENE_GRAPH_PAN_GESTURE_H__
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -143,6 +143,7 @@ public:
         state = rhs.state;
         local = rhs.local;
         screen = rhs.screen;
+        read = rhs.read;
       }
 
       return *this;