Remove variable shadowing 12/258512/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 19 May 2021 11:20:38 +0000 (12:20 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 19 May 2021 11:20:38 +0000 (12:20 +0100)
Change-Id: Ica05b9e265b1907e8798fd110e8410cf00afe7b8

14 files changed:
examples/bezier-curve/bezier-curve-example.cpp
examples/deferred-shading/deferred-shading.cpp
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
examples/line-mesh/line-mesh-example.cpp
examples/motion-blur/motion-blur-example.cpp
examples/motion-stretch/motion-stretch-example.cpp
examples/refraction-effect/refraction-effect-example.cpp
examples/scene-loader/scene-loader-example.cpp
examples/sparkle/sparkle-effect-example.cpp
examples/sparkle/sparkle-effect.h
examples/text-label/text-label-example.cpp
examples/text-scrolling/text-scrolling-example.cpp
examples/transitions/shadow-button-impl.cpp
examples/visual-transitions/beat-control-impl.cpp

index 7dc3b8a..3f5425c 100644 (file)
@@ -53,14 +53,6 @@ inline float Clamp(float v, float min, float max)
 
 struct HandlePositionConstraint
 {
-  HandlePositionConstraint(float minRelX, float maxRelX, float minRelY, float maxRelY)
-  : minRelX(minRelX),
-    maxRelX(maxRelX),
-    minRelY(minRelY),
-    maxRelY(maxRelY)
-  {
-  }
-
   void operator()(Vector3& current, const PropertyInputContainer& inputs)
   {
     Vector3 size(inputs[0]->GetVector3());
@@ -68,10 +60,10 @@ struct HandlePositionConstraint
     current.y = Clamp(current.y, minRelY * size.y, maxRelY * size.y);
   }
 
-  float minRelX;
-  float maxRelX;
-  float minRelY;
-  float maxRelY;
+  float minRelX{0.0f};
+  float maxRelX{0.0f};
+  float minRelY{0.0f};
+  float maxRelY{0.0f};
 };
 
 void AnimatingPositionConstraint(Vector3& current, const PropertyInputContainer& inputs)
@@ -304,7 +296,7 @@ public:
     positionAnimation.FinishedSignal().Connect(this, &BezierCurveExample::OnAnimationFinished);
 
     // Set up constraints for drag/drop
-    Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, HandlePositionConstraint(-0.5, 0.5, -1, 1));
+    Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, HandlePositionConstraint{-0.5, 0.5, -1, 1});
     constraint.AddSource(Source(parent, Actor::Property::SIZE));
     constraint.Apply();
 
index 8a2f93b..ae8e849 100644 (file)
@@ -183,8 +183,8 @@ Geometry CreateOctahedron(bool invertNormals)
 
   struct Vertex
   {
-    Vector3 position;
-    Vector3 normal;
+    Vector3 position{};
+    Vector3 normal{};
   };
   Vertex vertexData[] = {
     {positions[0]},
@@ -624,12 +624,12 @@ private:
 
 int DALI_EXPORT_API main(int argc, char** argv)
 {
-  const bool showLights = [](int argc, char** argv) {
+  const bool showLights = [argc, argv]() {
     auto endArgs = argv + argc;
     return std::find_if(argv, endArgs, [](const char* arg) {
              return strcmp(arg, "--show-lights") == 0;
            }) != endArgs;
-  }(argc, argv);
+  }();
 
   Application            app = Application::New(&argc, &argv);
   DeferredShadingExample example(app, (showLights ? DeferredShadingExample::Options::SHOW_LIGHTS : 0));
index 7fe4b6d..137a02a 100644 (file)
@@ -222,9 +222,9 @@ Dali::FittingMode::Type NextMode(const Dali::FittingMode::Type oldMode)
  * */
 struct ImageConfiguration
 {
-  ImageConfiguration(const char* const path, const Vector2 dimensions)
-  : path(path),
-    dimensions(dimensions)
+  ImageConfiguration(const char* const imagePath, const Vector2 dims)
+  : path(imagePath),
+    dimensions(dims)
   {
   }
   const char* path;
@@ -236,11 +236,11 @@ struct ImageConfiguration
  */
 struct PositionedImage
 {
-  PositionedImage(ImageConfiguration& configuration, unsigned cellX, unsigned cellY, Vector2 imageGridDims)
-  : configuration(configuration),
-    cellX(cellX),
-    cellY(cellY),
-    imageGridDims(imageGridDims)
+  PositionedImage(ImageConfiguration& config, unsigned x, unsigned y, Vector2 imageGridDimensions)
+  : configuration(config),
+    cellX(x),
+    cellY(y),
+    imageGridDims(imageGridDimensions)
   {
   }
 
@@ -422,11 +422,10 @@ public:
 
     // Place the images in the grid:
 
-    std::vector<ImageConfiguration>::iterator config, end;
-    GridFlags                                 grid(gridWidth, maxGridHeight);
-    std::vector<PositionedImage>              placedImages;
+    GridFlags                    grid(gridWidth, maxGridHeight);
+    std::vector<PositionedImage> placedImages;
 
-    for(config = configurations.begin(), end = configurations.end(); config != end; ++config)
+    for(std::vector<ImageConfiguration>::iterator config = configurations.begin(), end = configurations.end(); config != end; ++config)
     {
       unsigned cellX, cellY;
       Vector2  imageGridDims;
index a71ce30..742287b 100644 (file)
@@ -231,7 +231,7 @@ public:
     mMinusButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
     mMinusButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
 
-    Toolkit::PushButton mPlusButton = Toolkit::PushButton::New();
+    mPlusButton = Toolkit::PushButton::New();
     mPlusButton.SetProperty(Toolkit::Button::Property::LABEL, ">>");
     mPlusButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
     mPlusButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_RIGHT);
index e52e2c8..66f4c6e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -281,11 +281,11 @@ public:
     destPos.y                 = localPoint.y - originOffsetY;
     destPos.z                 = 0.0f;
 
-    float animDuration         = 0.5f;
-    mActorTapMovementAnimation = Animation::New(animDuration);
+    float tapMovementAnimDuration = 0.5f;
+    mActorTapMovementAnimation    = Animation::New(tapMovementAnimDuration);
     if(mMotionBlurImageView)
     {
-      mActorTapMovementAnimation.AnimateTo(Property(mMotionBlurImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(animDuration));
+      mActorTapMovementAnimation.AnimateTo(Property(mMotionBlurImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(tapMovementAnimDuration));
     }
     mActorTapMovementAnimation.SetEndAction(Animation::BAKE);
     mActorTapMovementAnimation.Play();
index dd55e34..0ecc426 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -254,11 +254,11 @@ public:
     destPos.y                 = localPoint.y - originOffsetY;
     destPos.z                 = 0.0f;
 
-    float animDuration         = 0.5f;
-    mActorTapMovementAnimation = Animation::New(animDuration);
+    float tapMovementAnimDuration = 0.5f;
+    mActorTapMovementAnimation    = Animation::New(tapMovementAnimDuration);
     if(mMotionStretchImageView)
     {
-      mActorTapMovementAnimation.AnimateTo(Property(mMotionStretchImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(animDuration));
+      mActorTapMovementAnimation.AnimateTo(Property(mMotionStretchImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(tapMovementAnimDuration));
     }
     mActorTapMovementAnimation.SetEndAction(Animation::BAKE);
     mActorTapMovementAnimation.Play();
index 37e83dd..cd4b682 100644 (file)
@@ -85,17 +85,6 @@ struct Vertex
   Vector3 position;
   Vector3 normal;
   Vector2 textureCoord;
-
-  Vertex()
-  {
-  }
-
-  Vertex(const Vector3& position, const Vector3& normal, const Vector2& textureCoord)
-  : position(position),
-    normal(normal),
-    textureCoord(textureCoord)
-  {
-  }
 };
 
 } // namespace
@@ -334,16 +323,16 @@ private:
       // make sure all the faces are front-facing
       if(normal.z > 0)
       {
-        vertices.push_back(Vertex(vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]));
-        vertices.push_back(Vertex(vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]));
-        vertices.push_back(Vertex(vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]));
+        vertices.push_back(Vertex{vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]});
+        vertices.push_back(Vertex{vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]});
+        vertices.push_back(Vertex{vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]});
       }
       else
       {
         normal *= -1.f;
-        vertices.push_back(Vertex(vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]));
-        vertices.push_back(Vertex(vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]));
-        vertices.push_back(Vertex(vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]));
+        vertices.push_back(Vertex{vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]});
+        vertices.push_back(Vertex{vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]});
+        vertices.push_back(Vertex{vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]});
       }
     }
 
@@ -386,10 +375,10 @@ private:
     {
       if(line[0] == 'v' && std::isspace(line[1])) // vertex
       {
-        std::istringstream iss(line.substr(2), std::istringstream::in);
+        std::istringstream vertexIss(line.substr(2), std::istringstream::in);
         unsigned int       i = 0;
         Vector3            vertex;
-        while(iss >> vertex[i++] && i < 3)
+        while(vertexIss >> vertex[i++] && i < 3)
           ;
         if(vertex.x < boundingBox[0]) boundingBox[0] = vertex.x;
         if(vertex.x > boundingBox[1]) boundingBox[1] = vertex.x;
@@ -413,11 +402,11 @@ private:
           numOfInt++;
         }
 
-        std::istringstream         iss(line.substr(2), std::istringstream::in);
+        std::istringstream         faceIss(line.substr(2), std::istringstream::in);
         Dali::Vector<unsigned int> indices;
         indices.Resize(numOfInt);
         unsigned int i = 0;
-        while(iss >> indices[i++] && i < numOfInt)
+        while(faceIss >> indices[i++] && i < numOfInt)
           ;
         unsigned int step = (i + 1) / 3;
         faceIndices.PushBack(indices[0] - 1);
index 9a1f116..13d7681 100644 (file)
@@ -204,7 +204,7 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
       {},\r
       {},\r
       nullptr,\r
-    };\r
+      {}};\r
     DliLoader::LoadParams loadParams{input, output};\r
     if(!loader.LoadScene(path, loadParams))\r
     {\r
@@ -233,7 +233,10 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
     viewProjection};\r
   NodeDefinition::CreateParams nodeParams{\r
     resources,\r
-    xforms};\r
+    xforms,\r
+    {},\r
+    {},\r
+    {}};\r
   Customization::Choices choices;\r
 \r
   Actor root = Actor::New();\r
index cac0e40..d4060fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -226,10 +226,10 @@ private:
 
     float particleIdx = static_cast<float>(idx / 4 + 1); // count from 1
     float colorIdx    = colorIndex + 1.f;                // count from 1
-    vertices.push_back(Vertex(Vector2(-colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
-    vertices.push_back(Vertex(Vector2(-colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
-    vertices.push_back(Vertex(Vector2(colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
-    vertices.push_back(Vertex(Vector2(colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
+    vertices.push_back(Vertex{Vector2(-colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
+    vertices.push_back(Vertex{Vector2(-colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
+    vertices.push_back(Vertex{Vector2(colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
+    vertices.push_back(Vertex{Vector2(colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
 
     faces.push_back(idx);
     faces.push_back(idx + 1);
index e7f9002..acd2d41 100644 (file)
@@ -201,23 +201,6 @@ const int MAXIMUM_ANIMATION_COUNT = 30;
 // Geometry format used by the SparkeEffect
 struct Vertex
 {
-  Vertex(const Vector2& texCoord,
-         const Vector2& aParticlePath0,
-         const Vector2& aParticlePath1,
-         const Vector2& aParticlePath2,
-         const Vector2& aParticlePath3,
-         const Vector2& aParticlePath4,
-         const Vector2& aParticlePath5)
-  : aTexCoord(texCoord),
-    aParticlePath0(aParticlePath0),
-    aParticlePath1(aParticlePath1),
-    aParticlePath2(aParticlePath2),
-    aParticlePath3(aParticlePath3),
-    aParticlePath4(aParticlePath4),
-    aParticlePath5(aParticlePath5)
-  {
-  }
-
   Vector2 aTexCoord;
   Vector2 aParticlePath0;
   Vector2 aParticlePath1;
index ff9db66..83743c7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -105,10 +105,10 @@ int ConvertToEven(int value)
 
 struct HSVColorConstraint
 {
-  HSVColorConstraint(float hue, float saturation, float value)
-  : hue(hue),
-    saturation(saturation),
-    value(value)
+  HSVColorConstraint(float hueParam, float saturationParam, float valueParam)
+  : hue(hueParam),
+    saturation(saturationParam),
+    value(valueParam)
   {
   }
 
index 85f92cd..05a2cf2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -131,7 +131,7 @@ public:
 
     mAnimation = Animation::New(1.0f);
 
-    const Size mTargetActorSize(mWindowSize.width, mWindowSize.height * WINDOW_HEIGHT_MULTIPLIER);
+    const Size targetActorSize(mWindowSize.width, mWindowSize.height * WINDOW_HEIGHT_MULTIPLIER);
 
     // Create Desktop
     Control desktop = Control::New();
@@ -139,7 +139,7 @@ public:
     desktop.SetProperty(Dali::Actor::Property::NAME, "desktopActor");
     desktop.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
     desktop.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
-    desktop.SetProperty(Actor::Property::SIZE, mTargetActorSize);
+    desktop.SetProperty(Actor::Property::SIZE, targetActorSize);
 
     rootActor.Add(desktop); // Add desktop (content) to offscreen actor
 
index 17cd0f4..77ef9f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -220,9 +220,10 @@ void ShadowButton::OnRelayout(const Vector2& targetSize, RelayoutContainer& cont
 
 void ShadowButton::RelayoutVisuals(const Vector2& targetSize)
 {
-  bool                                transitioning = false;
-  ShadowButton::Transitions::iterator iter          = mTransitions.begin();
-  for(; iter != mTransitions.end(); ++iter)
+  bool transitioning = false;
+  for(ShadowButton::Transitions::iterator iter = mTransitions.begin();
+      iter != mTransitions.end();
+      ++iter)
   {
     if(iter->mPlaying == true)
     {
@@ -368,10 +369,10 @@ void ShadowButton::ResetVisual(
     }
 
     // Extract transform maps out of the visual definition and store them
-    Property::Value* value = map->Find(Visual::Property::TRANSFORM, "transform");
-    if(value)
+    Property::Value* transformValue = map->Find(Visual::Property::TRANSFORM, "transform");
+    if(transformValue)
     {
-      Property::Map* transformMap = value->GetMap();
+      Property::Map* transformMap = transformValue->GetMap();
       if(transformMap)
       {
         ShadowButton::Transforms::iterator iter = FindTransform(index);
index 9dc35f4..ba2dba8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -252,10 +252,10 @@ void BeatControl::SetProperty(BaseObject* object, Property::Index index, const P
         const Property::Map* map = value.GetMap();
         if(map)
         {
-          Property::Value* value = map->Find(Visual::Property::TRANSFORM, "transform");
-          if(value)
+          Property::Value* transformValue = map->Find(Visual::Property::TRANSFORM, "transform");
+          if(transformValue)
           {
-            Property::Map* transformMap = value->GetMap();
+            Property::Map* transformMap = transformValue->GetMap();
             if(transformMap)
             {
               // We'll increment this whenever SIZE, ORIGIN or ANCHOR_POINT's are modified as we won't need to create a new visual if only these properties are used