sw/source/core/fields/authfld.cxx | 2 +- sw/source/core/text/porglue.cxx | 7 ++++--- sw/source/core/text/txttab.cxx | 4 ++-- sw/source/filter/ww8/ww8graf.cxx | 6 +++--- sw/source/filter/ww8/ww8par2.cxx | 7 +++---- 5 files changed, 13 insertions(+), 13 deletions(-)
New commits: commit fdc7a587275adcf06866d954d4da4116c8717723 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Feb 6 15:43:51 2022 +0100 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Feb 6 18:43:25 2022 +0100 We know the length here Change-Id: I0b8898551ac964711250832057af61e3064ef0c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129554 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index a754e8bce767..0232dbe01e75 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -736,7 +736,7 @@ bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ ) if(!(rAny >>= aParam)) return false; - OUStringBuffer sBuf; + OUStringBuffer sBuf(AUTH_FIELD_LOCAL_URL); comphelper::string::padToLength(sBuf, AUTH_FIELD_LOCAL_URL, TOX_STYLE_DELIMITER); OUString sToSet(sBuf.makeStringAndClear()); for(const PropertyValue& rParam : std::as_const(aParam)) diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx index 267ac824d240..00116bf68194 100644 --- a/sw/source/core/text/porglue.cxx +++ b/sw/source/core/text/porglue.cxx @@ -54,7 +54,7 @@ bool SwGluePortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) co if( GetLen() && rInf.OnWin() && rInf.GetOpt().IsBlank() && rInf.IsNoSymbol() ) { - OUStringBuffer aBuf; + OUStringBuffer aBuf(GetLen().get()); comphelper::string::padToLength(aBuf, sal_Int32(GetLen()), CH_BULLET); rText = aBuf.makeStringAndClear(); return true; @@ -69,8 +69,9 @@ void SwGluePortion::Paint( const SwTextPaintInfo &rInf ) const if( rInf.GetFont()->IsPaintBlank() ) { - OUStringBuffer aBuf; - comphelper::string::padToLength(aBuf, GetFixWidth() / sal_Int32(GetLen()), ' '); + const sal_Int32 nCount = GetFixWidth() / sal_Int32(GetLen()); + OUStringBuffer aBuf(nCount); + comphelper::string::padToLength(aBuf, nCount, ' '); OUString aText(aBuf.makeStringAndClear()); SwTextPaintInfo aInf( rInf, &aText ); aInf.DrawText(*this, TextFrameIndex(aText.getLength()), true); diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index fec16e962f0a..82f8e3129c97 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -620,7 +620,7 @@ void SwTabPortion::Paint( const SwTextPaintInfo &rInf ) const { // Always with kerning, also on printer! sal_uInt16 nChar = Width() / nCharWidth; - OUStringBuffer aBuf; + OUStringBuffer aBuf(nChar); comphelper::string::padToLength(aBuf, nChar, ' '); rInf.DrawText(aBuf.makeStringAndClear(), *this, TextFrameIndex(0), TextFrameIndex(nChar), true); @@ -642,7 +642,7 @@ void SwTabPortion::Paint( const SwTextPaintInfo &rInf ) const sal_uInt16 nChar = Width() / nCharWidth; if ( m_cFill == '_' ) ++nChar; // to avoid gaps - OUStringBuffer aBuf; + OUStringBuffer aBuf(nChar); comphelper::string::padToLength(aBuf, nChar, m_cFill); rInf.DrawText(aBuf.makeStringAndClear(), *this, TextFrameIndex(0), TextFrameIndex(nChar), true); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 14f9109a5b3c..113016dc036b 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -672,9 +672,9 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, if (!bBadSelection) { - OUStringBuffer sTemp; - comphelper::string::padToLength(sTemp, - nTextStart - nStartReplace, cReplaceSymbol); + sal_Int32 nCount = nTextStart - nStartReplace; + OUStringBuffer sTemp(nCount); + comphelper::string::padToLength(sTemp, nCount, cReplaceSymbol); m_pDrawEditEngine->QuickInsertText(sTemp.makeStringAndClear(), aReplaceSel); } } diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index e5037535a824..d3df4f76656f 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -635,8 +635,8 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, int nLevel, WW8_ANLV con const WW8_FFN* pF = m_xFonts->GetFont(SVBT16ToUInt16(rAV.ftc)); // FontInfo bool bListSymbol = pF && ( pF->aFFNBase.chs == 2 ); // Symbol/WingDings/... - OUStringBuffer sText; sal_uInt32 nLen = rAV.cbTextBefore + rAV.cbTextAfter; + OUStringBuffer sText(nLen); if (m_bVer67) { if (nLen > nElements) @@ -676,10 +676,9 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, int nLevel, WW8_ANLV con if( bListSymbol ) { // use cBulletChar for correct mapping on MAC - OUStringBuffer aBuf; - comphelper::string::padToLength(aBuf, rAV.cbTextBefore + sText.setLength(0); + comphelper::string::padToLength(sText, rAV.cbTextBefore + rAV.cbTextAfter, cBulletChar); - sText = aBuf; } } }