(Scene3D) Fix coverity : Do not call std::move for l-value 82/318182/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 14 Jan 2025 04:44:51 +0000 (13:44 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 14 Jan 2025 04:47:59 +0000 (13:47 +0900)
Change-Id: I935b6fc13556567d02aa5e9d4d626b8604f8a6c4
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-scene3d/internal/loader/glb-loader-impl.cpp
dali-scene3d/internal/model-components/model-node-impl.cpp
dali-scene3d/internal/model-components/model-node-impl.h
dali-scene3d/internal/model-components/model-primitive-impl.cpp
dali-scene3d/internal/model-components/model-primitive-impl.h
dali-scene3d/public-api/loader/buffer-definition.cpp
dali-scene3d/public-api/loader/buffer-definition.h
dali-scene3d/public-api/loader/scene-definition.cpp

index deaa91e9fa6b82bddb46063a6450aa42f7a5b539..0c5d11acecc96883d66605dfbeed1343bfc2fae5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -128,7 +128,7 @@ bool GlbLoaderImpl::LoadModel(const std::string& url, Dali::Scene3D::Loader::Loa
   outBuffers.reserve(document.mBuffers.size());
   if(!binaryChunkData.empty())
   {
-    BufferDefinition dataBuffer(binaryChunkData);
+    BufferDefinition dataBuffer(std::move(binaryChunkData));
     outBuffers.emplace_back(std::move(dataBuffer));
   }
 
index 2505c358615523a6a0f4905914fb407ed54c8bb3..5bc1a1e114a7ce3b63afb79c652039b5bc972229 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -375,7 +375,7 @@ void ModelNode::UpdateShader(Scene3D::Loader::ShaderManagerPtr shaderManager)
   }
 }
 
-void ModelNode::SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData& data, Scene3D::ModelPrimitive primitive)
+void ModelNode::SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData&& data, Scene3D::ModelPrimitive primitive)
 {
   // Update mBlendShapeIndexMap
   mBlendShapeIndexMap.clear();
@@ -389,7 +389,7 @@ void ModelNode::SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData&
     }
   }
 
-  GetImplementation(primitive).SetBlendShapeData(data);
+  GetImplementation(primitive).SetBlendShapeData(std::move(data));
 }
 
 void ModelNode::SetBoneMatrix(const Matrix& inverseMatrix, Scene3D::ModelPrimitive primitive, Scene3D::Loader::Index& boneIndex)
index a357180eccf4f37a17e9200fe48ff7cb3b146f43..ecf5ee3bb4745f17b582463299ec2182e9e5c8ee 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SCENE3D_MODEL_COMPONENTS_MODEL_NODE_IMPL_H
 
 /*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -280,7 +280,7 @@ public: // Public Method
    * @param[in] data The blend shape data.
    * @param[in] primitive The ModelPrimitive to set the blend shape data for.
    */
-  void SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData& data, Scene3D::ModelPrimitive primitive);
+  void SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData&& data, Scene3D::ModelPrimitive primitive);
 
   /**
    * @brief Sets the bone matrix for a ModelPrimitive and bone index.
index 68d6024a8113e8ad7a2c2f30ce4f6764463621ce..aed6e9425b2d4a782a13d770a9ddc42b74fe8d79 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -232,7 +232,7 @@ void ModelPrimitive::UpdateShader(Scene3D::Loader::ShaderManagerPtr shaderManage
   }
 }
 
-void ModelPrimitive::SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData& data)
+void ModelPrimitive::SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData&& data)
 {
   mBlendShapeData = std::move(data);
   Scene3D::Loader::BlendShapes::ConfigureProperties(mBlendShapeData, mRenderer);
index 6725e1ab5ac5539901bf340da10fd46c5053c241..c55e12967dd5ba9e26db1ceeec7db894c7bff272 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SCENE3D_MODEL_COMPONENTS_MODEL_PRIMITIVE_IMPL_H
 
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -160,7 +160,7 @@ public:
    *
    * @param[in] data The blend shape data to set.
    */
-  void SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData& data);
+  void SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData&& data);
 
   /**
    * @brief Sets the blend shape geometry for this model primitive.
@@ -270,7 +270,7 @@ private:
   bool                                         mHasTangents       = false;
   Scene3D::Loader::BlendShapes::Version        mBlendShapeVersion = Scene3D::Loader::BlendShapes::Version::INVALID;
 
-  bool mIsMaterialChanged        = false;
+  bool mIsMaterialChanged = false;
 };
 
 } // namespace Internal
index 0b8dc9352a84ba385887e4cb1f7d7816877304ee..57317df18b5aab146ec35a5d560bc95160009ba3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -38,7 +38,7 @@ struct BufferDefinition::Impl
   std::shared_ptr<Dali::FileStream> stream;
 };
 
-BufferDefinition::BufferDefinition(std::vector<uint8_t>& buffer)
+BufferDefinition::BufferDefinition(std::vector<uint8_t>&& buffer)
 : mImpl{new BufferDefinition::Impl}
 {
   mImpl.get()->buffer = std::move(buffer);
index a59d33012bb1203dbd4f1c7a8ddabb91ab855693..6911b6b8283794517b50c7fafb8ed1e6cd0455f7 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef DALI_SCENE3D_LOADER_BUFFER_DEFINITION_H
 #define DALI_SCENE3D_LOADER_BUFFER_DEFINITION_H
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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 @@ struct DALI_SCENE3D_API BufferDefinition
   using Vector = std::vector<BufferDefinition>;
 
   BufferDefinition();
-  BufferDefinition(std::vector<uint8_t>& buffer);
+  BufferDefinition(std::vector<uint8_t>&& buffer);
 
   ~BufferDefinition();
 
index 7d2805371b566b6e6550b73ff087b2af947a4f08..c7a47a03e73b5cd8738aae2efb9894735f03060d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -874,7 +874,7 @@ bool SceneDefinition::ConfigureBlendshapeShaders(const ResourceBundle&
         data.version      = mesh.first.mBlendShapeVersion;
         data.bufferOffset = mesh.second.blendShapeBufferOffset;
         data.mActor       = actor;
-        Internal::GetImplementation(node).SetBlendShapeData(data, request.mPrimitive);
+        Internal::GetImplementation(node).SetBlendShapeData(std::move(data), request.mPrimitive);
       }
     }
   }