loplugin:stringloop in various

Change-Id: Ic2436c6d94729211cd5bc72fee18af228381e4a3
Reviewed-on: https://gerrit.libreoffice.org/58250
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2018-07-28 18:01:28 +02:00
parent a612d738a8
commit e593b623da
11 changed files with 50 additions and 49 deletions

View File

@@ -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;
}
}

View File

@@ -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(),

View File

@@ -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()

View File

@@ -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 );
}

View File

@@ -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();
}

View File

@@ -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 >

View File

@@ -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)

View File

@@ -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();
}
}

View File

@@ -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();
}

View File

@@ -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++ );
}
}

View File

@@ -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"));