diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-06-13 16:00:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-06-13 19:28:19 +0000 |
commit | e0c6f71a8ea87c8a424c57e6f71f02f143d37ee9 (patch) | |
tree | d48508bd6ec638c0b89ab8df8556ccea94fdfc1c /editeng/source | |
parent | de432c0af127cc42a75292ec2288c13cbe0f1a44 (diff) |
coverity#1362679 try and tell coverity these are non-null by restoring...
to the pre vectorization code layout before...
commit e5d378b1ba04c470e0c6c16b48af97ab5818e2bb
Author: Kohei Yoshida <kohei.yoshida@gmail.com>
Date: Tue Apr 3 18:26:29 2012 -0400
Check for empty-ness of vector before accessing the first element.
I hope this will keep Stephan's tinderbox happy. If not...
changed it, now that c++11 data is available to us
Change-Id: I184092502d1f30fcec78f3fa807de70ddc6c2aef
Reviewed-on: https://gerrit.libreoffice.org/26224
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index f52df1fed348..b4c7bb6eb75b 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1099,7 +1099,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if ( pPortion->GetLen() && GetAsianCompressionMode() ) { EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray(); - long* pDXArray = &rArray[0] + nTmpPos - pLine->GetStart(); + long* pDXArray = rArray.data() + nTmpPos - pLine->GetStart(); bCompressedChars |= ImplCalcAsianCompression( pNode, pPortion, nTmpPos, pDXArray, 10000, false); } @@ -1270,11 +1270,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed ) { // I need the manipulated DXArray for determining the break position... - long* pDXArray = nullptr; - if (!pLine->GetCharPosArray().empty()) - { - pDXArray = &pLine->GetCharPosArray()[0] + (nPortionStart - pLine->GetStart()); - } + long* pDXArray = pLine->GetCharPosArray().data() + (nPortionStart - pLine->GetStart()); ImplCalcAsianCompression( pNode, pPortion, nPortionStart, pDXArray, 10000, true); } @@ -3068,8 +3064,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt aText = pPortion->GetNode()->GetString(); nTextStart = nIndex; nTextLen = rTextPortion.GetLen(); - if (!pLine->GetCharPosArray().empty()) - pDXArray = &pLine->GetCharPosArray()[0]+( nIndex-pLine->GetStart() ); + pDXArray = pLine->GetCharPosArray().data() + (nIndex - pLine->GetStart()); // Paint control characters (#i55716#) if ( aStatus.MarkFields() ) @@ -4436,13 +4431,9 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP ); sal_Int32 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion ); DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" ); - long* pDXArray = nullptr; - if (!pLine->GetCharPosArray().empty()) - { - pDXArray = &pLine->GetCharPosArray()[0]+( nTxtPortionStart-pLine->GetStart() ); - if ( pTP->GetExtraInfos()->pOrgDXArray ) - memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray, (pTP->GetLen()-1)*sizeof(sal_Int32) ); - } + long* pDXArray = pLine->GetCharPosArray().data() + (nTxtPortionStart - pLine->GetStart()); + if ( pTP->GetExtraInfos()->pOrgDXArray ) + memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray, (pTP->GetLen()-1)*sizeof(sal_Int32) ); ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, (sal_uInt16)nCompressPercent, true ); } } |