summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-28 11:27:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-28 17:22:39 +0200
commitfa87224130a4ab6c4b79f993cc990adc4be0465b (patch)
tree89ef6c5fbae775cfc508d96e20d052fa6bad114a
parente1d7b0973d8318bd7f153350e2e8a38bec3b3e7b (diff)
loplugin:stringloop basctl,chart2,connectivity
Change-Id: I21353dace60705d55b3d70f1e0bc610d55b84d63 Reviewed-on: https://gerrit.libreoffice.org/58210 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--basctl/source/basicide/baside2b.cxx32
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx8
-rw-r--r--chart2/source/tools/ExplicitCategoriesProvider.cxx8
-rw-r--r--chart2/source/tools/TitleHelper.cxx8
-rw-r--r--connectivity/source/commontools/TTableHelper.cxx3
-rw-r--r--connectivity/source/commontools/dbtools2.cxx10
-rw-r--r--connectivity/source/drivers/file/FStringFunctions.cxx6
-rw-r--r--connectivity/source/drivers/odbc/OStatement.cxx11
8 files changed, 42 insertions, 44 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index f32885c1292d..26c8b5170bf0 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1890,15 +1890,15 @@ void StackWindow::UpdateCalls()
SbMethod* pMethod = StarBASIC::GetActiveMethod( nScope );
while ( pMethod )
{
- OUString aEntry( OUString::number(nScope ));
+ OUStringBuffer aEntry( OUString::number(nScope ));
if ( aEntry.getLength() < 2 )
- aEntry = " " + aEntry;
- aEntry += ": " + pMethod->GetName();
+ aEntry.insert(0, " ");
+ aEntry.append(": ").append(pMethod->GetName());
SbxArray* pParams = pMethod->GetParameters();
SbxInfo* pInfo = pMethod->GetInfo();
if ( pParams )
{
- aEntry += "(";
+ aEntry.append("(");
// 0 is the sub's name...
for ( sal_uInt16 nParam = 1; nParam < pParams->Count(); nParam++ )
{
@@ -1906,34 +1906,34 @@ void StackWindow::UpdateCalls()
assert(pVar && "Parameter?!");
if ( !pVar->GetName().isEmpty() )
{
- aEntry += pVar->GetName();
+ aEntry.append(pVar->GetName());
}
else if ( pInfo )
{
const SbxParamInfo* pParam = pInfo->GetParam( nParam );
if ( pParam )
{
- aEntry += pParam->aName;
+ aEntry.append(pParam->aName);
}
}
- aEntry += "=";
+ aEntry.append("=");
SbxDataType eType = pVar->GetType();
if( eType & SbxARRAY )
{
- aEntry += "..." ;
+ aEntry.append("...");
}
else if( eType != SbxOBJECT )
{
- aEntry += pVar->GetOUString();
+ aEntry.append(pVar->GetOUString());
}
if ( nParam < ( pParams->Count() - 1 ) )
{
- aEntry += ", ";
+ aEntry.append(", ");
}
}
- aEntry += ")";
+ aEntry.append(")");
}
- aTreeListBox->InsertEntry( aEntry );
+ aTreeListBox->InsertEntry( aEntry.makeStringAndClear() );
nScope++;
pMethod = StarBASIC::GetActiveMethod( nScope );
}
@@ -2168,7 +2168,7 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent )
// Copy data and create name
- OUString aIndexStr = "(";
+ OUStringBuffer aIndexStr = "(";
pChildItem->mpArrayParentItem = pItem;
pChildItem->nDimLevel = nThisLevel;
pChildItem->nDimCount = pItem->nDimCount;
@@ -2177,10 +2177,10 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent )
for( j = 0 ; j < nParentLevel ; j++ )
{
short n = pChildItem->vIndices[j] = pItem->vIndices[j];
- aIndexStr += OUString::number( n ) + ",";
+ aIndexStr.append(OUString::number( n )).append(",");
}
pChildItem->vIndices[nParentLevel] = sal::static_int_cast<short>( i );
- aIndexStr += OUString::number( i ) + ")";
+ aIndexStr.append(OUString::number( i )).append(")");
OUString aDisplayName;
WatchItem* pArrayRootItem = pChildItem->GetRootItem();
@@ -2188,7 +2188,7 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent )
aDisplayName = pItem->maDisplayName;
else
aDisplayName = pItem->maName;
- aDisplayName += aIndexStr;
+ aDisplayName += aIndexStr.makeStringAndClear();
pChildItem->maDisplayName = aDisplayName;
SvTreeListEntry* pChildEntry = SvTreeListBox::InsertEntry( aDisplayName, pEntry );
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index a7ce1843d8f1..fd43b5457bf3 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -61,14 +61,12 @@ void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectIdent
ObjectHierarchy::tChildContainer aChildren( rHierarchy.getChildren(rParent) );
for (auto const& child : aChildren)
{
- ObjectIdentifier aOID = child;
- OUString aCID = aOID.getObjectCID();
ListBoxEntryData aEntry;
- aEntry.OID = aOID;
- aEntry.UIName += ObjectNameProvider::getNameForCID( aCID, xChartDoc );
+ aEntry.OID = child;
+ aEntry.UIName = ObjectNameProvider::getNameForCID( child.getObjectCID(), xChartDoc );
aEntry.nHierarchyDepth = nHierarchyDepth;
rEntries.push_back(aEntry);
- lcl_addObjectsToList( rHierarchy, aOID, rEntries, nHierarchyDepth+1, xChartDoc );
+ lcl_addObjectsToList( rHierarchy, child, rEntries, nHierarchyDepth+1, xChartDoc );
}
}
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index cab1103655dd..744d2ac2d383 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -355,7 +355,7 @@ Sequence< OUString > lcl_getExplicitSimpleCategories(
aRet.realloc(nMaxCategoryCount);
for(sal_Int32 nN=0; nN<nMaxCategoryCount; nN++)
{
- OUString aText;
+ OUStringBuffer aText;
for (auto const& complexCatPerIndex : aComplexCatsPerIndex)
{
if ( static_cast<size_t>(nN) < complexCatPerIndex.size() )
@@ -364,12 +364,12 @@ Sequence< OUString > lcl_getExplicitSimpleCategories(
if( !aAddText.isEmpty() )
{
if(!aText.isEmpty())
- aText += " ";
- aText += aAddText;
+ aText.append(" ");
+ aText.append(aAddText);
}
}
}
- aRet[nN]=aText;
+ aRet[nN]=aText.makeStringAndClear();
}
}
return aRet;
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
index f93798d4aee4..0487fa6f51e2 100644
--- a/chart2/source/tools/TitleHelper.cxx
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -300,13 +300,13 @@ uno::Reference< XTitle > TitleHelper::createTitle(
OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle )
{
- OUString aRet;
if(!xTitle.is())
- return aRet;
+ return OUString();
+ OUStringBuffer aRet;
uno::Sequence< uno::Reference< XFormattedString > > aStringList = xTitle->getText();
for( sal_Int32 nN=0; nN<aStringList.getLength();nN++ )
- aRet += aStringList[nN]->getString();
- return aRet;
+ aRet.append( aStringList[nN]->getString() );
+ return aRet.makeStringAndClear();
}
void TitleHelper::setCompleteString( const OUString& rNewText
diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx
index 6c7cd5f5aafc..92447c8e94db 100644
--- a/connectivity/source/commontools/TTableHelper.cxx
+++ b/connectivity/source/commontools/TTableHelper.cxx
@@ -448,12 +448,11 @@ void OTableHelper::refreshIndexes()
if(xResult.is())
{
Reference< XRow > xRow(xResult,UNO_QUERY);
- OUString aName;
OUString sCatalogSep = getMetaData()->getCatalogSeparator();
OUString sPreviousRoundName;
while( xResult->next() )
{
- aName = xRow->getString(5);
+ OUString aName = xRow->getString(5);
if(!aName.isEmpty())
aName += sCatalogSep;
aName += xRow->getString(6);
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index 5faf1146e67e..cd09553e06df 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -251,20 +251,20 @@ namespace
::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
const OUString sQuote(_xMetaData->getIdentifierQuoteString());
- OUString sSql( " (" );
+ OUStringBuffer sSql( " (" );
Reference< XPropertySet > xColProp;
sal_Int32 nColCount = _xColumns->getCount();
for(sal_Int32 i=0;i<nColCount;++i)
{
if ( (_xColumns->getByIndex(i) >>= xColProp) && xColProp.is() )
- sSql += ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))
- + ",";
+ sSql.append( ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) )
+ .append(",");
}
if ( nColCount )
- sSql = sSql.replaceAt(sSql.getLength()-1, 1, ")");
- return sSql;
+ sSql[sSql.getLength()-1] = ')';
+ return sSql.makeStringAndClear();
}
}
diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx
index 95119f650ebe..27dbdbfcc695 100644
--- a/connectivity/source/drivers/file/FStringFunctions.cxx
+++ b/connectivity/source/drivers/file/FStringFunctions.cxx
@@ -191,13 +191,13 @@ ORowSetValue OOp_Repeat::operate(const ORowSetValue& lhs,const ORowSetValue& rhs
if ( lhs.isNull() || rhs.isNull() )
return lhs;
- OUString sRet;
+ OUStringBuffer sRet;
sal_Int32 nCount = rhs;
for (sal_Int32 i=0; i < nCount; ++i)
{
- sRet += lhs;
+ sRet.append(lhs.operator OUString());
}
- return sRet;
+ return sRet.makeStringAndClear();
}
ORowSetValue OOp_Insert::operate(const std::vector<ORowSetValue>& lhs) const
diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx
index a26526894080..0ebc71e7dbde 100644
--- a/connectivity/source/drivers/odbc/OStatement.cxx
+++ b/connectivity/source/drivers/odbc/OStatement.cxx
@@ -33,6 +33,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <comphelper/types.hxx>
+#include <rtl/strbuf.hxx>
#include <algorithm>
#include <strings.hrc>
#include <connectivity/dbexception.hxx>
@@ -474,18 +475,18 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- OString aBatchSql;
+ OStringBuffer aBatchSql;
sal_Int32 nLen = m_aBatchVector.size();
for (auto const& elem : m_aBatchVector)
{
- aBatchSql += OUStringToOString(elem,getOwnConnection()->getTextEncoding());
- aBatchSql += ";";
+ aBatchSql.append(OUStringToOString(elem,getOwnConnection()->getTextEncoding()));
+ aBatchSql.append(";");
}
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- THROW_SQL(N3SQLExecDirect(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aBatchSql.getStr())), aBatchSql.getLength()));
+ auto s = aBatchSql.makeStringAndClear();
+ THROW_SQL(N3SQLExecDirect(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(s.getStr())), s.getLength()));
Sequence< sal_Int32 > aRet(nLen);
sal_Int32* pArray = aRet.getArray();