diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-06-08 22:27:29 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-08 22:52:32 +0200 |
commit | 725b725e9744c78f7fcf54a8cf42614fca7ce15e (patch) | |
tree | 8738a3fad649750fdf1892dbcec61cefcbee7322 /svtools | |
parent | 2076d5ce963a9e9b7beb2707134c8e069953a0e4 (diff) |
fix missing braces in TextEngine::CreateLines in previous commit
also fix various DBG_UTIL only code
Change-Id: I53b6c65f4a5769cb0e4849e3d30e6fb78449ecce
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/edit/textdata.cxx | 6 | ||||
-rw-r--r-- | svtools/source/edit/texteng.cxx | 38 |
2 files changed, 26 insertions, 18 deletions
diff --git a/svtools/source/edit/textdata.cxx b/svtools/source/edit/textdata.cxx index 16ac0685cfed..7d55ee13cc6a 100644 --- a/svtools/source/edit/textdata.cxx +++ b/svtools/source/edit/textdata.cxx @@ -194,9 +194,9 @@ sal_uInt16 TEParaPortion::GetLineNumber( sal_uInt16 nChar, sal_Bool bInclEnd ) } } - // Dann sollte es am Ende der letzten Zeile sein! - DBG_ASSERT( nChar == maLines[ maLines.Count() - 1 ]->GetEnd(), "Index voll daneben!" ); - DBG_ASSERT( !bInclEnd, "Zeile nicht gefunden: FindLine" ); + // Then it should be at the end of the last line + OSL_ENSURE(nChar == maLines[maLines.size() - 1]->GetEnd(), "wrong Index"); + OSL_ENSURE(!bInclEnd, "Line not found: FindLine"); return ( maLines.size() - 1 ); } diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index 8a5d34305a20..6cb42634bb67 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -985,7 +985,7 @@ long TextEngine::ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_uInt16 nIndex TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara ); sal_uInt16 nTextPortionStart = 0; - sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart ); + size_t nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart ); DBG_ASSERT( ( nTextPortion >= pLine->GetStartPortion() ) && ( nTextPortion <= pLine->GetEndPortion() ), "GetXPos: Portion not in current line! " ); @@ -1697,11 +1697,10 @@ void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara ) if ( bLineBreak == sal_True ) { - // -2: Die neue ist bereits eingefuegt. - #ifdef DBG_UTIL - TextLine* pLastLine = pTEParaPortion->GetLines().GetObject( pTEParaPortion->GetLines().Count()-2 ); - DBG_ASSERT( pLastLine, "Weicher Umbruch, keine Zeile ?!" ); - #endif + // -2: The new one is already inserted. + OSL_ENSURE( + pTEParaPortion->GetLines()[pTEParaPortion->GetLines().size()-2], + "Soft Break, no Line?!"); sal_uInt16 nPos = (sal_uInt16) pTEParaPortion->GetTextPortions().size() - 1 ; pTmpLine->SetStartPortion( nPos ); pTmpLine->SetEndPortion( nPos ); @@ -1857,7 +1856,9 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos ) break; } } - DBG_ASSERT( nP < pTEParaPortion->GetTextPortions().Count() || pTEParaPortion->GetTextPortions().empty(), "Nichts zum loeschen: CreateTextPortions" ); + OSL_ENSURE(nP < pTEParaPortion->GetTextPortions().size() + || pTEParaPortion->GetTextPortions().empty(), + "Nothing to delete: CreateTextPortions"); if ( nInvPortion && ( nPortionStart+pTEParaPortion->GetTextPortions()[nInvPortion]->GetLen() > nStartPos ) ) { // lieber eine davor... @@ -1883,14 +1884,14 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos ) pTEParaPortion->GetTextPortions().push_back( pNew ); } } - DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "No Portions?!" ); + OSL_ENSURE(pTEParaPortion->GetTextPortions().size(), "No Portions?!"); } void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short nNewChars ) { TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); - DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "Keine Portions!" ); - DBG_ASSERT( nNewChars, "RecalcTextPortion mit Diff == 0" ); + OSL_ENSURE(pTEParaPortion->GetTextPortions().size(), "no Portions!"); + OSL_ENSURE(nNewChars, "RecalcTextPortion with Diff == 0"); TextNode* const pNode = pTEParaPortion->GetNode(); if ( nNewChars > 0 ) @@ -1971,7 +1972,8 @@ void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short DBG_ASSERT( pTP->GetLen() > (-nNewChars), "Portion zu klein zum schrumpfen!" ); pTP->GetLen() = pTP->GetLen() + nNewChars; } - DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "RecalcTextPortions: Keine mehr da!" ); + OSL_ENSURE( pTEParaPortion->GetTextPortions().size(), + "RecalcTextPortions: none are left!" ); } } @@ -2036,7 +2038,8 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan nIndex = pLine->GetStart(); for ( sal_uInt16 y = pLine->GetStartPortion(); y <= pLine->GetEndPortion(); y++ ) { - DBG_ASSERT( pPortion->GetTextPortions().Count(), "Zeile ohne Textportion im Paint!" ); + OSL_ENSURE(pPortion->GetTextPortions().size(), + "Line without Textportion in Paint!"); TETextPortion* pTextPortion = pPortion->GetTextPortions()[ y ]; DBG_ASSERT( pTextPortion, "NULL-Pointer im Portioniterator in UpdateViews" ); @@ -2295,7 +2298,7 @@ sal_Bool TextEngine::CreateLines( sal_uLong nPara ) // --------------------------------------------------------------- // Ab hier alle Zeilen durchformatieren... // --------------------------------------------------------------- - sal_uInt16 nDelFromLine = 0xFFFF; + size_t nDelFromLine = std::numeric_limits<size_t>::max(); sal_Bool bLineBreak = sal_False; sal_uInt16 nIndex = pLine->GetStart(); @@ -2384,7 +2387,8 @@ sal_Bool TextEngine::CreateLines( sal_uLong nPara ) { bEOL = sal_True; pLine->SetEnd( nPortionEnd ); - DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "Keine TextPortions?" ); + OSL_ENSURE(pTEParaPortion->GetTextPortions().size(), + "No TextPortions?"); pLine->SetEndPortion( (sal_uInt16)pTEParaPortion->GetTextPortions().size() - 1 ); } @@ -2511,12 +2515,16 @@ sal_Bool TextEngine::CreateLines( sal_uLong nPara ) } } // while ( Index < Len ) - if ( nDelFromLine != 0xFFFF ) + if (nDelFromLine != std::numeric_limits<size_t>::max()) + { for( TextLines::iterator it = pTEParaPortion->GetLines().begin() + nDelFromLine; it != pTEParaPortion->GetLines().end(); ++it ) + { delete *it; + } pTEParaPortion->GetLines().erase( pTEParaPortion->GetLines().begin() + nDelFromLine, pTEParaPortion->GetLines().end() ); + } DBG_ASSERT( pTEParaPortion->GetLines().size(), "Keine Zeile nach CreateLines!" ); |