From 0bbbd067294ad02a039d45eac4b8131dde43677c Mon Sep 17 00:00:00 2001 From: Kimmo Hoikka Date: Mon, 31 Jul 2017 15:19:43 +0100 Subject: [PATCH] Fix some CppCheck errors dali/internal/update/gestures/scene-graph-pan-gesture.h 138 operatorEqVarError dali/integration-api/events/key-event-integ.cpp 42 passedByValue dali/internal/event/actors/actor-impl.cpp 4867 redundantCopyLocalConst dali/internal/event/animation/linear-constrainer-impl.h 113 arrayIndexThenCheck dali/internal/event/events/key-event-processor.cpp 53 redundantAssignment dali/internal/event/actors/actor-impl.h 1872 passedByValue dali/internal/render/common/render-algorithms.cpp 203 duplicateBreak dali/public-api/math/quaternion.cpp 54 useInitializationList Change-Id: Ifa3b1cd65187d0e0c00f81368ba90a2988975739 --- dali/integration-api/events/key-event-integ.cpp | 4 ++-- dali/integration-api/events/key-event-integ.h | 4 ++-- dali/internal/event/actors/actor-impl.cpp | 6 ++---- dali/internal/event/actors/actor-impl.h | 2 +- dali/internal/event/animation/linear-constrainer-impl.h | 4 ++-- dali/internal/event/events/key-event-processor.cpp | 5 ++--- dali/internal/render/common/render-algorithms.cpp | 3 +-- dali/internal/render/renderers/render-texture.cpp | 6 +++--- dali/internal/render/renderers/render-texture.h | 1 + dali/internal/update/gestures/scene-graph-pan-gesture.h | 3 ++- 10 files changed, 18 insertions(+), 20 deletions(-) diff --git a/dali/integration-api/events/key-event-integ.cpp b/dali/integration-api/events/key-event-integ.cpp index 79da685..56dd3e4 100644 --- a/dali/integration-api/events/key-event-integ.cpp +++ b/dali/integration-api/events/key-event-integ.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. @@ -39,7 +39,7 @@ KeyEvent::KeyEvent() } KeyEvent::KeyEvent( const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier, - unsigned long timeStamp, const State& keyState, const std::string deviceName, + unsigned long timeStamp, const State& keyState, const std::string& deviceName, const DevelDevice::Class::Type deviceClass, const DevelDevice::Subclass::Type deviceSubclass ) : Event( Key ), keyName( keyName ), diff --git a/dali/integration-api/events/key-event-integ.h b/dali/integration-api/events/key-event-integ.h index 536d3ef..9040707 100644 --- a/dali/integration-api/events/key-event-integ.h +++ b/dali/integration-api/events/key-event-integ.h @@ -2,7 +2,7 @@ #define __DALI_INTEGRATION_KEY_EVENT_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. @@ -71,7 +71,7 @@ struct KeyEvent : public Event int keyModifier, unsigned long timeStamp, const State& keyState, - const std::string deviceName, + const std::string& deviceName, const DevelDevice::Class::Type deviceClass, const DevelDevice::Subclass::Type deviceSubclass ); diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index e0e1604..ea7fe9f 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -4742,7 +4742,7 @@ void Actor::NegotiateDimensions( const Vector2& allocatedSize ) } } -Vector2 Actor::ApplySizeSetPolicy( const Vector2 size ) +Vector2 Actor::ApplySizeSetPolicy( const Vector2& size ) { switch( mRelayoutData->sizeSetPolicy ) { @@ -4864,8 +4864,6 @@ void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& cont SetNegotiatedSize( container ); // Negotiate down to children - const Vector2 newBounds = mTargetSize.GetVectorXY(); - for( unsigned int i = 0, count = GetChildCount(); i < count; ++i ) { ActorPtr child = GetChildAt( i ); @@ -4887,7 +4885,7 @@ void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& cont // Only relayout if required if( child->RelayoutRequired() ) { - container.Add( Dali::Actor( child.Get() ), newBounds ); + container.Add( Dali::Actor( child.Get() ), mTargetSize.GetVectorXY() ); } } DALI_LOG_TIMER_END( NegSizeTimer1, gLogRelayoutFilter, Debug::Concise, "NegotiateSize() took: "); diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index d931353..2f73da5 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -1869,7 +1869,7 @@ private: * @param[in] size The size to apply the policy to * @return Return the adjusted size */ - Vector2 ApplySizeSetPolicy( const Vector2 size ); + Vector2 ApplySizeSetPolicy( const Vector2& size ); /** * Retrieve the parent object of an Actor. diff --git a/dali/internal/event/animation/linear-constrainer-impl.h b/dali/internal/event/animation/linear-constrainer-impl.h index 6a6d78d..22cec38 100644 --- a/dali/internal/event/animation/linear-constrainer-impl.h +++ b/dali/internal/event/animation/linear-constrainer-impl.h @@ -110,7 +110,7 @@ struct LinearConstraintFunctor } else { - while( t >= mProgress[min] && min < valueCount-1 ) + while( ( min < valueCount-1 )&&( t >= mProgress[min] ) ) { min++; } @@ -118,7 +118,7 @@ struct LinearConstraintFunctor min--; max = min+1; - if( min >= valueCount-1) + if( min >= valueCount-1 ) { min = max = valueCount-1; tLocal = 0.0f; diff --git a/dali/internal/event/events/key-event-processor.cpp b/dali/internal/event/events/key-event-processor.cpp index 5afb81b..92daa90 100644 --- a/dali/internal/event/events/key-event-processor.cpp +++ b/dali/internal/event/events/key-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. @@ -42,7 +42,6 @@ KeyEventProcessor::~KeyEventProcessor() void KeyEventProcessor::ProcessKeyEvent(const Integration::KeyEvent& event) { - bool consumed = false; KeyEvent keyEvent(event.keyName, event.keyString, event.keyCode, event.keyModifier, event.time, static_cast(event.state)); GetImplementation( &keyEvent )->SetDeviceName( event.deviceName ); @@ -50,7 +49,7 @@ void KeyEventProcessor::ProcessKeyEvent(const Integration::KeyEvent& event) GetImplementation( &keyEvent )->SetDeviceSubclass( event.deviceSubclass ); // Emit the key event signal from stage. - consumed = mStage.EmitKeyEventGeneratedSignal( keyEvent ); + bool consumed = mStage.EmitKeyEventGeneratedSignal( keyEvent ); if( !consumed ) { diff --git a/dali/internal/render/common/render-algorithms.cpp b/dali/internal/render/common/render-algorithms.cpp index 0c50ce4..e31b8fe 100644 --- a/dali/internal/render/common/render-algorithms.cpp +++ b/dali/internal/render/common/render-algorithms.cpp @@ -199,8 +199,7 @@ inline void SetupStencilBuffer( const RenderItem& item, Context& context, bool& // Setup the color buffer based on the RenderMode. context.ColorMask( renderMode == RenderMode::COLOR ); - return; - break; // Break statement for consistency (although return will be called instead). + break; } case RenderMode::STENCIL: diff --git a/dali/internal/render/renderers/render-texture.cpp b/dali/internal/render/renderers/render-texture.cpp index b4646d5..572e4f2 100644 --- a/dali/internal/render/renderers/render-texture.cpp +++ b/dali/internal/render/renderers/render-texture.cpp @@ -17,13 +17,13 @@ // CLASS HEADER #include +// EXTERNAL INCLUDES +#include //floor, log2 + // INTERNAL INCLUDES #include #include -// EXTERNAL INCLUDES -#include //floor, log2 - namespace Dali { namespace Internal diff --git a/dali/internal/render/renderers/render-texture.h b/dali/internal/render/renderers/render-texture.h index f96ca9d..d9192e0 100644 --- a/dali/internal/render/renderers/render-texture.h +++ b/dali/internal/render/renderers/render-texture.h @@ -21,6 +21,7 @@ #include // INTERNAL INCLUDES +#include // Dali::ImageDimensions #include #include #include diff --git a/dali/internal/update/gestures/scene-graph-pan-gesture.h b/dali/internal/update/gestures/scene-graph-pan-gesture.h index 459c8fe..ad4e5e0 100644 --- a/dali/internal/update/gestures/scene-graph-pan-gesture.h +++ b/dali/internal/update/gestures/scene-graph-pan-gesture.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_PAN_GESTURE_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. @@ -143,6 +143,7 @@ public: state = rhs.state; local = rhs.local; screen = rhs.screen; + read = rhs.read; } return *this; -- 2.7.4