summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-06-13 15:55:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-06-13 15:59:05 +0100
commit9c13ba3b79249dae41c8ac844e435a1a226cd56e (patch)
tree278b6cffd8da870a04568394da32050b031454c7 /editeng
parent1092cc0c75f6d2ab649dd31b1db9f0a9f0944355 (diff)
coverity#1362679 try and tell coverty 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: Ie5e584c02f51d9cc8dc3b3f65f7cfc90822f65c2
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit3.cxx21
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 );
}
}