From 0697056b2ada1017c577c441c1c517ce8c08279f Mon Sep 17 00:00:00 2001 From: Xiangyin Ma Date: Fri, 14 Nov 2014 17:07:33 +0000 Subject: [PATCH 1/1] (toolkit) fix klocwork issues Change-Id: I37803bebef48a9bf836b77eec6e2984296afc8f0 --- .../controls/text-input/text-input-decorator-impl.cpp | 1 + .../text-input/text-input-text-highlight-impl.cpp | 15 +++++++++------ .../focus-manager/keyboard-focus-manager-impl.cpp | 2 -- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp b/base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp index 6ac183f..9f83898 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp @@ -93,6 +93,7 @@ Decorator::Decorator( TextViewCharacterPositioning& textViewManager, TextInputTe mCursorRTLEnabled( false ), mIsGrabHandleInScrollArea( false ), mIsCursorInScrollArea( false ), + mGrabHandleVisibility( false ), mGrabHandleEnabled( true ) { } diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-text-highlight-impl.cpp b/base/dali-toolkit/internal/controls/text-input/text-input-text-highlight-impl.cpp index 469c0aa..7475678 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-text-highlight-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-input/text-input-text-highlight-impl.cpp @@ -208,12 +208,15 @@ TextHighlight::HighlightInfo TextHighlight::CalculateHighlightInfo( std::size_t { lastIt = std::max( textLayoutInfo.mCharacterLayoutInfoTable.begin(), lastIt - 1 ); } - const Size rowSize( mTextViewCharacterPositioning.GetRowRectFromCharacterPosition( lastIt - textLayoutInfo.mCharacterLayoutInfoTable.begin(), min, max ) ); - maxRowLeft = std::min(maxRowLeft, min.x); - maxRowRight = std::max(maxRowRight, max.x); - float rowBottom = lastIt->mPosition.y - textLayoutInfo.mScrollOffset.y; - float rowTop = rowBottom - rowSize.height; - newHighlightInfo.AddQuad( rowLeft, rowTop, rowRight, rowBottom ); + if( lastIt != end ) + { + const Size rowSize( mTextViewCharacterPositioning.GetRowRectFromCharacterPosition( lastIt - textLayoutInfo.mCharacterLayoutInfoTable.begin(), min, max ) ); + maxRowLeft = std::min(maxRowLeft, min.x); + maxRowRight = std::max(maxRowRight, max.x); + float rowBottom = lastIt->mPosition.y - textLayoutInfo.mScrollOffset.y; + float rowTop = rowBottom - rowSize.height; + newHighlightInfo.AddQuad( rowLeft, rowTop, rowRight, rowBottom ); + } } } diff --git a/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index dffe9d5..0ccc095 100644 --- a/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -559,8 +559,6 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) // Move the focus towards right MoveFocus(Toolkit::Control::Right); } - - isFocusStartableKey = true; } else { -- 2.7.4