Fix svace issue (uint32_t to long) 21/287821/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 7 Feb 2023 02:05:12 +0000 (11:05 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 7 Feb 2023 03:35:57 +0000 (12:35 +0900)
To convert unsigned value into signed value safely,
we should convert as unsigned type with same size as signed type,
and after done, convert into signed type.

Change-Id: I1ee541cff8851adf0e5512ccf0d7a6e00a865690
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali/dali-test-suite-utils/test-graphics-buffer.cpp

index 27f0dce..42b53b1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -61,11 +61,11 @@ void TestGraphicsBuffer::Upload(uint32_t offset, uint32_t size)
   if(size <= memory.size() && mCreated)
   {
     // Use subData to avoid re-allocation
-    mGl.BufferSubData(GetTarget(), offset, size, &memory[offset]);
+    mGl.BufferSubData(GetTarget(), static_cast<GLintptr>(static_cast<unsigned long>(offset)), static_cast<GLsizeiptr>(static_cast<unsigned long>(size)), &memory[offset]);
   }
   else
   {
-    mGl.BufferData(GetTarget(), GLsizeiptr(size), &memory[0], GL_STATIC_DRAW); //@todo Query - do we need other usages?
+    mGl.BufferData(GetTarget(), static_cast<GLsizeiptr>(static_cast<unsigned long>(size)), &memory[0], GL_STATIC_DRAW); //@todo Query - do we need other usages?
     mCreated = true;
   }
 }