[Libreoffice-commits] core.git: editeng/source
Caolán McNamara
caolanm at redhat.com
Mon Jun 13 15:00:37 UTC 2016
editeng/source/editeng/impedit3.cxx | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
New commits:
commit 558df654ed5096fc47f91086d01dd2ebec7a2d75
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 13 15:59:52 2016 +0100
Revert "coverity#1362679 try and tell coverty these are non-null by restoring..."
didn't mean to push that just yet
This reverts commit 9c13ba3b79249dae41c8ac844e435a1a226cd56e.
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index b4c7bb6..f52df1f 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.data() + nTmpPos - pLine->GetStart();
+ long* pDXArray = &rArray[0] + nTmpPos - pLine->GetStart();
bCompressedChars |= ImplCalcAsianCompression(
pNode, pPortion, nTmpPos, pDXArray, 10000, false);
}
@@ -1270,7 +1270,11 @@ 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 = pLine->GetCharPosArray().data() + (nPortionStart - pLine->GetStart());
+ long* pDXArray = nullptr;
+ if (!pLine->GetCharPosArray().empty())
+ {
+ pDXArray = &pLine->GetCharPosArray()[0] + (nPortionStart - pLine->GetStart());
+ }
ImplCalcAsianCompression(
pNode, pPortion, nPortionStart, pDXArray, 10000, true);
}
@@ -3064,7 +3068,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
aText = pPortion->GetNode()->GetString();
nTextStart = nIndex;
nTextLen = rTextPortion.GetLen();
- pDXArray = pLine->GetCharPosArray().data() + (nIndex - pLine->GetStart());
+ if (!pLine->GetCharPosArray().empty())
+ pDXArray = &pLine->GetCharPosArray()[0]+( nIndex-pLine->GetStart() );
// Paint control characters (#i55716#)
if ( aStatus.MarkFields() )
@@ -4431,9 +4436,13 @@ 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 = pLine->GetCharPosArray().data() + (nTxtPortionStart - pLine->GetStart());
- if ( pTP->GetExtraInfos()->pOrgDXArray )
- memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray, (pTP->GetLen()-1)*sizeof(sal_Int32) );
+ 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) );
+ }
ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, (sal_uInt16)nCompressPercent, true );
}
}
More information about the Libreoffice-commits
mailing list