fix Klocwork warning of unintialized data members, unneeded assignment & unreachable... 30/29830/1
authorXiangyin Ma <x1.ma@samsung.com>
Tue, 4 Nov 2014 18:28:08 +0000 (18:28 +0000)
committerXiangyin Ma <x1.ma@samsung.com>
Tue, 4 Nov 2014 18:28:08 +0000 (18:28 +0000)
[Problem] Klocwork issues

[Cause] 1. data members are not initialized in constructor
        2. values of variables is never used after initialization
        3. unreachable code

[Solution]

Change-Id: Iee48bfedb3e5c2da14dfdfbb957dca62d83d84ec

20 files changed:
base/dali-toolkit/internal/builder/builder-actor.cpp
base/dali-toolkit/internal/builder/builder-animations.cpp
base/dali-toolkit/internal/builder/builder-impl.cpp
base/dali-toolkit/internal/builder/builder-signals.cpp
base/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp
base/dali-toolkit/internal/controls/popup/popup-impl.cpp
base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp
base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp
optional/dali-toolkit/internal/controls/image-view/image-view-impl.cpp
optional/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp
optional/dali-toolkit/internal/controls/navigation-frame/page-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
optional/dali-toolkit/internal/controls/selectors/rotating-selector-impl.cpp
optional/dali-toolkit/internal/shader-effects/page-turn-effect-impl.cpp
optional/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp
optional/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp
optional/dali-toolkit/public-api/controls/page-turn-view/page-factory.cpp
optional/dali-toolkit/public-api/shader-effects/dissolve-local-effect.cpp

index c453839..d8271e4 100644 (file)
@@ -87,7 +87,7 @@ Actor SetupActor( const TreeNode& child, Actor& actor, const Replacement& consta
       {
         if( Property::INVALID_INDEX == index )
         {
       {
         if( Property::INVALID_INDEX == index )
         {
-          index = actor.RegisterProperty( key, value );
+          actor.RegisterProperty( key, value );
         }
         else
         {
         }
         else
         {
index de6b380..7714541 100644 (file)
@@ -96,7 +96,6 @@ Property::Value GetPropertyValue( const Property::Type& propType, const TreeNode
     default:
     {
       DALI_ASSERT_ALWAYS( !"Property type incorrect" );
     default:
     {
       DALI_ASSERT_ALWAYS( !"Property type incorrect" );
-      return Property::Value();
     }
   }
 }
     }
   }
 }
index d85fdec..ba3678b 100644 (file)
@@ -851,8 +851,6 @@ Animation Builder::CreateAnimation( const std::string& animationName )
 
 void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::UIFormat format )
 {
 
 void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::UIFormat format )
 {
-  DALI_ASSERT_ALWAYS( format == Dali::Toolkit::Builder::JSON && "Currently only JSON is supported" );
-
   // parser to get constants and includes only
   Dali::Toolkit::JsonParser parser = Dali::Toolkit::JsonParser::New();
 
   // parser to get constants and includes only
   Dali::Toolkit::JsonParser parser = Dali::Toolkit::JsonParser::New();
 
index 3124c46..63345fb 100644 (file)
@@ -322,15 +322,10 @@ float GetConditionArg0(const TreeNode &child)
   {
     f = IsFloat( IsChild(child, "min") );
   }
   {
     f = IsFloat( IsChild(child, "min") );
   }
+
   DALI_ASSERT_ALWAYS(f && "Notification condition for arg0 not specified");
   DALI_ASSERT_ALWAYS(f && "Notification condition for arg0 not specified");
-  if(f)
-  {
-    return *f;
-  }
-  else
-  {
-    return 0.f;
-  }
+
+  return *f;
 }
 
 /**
 }
 
 /**
@@ -344,15 +339,10 @@ float GetConditionArg1(const TreeNode &child)
   {
     f = IsFloat( IsChild(child, "max") );
   }
   {
     f = IsFloat( IsChild(child, "max") );
   }
+
   DALI_ASSERT_ALWAYS(f && "Notification condition for arg1 not specified");
   DALI_ASSERT_ALWAYS(f && "Notification condition for arg1 not specified");
-  if(f)
-  {
-    return *f;
-  }
-  else
-  {
-    return 0.f;
-  }
+
+  return *f;
 }
 
 
 }
 
 
index f5093a8..6fbea47 100644 (file)
@@ -253,7 +253,9 @@ bool CheckBoxButton::DoAction(BaseObject* object, const std::string& actionName,
 CheckBoxButton::CheckBoxButton()
 : Button(),
   mChecked( false ),
 CheckBoxButton::CheckBoxButton()
 : Button(),
   mChecked( false ),
-  mClickActionPerforming(false)
+  mClickActionPerforming(false),
+  mUseFadeAnimationProperty(Property::INVALID_INDEX),
+  mUseCheckAnimationProperty(Property::INVALID_INDEX)
 {
   // Creates specific painter.
   mPainter = new CheckBoxButtonDefaultPainter();
 {
   // Creates specific painter.
   mPainter = new CheckBoxButtonDefaultPainter();
index 173554b..8c29724 100755 (executable)
@@ -183,7 +183,9 @@ Popup::Popup(PopupStyle& style)
   mShowing(false),
   mState(Toolkit::Popup::POPUP_NONE), // Initially, the popup state should not be set, it's set in OnInitialize
   mAlterAddedChild(false),
   mShowing(false),
   mState(Toolkit::Popup::POPUP_NONE), // Initially, the popup state should not be set, it's set in OnInitialize
   mAlterAddedChild(false),
-  mPopupStyle(PopupStylePtr(&style))
+  mPopupStyle(PopupStylePtr(&style)),
+  mPropertyTitle(Property::INVALID_INDEX),
+  mPropertyState(Property::INVALID_INDEX)
 {
   SetKeyboardNavigationSupport( true );
 }
 {
   SetKeyboardNavigationSupport( true );
 }
index d76476f..b72eb82 100644 (file)
@@ -503,7 +503,7 @@ void FocusManager::SetFocusGroup(Actor actor, bool isFocusGroup)
     Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP);
     if(propertyIsFocusGroup == Property::INVALID_INDEX)
     {
     Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP);
     if(propertyIsFocusGroup == Property::INVALID_INDEX)
     {
-      propertyIsFocusGroup = actor.RegisterProperty(IS_FOCUS_GROUP, isFocusGroup);
+      actor.RegisterProperty(IS_FOCUS_GROUP, isFocusGroup);
     }
     else
     {
     }
     else
     {
@@ -646,7 +646,7 @@ void FocusManager::SetFocusable(Actor actor, bool focusable)
     Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
     if(propertyActorFocusable == Property::INVALID_INDEX)
     {
     Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
     if(propertyActorFocusable == Property::INVALID_INDEX)
     {
-      propertyActorFocusable = actor.RegisterProperty(ACTOR_FOCUSABLE, focusable);
+      actor.RegisterProperty(ACTOR_FOCUSABLE, focusable);
     }
     else
     {
     }
     else
     {
index 47e2898..f766b0b 100644 (file)
@@ -390,7 +390,7 @@ void KeyboardFocusManager::SetAsFocusGroup(Actor actor, bool isFocusGroup)
     Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP_PROPERTY_NAME);
     if(propertyIsFocusGroup == Property::INVALID_INDEX)
     {
     Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP_PROPERTY_NAME);
     if(propertyIsFocusGroup == Property::INVALID_INDEX)
     {
-      propertyIsFocusGroup = actor.RegisterProperty(IS_FOCUS_GROUP_PROPERTY_NAME, isFocusGroup);
+      actor.RegisterProperty(IS_FOCUS_GROUP_PROPERTY_NAME, isFocusGroup);
     }
     else
     {
     }
     else
     {
index 62ef78d..2723382 100644 (file)
@@ -46,6 +46,17 @@ BubbleEmitter::BubbleEmitter( const Vector2& movementArea,
   mCurrentUniform( 0 ),
   mDensity( 5 )
 {
   mCurrentUniform( 0 ),
   mDensity( 5 )
 {
+  // Calculate how many BubbleEffect shaders are required
+  if( mTotalNumOfBubble>100 )
+  {
+    mNumBubblePerShader = 100;
+    mNumShader = mTotalNumOfBubble / 100;
+  }
+  else
+  {
+    mNumBubblePerShader = mTotalNumOfBubble;
+    mNumShader = 1;
+  }
 }
 
 BubbleEmitter::~BubbleEmitter()
 }
 
 BubbleEmitter::~BubbleEmitter()
@@ -82,18 +93,6 @@ void BubbleEmitter::OnInitialize()
   // Generate the material object, which is used by all meshActors
   GenMaterial();
 
   // Generate the material object, which is used by all meshActors
   GenMaterial();
 
-  // Calculate how many BubbleEffect shaders are required
-  if( mTotalNumOfBubble>100 )
-  {
-    mNumBubblePerShader = 100;
-    mNumShader = mTotalNumOfBubble / 100;
-  }
-  else
-  {
-    mNumBubblePerShader = mTotalNumOfBubble;
-    mNumShader = 1;
-  }
-
   mMesh.resize( mNumShader );
   mMeshActor.resize( mNumShader );
   mEffect.resize( mNumShader );
   mMesh.resize( mNumShader );
   mMeshActor.resize( mNumShader );
   mEffect.resize( mNumShader );
index db40398..b2f88cf 100644 (file)
@@ -141,7 +141,7 @@ void Cluster::AddChildInfoAt( ChildInfo childInfo, unsigned int index )
     Property::Index depthProperty = child.GetPropertyIndex(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH);
     if(depthProperty == Property::INVALID_INDEX)
     {
     Property::Index depthProperty = child.GetPropertyIndex(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH);
     if(depthProperty == Property::INVALID_INDEX)
     {
-      depthProperty = child.RegisterProperty(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH, depth);
+      child.RegisterProperty(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH, depth);
     }
 
     // not added prior
     }
 
     // not added prior
index 4c54138..45ab799 100644 (file)
@@ -94,7 +94,8 @@ Dali::Toolkit::ImageView ImageView::New()
 }
 
 ImageView::ImageView()
 }
 
 ImageView::ImageView()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) )
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+  mPropertyDetail( Property::INVALID_INDEX )
 {
 }
 
 {
 }
 
index 597a4c2..0cf34a0 100644 (file)
@@ -155,6 +155,7 @@ Dali::Toolkit::Magnifier Magnifier::New()
 Magnifier::Magnifier()
 : Control( REQUIRES_TOUCH_EVENTS ),
   mPropertySourcePosition(Property::INVALID_INDEX),
 Magnifier::Magnifier()
 : Control( REQUIRES_TOUCH_EVENTS ),
   mPropertySourcePosition(Property::INVALID_INDEX),
+  mDefaultCameraDistance(1000.f),
   mActorSize(Vector3::ZERO),
   mMagnificationFactor(1.0f)
 {
   mActorSize(Vector3::ZERO),
   mMagnificationFactor(1.0f)
 {
index ea7d405..615f3a6 100644 (file)
@@ -48,7 +48,9 @@ TypeRegistration mType( typeid(Toolkit::Page), typeid(CustomActor), Create );
 Page::Page()
 : Control( CONTROL_BEHAVIOUR_NONE ),
   mTitle(""),
 Page::Page()
 : Control( CONTROL_BEHAVIOUR_NONE ),
   mTitle(""),
-  mSubTitle("")
+  mSubTitle(""),
+  mPropertyTitle(Property::INVALID_INDEX),
+  mPropertySubTitle(Property::INVALID_INDEX)
 {
 }
 
 {
 }
 
index 1c6ee40..4f548bf 100644 (file)
@@ -260,13 +260,19 @@ PageTurnView::PageTurnView( PageFactory& pageFactory, const Vector2& pageSize )
 : Control( REQUIRES_TOUCH_EVENTS ),
   mPageFactory( pageFactory ),
   mPageSize( pageSize ),
 : Control( REQUIRES_TOUCH_EVENTS ),
   mPageFactory( pageFactory ),
   mPageSize( pageSize ),
+  mTotalPageCount( 0 ),
   mIsEditMode( false ),
   mIsEditMode( false ),
+  mNeedOffscreenRendering( false ),
   mPanning( false ),
   mSpineShadowParameter( DEFAULT_SPINE_SHADOW_PARAMETER ),
   mCurrentPageIndex( 0 ),
   mIndex( 0 ),
   mPress( false ),
   mPageUpdated( true ),
   mPanning( false ),
   mSpineShadowParameter( DEFAULT_SPINE_SHADOW_PARAMETER ),
   mCurrentPageIndex( 0 ),
   mIndex( 0 ),
   mPress( false ),
   mPageUpdated( true ),
+  mDistanceUpCorner( 0.f ),
+  mDistanceBottomCorner( 0.f ),
+  mPanDisplacement( 0.f ),
+  mConstraints( false ),
   mPageTurnStartedSignal(),
   mPageTurnFinishedSignal(),
   mPagePanStartedSignal(),
   mPageTurnStartedSignal(),
   mPageTurnFinishedSignal(),
   mPagePanStartedSignal(),
index 0521bec..dac574e 100644 (file)
@@ -112,6 +112,7 @@ RotatingSelector::RotatingSelector()
 : Control( REQUIRES_TOUCH_EVENTS ),
   mSelected(false),
   mSelectable(true),
 : Control( REQUIRES_TOUCH_EVENTS ),
   mSelected(false),
   mSelectable(true),
+  mPressed(false),
   mIsAnimating(false)
 {
 }
   mIsAnimating(false)
 {
 }
index 9996db4..350e6b6 100644 (file)
@@ -129,6 +129,8 @@ struct CommonParametersConstraint
 }//namespace
 
 PageTurnEffect::PageTurnEffect()
 }//namespace
 
 PageTurnEffect::PageTurnEffect()
+: mOriginalCenterPropertyIndex(Property::INVALID_INDEX),
+  mCurrentCenterPropertyIndex(Property::INVALID_INDEX)
 {
 }
 
 {
 }
 
index 0dbc80f..4b7ad4a 100644 (file)
@@ -28,7 +28,8 @@ namespace Internal
 {
 
 CubeTransitionCrossEffect::CubeTransitionCrossEffect( unsigned int numRows, unsigned int numColumns, Size viewAreaSize )
 {
 
 CubeTransitionCrossEffect::CubeTransitionCrossEffect( unsigned int numRows, unsigned int numColumns, Size viewAreaSize )
-: CubeTransitionEffect( numRows, numColumns, viewAreaSize)
+: CubeTransitionEffect( numRows, numColumns, viewAreaSize),
+  mDisplacementRatio( 1.f )
 {
 }
 
 {
 }
 
index d066d24..d483ff1 100644 (file)
@@ -28,7 +28,10 @@ namespace Internal
 {
 
 CubeTransitionWaveEffect::CubeTransitionWaveEffect( unsigned int numRows, unsigned int numColumns, Size viewAreaSize )
 {
 
 CubeTransitionWaveEffect::CubeTransitionWaveEffect( unsigned int numRows, unsigned int numColumns, Size viewAreaSize )
-: CubeTransitionEffect( numRows, numColumns, viewAreaSize)
+: CubeTransitionEffect( numRows, numColumns, viewAreaSize),
+  mSaddleAA( 1.f ),
+  mSaddleBB( 1.f ),
+  mSaddleB( 1.f )
 {
 }
 
 {
 }
 
index 620be2c..8bde850 100644 (file)
@@ -50,7 +50,7 @@ void PageFactory::SetActorHittability( Actor actor, bool hittable )
   Property::Index propertyActorHittable = actor.GetPropertyIndex(ACTOR_HITTABLE);
   if(propertyActorHittable == Property::INVALID_INDEX && hittable)
   {
   Property::Index propertyActorHittable = actor.GetPropertyIndex(ACTOR_HITTABLE);
   if(propertyActorHittable == Property::INVALID_INDEX && hittable)
   {
-    propertyActorHittable = actor.RegisterProperty(ACTOR_HITTABLE, true);
+    actor.RegisterProperty(ACTOR_HITTABLE, true);
   }
   else
   {
   }
   else
   {
index e63f6be..f5b7387 100644 (file)
@@ -36,12 +36,14 @@ namespace
 }
 
 DissolveLocalEffect::DissolveLocalEffect()
 }
 
 DissolveLocalEffect::DissolveLocalEffect()
+: mNumberOfDimples( 1 )
 {
 }
 
 //Call the Parent copy constructor to add reference to the implementation for this object
 DissolveLocalEffect::DissolveLocalEffect( ShaderEffect handle )
 {
 }
 
 //Call the Parent copy constructor to add reference to the implementation for this object
 DissolveLocalEffect::DissolveLocalEffect( ShaderEffect handle )
-: ShaderEffect( handle )
+: ShaderEffect( handle ),
+  mNumberOfDimples( 1 )
 {
 }
 
 {
 }