[Tizen] Fix undefined behaviour due to strict-aliasing. 60/110960/1
authorFrancisco Santos <f1.santos@samsung.com>
Wed, 18 Jan 2017 17:38:32 +0000 (17:38 +0000)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 19 Jan 2017 03:57:10 +0000 (12:57 +0900)
- This patch is cherry-picked from devel/master branch.
  After DALi Integration (version up) to 1.2.23, this patch can be reverted.

Change-Id: I5b69e86a01d8f4dd720f685222ce2424aa664d9b

dali/internal/update/manager/geometry-batcher.cpp

index 2409c95..2ec048e 100644 (file)
@@ -63,18 +63,18 @@ struct TransformVertexBufferData
 template <typename PositionType >
 void TransformVertexBuffer( TransformVertexBufferData& data )
 {
-  const PositionType* source = reinterpret_cast<const PositionType*>( data.sourcePtr );
-  PositionType* destination = reinterpret_cast<PositionType*>( data.destinationPtr );
+  const char* source = reinterpret_cast<const char*>( data.sourcePtr );
+  char* destination = reinterpret_cast<char*>( data.destinationPtr );
 
   size_t componentSize = data.componentSize ? data.componentSize : sizeof( PositionType );
-  const void* sourceEnd = (reinterpret_cast<const char*>( source ) + ( data.vertexCount*componentSize ));
+  const char* sourceEnd = source + data.vertexCount*componentSize;
   for( ; source < sourceEnd;
-       *(reinterpret_cast<char**>( &destination )) += componentSize,
-       *(reinterpret_cast<const char**>( &source )) += componentSize
+       destination += componentSize,
+       source += componentSize
        )
   {
-    Dali::Internal::MultiplyVectorBySize( *destination, *source, data.size );
-    Dali::Internal::MultiplyVectorByMatrix4( *destination, data.transform, *destination );
+    Dali::Internal::MultiplyVectorBySize( *reinterpret_cast<PositionType*>(destination), *reinterpret_cast<const PositionType*>(source), data.size );
+    Dali::Internal::MultiplyVectorByMatrix4( *reinterpret_cast<PositionType*>(destination), data.transform, *reinterpret_cast<PositionType*>(destination) );
   }
 }