editeng/source/editeng/impedit3.cxx | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
New commits: commit e0c6f71a8ea87c8a424c57e6f71f02f143d37ee9 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Jun 13 16:00:34 2016 +0100 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.yosh...@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 <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index f52df1f..b4c7bb6 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 ); } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits