[Libreoffice-commits] core.git: desktop/source drawinglayer/source dtrans/source extensions/source hwpfilter/source i18npool/source test/source vbahelper/source writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Jul 29 10:14:45 UTC 2018
desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 10 ++---
drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx | 9 ++--
dtrans/source/cnttype/mcnttype.cxx | 19 +++++-----
extensions/source/abpilot/datasourcehandling.cxx | 3 -
extensions/source/propctrlr/standardcontrol.cxx | 8 ++--
extensions/source/propctrlr/stringrepresentation.cxx | 9 ++--
hwpfilter/source/hwpreader.cxx | 17 ++++----
i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 10 ++---
test/source/mtfxmldump.cxx | 8 ++--
vbahelper/source/msforms/vbacontrols.cxx | 3 -
writerfilter/source/dmapper/FormControlHelper.cxx | 3 -
11 files changed, 50 insertions(+), 49 deletions(-)
New commits:
commit e593b623dad9456d3452c4c537479596bcd0b00b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 28 18:01:28 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 29 12:14:22 2018 +0200
loplugin:stringloop in various
Change-Id: Ic2436c6d94729211cd5bc72fee18af228381e4a3
Reviewed-on: https://gerrit.libreoffice.org/58250
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 5df9f5574093..e8442a20f8a1 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -140,14 +140,14 @@ void Entry_Impl::checkDependencies()
deployment::DependencyException depExc;
if ( e.Cause >>= depExc )
{
- OUString aMissingDep( DpResId( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
+ OUStringBuffer aMissingDep( DpResId( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i )
{
- aMissingDep += "\n";
- aMissingDep += dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]);
+ aMissingDep.append("\n");
+ aMissingDep.append(dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]));
}
- aMissingDep += "\n";
- m_sErrorText = aMissingDep;
+ aMissingDep.append("\n");
+ m_sErrorText = aMissingDep.makeStringAndClear();
m_bMissingDeps = true;
}
}
diff --git a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx
index 952ef92284ae..e63728c48023 100644
--- a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx
@@ -87,20 +87,21 @@ namespace drawinglayer
const double fStrikeCharCount(fabs(getWidth()/fStrikeCharWidth));
const sal_uInt32 nStrikeCharCount(static_cast< sal_uInt32 >(fStrikeCharCount + 0.5));
std::vector<double> aDXArray(nStrikeCharCount);
- OUString aStrikeoutString;
+ OUStringBuffer aStrikeoutString;
for(sal_uInt32 a(0); a < nStrikeCharCount; a++)
{
- aStrikeoutString += aSingleCharString;
+ aStrikeoutString.append(aSingleCharString);
aDXArray[a] = (a + 1) * fStrikeCharWidth;
}
+ auto len = aStrikeoutString.getLength();
rContainer.push_back(
new TextSimplePortionPrimitive2D(
getObjectTransformation(),
- aStrikeoutString,
+ aStrikeoutString.makeStringAndClear(),
0,
- aStrikeoutString.getLength(),
+ len,
aDXArray,
getFontAttribute(),
getLocale(),
diff --git a/dtrans/source/cnttype/mcnttype.cxx b/dtrans/source/cnttype/mcnttype.cxx
index 3f982dd8a62c..f844c7998dd7 100644
--- a/dtrans/source/cnttype/mcnttype.cxx
+++ b/dtrans/source/cnttype/mcnttype.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <com/sun/star/container/NoSuchElementException.hpp>
+#include <rtl/ustrbuf.hxx>
#include "mcnttype.hxx"
@@ -223,13 +224,13 @@ void CMimeContentType::trailer()
OUString CMimeContentType::pName( )
{
- OUString pname;
+ OUStringBuffer pname;
OUString sToken(TOKEN);
while( !m_nxtSym.isEmpty( ) )
{
if ( isInRange( m_nxtSym, sToken ) )
- pname += m_nxtSym;
+ pname.append(m_nxtSym);
else if ( isInRange( m_nxtSym, "= " ) )
break;
else
@@ -237,7 +238,7 @@ OUString CMimeContentType::pName( )
getSym( );
}
- return pname;
+ return pname.makeStringAndClear();
}
OUString CMimeContentType::pValue( )
@@ -276,7 +277,7 @@ OUString CMimeContentType::pValue( )
OUString CMimeContentType::quotedPValue( )
{
- OUString pvalue;
+ OUStringBuffer pvalue;
bool bAfterQuoteSign = false;
while ( !m_nxtSym.isEmpty( ) )
@@ -290,7 +291,7 @@ OUString CMimeContentType::quotedPValue( )
}
else if ( isInRange( m_nxtSym, OUStringLiteral(TOKEN) + TSPECIALS + SPACE ) )
{
- pvalue += m_nxtSym;
+ pvalue.append(m_nxtSym);
bAfterQuoteSign = m_nxtSym == "\"";
}
else
@@ -298,18 +299,18 @@ OUString CMimeContentType::quotedPValue( )
getSym( );
}
- return pvalue;
+ return pvalue.makeStringAndClear();
}
OUString CMimeContentType::nonquotedPValue( )
{
- OUString pvalue;
+ OUStringBuffer pvalue;
OUString sToken(TOKEN);
while ( !m_nxtSym.isEmpty( ) )
{
if ( isInRange( m_nxtSym, sToken ) )
- pvalue += m_nxtSym;
+ pvalue.append(m_nxtSym);
else if ( isInRange( m_nxtSym, "; " ) )
break;
else
@@ -317,7 +318,7 @@ OUString CMimeContentType::nonquotedPValue( )
getSym( );
}
- return pvalue;
+ return pvalue.makeStringAndClear();
}
void CMimeContentType::comment()
diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx
index 0923e9902943..847518e1301a 100644
--- a/extensions/source/abpilot/datasourcehandling.cxx
+++ b/extensions/source/abpilot/datasourcehandling.cxx
@@ -229,8 +229,7 @@ namespace abp
sal_Int32 nPostfix = 1;
while ( ( m_pImpl->aDataSourceNames.end() != aPos ) && ( nPostfix < 65535 ) )
{ // there already is a data source with this name
- sCheck = _rDataSourceName;
- sCheck += OUString::number( nPostfix++ );
+ sCheck = _rDataSourceName + OUString::number( nPostfix++ );
aPos = m_pImpl->aDataSourceNames.find( sCheck );
}
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 4bd7c2055d47..f6bd2718c35e 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -1063,16 +1063,16 @@ namespace pcr
OUString lcl_convertListToMultiLine( const StlSyntaxSequence< OUString >& _rStrings )
{
- OUString sMultiLineText;
+ OUStringBuffer sMultiLineText;
for ( StlSyntaxSequence< OUString >::const_iterator item = _rStrings.begin();
item != _rStrings.end();
)
{
- sMultiLineText += *item;
+ sMultiLineText.append(*item);
if ( ++item != _rStrings.end() )
- sMultiLineText += "\n";
+ sMultiLineText.append("\n");
}
- return sMultiLineText;
+ return sMultiLineText.makeStringAndClear();
}
diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx
index 90ba6e5cbc58..40cc301bc8ed 100644
--- a/extensions/source/propctrlr/stringrepresentation.cxx
+++ b/extensions/source/propctrlr/stringrepresentation.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/util/Time.hpp>
#include <connectivity/dbconversion.hxx>
#include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
#include <strings.hrc>
#include <yesno.hrc>
#include "pcrservices.hxx"
@@ -331,7 +332,7 @@ namespace
template < class ElementType, class Transformer >
OUString composeSequenceElements( const Sequence< ElementType >& _rElements, const Transformer& _rTransformer )
{
- OUString sCompose;
+ OUStringBuffer sCompose;
// loop through the elements and concatenate the string representations of the integers
// (separated by a line break)
@@ -339,12 +340,12 @@ namespace
const ElementType* pElementsEnd = pElements + _rElements.getLength();
for ( ; pElements != pElementsEnd; ++pElements )
{
- sCompose += OUString( _rTransformer( *pElements ) );
+ sCompose.append( OUString( _rTransformer( *pElements ) ) );
if ( pElements != pElementsEnd )
- sCompose += "\n";
+ sCompose.append("\n");
}
- return sCompose;
+ return sCompose.makeStringAndClear();
}
template < class ElementType, class Transformer >
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index e8a5582f5ec9..b3e8ba9f7d8b 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -34,6 +34,7 @@
#include <iostream>
#include <locale.h>
#include <sal/types.h>
+#include <rtl/ustrbuf.hxx>
// To be shorten source code by realking
#define hconv(x) hstr2ucsstr(x).c_str()
@@ -4350,7 +4351,7 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
sprintf(buf, "0 0 %d %d", WTSM(drawobj->extent.w) , WTSM(drawobj->extent.h) );
padd("svg:viewBox", sXML_CDATA, ascii(buf) );
- OUString oustr;
+ OUStringBuffer oustr;
if ((drawobj->u.freeform.npt > 2) &&
(static_cast<size_t>(drawobj->u.freeform.npt) <
@@ -4400,7 +4401,7 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
sprintf(buf, "M%d %dC%d %d", WTSM(xarr[0]), WTSM(yarr[0]),
WTSM(xarr[0] + xb[0]/3), WTSM(yarr[0] + yb[0]/3) );
- oustr += ascii(buf);
+ oustr.append(ascii(buf));
for( i = 1 ; i < n ; i++ ){
if( i == n -1 ){
@@ -4415,7 +4416,7 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
WTSM(xarr[i] + xb[i]/3), WTSM(yarr[i] + yb[i]/3) );
}
- oustr += ascii(buf);
+ oustr.append(ascii(buf));
}
delete[] tarr;
delete[] xarr;
@@ -4428,7 +4429,7 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
delete[] darr;
}
- padd("svg:d", sXML_CDATA, oustr);
+ padd("svg:d", sXML_CDATA, oustr.makeStringAndClear());
rstartEl("draw:path", mxList.get());
mxList->clear();
@@ -4463,19 +4464,19 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
sprintf(buf, "0 0 %d %d", WTSM(drawobj->extent.w), WTSM(drawobj->extent.h));
padd("svg:viewBox", sXML_CDATA, ascii(buf) );
- OUString oustr;
+ OUStringBuffer oustr;
if (drawobj->u.freeform.npt > 0)
{
sprintf(buf, "%d,%d", WTSM(drawobj->u.freeform.pt[0].x), WTSM(drawobj->u.freeform.pt[0].y));
- oustr += ascii(buf);
+ oustr.append(ascii(buf));
int i;
for (i = 1; i < drawobj->u.freeform.npt ; i++)
{
sprintf(buf, " %d,%d",
WTSM(drawobj->u.freeform.pt[i].x),
WTSM(drawobj->u.freeform.pt[i].y));
- oustr += ascii(buf);
+ oustr.append(ascii(buf));
}
if( drawobj->u.freeform.pt[0].x == drawobj->u.freeform.pt[i-1].x &&
drawobj->u.freeform.pt[0].y == drawobj->u.freeform.pt[i-1].y )
@@ -4483,7 +4484,7 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
bIsPolygon = true;
}
}
- padd("draw:points", sXML_CDATA, oustr);
+ padd("draw:points", sXML_CDATA, oustr.makeStringAndClear());
if( drawobj->property.fill_color <= 0xffffff ||
drawobj->property.pattern_type != 0)
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 99cf26fe60cb..813e2451b7bf 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -1009,7 +1009,7 @@ OUString DefaultNumberingProvider::makeNumberingIdentifier(sal_Int16 index)
if (aSupportedTypes[index].cSymbol)
return OUString(aSupportedTypes[index].cSymbol, strlen(aSupportedTypes[index].cSymbol), RTL_TEXTENCODING_UTF8);
else {
- OUString result;
+ OUStringBuffer result;
Locale aLocale("en", OUString(), OUString());
Sequence<beans::PropertyValue> aProperties(2);
aProperties[0].Name = "NumberingType";
@@ -1017,11 +1017,11 @@ OUString DefaultNumberingProvider::makeNumberingIdentifier(sal_Int16 index)
aProperties[1].Name = "Value";
for (sal_Int32 j = 1; j <= 3; j++) {
aProperties[1].Value <<= j;
- result += makeNumberingString( aProperties, aLocale );
- result += ", ";
+ result.append( makeNumberingString( aProperties, aLocale ) );
+ result.append(", ");
}
- result += "...";
- return result;
+ result.append("...");
+ return result.makeStringAndClear();
}
}
diff --git a/test/source/mtfxmldump.cxx b/test/source/mtfxmldump.cxx
index cd21df3ff71e..b298f736f57f 100644
--- a/test/source/mtfxmldump.cxx
+++ b/test/source/mtfxmldump.cxx
@@ -670,13 +670,13 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
if (pMetaTextArrayAction->GetDXArray())
{
rWriter.startElement("dxarray");
- OUString sDxLengthString;
+ OUStringBuffer sDxLengthString;
for (sal_Int32 i = 0; i < aLength - aIndex; ++i)
{
- sDxLengthString += OUString::number(pMetaTextArrayAction->GetDXArray()[aIndex + i]);
- sDxLengthString += " ";
+ sDxLengthString.append(OUString::number(pMetaTextArrayAction->GetDXArray()[aIndex + i]));
+ sDxLengthString.append(" ");
}
- rWriter.content(sDxLengthString);
+ rWriter.content(sDxLengthString.makeStringAndClear());
rWriter.endElement();
}
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index 928d6d5a6632..be3a5dc82b61 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -270,8 +270,7 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
sal_Int32 nInd = 0;
while( xDialogContainer->hasByName( aNewName ) && (nInd < SAL_MAX_INT32) )
{
- aNewName = aComServiceName;
- aNewName += OUString::number( nInd++ );
+ aNewName = aComServiceName + OUString::number( nInd++ );
}
}
diff --git a/writerfilter/source/dmapper/FormControlHelper.cxx b/writerfilter/source/dmapper/FormControlHelper.cxx
index f1ddacf2ae2f..3877763edab1 100644
--- a/writerfilter/source/dmapper/FormControlHelper.cxx
+++ b/writerfilter/source/dmapper/FormControlHelper.cxx
@@ -97,8 +97,7 @@ uno::Reference<form::XForm> const & FormControlHelper::FormControlHelper_Impl::g
while (xFormsNamedContainer->hasByName(sFormName))
{
++nUnique;
- sFormName = sDOCXForm;
- sFormName += OUString::number(nUnique);
+ sFormName = sDOCXForm + OUString::number(nUnique);
}
uno::Reference<uno::XInterface> xForm(getServiceFactory()->createInstance("com.sun.star.form.component.Form"));
More information about the Libreoffice-commits
mailing list