From b87ea88c9c1af89ddbca860abda6ed9154820ab7 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Tue, 15 Nov 2016 15:35:14 +0000 Subject: [PATCH] Fix various SVACE errors Change-Id: I9bef1e40dbcd4a5feb8bf518ade181e5e9d08cdb --- .../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h | 6 +++++- automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp | 5 ++++- .../internal/controls/scrollable/item-view/depth-layout.cpp | 4 ++-- dali-toolkit/internal/controls/scrollable/item-view/grid-layout.cpp | 4 ++-- dali-toolkit/internal/image-loader/image-load-thread.h | 4 +++- dali-toolkit/internal/scripting/script-plugin-proxy.h | 6 +++++- dali-toolkit/internal/text/multi-language-support-impl.cpp | 3 +-- dali-toolkit/internal/text/rendering/atlas/atlas-mesh-factory.cpp | 5 ++++- dali-toolkit/internal/text/text-controller-impl.cpp | 1 + dali-toolkit/internal/visuals/gradient/gradient-visual.cpp | 2 +- dali-toolkit/internal/visuals/npatch-loader.cpp | 6 +++--- 11 files changed, 31 insertions(+), 15 deletions(-) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h index 278bcd7..8ce96a4 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h @@ -2,7 +2,7 @@ #define __TEST_GL_SYNC_ABSTRACTION_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -108,6 +108,10 @@ public: // TEST FUNCTIONS int GetNumberOfSyncObjects(); private: + + TestGlSyncAbstraction( const TestGlSyncAbstraction& ); ///< Undefined + TestGlSyncAbstraction& operator=( const TestGlSyncAbstraction& ); ///< Undefined + typedef std::vector SyncContainer; typedef SyncContainer::iterator SyncIter; SyncContainer mSyncObjects; ///< The sync objects diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp index 447c78a..aa51150 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -291,6 +291,9 @@ int UtcDaliItemLayoutSetAndGetOrientation(void) DALI_TEST_CHECK(flickSpeedFactor != 0.0f); + // White box test here: -( itemId / NoOfItemsPerRow(default 4) ) * NoOfItemsPerRow + DALI_TEST_EQUALS( -1.0f, gridLayout->GetItemScrollToPosition( 1 ), TEST_LOCATION ); + ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH ); view.AddLayout(*depthLayout); diff --git a/dali-toolkit/internal/controls/scrollable/item-view/depth-layout.cpp b/dali-toolkit/internal/controls/scrollable/item-view/depth-layout.cpp index 557a089..613af0a 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/depth-layout.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/depth-layout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -390,7 +390,7 @@ float DepthLayout::GetClosestAnchorPosition(float layoutPosition) const float DepthLayout::GetItemScrollToPosition(unsigned int itemId) const { - float rowIndex = static_cast(itemId / mImpl->mNumberOfColumns); + float rowIndex = static_cast< float >( itemId ) / mImpl->mNumberOfColumns; return -rowIndex * static_cast(mImpl->mNumberOfColumns); } diff --git a/dali-toolkit/internal/controls/scrollable/item-view/grid-layout.cpp b/dali-toolkit/internal/controls/scrollable/item-view/grid-layout.cpp index e1ca4d0..4ef642c 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/grid-layout.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/grid-layout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -390,7 +390,7 @@ float GridLayout::GetClosestAnchorPosition(float layoutPosition) const float GridLayout::GetItemScrollToPosition(unsigned int itemId) const { - float rowIndex = static_cast(itemId / mImpl->mNumberOfColumns); + float rowIndex = static_cast< float >( itemId ) / mImpl->mNumberOfColumns; return -rowIndex * static_cast(mImpl->mNumberOfColumns); } diff --git a/dali-toolkit/internal/image-loader/image-load-thread.h b/dali-toolkit/internal/image-loader/image-load-thread.h index 4eddce7..85ea419 100644 --- a/dali-toolkit/internal/image-loader/image-load-thread.h +++ b/dali-toolkit/internal/image-loader/image-load-thread.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_IMAGE_LOAD_THREAD_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -83,6 +83,8 @@ public: * Add a task in to the loading queue * * @param[in] task The task added to the queue. + * + * @note This class takes ownership of the task object */ void AddTask( LoadingTask* task ); diff --git a/dali-toolkit/internal/scripting/script-plugin-proxy.h b/dali-toolkit/internal/scripting/script-plugin-proxy.h index 2c359c7..eff47e3 100644 --- a/dali-toolkit/internal/scripting/script-plugin-proxy.h +++ b/dali-toolkit/internal/scripting/script-plugin-proxy.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCRIPT_PLUGIN_PROXY_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -79,6 +79,10 @@ public: bool IsInitialized() const; private: + + ScriptPluginProxy( const ScriptPluginProxy& ); ///< Undefined + ScriptPluginProxy& operator=( const ScriptPluginProxy& ); ///< Undefined + /** * @brief Dynamically loads the script plugin. */ diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index ae9a68b..32e7c38 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -565,7 +565,6 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, // At this point the character common for all scripts has no font assigned. // If there is a valid previously cached default font for it, use that one. fontId = cachedDefaultFontId; - isValidFont = true; } } else diff --git a/dali-toolkit/internal/text/rendering/atlas/atlas-mesh-factory.cpp b/dali-toolkit/internal/text/rendering/atlas/atlas-mesh-factory.cpp index 4da6c1f..4017f79 100644 --- a/dali-toolkit/internal/text/rendering/atlas/atlas-mesh-factory.cpp +++ b/dali-toolkit/internal/text/rendering/atlas/atlas-mesh-factory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -83,6 +83,9 @@ void CreateQuad( SizeType imageWidth, Vector2 topLeft = Vector2( position.x - 0.5f, position.y - 0.5f ); float fBlockX = texelBlockWidth * static_cast< float >( block % atlasWidthInBlocks ); + + // In the next expression, we have purposely made ( block / atlasWidthInBlocks ) yield an integer value and then convert to float as + // we do not want the remainder in that expression to affect the value of fBlockY float fBlockY = texelBlockHeight * static_cast< float >( block / atlasWidthInBlocks ); // Add on texture filtering compensation ( half a texel plus compensation for filled pixel in top left corner ) diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 6d2a022..ee7c4ac 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -75,6 +75,7 @@ EventData::EventData( DecoratorPtr decorator ) mPlaceholderTextColor( 0.8f, 0.8f, 0.8f, 0.8f ), mEventQueue(), mInputStyleChangedQueue(), + mPreviousState( INACTIVE ), mState( INACTIVE ), mPrimaryCursorPosition( 0u ), mLeftSelectionPosition( 0u ), diff --git a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp index 6f50a9a..bfc9130 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp +++ b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp @@ -449,7 +449,7 @@ bool GradientVisual::NewGradient(Type gradientType, const Property::Map& propert if( spread ) { Toolkit::GradientVisual::SpreadMethod::Type spreadMethod = Toolkit::GradientVisual::SpreadMethod::PAD; - if( Scripting::GetEnumerationProperty( *spread, SPREAD_METHOD_TABLE, SPREAD_METHOD_TABLE_COUNT, spreadMethod ) ); + if( Scripting::GetEnumerationProperty( *spread, SPREAD_METHOD_TABLE, SPREAD_METHOD_TABLE_COUNT, spreadMethod ) ) { mGradient->SetSpreadMethod( spreadMethod ); } diff --git a/dali-toolkit/internal/visuals/npatch-loader.cpp b/dali-toolkit/internal/visuals/npatch-loader.cpp index 026450d..6e3c8ec 100644 --- a/dali-toolkit/internal/visuals/npatch-loader.cpp +++ b/dali-toolkit/internal/visuals/npatch-loader.cpp @@ -59,12 +59,12 @@ std::size_t NPatchLoader::Load( const std::string& url ) NinePatchImage ninePatch = NinePatchImage::New( url ); if( ninePatch ) { - Data* data = new Data(); - data->hash = hash; - data->url = url; BufferImage croppedImage = ninePatch.CreateCroppedBufferImage(); if( croppedImage ) { + Data* data = new Data(); + data->hash = hash; + data->url = url; data->textureSet = TextureSet::New(); TextureSetImage( data->textureSet, 0u, croppedImage ); data->croppedWidth = croppedImage.GetWidth(); -- 2.7.4