Kaydet (Commit) 9c13ba3b authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1362679 try and tell coverty these are non-null by restoring...

to the pre vectorization code layout before...

commit e5d378b1
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
üst 1092cc0c
...@@ -1099,7 +1099,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) ...@@ -1099,7 +1099,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
if ( pPortion->GetLen() && GetAsianCompressionMode() ) if ( pPortion->GetLen() && GetAsianCompressionMode() )
{ {
EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray(); EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
long* pDXArray = &rArray[0] + nTmpPos - pLine->GetStart(); long* pDXArray = rArray.data() + nTmpPos - pLine->GetStart();
bCompressedChars |= ImplCalcAsianCompression( bCompressedChars |= ImplCalcAsianCompression(
pNode, pPortion, nTmpPos, pDXArray, 10000, false); pNode, pPortion, nTmpPos, pDXArray, 10000, false);
} }
...@@ -1270,11 +1270,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) ...@@ -1270,11 +1270,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed ) if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed )
{ {
// I need the manipulated DXArray for determining the break position... // I need the manipulated DXArray for determining the break position...
long* pDXArray = nullptr; long* pDXArray = pLine->GetCharPosArray().data() + (nPortionStart - pLine->GetStart());
if (!pLine->GetCharPosArray().empty())
{
pDXArray = &pLine->GetCharPosArray()[0] + (nPortionStart - pLine->GetStart());
}
ImplCalcAsianCompression( ImplCalcAsianCompression(
pNode, pPortion, nPortionStart, pDXArray, 10000, true); pNode, pPortion, nPortionStart, pDXArray, 10000, true);
} }
...@@ -3068,8 +3064,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt ...@@ -3068,8 +3064,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
aText = pPortion->GetNode()->GetString(); aText = pPortion->GetNode()->GetString();
nTextStart = nIndex; nTextStart = nIndex;
nTextLen = rTextPortion.GetLen(); nTextLen = rTextPortion.GetLen();
if (!pLine->GetCharPosArray().empty()) pDXArray = pLine->GetCharPosArray().data() + (nIndex - pLine->GetStart());
pDXArray = &pLine->GetCharPosArray()[0]+( nIndex-pLine->GetStart() );
// Paint control characters (#i55716#) // Paint control characters (#i55716#)
if ( aStatus.MarkFields() ) if ( aStatus.MarkFields() )
...@@ -4436,13 +4431,9 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* ...@@ -4436,13 +4431,9 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP ); sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP );
sal_Int32 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion ); sal_Int32 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion );
DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" ); DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" );
long* pDXArray = nullptr; long* pDXArray = pLine->GetCharPosArray().data() + (nTxtPortionStart - pLine->GetStart());
if (!pLine->GetCharPosArray().empty()) if ( pTP->GetExtraInfos()->pOrgDXArray )
{ memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray, (pTP->GetLen()-1)*sizeof(sal_Int32) );
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 ); ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, (sal_uInt16)nCompressPercent, true );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment