From: Kimmo Hoikka Date: Wed, 17 May 2017 16:57:34 +0000 (+0100) Subject: Enable -Wold-style-cast to ensure more consideration is given to types and their... X-Git-Tag: dali_1.2.40~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=06fe515b4e32f42fe9ba3723df05a3628aa51ed1 Enable -Wold-style-cast to ensure more consideration is given to types and their conversions Change-Id: I8b8e92f09434e52ad62353d54a2846fae96fb3c3 --- diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac index d4b85ef..ca4dd8e 100644 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@ -31,7 +31,7 @@ AC_SUBST(DALI_VERSION) DALI_CFLAGS=-DPLATFORM_TIZEN # Use C++ 11 -DALI_CFLAGS="$DALI_CFLAGS -std=c++11 -Wnon-virtual-dtor -Woverloaded-virtual" +DALI_CFLAGS="$DALI_CFLAGS -std=c++11 -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast" AC_ARG_ENABLE(exportall, [AC_HELP_STRING([--enable-exportall], diff --git a/dali/devel-api/images/distance-field.cpp b/dali/devel-api/images/distance-field.cpp index bb4224a..6e4346d 100644 --- a/dali/devel-api/images/distance-field.cpp +++ b/dali/devel-api/images/distance-field.cpp @@ -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. @@ -196,8 +196,8 @@ void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size { for ( int x = 0; x < paddedWidth; ++x) { - if( y < (int)fieldBorder || y >= (paddedHeight - (int)fieldBorder) || - x < (int)fieldBorder || x >= (paddedWidth - (int)fieldBorder) ) + if( y < static_cast< int >( fieldBorder ) || y >= ( paddedHeight - static_cast< int >( fieldBorder ) ) || + x < static_cast< int >( fieldBorder ) || x >= ( paddedWidth - static_cast< int >( fieldBorder ) ) ) { outside[ y * paddedWidth + x ] = MAX_DISTANCE; inside[ y * paddedWidth + x ] = 0.0f; diff --git a/dali/devel-api/scripting/scripting.h b/dali/devel-api/scripting/scripting.h index 3216df4..6149155 100644 --- a/dali/devel-api/scripting/scripting.h +++ b/dali/devel-api/scripting/scripting.h @@ -245,7 +245,7 @@ const char* GetEnumerationName( T value, const StringEnum* table, unsigned int t template< typename T > const char * GetLinearEnumerationName( T value, const StringEnum* table, unsigned int tableCount ) { - if ( table && ( value > 0 || value <= (int)tableCount ) ) + if ( table && ( value > 0 || value <= static_cast( tableCount ) ) ) { return table[value].string; } diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list index 614ea22..afcc494 100644 --- a/dali/integration-api/file.list +++ b/dali/integration-api/file.list @@ -31,7 +31,6 @@ platform_abstraction_header_files = \ $(platform_abstraction_src_dir)/bitmap.h \ $(platform_abstraction_src_dir)/resource-policies.h \ $(platform_abstraction_src_dir)/resource-types.h \ - $(platform_abstraction_src_dir)/resource-declarations.h \ $(platform_abstraction_src_dir)/gl-abstraction.h \ $(platform_abstraction_src_dir)/gl-defines.h \ $(platform_abstraction_src_dir)/gl-sync-abstraction.h \ diff --git a/dali/integration-api/platform-abstraction.h b/dali/integration-api/platform-abstraction.h index ad79582..db2586b 100644 --- a/dali/integration-api/platform-abstraction.h +++ b/dali/integration-api/platform-abstraction.h @@ -30,7 +30,7 @@ namespace Dali namespace Integration { - +typedef unsigned int ResourceId; typedef IntrusivePtr ResourcePointer; /** diff --git a/dali/integration-api/resource-declarations.h b/dali/integration-api/resource-declarations.h deleted file mode 100644 index a17af2e..0000000 --- a/dali/integration-api/resource-declarations.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef __DALI_INTEGRATION_RESOURCE_DECLARATIONS_H__ -#define __DALI_INTEGRATION_RESOURCE_DECLARATIONS_H__ - -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -namespace Dali -{ - -namespace Integration -{ - -/** - * @brief Used to identify a resource loading operation. - * - * These unique ResourceId values can be used to identify a resource loading - * transaction in core-adaptor communication. - * A resource transaction is asynchronous and many can be in-flight - * concurrently. - * A ResourceId allows the core to track a resource transaction over its - * lifetime and match an asynchronous completion notification to the - * corresponding load request or to cancel the operation early. - * - * A resource transaction begins with a call to PlatformAbstraction::LoadResource() - * Later asynchronous status notifications obtained by polling - * PlatformAbstraction::GetResources() can be mapped to corresponding - * LoadResource() invocations using the ResourceId value. - * It is the core's responsibility to ensure that each invocation of - * PlatformAbstraction::LoadResource() passes in a Request object with a unique - * integer ResourceId. - * - * @sa Dali::Integration::PlatformAbstraction::LoadResource - * Dali::Integration::PlatformAbstraction::GetResources - * Dali::Integration::ResourceCache - */ -typedef unsigned int ResourceId; -const ResourceId InvalidResourceId = (ResourceId)-1; - -/** - * Used to inform the current loading status - */ -enum LoadStatus -{ - RESOURCE_LOADING, ///< There are missing resources, being loaded - RESOURCE_PARTIALLY_LOADED, ///< Enough resource has been loaded to start low quality rendering - RESOURCE_COMPLETELY_LOADED, ///< The resource has been completely loaded -}; - -} // namespace Integration - -} // namespace Dali - -#endif // __DALI_INTEGRATION_RESOURCE_DECLARATIONS_H__ diff --git a/dali/integration-api/resource-types.h b/dali/integration-api/resource-types.h index db03510..d793a0c 100644 --- a/dali/integration-api/resource-types.h +++ b/dali/integration-api/resource-types.h @@ -2,7 +2,7 @@ #define __DALI_INTEGRATION_RESOURCE_TYPES_H__ /* - * 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. @@ -28,7 +28,6 @@ #include #include #include -#include namespace Dali { diff --git a/dali/internal/event/animation/path-impl.cpp b/dali/internal/event/animation/path-impl.cpp index 6242e66..865c4fa 100644 --- a/dali/internal/event/animation/path-impl.cpp +++ b/dali/internal/event/animation/path-impl.cpp @@ -348,7 +348,7 @@ void Path::FindSegmentAndProgress( float t, unsigned int& segment, float& tLocal { segment = t * numSegs; float segLength = 1.0f / numSegs; - float segStart = (float)segment * segLength; + float segStart = static_cast( segment ) * segLength; tLocal = (t - segStart) * numSegs; } } diff --git a/dali/internal/event/common/object-impl.cpp b/dali/internal/event/common/object-impl.cpp index 344e72c..da2f58d 100644 --- a/dali/internal/event/common/object-impl.cpp +++ b/dali/internal/event/common/object-impl.cpp @@ -1448,7 +1448,7 @@ CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) cons int arrayIndex = index - PROPERTY_CUSTOM_START_INDEX; if( arrayIndex >= 0 ) { - if( arrayIndex < (int)mCustomProperties.Count() ) // we can only access the first 2 billion custom properties + if( arrayIndex < static_cast( mCustomProperties.Count() ) ) // we can only access the first 2 billion custom properties { property = static_cast(mCustomProperties[ arrayIndex ]); } @@ -1459,7 +1459,8 @@ CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) cons AnimatablePropertyMetadata* Object::FindAnimatableProperty( Property::Index index ) const { - for ( int arrayIndex = 0; arrayIndex < (int)mAnimatableProperties.Count(); arrayIndex++ ) + const PropertyMetadataLookup::SizeType count = mAnimatableProperties.Count(); + for ( PropertyMetadataLookup::SizeType arrayIndex = 0; arrayIndex < count; ++arrayIndex ) { AnimatablePropertyMetadata* property = static_cast( mAnimatableProperties[ arrayIndex ] ); if( property->index == index ) @@ -1531,7 +1532,8 @@ void Object::ResolveChildProperties() if( parentTypeInfo ) { // Go through each custom property - for ( int arrayIndex = 0; arrayIndex < (int)mCustomProperties.Count(); arrayIndex++ ) + const PropertyMetadataLookup::SizeType count = mCustomProperties.Count(); + for ( PropertyMetadataLookup::SizeType arrayIndex = 0; arrayIndex < count; ++arrayIndex ) { CustomPropertyMetadata* customProperty = static_cast( mCustomProperties[ arrayIndex ] ); diff --git a/dali/internal/event/events/hover-event-processor.cpp b/dali/internal/event/events/hover-event-processor.cpp index 964ad87..a19da0f 100644 --- a/dali/internal/event/events/hover-event-processor.cpp +++ b/dali/internal/event/events/hover-event-processor.cpp @@ -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. @@ -245,7 +245,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even DALI_LOG_INFO( gLogFilter, Debug::General, " State(%s), Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", TOUCH_POINT_STATE[iter->GetState()], iter->GetScreenPosition().x, iter->GetScreenPosition().y, - ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ), + ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ), ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ), hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); @@ -269,8 +269,8 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even Dali::Actor primaryHitActor = primaryPoint.hitActor; TouchPoint::State primaryPointState = primaryPoint.state; - DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryPoint.hitActor ? (void*)&primaryPoint.hitActor.GetBaseObject() : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetName().c_str() : "" ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryPoint.hitActor ? reinterpret_cast< void* >( &primaryPoint.hitActor.GetBaseObject() ) : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); if ( ( primaryPointState == TouchPoint::Started ) && ( hoverEvent.GetPointCount() == 1 ) && @@ -299,7 +299,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even { if ( lastPrimaryHitActor->GetLeaveRequired() ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() ); leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Leave ); } } @@ -307,7 +307,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even { // At this point mLastPrimaryHitActor was touchable and sensitive in the previous touch event process but is not in the current one. // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls) - DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit): (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() ); leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Interrupted ); } } @@ -325,7 +325,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even { if( lastConsumedActor->GetLeaveRequired() ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() ); EmitHoverSignals( lastConsumedActor, lastRenderTaskImpl, hoverEvent, TouchPoint::Leave ); } } @@ -333,7 +333,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even { // At this point mLastConsumedActor was touchable and sensitive in the previous touch event process but is not in the current one. // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls) - DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() ); EmitHoverSignals( mLastConsumedActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Interrupted ); } } diff --git a/dali/internal/event/events/touch-event-processor.cpp b/dali/internal/event/events/touch-event-processor.cpp index b9c305c..871d851 100644 --- a/dali/internal/event/events/touch-event-processor.cpp +++ b/dali/internal/event/events/touch-event-processor.cpp @@ -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. @@ -258,7 +258,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even DALI_LOG_INFO( gLogFilter, Debug::General, " State(%s), Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", TOUCH_POINT_STATE[iter->GetState()], iter->GetScreenPosition().x, iter->GetScreenPosition().y, - ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ), + ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ), ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ), hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); @@ -282,8 +282,8 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even Dali::Actor primaryHitActor = primaryPoint.GetHitActor(); PointState::Type primaryPointState = primaryPoint.GetState(); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryHitActor ? (void*)&primaryHitActor.GetBaseObject() : NULL, primaryHitActor ? primaryHitActor.GetName().c_str() : "" ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryHitActor ? reinterpret_cast< void* >( &primaryHitActor.GetBaseObject() ) : NULL, primaryHitActor ? primaryHitActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); if ( ( primaryPointState == PointState::DOWN ) && ( touchEvent.GetPointCount() == 1 ) && @@ -312,7 +312,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even { if ( lastPrimaryHitActor->GetLeaveRequired() ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() ); leaveEventConsumer = EmitTouchSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, touchEvent, touchData, PointState::LEAVE ); } } @@ -320,7 +320,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even { // At this point mLastPrimaryHitActor was touchable and sensitive in the previous touch event process but is not in the current one. // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls) - DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit): (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() ); leaveEventConsumer = EmitTouchSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, touchEvent, touchData, PointState::INTERRUPTED ); } } @@ -338,7 +338,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even { if( lastConsumedActor->GetLeaveRequired() ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() ); EmitTouchSignals( lastConsumedActor, lastRenderTaskImpl, touchEvent, touchData, PointState::LEAVE ); } } @@ -346,7 +346,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even { // At this point mLastConsumedActor was touchable and sensitive in the previous touch event process but is not in the current one. // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls) - DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() ); EmitTouchSignals( mLastConsumedActor.GetActor(), lastRenderTaskImpl, touchEvent, touchData, PointState::INTERRUPTED ); } } diff --git a/dali/internal/event/events/wheel-event-processor.cpp b/dali/internal/event/events/wheel-event-processor.cpp index 6d08325..0dcdb2f 100644 --- a/dali/internal/event/events/wheel-event-processor.cpp +++ b/dali/internal/event/events/wheel-event-processor.cpp @@ -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. @@ -142,15 +142,15 @@ void WheelEventProcessor::ProcessWheelEvent(const Integration::WheelEvent& event DALI_LOG_INFO( gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", event.point.x, event.point.y, - ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ), + ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ), ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ), hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); // Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached. Dali::Actor consumedActor = EmitWheelSignals( hitTestResults.actor, wheelEvent ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL, hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL, hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); } else { diff --git a/dali/internal/event/images/encoded-buffer-image-impl.cpp b/dali/internal/event/images/encoded-buffer-image-impl.cpp index 6696f4d..6666656 100644 --- a/dali/internal/event/images/encoded-buffer-image-impl.cpp +++ b/dali/internal/event/images/encoded-buffer-image-impl.cpp @@ -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. @@ -70,8 +70,8 @@ EncodedBufferImagePtr EncodedBufferImage::New( const uint8_t * const encodedImag // Get image size from buffer Dali::Integration::PlatformAbstraction& platformAbstraction = Internal::ThreadLocalStorage::Get().GetPlatformAbstraction(); const ImageDimensions expectedSize = platformAbstraction.GetClosestImageSize( buffer, size, fittingMode, samplingMode, orientationCorrection ); - image->mWidth = (unsigned int) expectedSize.GetWidth(); - image->mHeight = (unsigned int) expectedSize.GetHeight(); + image->mWidth = static_cast( expectedSize.GetWidth() ); + image->mHeight = static_cast( expectedSize.GetHeight() ); // Load the image synchronously Integration::BitmapPtr bitmap = platformAbstraction.DecodeBuffer( resourceType, &(buffer->GetVector()[0]), encodedImageByteCount ); diff --git a/dali/internal/event/rendering/frame-buffer-impl.cpp b/dali/internal/event/rendering/frame-buffer-impl.cpp index c2cfc80..20d09d3 100644 --- a/dali/internal/event/rendering/frame-buffer-impl.cpp +++ b/dali/internal/event/rendering/frame-buffer-impl.cpp @@ -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. @@ -59,8 +59,8 @@ void FrameBuffer::Initialize() void FrameBuffer::AttachColorTexture( TexturePtr texture, unsigned int mipmapLevel, unsigned int layer ) { - if( (unsigned int)( texture->GetWidth() / ( 1 << mipmapLevel ) ) == mWidth && - (unsigned int)( texture->GetHeight() / ( 1 << mipmapLevel ) ) == mHeight ) + if( ( texture->GetWidth() / ( 1u << mipmapLevel ) == mWidth ) && + ( texture->GetHeight() / ( 1u << mipmapLevel ) == mHeight ) ) { mColor = texture; AttachColorTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel, layer ); diff --git a/dali/internal/event/rendering/sampler-impl.cpp b/dali/internal/event/rendering/sampler-impl.cpp index ecec053..8f4f25b 100644 --- a/dali/internal/event/rendering/sampler-impl.cpp +++ b/dali/internal/event/rendering/sampler-impl.cpp @@ -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. @@ -39,7 +39,7 @@ void Sampler::SetFilterMode( Dali::FilterMode::Type minFilter, Dali::FilterMode: { if( NULL != mRenderObject ) { - SetFilterModeMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, (unsigned int)minFilter, (unsigned int)magFilter ); + SetFilterModeMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, static_cast< unsigned int >( minFilter ), static_cast< unsigned int >( magFilter ) ); } } @@ -47,7 +47,7 @@ void Sampler::SetWrapMode( Dali::WrapMode::Type rWrap, Dali::WrapMode::Type sWra { if( NULL != mRenderObject ) { - SetWrapModeMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, (unsigned int)rWrap, (unsigned int)sWrap, (unsigned int)tWrap ); + SetWrapModeMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, static_cast< unsigned int >( rWrap ), static_cast< unsigned int >( sWrap ), static_cast< unsigned int >( tWrap ) ); } } diff --git a/dali/internal/render/data-providers/property-buffer-data-provider.h b/dali/internal/render/data-providers/property-buffer-data-provider.h index 61e1e30..51c8f64 100644 --- a/dali/internal/render/data-providers/property-buffer-data-provider.h +++ b/dali/internal/render/data-providers/property-buffer-data-provider.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_BUFFER_DATA_PROVIDER_H /* - * 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. @@ -22,7 +22,6 @@ // INTERNAL INCLUDES #include -#include #include namespace Dali diff --git a/dali/internal/render/data-providers/uniform-map-data-provider.h b/dali/internal/render/data-providers/uniform-map-data-provider.h index 97bcd39..7d7e120 100644 --- a/dali/internal/render/data-providers/uniform-map-data-provider.h +++ b/dali/internal/render/data-providers/uniform-map-data-provider.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_UNIFORM_MAP_DATA_PROVIDER_H /* - * 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. @@ -17,7 +17,6 @@ * limitations under the License. */ #include -#include #include namespace Dali diff --git a/dali/internal/render/gl-resources/context.h b/dali/internal/render/gl-resources/context.h index 28afbfd..59ed396 100644 --- a/dali/internal/render/gl-resources/context.h +++ b/dali/internal/render/gl-resources/context.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_CONTEXT_H__ /* - * 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. @@ -119,7 +119,7 @@ public: */ void PrintGlString(const char* stringName, GLenum stringId) { - DALI_LOG_INFO(Debug::Filter::gRender, Debug::General, "GL %s = %s\n", stringName, (const char *)GetString( stringId ) ); + DALI_LOG_INFO(Debug::Filter::gRender, Debug::General, "GL %s = %s\n", stringName, reinterpret_cast< const char * >( GetString( stringId ) ) ); } /**************************************************************************************** diff --git a/dali/internal/render/renderers/render-frame-buffer.h b/dali/internal/render/renderers/render-frame-buffer.h index 00d2996..942e5b3 100644 --- a/dali/internal/render/renderers/render-frame-buffer.h +++ b/dali/internal/render/renderers/render-frame-buffer.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_RENDER_FRAME_BUFFER_H /* - * 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. @@ -22,7 +22,6 @@ #include #include #include -#include namespace Dali { diff --git a/dali/internal/render/renderers/render-property-buffer.cpp b/dali/internal/render/renderers/render-property-buffer.cpp index 6be4623..ccbd2d0 100644 --- a/dali/internal/render/renderers/render-property-buffer.cpp +++ b/dali/internal/render/renderers/render-property-buffer.cpp @@ -1,3 +1,19 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #include #include // Dali::Internal::PropertyBuffer @@ -183,7 +199,7 @@ unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vector( attributeOffset ) ); } } diff --git a/dali/internal/render/renderers/render-renderer.cpp b/dali/internal/render/renderers/render-renderer.cpp index 97f45ee..593316f 100644 --- a/dali/internal/render/renderers/render-renderer.cpp +++ b/dali/internal/render/renderers/render-renderer.cpp @@ -535,7 +535,7 @@ void Renderer::Render( Context& context, Program* program = mRenderDataProvider->GetShader().GetProgram(); if( !program ) { - DALI_LOG_ERROR( "Failed to get program for shader at address %p.\n", (void*)&mRenderDataProvider->GetShader() ); + DALI_LOG_ERROR( "Failed to get program for shader at address %p.\n", reinterpret_cast< void* >( &mRenderDataProvider->GetShader() ) ); return; } diff --git a/dali/internal/render/shaders/program.cpp b/dali/internal/render/shaders/program.cpp index 5739f18..451de0b 100644 --- a/dali/internal/render/shaders/program.cpp +++ b/dali/internal/render/shaders/program.cpp @@ -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. @@ -258,7 +258,7 @@ void Program::GetActiveSamplerUniforms() for( int i=0; i( i ), uniformMaxNameLength, &nameLength, &number, &type, name ); if( type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES ) diff --git a/dali/internal/update/gestures/scene-graph-pan-gesture.cpp b/dali/internal/update/gestures/scene-graph-pan-gesture.cpp index 596a391..6218102 100644 --- a/dali/internal/update/gestures/scene-graph-pan-gesture.cpp +++ b/dali/internal/update/gestures/scene-graph-pan-gesture.cpp @@ -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. @@ -137,7 +137,7 @@ void PanGesture::PredictiveAlgorithm1(int eventsThisFrame, PanInfo& gestureOut, ++iter; continue; } - float previousValueWeight = (float)(MAX_GESTURE_AGE - (lastVSyncTime - lastTime)) / (float)MAX_GESTURE_AGE; + float previousValueWeight = ( static_cast< float >( MAX_GESTURE_AGE ) - (lastVSyncTime - lastTime) ) / static_cast< float >( MAX_GESTURE_AGE ); float velMag = currentGesture.screen.velocity.Length(); float velDiff = velMag - screenVelocity.Length(); float acceleration = 0.0f; diff --git a/dali/internal/update/manager/render-instruction-processor.h b/dali/internal/update/manager/render-instruction-processor.h index ecdb451..95cc818 100644 --- a/dali/internal/update/manager/render-instruction-processor.h +++ b/dali/internal/update/manager/render-instruction-processor.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_PROCESSOR_H /* - * 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. @@ -21,7 +21,6 @@ // INTERNAL INCLUDES #include #include -#include #include namespace Dali diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index 6496987..4f92d2c 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -22,8 +22,6 @@ #include #include -#include - #include #include #include diff --git a/dali/public-api/common/dali-common.cpp b/dali/public-api/common/dali-common.cpp index c2c16cc..78dd20d 100644 --- a/dali/public-api/common/dali-common.cpp +++ b/dali/public-api/common/dali-common.cpp @@ -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. @@ -69,7 +69,7 @@ std::string Demangle(const char* symbol) size_t tokenLength = endOfToken - startOfToken; // Allocate space for symbol - char *mangledSymbol = (char*)malloc(tokenLength+1u); + char *mangledSymbol = reinterpret_cast< char* >( malloc( tokenLength + 1u ) ); if(mangledSymbol != NULL) { strncpy(mangledSymbol, startOfToken, tokenLength); diff --git a/dali/public-api/common/dali-vector.cpp b/dali/public-api/common/dali-vector.cpp index 9dd7d8c..2e2bd8f 100644 --- a/dali/public-api/common/dali-vector.cpp +++ b/dali/public-api/common/dali-vector.cpp @@ -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. @@ -75,7 +75,7 @@ void VectorBase::Reserve( SizeType capacity, SizeType elementSize ) if( capacity > oldCapacity ) { const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize; - void* wholeData = (void*) new unsigned char[ wholeAllocation ]; + void* wholeData = reinterpret_cast< void* >( new unsigned char[ wholeAllocation ] ); DALI_ASSERT_ALWAYS( wholeData && "VectorBase::Reserve - Memory allocation failed" ); #if defined( DEBUG_ENABLED ) diff --git a/dali/public-api/math/quaternion.cpp b/dali/public-api/math/quaternion.cpp index cfa8fa9..19546b4 100644 --- a/dali/public-api/math/quaternion.cpp +++ b/dali/public-api/math/quaternion.cpp @@ -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. @@ -302,12 +302,12 @@ bool Quaternion::operator!=( const Quaternion& rhs ) const float Quaternion::Length() const { - return (float)sqrt(mVector.w * mVector.w + mVector.Dot(mVector)); + return static_cast< float >( sqrt(mVector.w * mVector.w + mVector.Dot(mVector) ) ); } float Quaternion::LengthSquared() const { - return (float)(mVector.w * mVector.w + mVector.Dot(mVector)); + return static_cast< float >( mVector.w * mVector.w + mVector.Dot(mVector) ); } void Quaternion::Normalize()