Fix various SVACE errors 53/97253/5
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 11 Nov 2016 16:53:47 +0000 (16:53 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 14 Nov 2016 17:15:02 +0000 (17:15 +0000)
Change-Id: I53d180d04995a78a1728bdf5fd740c048a7cac02

23 files changed:
automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h
dali/devel-api/animation/animation-data.h
dali/devel-api/images/distance-field.cpp
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/animation/animation-impl.cpp
dali/internal/event/common/object-registry-impl.cpp
dali/internal/event/common/stage-impl.cpp
dali/internal/event/events/long-press-gesture-detector-impl.cpp
dali/internal/event/events/pan-gesture-detector-impl.cpp
dali/internal/event/events/pinch-gesture-detector-impl.cpp
dali/internal/event/events/tap-gesture-detector-impl.cpp
dali/internal/event/images/bitmap-packed-pixel.h
dali/internal/event/render-tasks/render-task-impl.cpp
dali/internal/event/resources/resource-client.h
dali/internal/render/shaders/program.h
dali/internal/update/common/scene-graph-property-notification.cpp
dali/internal/update/gestures/scene-graph-pan-gesture.h
dali/public-api/events/gesture.cpp
dali/public-api/events/long-press-gesture.cpp
dali/public-api/events/pan-gesture.cpp
dali/public-api/events/pinch-gesture.cpp
dali/public-api/events/tap-gesture.cpp
dali/public-api/object/property-value.cpp

index 10c3264..9bed832 100644 (file)
@@ -956,10 +956,11 @@ public:
   inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
   {
     const std::string shaderSource = mShaderSources[shader];
-    if( static_cast<int>(shaderSource.length()) < bufsize )
+    const int shaderSourceLength = static_cast<int>(shaderSource.length());
+    if( shaderSourceLength < bufsize )
     {
-      strcpy(source, shaderSource.c_str());
-      *length = shaderSource.length();
+      strncpy( source, shaderSource.c_str(), shaderSourceLength );
+      *length = shaderSourceLength;
     }
     else
     {
index c429149..ebdad5a 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_ANIMATION_DATA_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -76,6 +76,7 @@ public:
   /**
    * @brief Adds one AnimationDataElement to the list to describe one animation.
    * @param[in] animationDataElement A pre-populated struct to add
+   * @note This class takes ownership of animationDataElement
    */
   void Add( AnimationDataElement* animationDataElement );
 
index 134f9c4..bb4224a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -116,7 +116,7 @@ void DistanceTransform( float *source, float* dest, unsigned int length )
     {
       ++rightmost;
     }
-    dest[i] = SQUARE( i - parabolas[rightmost] ) + source[parabolas[rightmost]];
+    dest[i] = SQUARE( static_cast< int >( i ) - parabolas[rightmost] ) + source[parabolas[rightmost]];
   }
 }
 
index 485ec51..b3fce27 100644 (file)
@@ -1386,6 +1386,8 @@ void Actor::SetRelayoutEnabled( bool relayoutEnabled )
   {
     EnsureRelayoutData();
 
+    DALI_ASSERT_DEBUG( mRelayoutData && "mRelayoutData not created" );
+
     mRelayoutData->relayoutEnabled = relayoutEnabled;
   }
 }
@@ -1915,7 +1917,7 @@ Dali::Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
 bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
-  Actor* actor = dynamic_cast< Actor* >( object );
+  Actor* actor = static_cast< Actor* >( object ); // TypeRegistry guarantees that this is the correct type.
 
   if( 0 == signalName.compare( SIGNAL_TOUCHED ) )
   {
index ec49265..5a8ca0c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -791,7 +791,7 @@ void Animation::EmitSignalFinish()
 bool Animation::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
-  Animation* animation = dynamic_cast<Animation*>(object);
+  Animation* animation = static_cast< Animation* >(object); // TypeRegistry guarantees that this is the correct type.
 
   if( 0 == signalName.compare( SIGNAL_FINISHED ) )
   {
index 76c2cbe..f2ca897 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -78,7 +78,7 @@ void ObjectRegistry::UnregisterObject( Dali::BaseObject* object )
 bool ObjectRegistry::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
-  ObjectRegistry* objectRegistry = dynamic_cast<ObjectRegistry*>( object );
+  ObjectRegistry* objectRegistry = static_cast< ObjectRegistry* >( object ); // TypeRegistry guarantees that this is the correct type.
 
   if( 0 == strcmp( signalName.c_str(), SIGNAL_OBJECT_CREATED ) )
   {
index bbdf7b0..a9abac8 100644 (file)
@@ -520,7 +520,7 @@ void Stage::KeepRendering( float durationSeconds )
 bool Stage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
-  Stage* stage = dynamic_cast<Stage*>(object);
+  Stage* stage = static_cast< Stage* >(object); // TypeRegistry guarantees that this is the correct type.
 
   if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
   {
index 441ba62..804e8d4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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,7 +143,7 @@ void LongPressGestureDetector::EmitLongPressGestureSignal(Dali::Actor pressedAct
 bool LongPressGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
-  LongPressGestureDetector* gesture = dynamic_cast<LongPressGestureDetector*>(object);
+  LongPressGestureDetector* gesture = static_cast< LongPressGestureDetector* >(object); // TypeRegistry guarantees that this is the correct type.
 
   if ( 0 == strcmp( signalName.c_str(), SIGNAL_LONG_PRESS_DETECTED ) )
   {
index c819a82..a66e15f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -291,7 +291,7 @@ void PanGestureDetector::SetSceneObject( const SceneGraph::PanGesture* object )
 bool PanGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
-  PanGestureDetector* gesture = dynamic_cast<PanGestureDetector*>(object);
+  PanGestureDetector* gesture = static_cast< PanGestureDetector* >(object); // TypeRegistry guarantees that this is the correct type.
 
   if ( 0 == strcmp( signalName.c_str(), SIGNAL_PAN_DETECTED ) )
   {
index aa717aa..e2b49ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -77,7 +77,7 @@ void PinchGestureDetector::EmitPinchGestureSignal(Dali::Actor actor, const Pinch
 bool PinchGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
-  PinchGestureDetector* gesture = dynamic_cast<PinchGestureDetector*>(object);
+  PinchGestureDetector* gesture = static_cast< PinchGestureDetector* >(object); // TypeRegistry guarantees that this is the correct type.
 
   if ( 0 == strcmp( signalName.c_str(), SIGNAL_PINCH_DETECTED ) )
   {
index 7df665b..7f65842 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -148,7 +148,7 @@ void TapGestureDetector::EmitTapGestureSignal(Dali::Actor tappedActor, const Tap
 bool TapGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
-  TapGestureDetector* gesture = dynamic_cast<TapGestureDetector*>(object);
+  TapGestureDetector* gesture = static_cast< TapGestureDetector* >(object); // TypeRegistry guarantees that this is the correct type.
 
   if ( 0 == strcmp( signalName.c_str(), SIGNAL_TAP_DETECTED ) )
   {
index 5708a87..c6ca538 100644 (file)
@@ -116,7 +116,7 @@ public:
   // unsigned int GetBufferSize() const
   virtual size_t GetBufferSize() const
   {
-    return mBufferWidth*mBytesPerPixel*mBufferHeight;
+    return static_cast< size_t >( mBufferWidth ) * mBytesPerPixel * mBufferHeight; // need to cast to size_t to avoid possibility of overflow
   }
 
   /**
@@ -124,9 +124,6 @@ public:
    * @return The buffer stride (in bytes).
    */
   virtual unsigned int GetBufferStride() const;
-  //{
-  //  return mBufferWidth*mBytesPerPixel;
-  //}
 
   /**
    * Get the pixel format
index 09514c9..a1ad2b8 100644 (file)
@@ -789,7 +789,7 @@ Dali::RenderTask::RenderTaskSignalType& RenderTask::FinishedSignal()
 bool RenderTask::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
-  RenderTask* renderTask = dynamic_cast<RenderTask*>(object);
+  RenderTask* renderTask = static_cast< RenderTask* >(object); // TypeRegistry guarantees that this is the correct type.
 
   if ( 0 == strcmp( signalName.c_str(), SIGNAL_FINISHED ) )
   {
index 1de28df..7c10b7e 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_RESOURCE_CLIENT_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -265,6 +265,10 @@ public: // Message methods
   void UpdateImageTicket( ResourceId id, const ImageAttributes& imageAttributes ); ///!< Issue #AHC01
 
 private:
+
+  ResourceClient( const ResourceClient& ); ///< Undefined
+  ResourceClient& operator=( const ResourceClient& ); ///< Undefined
+
   ResourceManager& mResourceManager;          ///< The resource manager
   EventThreadServices& mEventThreadServices;        ///< Interface to send messages through
 
index b818508..0d5f416 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_PROGRAM_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -324,10 +324,9 @@ public:
 
 private:
 
-  // default constructor, not defined
-  Program();
-  // assignment operator, not defined
-  Program& operator=( const Program& );
+  Program(); ///< default constructor, not defined
+  Program( const Program& ); ///< copy constructor, not defined
+  Program& operator=( const Program& ); ///< assignment operator, not defined
 
   /**
    * Load the shader, from a precompiled binary if available, else from source code
index 012b537..82464fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -60,7 +60,8 @@ PropertyNotification::PropertyNotification(Object& object,
   mConditionType(condition),
   mArguments(arguments),
   mValid(false),
-  mNotifyMode( Dali::PropertyNotification::Disabled )
+  mNotifyMode( Dali::PropertyNotification::Disabled ),
+  mConditionFunction(NULL)
 {
   SetNotifyMode(notifyMode);
 
index 0185f72..c511f7c 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_SCENE_GRAPH_PAN_GESTURE_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -93,9 +93,12 @@ public:
        */
       Info& operator=( const Info& rhs )
       {
-        velocity = rhs.velocity;
-        displacement = rhs.displacement;
-        position = rhs.position;
+        if( this != &rhs )
+        {
+          velocity = rhs.velocity;
+          displacement = rhs.displacement;
+          position = rhs.position;
+        }
 
         return *this;
       }
@@ -134,10 +137,13 @@ public:
      */
     PanInfo& operator=( const PanInfo& rhs )
     {
-      time = rhs.time;
-      state = rhs.state;
-      local = rhs.local;
-      screen = rhs.screen;
+      if( this != &rhs )
+      {
+        time = rhs.time;
+        state = rhs.state;
+        local = rhs.local;
+        screen = rhs.screen;
+      }
 
       return *this;
     }
index 31c3b25..0ceaadf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -30,9 +30,12 @@ Gesture::Gesture( const Gesture& rhs )
 
 Gesture& Gesture::operator=( const Gesture& rhs )
 {
-  type = rhs.type;
-  state = rhs.state;
-  time = rhs.time;
+  if( this != &rhs )
+  {
+    type = rhs.type;
+    state = rhs.state;
+    time = rhs.time;
+  }
 
   return *this;
 }
index b9dd141..e329c82 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -37,10 +37,13 @@ LongPressGesture::LongPressGesture( const LongPressGesture& rhs )
 
 LongPressGesture& LongPressGesture::operator=( const LongPressGesture& rhs )
 {
-  Gesture::operator=(rhs);
-  numberOfTouches = rhs.numberOfTouches;
-  screenPoint = rhs.screenPoint;
-  localPoint = rhs.localPoint;
+  if( this != &rhs )
+  {
+    Gesture::operator=(rhs);
+    numberOfTouches = rhs.numberOfTouches;
+    screenPoint = rhs.screenPoint;
+    localPoint = rhs.localPoint;
+  }
 
   return *this;
 }
index f6011ad..a2a8f44 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -50,14 +50,17 @@ PanGesture::PanGesture( const PanGesture& rhs )
 
 PanGesture& PanGesture::operator=( const PanGesture& rhs )
 {
-  Gesture::operator=(rhs);
-  velocity = rhs.velocity;
-  displacement = rhs.displacement;
-  position = rhs.position;
-  screenVelocity = rhs.screenVelocity;
-  screenDisplacement = rhs.screenDisplacement;
-  screenPosition = rhs.screenPosition;
-  numberOfTouches = rhs.numberOfTouches;
+  if( this != &rhs )
+  {
+    Gesture::operator=(rhs);
+    velocity = rhs.velocity;
+    displacement = rhs.displacement;
+    position = rhs.position;
+    screenVelocity = rhs.screenVelocity;
+    screenDisplacement = rhs.screenDisplacement;
+    screenPosition = rhs.screenPosition;
+    numberOfTouches = rhs.numberOfTouches;
+  }
 
   return *this;
 }
index d074efe..9c72c25 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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,11 +42,14 @@ PinchGesture::PinchGesture( const PinchGesture& rhs )
 
 PinchGesture& PinchGesture::operator=( const PinchGesture& rhs )
 {
-  Gesture::operator=(rhs);
-  scale = rhs.scale;
-  speed = rhs.speed;
-  screenCenterPoint = rhs.screenCenterPoint;
-  localCenterPoint = rhs.localCenterPoint;
+  if( this != &rhs )
+  {
+    Gesture::operator=(rhs);
+    scale = rhs.scale;
+    speed = rhs.speed;
+    screenCenterPoint = rhs.screenCenterPoint;
+    localCenterPoint = rhs.localCenterPoint;
+  }
 
   return *this;
 }
index 3d9fed6..d20afc4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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,11 +39,14 @@ TapGesture::TapGesture( const TapGesture& rhs )
 
 TapGesture& TapGesture::operator=( const TapGesture& rhs )
 {
-  Gesture::operator=(rhs);
-  numberOfTaps = rhs.numberOfTaps;
-  numberOfTouches = rhs.numberOfTouches;
-  screenPoint = rhs.screenPoint;
-  localPoint = rhs.localPoint;
+  if( this != &rhs )
+  {
+    Gesture::operator=(rhs);
+    numberOfTaps = rhs.numberOfTaps;
+    numberOfTouches = rhs.numberOfTouches;
+    screenPoint = rhs.screenPoint;
+    localPoint = rhs.localPoint;
+  }
 
   return *this;
 }
index ffd0f70..fd4058e 100644 (file)
@@ -313,6 +313,7 @@ Property::Value::Value( Property::Map& mapValue )
 }
 
 Property::Value::Value( Type type )
+: mImpl( NULL )
 {
   switch (type)
   {