Enable -Wold-style-cast in Adaptor 11/132011/12
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Wed, 31 May 2017 15:29:24 +0000 (16:29 +0100)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Fri, 2 Jun 2017 12:14:13 +0000 (13:14 +0100)
- Have to exclude bits of Ecore and 3rd party libs written in C-style

Change-Id: Id7a7cd47ef681634e745a0533688b47c376cd777

48 files changed:
adaptors/base/combined-update-render/combined-update-render-controller.cpp
adaptors/base/performance-logging/performance-server.cpp
adaptors/base/separate-update-render/frame-time.cpp
adaptors/common/event-loop/ecore/ecore-callback-manager.cpp
adaptors/common/event-loop/ecore/ecore-file-descriptor-monitor.cpp
adaptors/common/event-loop/ecore/ecore-timer-impl.cpp
adaptors/common/gl/egl-image-extensions.cpp
adaptors/common/gl/egl-sync-implementation.cpp
adaptors/common/gl/gl-extensions.cpp
adaptors/common/networking/socket-impl.cpp
adaptors/common/orientation-impl.cpp
adaptors/devel-api/adaptor-framework/gif-loading.cpp
adaptors/ecore/common/ecore-indicator-impl.cpp
adaptors/ecore/common/ecore-server-connection.cpp
adaptors/ecore/common/ecore-virtual-keyboard.cpp
adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp
adaptors/ecore/wayland/event-handler-ecore-wl.cpp
adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp
adaptors/ecore/wayland/window-impl-ecore-wl.cpp
adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp
adaptors/mobile/accessibility-adaptor-impl-mobile.cpp
adaptors/tizen/display-connection-impl-tizen.cpp
adaptors/tizen/gl/egl-image-extensions-tizen.cpp
adaptors/tizen/native-render-surface-tizen.cpp
adaptors/tizen/tilt-sensor-impl-tizen.cpp
adaptors/x11/ecore-x-event-handler.cpp
adaptors/x11/ecore-x-window-interface.cpp
adaptors/x11/imf-manager-impl-x.cpp
adaptors/x11/native-image-source-impl-x.cpp
adaptors/x11/pixmap-render-surface-x.cpp
adaptors/x11/window-extensions.cpp
adaptors/x11/window-impl-x.cpp
adaptors/x11/window-render-surface-x.cpp
build/tizen/adaptor/Makefile.am
platform-abstractions/portable/image-operations.cpp
platform-abstractions/tizen/image-loaders/loader-astc.cpp
platform-abstractions/tizen/image-loaders/loader-bmp.cpp
platform-abstractions/tizen/image-loaders/loader-ico.cpp
platform-abstractions/tizen/image-loaders/loader-ktx.cpp
platform-abstractions/tizen/image-loaders/loader-png.cpp
platform-abstractions/tizen/image-loaders/loader-wbmp.cpp
platform-abstractions/tizen/tizen-logging.cpp
text/dali/internal/glyphy/glyphy-arcs.cc
text/dali/internal/glyphy/glyphy-blob-impl.cc
text/dali/internal/glyphy/glyphy-geometry.hh
text/dali/internal/glyphy/glyphy-outline.cc
text/dali/internal/text-abstraction/font-client-plugin-impl.cpp
third-party/image-resampler/resampler.cpp

index a28afd6..5f9e700 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -55,8 +55,8 @@ const unsigned int NANOSECONDS_PER_MILLISECOND( 1e+6 );
 
 // The following values will get calculated at compile time
 const float        DEFAULT_FRAME_DURATION_IN_SECONDS( 1.0f / 60.0f );
-const unsigned int DEFAULT_FRAME_DURATION_IN_MILLISECONDS( DEFAULT_FRAME_DURATION_IN_SECONDS * MILLISECONDS_PER_SECOND );
-const unsigned int DEFAULT_FRAME_DURATION_IN_NANOSECONDS( DEFAULT_FRAME_DURATION_IN_SECONDS * NANOSECONDS_PER_SECOND );
+const uint64_t DEFAULT_FRAME_DURATION_IN_MILLISECONDS( DEFAULT_FRAME_DURATION_IN_SECONDS * MILLISECONDS_PER_SECOND );
+const uint64_t DEFAULT_FRAME_DURATION_IN_NANOSECONDS( DEFAULT_FRAME_DURATION_IN_SECONDS * NANOSECONDS_PER_SECOND );
 
 /**
  * Handles the use case when an update-request is received JUST before we process a sleep-request. If we did not have an update-request count then
@@ -288,9 +288,9 @@ void CombinedUpdateRenderController::SetRenderRefreshRate( unsigned int numberOf
 {
   // Not protected by lock, but written to rarely so not worth adding a lock when reading
   mDefaultFrameDelta                  = numberOfFramesPerRender * DEFAULT_FRAME_DURATION_IN_SECONDS;
-  mDefaultFrameDurationMilliseconds   = (uint64_t)numberOfFramesPerRender * DEFAULT_FRAME_DURATION_IN_MILLISECONDS;
-  mDefaultFrameDurationNanoseconds    = (uint64_t)numberOfFramesPerRender * DEFAULT_FRAME_DURATION_IN_NANOSECONDS;
-  mDefaultHalfFrameNanoseconds        = mDefaultFrameDurationNanoseconds / 2;
+  mDefaultFrameDurationMilliseconds   = uint64_t( numberOfFramesPerRender ) * DEFAULT_FRAME_DURATION_IN_MILLISECONDS;
+  mDefaultFrameDurationNanoseconds    = uint64_t( numberOfFramesPerRender ) * DEFAULT_FRAME_DURATION_IN_NANOSECONDS;
+  mDefaultHalfFrameNanoseconds        = mDefaultFrameDurationNanoseconds / 2u;
 
   LOG_EVENT( "mDefaultFrameDelta(%.6f), mDefaultFrameDurationMilliseconds(%lld), mDefaultFrameDurationNanoseconds(%lld)", mDefaultFrameDelta, mDefaultFrameDurationMilliseconds, mDefaultFrameDurationNanoseconds );
 }
index d6e68fe..3fd9be7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -225,8 +225,8 @@ void PerformanceServer::LogMarker( const PerformanceMarker& marker, const char*
   {
     Integration::Log::LogMessage( Dali::Integration::Log::DebugInfo,
                                     "%.6f (seconds), %s\n",
-                                    (float)( marker.GetTimeStamp().microseconds * MICROSECONDS_TO_SECOND ),
-                                    description);
+                                    float( marker.GetTimeStamp().microseconds ) * MICROSECONDS_TO_SECOND,
+                                    description );
 
   }
 }
index e8aa42d..489e024 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -97,7 +97,7 @@ void FrameTime::SetSyncTime( unsigned int frameNumber )
 
     mLastSyncFrameNumber = frameNumber;
 
-    DALI_LOG_INFO( gLogFilter, Debug::General, "FrameTime: SetSyncTime(): Frame: %u: Time: %u\n", mLastSyncFrameNumber, (unsigned int) ( mLastSyncTime / MICROSECONDS_PER_MILLISECOND ) );
+    DALI_LOG_INFO( gLogFilter, Debug::General, "FrameTime: SetSyncTime(): Frame: %u: Time: %u\n", mLastSyncFrameNumber, static_cast<unsigned int>( mLastSyncTime / MICROSECONDS_PER_MILLISECOND ) );
   }
 }
 
index 77b525e..c130bda 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -19,6 +19,9 @@
 #include "ecore-callback-manager.h"
 
 // EXTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 
 #include <dali/integration-api/debug.h>
@@ -185,3 +188,5 @@ CallbackManager* CallbackManager::New()
 } // namespace Internal
 
 } // namespace Dali
+
+#pragma GCC diagnostic pop
index 81a943e..5e7465f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -19,6 +19,9 @@
 #include "file-descriptor-monitor.h"
 
 // EXTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 
 // INTERNAL INCLUDES
@@ -144,3 +147,5 @@ FileDescriptorMonitor::~FileDescriptorMonitor()
 } // namespace Internal
 
 } // namespace Dali
+
+#pragma GCC diagnostic pop
index 5c3f479..681ca16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -19,6 +19,9 @@
 #include "timer-impl.h"
 
 // EXTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 
 namespace Dali
@@ -155,3 +158,5 @@ bool Timer::IsRunning() const
 } // namespace Internal
 
 } // namespace Dali
+
+#pragma GCC diagnostic pop
index b77bfa1..4792522 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -139,7 +139,7 @@ void* EglImageExtensions::CreateImageKHR(EGLClientBuffer clientBuffer)
     }
   }
 
-  return (void*)eglImage;
+  return eglImage;
 }
 
 void EglImageExtensions::DestroyImageKHR(void* eglImageKHR)
@@ -199,7 +199,7 @@ void EglImageExtensions::TargetTextureKHR(void* eglImageKHR)
     GLint glError = glGetError();
 #endif
 
-    glEGLImageTargetTexture2DOESProc(GL_TEXTURE_2D, (GLeglImageOES)eglImage);
+    glEGLImageTargetTexture2DOESProc(GL_TEXTURE_2D, reinterpret_cast< GLeglImageOES >( eglImage ) );
 
 #ifdef EGL_ERROR_CHECKING
     glError = glGetError();
@@ -216,9 +216,9 @@ void EglImageExtensions::InitializeEglImageKHR()
   // avoid trying to reload extended KHR functions, if it fails the first time
   if( ! mImageKHRInitializeFailed )
   {
-    eglCreateImageKHRProc  = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR"); /* parasoft-suppress MISRA2004-11_1_DMC "Using EGL defined functions." */
-    eglDestroyImageKHRProc = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR"); /* parasoft-suppress MISRA2004-11_1_DMC "Using EGL defined functions." */
-    glEGLImageTargetTexture2DOESProc = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) eglGetProcAddress("glEGLImageTargetTexture2DOES"); /* parasoft-suppress MISRA2004-11_1_DMC "Using EGL defined functions." */
+    eglCreateImageKHRProc  = reinterpret_cast< PFNEGLCREATEIMAGEKHRPROC >( eglGetProcAddress("eglCreateImageKHR") );
+    eglDestroyImageKHRProc = reinterpret_cast< PFNEGLDESTROYIMAGEKHRPROC >( eglGetProcAddress("eglDestroyImageKHR") );
+    glEGLImageTargetTexture2DOESProc = reinterpret_cast< PFNGLEGLIMAGETARGETTEXTURE2DOESPROC >( eglGetProcAddress("glEGLImageTargetTexture2DOES") );
   }
 
   if (eglCreateImageKHRProc && eglDestroyImageKHRProc && glEGLImageTargetTexture2DOESProc)
index 1ef1cb0..23541ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -152,9 +152,9 @@ void EglSyncImplementation::InitializeEglSync()
 {
   if( ! mSyncInitializeFailed )
   {
-    eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC)eglGetProcAddress("eglCreateSyncKHR");
-    eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC)eglGetProcAddress("eglClientWaitSyncKHR");
-    eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC)eglGetProcAddress("eglDestroySyncKHR");
+    eglCreateSyncKHR = reinterpret_cast< PFNEGLCREATESYNCKHRPROC >( eglGetProcAddress("eglCreateSyncKHR") );
+    eglClientWaitSyncKHR = reinterpret_cast< PFNEGLCLIENTWAITSYNCKHRPROC >( eglGetProcAddress("eglClientWaitSyncKHR") );
+    eglDestroySyncKHR = reinterpret_cast< PFNEGLDESTROYSYNCKHRPROC >( eglGetProcAddress("eglDestroySyncKHR") );
   }
 
   if( eglCreateSyncKHR && eglClientWaitSyncKHR && eglDestroySyncKHR )
index f86434a..036949a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -127,12 +127,12 @@ void GlExtensions::Initialize()
   mInitialized = true;
 
 #ifdef GL_EXT_discard_framebuffer
-  mGlDiscardFramebuffer = (PFNGLDISCARDFRAMEBUFFEREXTPROC) eglGetProcAddress("glDiscardFramebufferEXT");
+  mGlDiscardFramebuffer = reinterpret_cast< PFNGLDISCARDFRAMEBUFFEREXTPROC >( eglGetProcAddress("glDiscardFramebufferEXT") );
 #endif
 
 #ifdef GL_OES_get_program_binary
-  mGlGetProgramBinaryOES = (PFNGLGETPROGRAMBINARYOESPROC) eglGetProcAddress("glGetProgramBinaryOES");
-  mGlProgramBinaryOES = (PFNGLPROGRAMBINARYOESPROC) eglGetProcAddress("glProgramBinaryOES");
+  mGlGetProgramBinaryOES = reinterpret_cast< PFNGLGETPROGRAMBINARYOESPROC >( eglGetProcAddress("glGetProgramBinaryOES") );
+  mGlProgramBinaryOES = reinterpret_cast< PFNGLPROGRAMBINARYOESPROC >( eglGetProcAddress("glProgramBinaryOES") );
 #endif
 }
 
index d5dab6a..968cca4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -121,7 +121,7 @@ bool Socket::Bind( uint16_t port )
   serverAddress.sin_addr.s_addr = htonl( INADDR_ANY ); //  binds the socket to all available interfaces
 
   int ret = bind( mSocketFileDescriptor,
-                  (struct sockaddr* ) &serverAddress,
+                  reinterpret_cast< struct sockaddr* >( &serverAddress ),
                   sizeof(serverAddress));
 
   if( ret == -1 )
index cbd705e..0e3fd0e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -66,7 +66,7 @@ int Orientation::GetDegrees() const
 
 float Orientation::GetRadians() const
 {
-  return Math::PI * (float)mOrientation / 180.0f;
+  return Math::PI * float(mOrientation) / 180.0f;
 }
 
 Orientation::OrientationSignalType& Orientation::ChangedSignal()
index 74491f2..93e7b71 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -87,7 +87,8 @@ int DGifExtensionToGCB(const size_t GifExtensionLength,
                        char *GifExtension,
                        GraphicsControlBlock *GCB)
 {
-  if (GifExtensionLength != 4) {
+  if (GifExtensionLength != 4)
+  {
     return GIF_ERROR;
   }
 
@@ -95,9 +96,13 @@ int DGifExtensionToGCB(const size_t GifExtensionLength,
   GCB->UserInputFlag = (GifExtension[0] & 0x02) != 0;
   GCB->DelayTime = UNSIGNED_LITTLE_ENDIAN(GifExtension[1], GifExtension[2]);
   if (GifExtension[0] & 0x01)
-    GCB->TransparentColor = ((int)GifExtension[3]+256)%256;
+  {
+    GCB->TransparentColor = reinterpret_cast< int >( GifExtension[3]+256 ) % 256;
+  }
   else
+  {
     GCB->TransparentColor = NO_TRANSPARENT_COLOR;
+  }
 
   return GIF_OK;
 }
index 7f6b3ae..4ed4667 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -19,6 +19,9 @@
 #include "ecore-indicator-impl.h"
 
 // EXTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 #include <Evas.h>
 #ifdef WAYLAND
@@ -1655,5 +1658,9 @@ void Indicator::OnStageTouch(const Dali::TouchData& touchData)
 }
 
 } // Adaptor
+
 } // Internal
+
 } // Dali
+
+#pragma GCC diagnostic pop
index 5f7a841..6934be1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -19,6 +19,9 @@
 #include "ecore-server-connection.h"
 
 // EXTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 
 #include <dali/integration-api/debug.h>
@@ -211,5 +214,9 @@ void ServerConnection::CloseConnection()
 }
 
 } // Adaptor
+
 } // Internal
+
 } // Dali
+
+#pragma GCC diagnostic pop
\ No newline at end of file
index dfb5649..7747cd3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -24,6 +24,9 @@
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include "ecore-virtual-keyboard.h"
 #include <adaptor.h>
 #include <locale-utils.h>
@@ -338,3 +341,5 @@ Dali::VirtualKeyboard::TextDirection GetTextDirection()
 } // namespace Internal
 
 } // namespace Dali
+
+#pragma GCC diagnostic pop
index b19af9b..0839ca2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -19,6 +19,9 @@
 #include "clipboard-impl.h"
 
 // EXTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 #include <Ecore_Wayland.h>
 #include <dali/public-api/object/any.h>
@@ -293,3 +296,5 @@ char* Clipboard::ExcuteBuffered( bool type, void *event )
 } // namespace Internal
 
 } // namespace Dali
+
+#pragma GCC diagnostic pop
index 683f66f..c2a19e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -19,6 +19,9 @@
 #include <events/event-handler.h>
 
 // EXTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 #include <Ecore_Input.h>
 #include <ecore-wl-render-surface.h>
@@ -1409,3 +1412,5 @@ void EventHandler::SetRotationObserver( RotationObserver* observer )
 } // namespace Internal
 
 } // namespace Dali
+
+#pragma GCC diagnostic pop
index 038f6c7..723c90e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -16,6 +16,9 @@
  */
 
 // CLASS HEADER
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <imf-manager-impl.h>
 
 // EXTERNAL INCLUDES
@@ -650,9 +653,10 @@ const std::string& ImfManager::GetSurroundingText() const
 void ImfManager::NotifyTextInputMultiLine( bool multiLine )
 {
   Ecore_IMF_Input_Hints currentHint = ecore_imf_context_input_hint_get(mIMFContext);
-  ecore_imf_context_input_hint_set(mIMFContext, (Ecore_IMF_Input_Hints)(multiLine ?
-    (currentHint | ECORE_IMF_INPUT_HINT_MULTILINE) :
-    (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE)));
+  ecore_imf_context_input_hint_set( mIMFContext,
+                                    static_cast< Ecore_IMF_Input_Hints >( multiLine ?
+                                      (currentHint | ECORE_IMF_INPUT_HINT_MULTILINE) :
+                                      (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE)));
 }
 
 Dali::ImfManager::TextDirection ImfManager::GetTextDirection()
@@ -830,3 +834,5 @@ void ImfManager::HideInputPanel()
 } // Internal
 
 } // Dali
+
+#pragma GCC diagnostic pop
index 18e4c8d..3f0427c 100644 (file)
@@ -19,6 +19,9 @@
 #include <window-impl.h>
 
 // EXTERNAL HEADERS
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 #include <Ecore_Wayland.h>
 #include <tizen-extension-client-protocol.h>
@@ -1367,5 +1370,9 @@ int Window::GetBrightness()
 }
 
 } // Adaptor
+
 } // Internal
+
 } // Dali
+
+#pragma GCC diagnostic pop
index 2dfbddf..5cb7511 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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,8 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
   // create the EGL surface
   ecore_wl_window_surface_create(mWlWindow);
   mEglWindow = wl_egl_window_create(ecore_wl_window_surface_get(mWlWindow), mPosition.width, mPosition.height);
-  eglImpl.CreateSurfaceWindow( (EGLNativeWindowType)mEglWindow, mColorDepth ); // reinterpret_cast does not compile
+  EGLNativeWindowType windowType( mEglWindow );
+  eglImpl.CreateSurfaceWindow( windowType, mColorDepth );
 }
 
 void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf )
@@ -156,7 +157,8 @@ bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
   mEglWindow = wl_egl_window_create(ecore_wl_window_surface_get(mWlWindow), mPosition.width, mPosition.height);
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-  return eglImpl.ReplaceSurfaceWindow( (EGLNativeWindowType)mEglWindow ); // reinterpret_cast does not compile
+  EGLNativeWindowType windowType( mEglWindow );
+  return eglImpl.ReplaceSurfaceWindow( windowType );
 }
 
 void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize )
@@ -242,7 +244,7 @@ void WindowRenderSurface::CreateWlRenderable()
 
   if ( mWlWindow == 0 )
   {
-      DALI_ASSERT_ALWAYS(0 && "Failed to create X window");
+    DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
   }
 }
 
index 01656e1..bd4a41e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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 @@
 #include "system-settings.h"
 
 #ifndef WAYLAND
-#define MSG_DOMAIN_CONTROL_ACCESS (int)ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL
+#define MSG_DOMAIN_CONTROL_ACCESS static_cast< int >( ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL )
 #endif
 
 namespace Dali
@@ -69,7 +69,7 @@ bool GetEnabledVConf()
     vconf_get_bool( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled );
   }
 
-  return (bool)isEnabled;
+  return bool( isEnabled );
 }
 
 
index 0516ba2..f65cf8d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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,14 +37,14 @@ namespace Adaptor
 
 EGLNativeDisplayType DisplayConnection::GetNativeDisplay()
 {
-  return (EGLNativeDisplayType)tbm_bufmgr_init( -1 );
+  return reinterpret_cast< EGLNativeDisplayType >( tbm_bufmgr_init( -1 ) );
 }
 
 void DisplayConnection::ReleaseNativeDisplay()
 {
   if( mDisplay )
   {
-    tbm_bufmgr_deinit( (tbm_bufmgr)mDisplay );
+    tbm_bufmgr_deinit( reinterpret_cast< tbm_bufmgr >( mDisplay ) );
   }
 }
 
index ad1edb6..57d0c08 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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* EglImageExtensions::CreateImageKHR(EGLClientBuffer clientBuffer)
     }
   }
 
-  return (void*)eglImage;
+  return eglImage;
 }
 
 void EglImageExtensions::DestroyImageKHR(void* eglImageKHR)
@@ -203,7 +203,7 @@ void EglImageExtensions::TargetTextureKHR(void* eglImageKHR)
     GLint glError = glGetError();
 #endif
 
-    glEGLImageTargetTexture2DOESProc(GL_TEXTURE_EXTERNAL_OES, (GLeglImageOES)eglImage);
+    glEGLImageTargetTexture2DOESProc(GL_TEXTURE_EXTERNAL_OES, reinterpret_cast< GLeglImageOES >( eglImage ) );
 
 #ifdef EGL_ERROR_CHECKING
     glError = glGetError();
@@ -220,9 +220,9 @@ void EglImageExtensions::InitializeEglImageKHR()
   // avoid trying to reload extended KHR functions, if it fails the first time
   if( ! mImageKHRInitializeFailed )
   {
-    eglCreateImageKHRProc  = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR"); /* parasoft-suppress MISRA2004-11_1_DMC "Using EGL defined functions." */
-    eglDestroyImageKHRProc = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR"); /* parasoft-suppress MISRA2004-11_1_DMC "Using EGL defined functions." */
-    glEGLImageTargetTexture2DOESProc = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) eglGetProcAddress("glEGLImageTargetTexture2DOES"); /* parasoft-suppress MISRA2004-11_1_DMC "Using EGL defined functions." */
+    eglCreateImageKHRProc  = reinterpret_cast< PFNEGLCREATEIMAGEKHRPROC >( eglGetProcAddress("eglCreateImageKHR") );
+    eglDestroyImageKHRProc = reinterpret_cast< PFNEGLDESTROYIMAGEKHRPROC >( eglGetProcAddress("eglDestroyImageKHR") );
+    glEGLImageTargetTexture2DOESProc = reinterpret_cast< PFNGLEGLIMAGETARGETTEXTURE2DOESPROC >( eglGetProcAddress("glEGLImageTargetTexture2DOES") );
   }
 
   if (eglCreateImageKHRProc && eglDestroyImageKHRProc && glEGLImageTargetTexture2DOESProc)
index e02822d..7af6a74 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -130,7 +130,7 @@ void NativeRenderSurface::CreateEglSurface( EglInterface& egl )
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
 
-  eglImpl.CreateSurfaceWindow( (EGLNativeWindowType)mImpl->mTbmQueue, mImpl->mColorDepth );
+  eglImpl.CreateSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mImpl->mTbmQueue ), mImpl->mColorDepth );
 }
 
 void NativeRenderSurface::DestroyEglSurface( EglInterface& egl )
@@ -152,7 +152,7 @@ bool NativeRenderSurface::ReplaceEGLSurface( EglInterface& egl )
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
 
-  return eglImpl.ReplaceSurfaceWindow( (EGLNativeWindowType)mImpl->mTbmQueue ); // reinterpret_cast does not compile
+  return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mImpl->mTbmQueue ) );
 }
 
 void NativeRenderSurface::StartRender()
index 4957f64..1f989f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -58,7 +58,7 @@ namespace Adaptor
 #ifdef SENSOR_ENABLED
 static void sensor_changed_cb (sensor_h sensor, sensor_event_s *event, void *user_data)
 {
-  TiltSensor* tiltSensor = (TiltSensor*)user_data;
+  TiltSensor* tiltSensor = reinterpret_cast< TiltSensor* >( user_data );
 
   if(tiltSensor)
   {
index 2d3ce7f..73a595a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -19,6 +19,9 @@
 #include <events/event-handler.h>
 
 // EXTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 #include <Ecore_Input.h>
 #include <Ecore_X.h>
@@ -1886,3 +1889,5 @@ void EventHandler::SetRotationObserver( RotationObserver* observer )
 } // namespace Internal
 
 } // namespace Dali
+
+#pragma GCC diagnostic pop
index 25c310f..b820656 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -91,7 +91,7 @@ std::string GetWindowProperty( Ecore_X_Atom property, Ecore_X_Atom *xDataType, u
                              LONG_MAX,                                     // long length of data to retrieve
                              False,                                        // Bool flag to delete data
                              ecore_x_window_prop_any_type(),               // Atom atom id associated to property type
-                             (Atom *)&typeRet,                             // Atom actual_type_return, atom id property type
+                             reinterpret_cast< Atom * >( &typeRet ),       // Atom actual_type_return, atom id property type
                              &sizeRet,                                     // int* format of property
                              &numRet,                                      // unsigned long*  number of items being returned in prop_return
                              &bytes,                                       // unsigned long* remaining bytes if partial retrieval
@@ -124,7 +124,7 @@ std::string GetWindowProperty( Ecore_X_Atom property, Ecore_X_Atom *xDataType, u
    {
      for ( i = 0; i < numRet; i++ )
      {
-       data +=  ( ( unsigned short * )propRet )[i];
+       data += propRet )[i];
      }
    }
    break;
@@ -133,7 +133,7 @@ std::string GetWindowProperty( Ecore_X_Atom property, Ecore_X_Atom *xDataType, u
    {
      for ( i = 0; i < numRet; i++ )
      {
-       data += ( ( unsigned long * )propRet )[i];
+       data += ( propRet )[i];
      }
    }
    break;
@@ -161,7 +161,7 @@ void SendXEvent(Ecore_X_Display* display, Ecore_X_Window window, bool propagate,
   message.window = window;
   snprintf(message.data.b, 20, "%s", msg);
 
-  XSendEvent( static_cast<Display*>( display ), window, propagate, eventMask,( XEvent* )&message );
+  XSendEvent( static_cast<Display*>( display ), window, propagate, eventMask, reinterpret_cast< XEvent* >( &message ) );
 }
 
 
index de01b3c..1e598c2 100644 (file)
@@ -30,6 +30,9 @@
 #include <locale-utils.h>
 #include <singleton-service-impl.h>
 #include <virtual-keyboard-impl.h>
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include "ecore-virtual-keyboard.h"
 
 namespace Dali
@@ -692,3 +695,5 @@ void ImfManager::HideInputPanel()
 } // Internal
 
 } // Dali
+
+#pragma GCC diagnostic pop
index 91f32b6..45562ee 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -387,7 +387,7 @@ void NativeImageSource::GetPixmapDetails()
   int x, y;
 
   // get the width, height and depth
-  ecore_x_pixmap_geometry_get(mPixmap, &x, &y, (int*)&mWidth, (int*)&mHeight);
+  ecore_x_pixmap_geometry_get( mPixmap, &x, &y, reinterpret_cast< int* >( &mWidth ), reinterpret_cast< int* >( &mHeight ) );
 
   // set whether blending is required according to pixel format based on the depth
   /* default pixel format is RGB888
index 9447e8a..76a8734 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -248,7 +248,8 @@ void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract
       // make a fixes region as updated area
       region = XFixesCreateRegion( display, &rect, 1 );
       // add damage event to updated drawable
-      XDamageAdd( display, (Drawable)drawable, region );
+      Drawable xdrawable( drawable ); // ecore type is unsigned int whereas in 64bit linux Drawable is long unsigned int
+      XDamageAdd( display, xdrawable, region );
       XFixesDestroyRegion( display, region );
 
       XFlush( display );
index 81566b1..9b7417c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -99,7 +99,7 @@ void EnableEffect( Window window, bool enable )
   nativeWindow.Get(ecoreWindow);
   ecore_x_window_prop_property_set( ecoreWindow, ECORE_X_ATOM_E_WINDOW_AUX_HINT,
                                     ECORE_X_ATOM_STRING, 8,
-                                    (void*)ss.str().c_str(), ss.str().size() + 1 );
+                                    ss.str().c_str(), ss.str().size() + 1 );
 }
 
 bool IsEffectEnabled( Window window )
index 357cafe..710d9fb 100644 (file)
@@ -19,6 +19,9 @@
 #include "window-impl.h"
 
 // EXTERNAL HEADERS
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 #include <Ecore_X.h>
 
@@ -905,5 +908,9 @@ int Window::GetBrightness()
 }
 
 } // Adaptor
+
 } // Internal
+
 } // Dali
+
+#pragma GCC diagnostic pop
index d85c9c8..af29020 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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 @@ WindowRenderSurface::~WindowRenderSurface()
 Ecore_X_Drawable WindowRenderSurface::GetDrawable()
 {
   // already an e-core type
-  return (Ecore_X_Drawable)mX11Window;
+  return static_cast< Ecore_X_Drawable >( mX11Window );
 }
 
 Any WindowRenderSurface::GetSurface()
@@ -113,9 +113,9 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
 
   // create the EGL surface
-  // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
-  XWindow window = static_cast< XWindow>( mX11Window );
-  eglImpl.CreateSurfaceWindow( (EGLNativeWindowType)window, mColorDepth ); // reinterpret_cast does not compile
+  // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
+  XWindow window( mX11Window );
+  eglImpl.CreateSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( window ), mColorDepth );
 }
 
 void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf )
@@ -130,11 +130,11 @@ bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
 {
   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
 
-  // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
-  XWindow window = static_cast< XWindow >( mX11Window );
+  // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
+  XWindow window( mX11Window );
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
 
-  return eglImpl.ReplaceSurfaceWindow( (EGLNativeWindowType)window ); // reinterpret_cast does not compile
+  return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( window ) );
 }
 
 void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize )
index 5e87579..95def19 100644 (file)
@@ -379,7 +379,7 @@ libdali_adaptor_la_CXXFLAGS = \
                       -DTIZEN_PLATFORM_CONFIG_SUPPORTED=${tizenPlatformConfigSupported} \
                       -DNON_POWER_OF_TWO_TEXTURES \
                       -DDALI_COMPILATION -DDALI_ADAPTOR_COMPILATION \
-                      -Werror -Wall -lgcc \
+                      -Werror -Wall -lgcc -Wold-style-cast\
                       $(libdali_adaptor_la_includes) \
                       $(DALI_ADAPTOR_CFLAGS) \
                       $(DALICORE_CFLAGS) \
index 7fd74b3..c301fcc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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 @@ inline void DebugAssertDualScanlineParameters( const uint8_t * const scanline1,
   DALI_ASSERT_DEBUG( scanline2 && "Null pointer." );
   DALI_ASSERT_DEBUG( outputScanline && "Null pointer." );
   DALI_ASSERT_DEBUG( ((scanline1 >= scanline2 + widthInComponents) || (scanline2 >= scanline1 + widthInComponents )) && "Scanlines alias." );
-  DALI_ASSERT_DEBUG( ((((void*)outputScanline) >= (void*)(scanline2 + widthInComponents)) || (((void*)scanline2) >= (void*)(scanline1 + widthInComponents))) && "Scanline 2 aliases output." );
+  DALI_ASSERT_DEBUG( ((outputScanline >= (scanline2 + widthInComponents)) || (scanline2 >= (scanline1 + widthInComponents))) && "Scanline 2 aliases output." );
 }
 
 /**
@@ -1177,8 +1177,8 @@ inline void PointSampleAddressablePixels( const uint8_t * inPixels,
   DALI_ASSERT_DEBUG( ((desiredWidth <= inputWidth && desiredHeight <= inputHeight) ||
       outPixels >= inPixels + inputWidth * inputHeight * sizeof(PIXEL) || outPixels <= inPixels - desiredWidth * desiredHeight * sizeof(PIXEL)) &&
       "The input and output buffers must not overlap for an upscaling.");
-  DALI_ASSERT_DEBUG( ((uint64_t) inPixels)  % sizeof(PIXEL) == 0 && "Pixel pointers need to be aligned to the size of the pixels (E.g., 4 bytes for RGBA, 2 bytes for RGB565, ...)." );
-  DALI_ASSERT_DEBUG( ((uint64_t) outPixels) % sizeof(PIXEL) == 0 && "Pixel pointers need to be aligned to the size of the pixels (E.g., 4 bytes for RGBA, 2 bytes for RGB565, ...)." );
+  DALI_ASSERT_DEBUG( reinterpret_cast< uint64_t >( inPixels )  % sizeof(PIXEL) == 0 && "Pixel pointers need to be aligned to the size of the pixels (E.g., 4 bytes for RGBA, 2 bytes for RGB565, ...)." );
+  DALI_ASSERT_DEBUG( reinterpret_cast< uint64_t >( outPixels ) % sizeof(PIXEL) == 0 && "Pixel pointers need to be aligned to the size of the pixels (E.g., 4 bytes for RGBA, 2 bytes for RGB565, ...)." );
 
   if( inputWidth < 1u || inputHeight < 1u || desiredWidth < 1u || desiredHeight < 1u )
   {
@@ -1420,8 +1420,8 @@ inline void LinearSampleGeneric( const unsigned char * __restrict__ inPixels,
                      "Input and output buffers cannot overlap.");
   if( DEBUG_ASSERT_ALIGNMENT )
   {
-    DALI_ASSERT_DEBUG( ((uint64_t) inPixels)  % sizeof(PIXEL) == 0 && "Pixel pointers need to be aligned to the size of the pixels (E.g., 4 bytes for RGBA, 2 bytes for RGB565, ...)." );
-    DALI_ASSERT_DEBUG( ((uint64_t) outPixels) % sizeof(PIXEL) == 0 && "Pixel pointers need to be aligned to the size of the pixels (E.g., 4 bytes for RGBA, 2 bytes for RGB565, ...)." );
+    DALI_ASSERT_DEBUG( reinterpret_cast< uint64_t >( inPixels )  % sizeof(PIXEL) == 0 && "Pixel pointers need to be aligned to the size of the pixels (E.g., 4 bytes for RGBA, 2 bytes for RGB565, ...)." );
+    DALI_ASSERT_DEBUG( reinterpret_cast< uint64_t >( outPixels) % sizeof(PIXEL) == 0 && "Pixel pointers need to be aligned to the size of the pixels (E.g., 4 bytes for RGBA, 2 bytes for RGB565, ...)." );
   }
 
   if( inputWidth < 1u || inputHeight < 1u || desiredWidth < 1u || desiredHeight < 1u )
index aed1071..bddf954 100755 (executable)
@@ -122,11 +122,11 @@ Pixel::Format GetAstcPixelFormat( AstcFileHeader& header )
  * @param[out] fileHeader  This will be populated with the header data
  * @return                 True if the file is valid, false otherwise
  */
-bool LoadAstcHeader( FILE * const filePointer, unsigned int &width, unsigned int &height, AstcFileHeader &fileHeader )
+bool LoadAstcHeader( FILE * const filePointer, unsigned int& width, unsigned int& height, AstcFileHeader& fileHeader )
 {
   // Pull the bytes of the file header in as a block:
-  unsigned int readLength = sizeof( AstcFileHeader );
-  if( fread( (void*)&fileHeader, 1, readLength, filePointer ) != readLength )
+  const unsigned int readLength = sizeof( AstcFileHeader );
+  if( fread( &fileHeader, 1, readLength, filePointer ) != readLength )
   {
     return false;
   }
index 4082c5c..0ac6748 100644 (file)
@@ -84,10 +84,10 @@ struct BmpInfoHeader
 template<typename T>
 inline bool ReadHeader(FILE* fp, T& header)
 {
-  unsigned int readLength = sizeof(T);
+  const unsigned int readLength = sizeof(T);
 
   // Load the information directly into our structure
-  if (fread((void*)&header, 1, readLength, fp) != readLength)
+  if ( fread( &header, 1, readLength, fp ) != readLength )
   {
     return false;
   }
index d58088b..4a46931 100644 (file)
@@ -76,16 +76,13 @@ const unsigned char ICO_FILE_HEADER = 22;
 const unsigned char ICO_IMAGE_INFO_HEADER = 40;
 
 typedef unsigned char  DATA8;
-#define A_VAL(p) (((DATA8 *)(p))[3])
+#define A_VAL(p) (reinterpret_cast< DATA8 * >( p )[3])
 
 #define RGB_JOIN(r,g,b) \
                 (((r) << 16) + ((g) << 8) + (b))
 
 #define ARGB_JOIN(a,r,g,b) \
                 (((a) << 24) + ((r) << 16) + ((g) << 8) + (b))
-#define IMG_TOO_BIG(w, h) \
-       ((((unsigned long long)w) * ((unsigned long long)h)) >= \
-           ((1ULL << (29 * (sizeof(void *) / 4))) - 2048))
 
 bool read_ushort(unsigned char *map, size_t length, size_t *position, unsigned short *ret)
 {
@@ -387,9 +384,9 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
 
   size_t position = chosen.bmoffset;//22 == position
 
-  int w = chosen.w;
-  int h = chosen.h;
-  int cols = chosen.cols;
+  unsigned int w = chosen.w;
+  unsigned int h = chosen.h;
+  unsigned int cols = chosen.cols;
 
   // read bmp header time... let's do some checking
   if (!read_uint(&map[0], fsize, &position, &dword))
@@ -402,7 +399,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
   }
   if (dword > 0)
   {
-    if ((int)dword != w)
+    if (dword != w)
     {
       w = dword;
       diff_size = 1;
@@ -414,7 +411,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
   }
   if (dword > 0)
   {
-    if ((int)dword != (h * 2))
+    if (dword != (h * 2))
     {
       h = dword / 2;
       diff_size = 1;
@@ -467,7 +464,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
     return false; // colors important
   }
 
-  for(int i = 0; i < cols ; i ++)
+  for( unsigned int i = 0; i < cols ; i ++ )
   {
     unsigned char a, r, g, b;
 
@@ -491,8 +488,8 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
   }
 
   // This is the reference way of calculating the total number of bytes necessary to store one row of pixels.
-  int stride = ( ( ( bitcount * w ) + 31 ) / 32 ) * 4;
-  int bitStride = ( ( w + 31 ) / 32 ) * 4;
+  unsigned int stride = ( ( ( bitcount * w ) + 31 ) / 32 ) * 4;
+  unsigned int bitStride = ( ( w + 31 ) / 32 ) * 4;
 
   // Pixbuf only ever contains one scanline worth of data.
   pixbuf.Resize( stride );
@@ -507,9 +504,9 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
       unsigned char* p = &map[position];
       pix = &surface[0] + ( ( h - 1 ) * w );
 
-      for( int i = 0; i < h; i++ )
+      for( unsigned int i = 0; i < h; i++ )
       {
-        for( int j = 0; j < w; j++ )
+        for( unsigned int j = 0; j < w; j++ )
         {
           *pix++ = ARGB_JOIN( p[3], p[0], p[1], p[2] );
           p += 4;
@@ -522,7 +519,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
 
     case 24:
     {
-      for( int i = 0; i < h; i++ )
+      for( unsigned int i = 0; i < h; i++ )
       {
         pix = &surface[0] + ( ( h - 1 - i ) * w );
         if( !read_mem( &map[0], fsize, &position, &pixbuf[0], stride ) )
@@ -530,7 +527,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
           return false;
         }
         unsigned char* p = &pixbuf[0];
-        for( int j = 0; j < w; j++ )
+        for( unsigned int j = 0; j < w; j++ )
         {
           *pix++ = ARGB_JOIN( 0xff, p[0], p[1], p[2] );
           p += 3;
@@ -541,7 +538,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
 
     case 8:
     {
-      for( int i = 0; i < h; i++ )
+      for( unsigned int i = 0; i < h; i++ )
       {
         pix = &surface[0] + ( ( h - 1 - i ) * w );
         if( !read_mem( &map[0], fsize, &position, &pixbuf[0], stride ) )
@@ -549,7 +546,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
           return false;
         }
         unsigned char* p = &pixbuf[0];
-        for( int j = 0; j < w; j++ )
+        for( unsigned int j = 0; j < w; j++ )
         {
           *pix++ = pal[*p++];
         }
@@ -559,7 +556,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
 
     case 4:
     {
-      for( int i = 0; i < h; i++ )
+      for( unsigned int i = 0; i < h; i++ )
       {
         pix = &surface[0] + ( ( h - 1 - i ) * w );
         if( !read_mem( &map[0], fsize, &position, &pixbuf[0], stride ) )
@@ -567,7 +564,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
           return false;
         }
         unsigned char* p = &pixbuf[0];
-        for( int j = 0; j < w; j++ )
+        for( unsigned int j = 0; j < w; j++ )
         {
           if( j & 0x1 )
           {
@@ -586,7 +583,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
 
     case 1:
     {
-      for( int i = 0; i < h; i++ )
+      for( unsigned int i = 0; i < h; i++ )
       {
         pix = &surface[0] + ( ( h - 1 - i ) * w );
         if( !read_mem( &map[0], fsize, &position, &pixbuf[0], stride ) )
@@ -595,7 +592,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
         }
         unsigned char* p = &pixbuf[0];
 
-        for( int j = 0; j < w; j += 8 )
+        for( unsigned int j = 0; j < w; j += 8 )
         {
           *pix++ = pal[ *p >> 7 ];
           *pix++ = pal[ *p >> 6 & 0x01 ];
@@ -629,17 +626,17 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
 
     // Apply mask.
     // Precalc to save time in the loops.
-    int bytesPerWidth = w / 8;
-    int bytesRemainingPerWidth = w - ( bytesPerWidth << 3 );
+    unsigned int bytesPerWidth = w / 8;
+    unsigned int bytesRemainingPerWidth = w - ( bytesPerWidth << 3 );
 
     // Loop for each line of the image.
-    for( int i = 0; i < h; ++i )
+    for( unsigned int i = 0; i < h; ++i )
     {
       unsigned char *m = &maskbuf[0] + ( bitStride * i );
       pix = &surface[0] + ( ( h - 1 - i ) * w );
 
       // Do chunks of 8 pixels first so mask operations can be unrolled.
-      for( int j = 0; j < bytesPerWidth; ++j )
+      for( unsigned int j = 0; j < bytesPerWidth; ++j )
       {
         // Unrolled 8 bits of the mask to avoid many conditions and branches.
         A_VAL( pix++ ) = ( *m & ( 1 << 7 ) ) ? 0x00 : 0xff;
@@ -656,7 +653,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
       // Handle any remaining width ( < 8 ) or images that are < 8 wide.
       if( bytesRemainingPerWidth > 0 )
       {
-        for( int j = 0; j < bytesRemainingPerWidth; ++j )
+        for( unsigned int j = 0; j < bytesRemainingPerWidth; ++j )
         {
           // Note: Although we are doing less that a bytes worth of mask, we still always start on the first bit.
           // If the image is smaller than 8 pixels wide, each mask will still start on a new byte.
@@ -668,7 +665,7 @@ bool LoadBitmapFromIco( const ImageLoader::Input& input, Integration::Bitmap& bi
   }
 
   pixels = bitmap.GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, w, h );
-  memcpy( pixels, (unsigned char*)&surface[0], w * h * 4 );
+  memcpy( pixels, &surface[0], w * h * 4 );
 
   return true;
 }
index 2348b4d..fe474f5 100755 (executable)
@@ -183,18 +183,17 @@ struct KtxFileHeader
 // so we can be sure of reading the whole thing from file in one call to fread.
 
 /**
- * Template function to read from the file directly into our structure.
+ * Function to read from the file directly into our structure.
  * @param[in]  fp     The file to read from
  * @param[out] header The structure we want to store our information in
  * @return true, if read successful, false otherwise
  */
-template<typename T>
-inline bool ReadHeader(FILE* fp, T& header)
+inline bool ReadHeader( FILE* filePointer, KtxFileHeader& header )
 {
-  unsigned int readLength = sizeof(T);
+  const unsigned int readLength = sizeof( KtxFileHeader );
 
   // Load the information directly into our structure
-  if (fread((void*)&header, 1, readLength, fp) != readLength)
+  if( fread( &header, 1, readLength, filePointer ) != readLength )
   {
     return false;
   }
@@ -454,10 +453,10 @@ bool ConvertPixelFormat(const uint32_t ktxPixelFormat, Dali::Pixel::Format& form
   return true;
 }
 
-bool LoadKtxHeader(FILE * const fp, unsigned int &width, unsigned int &height, KtxFileHeader &fileHeader)
+bool LoadKtxHeader( FILE * const fp, unsigned int& width, unsigned int& height, KtxFileHeader& fileHeader )
 {
   // Pull the bytes of the file header in as a block:
-  if ( !ReadHeader(fp, fileHeader) )
+  if ( !ReadHeader( fp, fileHeader ) )
   {
     return false;
   }
@@ -546,7 +545,7 @@ bool LoadBitmapFromKtx( const ImageLoader::Input& input, Integration::Bitmap& bi
 
   // Load the size of the image data:
   uint32_t imageByteCount = 0;
-  if (fread((void*)&imageByteCount, 1, 4, fp) != 4)
+  if ( fread( &imageByteCount, 1, 4, fp ) != 4 )
   {
     DALI_LOG_ERROR( "Read of image size failed.\n" );
     return false;
@@ -569,7 +568,7 @@ bool LoadBitmapFromKtx( const ImageLoader::Input& input, Integration::Bitmap& bi
   }
 
   // Load up the image bytes:
-  PixelBuffer * const pixels = bitmap.GetCompressedProfile()->ReserveBufferOfSize( pixelFormat, width, height, (size_t) imageByteCount );
+  PixelBuffer* const pixels = bitmap.GetCompressedProfile()->ReserveBufferOfSize( pixelFormat, width, height, imageByteCount );
   if(!pixels)
   {
     DALI_LOG_ERROR( "Unable to reserve a pixel buffer to load the requested bitmap into.\n" );
index 42d5d34..e6fdcde 100644 (file)
@@ -306,10 +306,10 @@ bool LoadBitmapFromPng( const ImageLoader::Input& input, Integration::Bitmap& bi
   pixels = bitmap.GetPackedPixelsProfile()->ReserveBuffer(pixelFormat, width, height, bufferWidth, bufferHeight);
 
   DALI_ASSERT_DEBUG(pixels);
-  rows = (png_bytep*) malloc(sizeof(png_bytep) * height);
+  rows = reinterpret_cast< png_bytep* >( malloc(sizeof(png_bytep) * height) );
   for(y=0; y<height; y++)
   {
-    rows[y] = (png_byte*) (pixels + y * stride);
+    rows[y] = pixels + y * stride;
   }
 
   // decode image
index d4d6466..4a176ef 100755 (executable)
@@ -77,7 +77,7 @@ int extractMultiByteInteger(unsigned int *data, void *map, size_t length, size_t
     {
       return -1;
     }
-    buf = ((unsigned char *) map)[(*position)++];
+    buf = reinterpret_cast< unsigned char * >( map )[(*position)++];
     targetMultiByteInteger = (targetMultiByteInteger << 7) | (buf & 0x7f);
 
     if ((buf & 0x80) == 0)
@@ -105,11 +105,11 @@ bool LoadBitmapFromWbmp( const ImageLoader::Input& input, Integration::Bitmap& b
   PixelBuffer* pixels = NULL;
   size_t position = 0;
 
-  unsigned int  w, h;
+  unsigned int w, h;
   unsigned int type;
   unsigned int line_length;
   unsigned char *line = NULL;
-  int cur = 0, x, y;
+  unsigned int cur = 0, x, y;
 
   if( fseek(fp,0,SEEK_END) )
   {
@@ -183,7 +183,7 @@ bool LoadBitmapFromWbmp( const ImageLoader::Input& input, Integration::Bitmap& b
   memset(&surface[0], 0, w * h ); // w * h * 4
 
   line_length = (w + 7) >> 3;
-  for (y = 0; y < (int)h; y ++)
+  for (y = 0; y < h; y ++)
   {
     if (position + line_length > fsize)
     {
@@ -191,7 +191,7 @@ bool LoadBitmapFromWbmp( const ImageLoader::Input& input, Integration::Bitmap& b
     }
     line = &map[0] + position;
     position += line_length;
-    for (x = 0; x < (int)w; x++)
+    for (x = 0; x < w; x++)
     {
       int idx = x >> 3;
       int offset = 1 << (0x07 - (x & 0x07));
@@ -208,7 +208,7 @@ bool LoadBitmapFromWbmp( const ImageLoader::Input& input, Integration::Bitmap& b
   }
   pixels = bitmap.GetPackedPixelsProfile()->ReserveBuffer(Pixel::L8, w, h);//Pixel::RGBA8888
 
-  memcpy(pixels, (unsigned char*)&surface[0], w * h );//w * h * 4
+  memcpy( pixels, &surface[0], w * h ); //w * h * 4
 
   return true;
 }
index af14633..3283d32 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -20,6 +20,9 @@
 
 // EXTERNAL INCLUDES
 #ifndef DALI_PROFILE_UBUNTU
+// Dlog uses C style casts internally
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <dlog.h>
 #else // DALI_PROFILE_UBUNTU
 #include <cstdio>
@@ -51,6 +54,7 @@ void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& messag
       LOG(LOG_DEFAULT, DALI_TAG, "%s", message.c_str());
       break;
   }
+#pragma GCC diagnostic pop
 #else // DALI_PROFILE_UBUNTU
   const char *format = NULL;
   switch(level)
index be9e46d..35b4228 100644 (file)
 #include <config.h>
 #endif
 
+// Glyphy is written using C style casts
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+
 #include "glyphy-common.hh"
 #include "glyphy-geometry.hh"
 #include "glyphy-arcs-bezier.hh"
@@ -282,3 +286,5 @@ glyphy_arc_list_extents (const glyphy_arc_endpoint_t *endpoints,
     glyphy_extents_extend (extents, &arc_extents);
   }
 }
+
+#pragma GCC diagnostic pop
index 444747e..a6dc849 100644 (file)
 #include <config.h>
 #endif
 
+// Glyphy is written using C style casts
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+
 #include "glyphy-common.hh"
 #include "glyphy-geometry.hh"
 
@@ -326,3 +330,5 @@ glyphy_arc_list_encode_blob (const glyphy_arc_endpoint_t *endpoints,
 
   return true;
 }
+
+#pragma GCC diagnostic pop
index 0a3d734..c9b26ef 100644 (file)
 #ifndef GLYPHY_GEOMETRY_HH
 #define GLYPHY_GEOMETRY_HH
 
+// Glyphy is written using C style casts
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+
 #include "glyphy-common.hh"
 
 namespace GLyphy {
@@ -710,4 +714,6 @@ inline const Bezier Bezier::segment (const double &t0, const double &t1) const
 } /* namespace Geometry */
 } /* namespace GLyphy */
 
+#pragma GCC diagnostic pop
+
 #endif /* GLYPHY_GEOMETRY_HH */
index 988cc4d..3ff6875 100644 (file)
 #include <config.h>
 #endif
 
+// Glyphy is written using C style casts
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+
 #include "glyphy-common.hh"
 #include "glyphy-geometry.hh"
 
@@ -366,3 +370,5 @@ glyphy_outline_winding_from_even_odd (glyphy_arc_endpoint_t *endpoints,
   ret = ret | process_contour (endpoints + start, num_endpoints - start, endpoints, num_endpoints, bool (inverse));
   return ret;
 }
+
+#pragma GCC diagnostic pop
index 970f0ff..501641f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -912,7 +912,7 @@ void FontClient::Plugin::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dal
           error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, 0, 1 );
           if ( FT_Err_Ok == error )
           {
-            FT_BitmapGlyph bitmapGlyph = (FT_BitmapGlyph)glyph;
+            FT_BitmapGlyph bitmapGlyph = reinterpret_cast< FT_BitmapGlyph >( glyph );
             ConvertBitmap( data, bitmapGlyph->bitmap );
           }
           else
index 9a40f24..045549c 100644 (file)
 #include <float.h>
 #include <assert.h>
 #include <string.h>
+
+// resampler is written using C style casts
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+
 #include "resampler.h"
 
 #define resampler_assert assert
@@ -1213,3 +1218,4 @@ char* Resampler::get_filter_name(int filter_num)
       return g_filters[filter_num].name;
 }
 
+#pragma GCC diagnostic pop