Kaydet (Commit) b83cc2b0 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:stringloop in basic, framework, sax, svtools

Change-Id: I2bad74a8f103e9dc68c8e0d0e6315697068d2f6d
Reviewed-on: https://gerrit.libreoffice.org/58135
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 86be39af
......@@ -189,7 +189,7 @@ void SbiCodeGen::Save()
if( pProc && pProc->IsDefined() )
{
OUString aProcName = pProc->GetName();
OUString aIfaceProcName;
OUStringBuffer aIfaceProcName;
OUString aIfaceName;
sal_uInt16 nPassCount = 1;
if( nIfaceCount )
......@@ -210,9 +210,9 @@ void SbiCodeGen::Save()
{
if( nPropPrefixFound == 0 )
{
aIfaceProcName += aPropPrefix;
aIfaceProcName.append(aPropPrefix);
}
aIfaceProcName += aPureProcName.copy( rIfaceName.getLength() + 1 );
aIfaceProcName.append(aPureProcName.copy( rIfaceName.getLength() + 1 ));
aIfaceName = rIfaceName;
nPassCount = 2;
break;
......@@ -224,7 +224,7 @@ void SbiCodeGen::Save()
{
if( nPass == 1 )
{
aProcName = aIfaceProcName;
aProcName = aIfaceProcName.toString();
}
PropertyMode ePropMode = pProc->getPropertyMode();
if( ePropMode != PropertyMode::NONE )
......
......@@ -1550,20 +1550,20 @@ void SbRtl_Join(StarBASIC *, SbxArray & rPar, bool)
{
aDelim = " ";
}
OUString aRetStr;
OUStringBuffer aRetStr;
short nLower, nUpper;
pArr->GetDim( 1, nLower, nUpper );
short aIdx[1];
for (aIdx[0] = nLower; aIdx[0] <= nUpper; ++aIdx[0])
{
OUString aStr = pArr->Get(aIdx)->GetOUString();
aRetStr += aStr;
aRetStr.append(aStr);
if (aIdx[0] != nUpper)
{
aRetStr += aDelim;
aRetStr.append(aDelim);
}
}
rPar.Get(0)->PutString( aRetStr );
rPar.Get(0)->PutString( aRetStr.makeStringAndClear() );
}
else
{
......
......@@ -140,7 +140,7 @@ static SbxVariableRef Operand
else if( !bVar && *p == '"' )
{
// A string
OUString aString;
OUStringBuffer aString;
p++;
for( ;; )
{
......@@ -157,9 +157,9 @@ static SbxVariableRef Operand
break;
}
}
aString += OUStringLiteral1(*p++);
aString.append(*p++);
}
refVar->PutString( aString );
refVar->PutString( aString.makeStringAndClear() );
}
else
{
......
......@@ -233,7 +233,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
return maName;
}
sal_Unicode cType = ' ';
OUString aTmp( maName );
OUStringBuffer aTmp( maName );
// short type? Then fetch it, possible this is 0.
SbxDataType et = GetType();
if( t == SbxNameType::ShortTypes )
......@@ -244,10 +244,10 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
}
if( cType != ' ' )
{
aTmp += OUStringLiteral1(cType);
aTmp.append(cType);
}
}
aTmp += "(";
aTmp.append("(");
for (SbxParams::const_iterator iter = pInfo->m_Params.begin(); iter != pInfo->m_Params.end(); ++iter)
{
......@@ -255,17 +255,17 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
int nt = i->eType & 0x0FFF;
if (iter != pInfo->m_Params.begin())
{
aTmp += ",";
aTmp.append(",");
}
if( i->nFlags & SbxFlagBits::Optional )
{
aTmp += GetSbxRes( StringId::Optional );
aTmp.append( GetSbxRes( StringId::Optional ) );
}
if( i->eType & SbxBYREF )
{
aTmp += GetSbxRes( StringId::ByRef );
aTmp.append( GetSbxRes( StringId::ByRef ) );
}
aTmp += i->aName;
aTmp.append( i->aName );
cType = ' ';
// short type? Then fetch it, possible this is 0.
if( t == SbxNameType::ShortTypes )
......@@ -277,32 +277,32 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
}
if( cType != ' ' )
{
aTmp += OUStringLiteral1(cType);
aTmp.append(cType);
if( i->eType & SbxARRAY )
{
aTmp += "()";
aTmp.append("()");
}
}
else
{
if( i->eType & SbxARRAY )
{
aTmp += "()";
aTmp.append("()");
}
// long type?
aTmp += GetSbxRes( StringId::As );
aTmp.append(GetSbxRes( StringId::As ));
if( nt < 32 )
{
aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) );
aTmp.append(GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) ));
}
else
{
aTmp += GetSbxRes( StringId::Any );
aTmp.append(GetSbxRes( StringId::Any ));
}
}
}
aTmp += ")";
const_cast<SbxVariable*>(this)->aToolString = aTmp;
aTmp.append(")");
const_cast<SbxVariable*>(this)->aToolString = aTmp.makeStringAndClear();
return aToolString;
}
......
......@@ -37,6 +37,7 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <rtl/ustrbuf.hxx>
#include <algorithm>
......@@ -350,14 +351,14 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::getParentStorage(cons
return m_xRoot;
// c)
OUString sParentPath;
OUStringBuffer sParentPath;
sal_Int32 i = 0;
for (i=0; i<c-1; ++i)
{
sParentPath += lFolders[i] + PATH_SEPARATOR;
sParentPath.append(lFolders[i]).append(PATH_SEPARATOR);
}
TPath2StorageInfo::const_iterator pParent = m_lStorages.find(sParentPath);
TPath2StorageInfo::const_iterator pParent = m_lStorages.find(sParentPath.makeStringAndClear());
if (pParent != m_lStorages.end())
return pParent->second.Storage;
......
......@@ -864,7 +864,7 @@ void OWriteMenuDocumentHandler::WriteMenuItem( const OUString& aCommandURL, cons
}
if ( nStyle > 0 )
{
OUString aValue;
OUStringBuffer aValue;
const MenuStyleItem* pStyle = MenuItemStyles;
for ( sal_Int32 nIndex = 0; nIndex < nMenuStyleItemEntries; ++nIndex, ++pStyle )
......@@ -872,13 +872,13 @@ void OWriteMenuDocumentHandler::WriteMenuItem( const OUString& aCommandURL, cons
if ( nStyle & pStyle->nBit )
{
if ( !aValue.isEmpty() )
aValue += "+";
aValue += OUString::createFromAscii( pStyle->attrName );
aValue.append("+");
aValue.appendAscii( pStyle->attrName );
}
}
pList->AddAttribute( ATTRIBUTE_NS_STYLE,
m_aAttributeType,
aValue );
aValue.makeStringAndClear() );
}
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
......
......@@ -711,7 +711,7 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem(
if ( nStyle > 0 )
{
OUString aValue;
OUStringBuffer aValue;
const ToolboxStyleItem* pStyle = Styles;
for ( sal_Int32 nIndex = 0; nIndex < nStyleItemEntries; ++nIndex, ++pStyle )
......@@ -719,13 +719,13 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem(
if ( nStyle & pStyle->nBit )
{
if ( !aValue.isEmpty() )
aValue += " ";
aValue += OUString::createFromAscii( pStyle->attrName );
aValue.append(" ");
aValue.appendAscii( pStyle->attrName );
}
}
pList->AddAttribute( m_aXMLToolbarNS + ATTRIBUTE_ITEMSTYLE,
m_aAttributeType,
aValue );
aValue.makeStringAndClear() );
}
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
......
......@@ -167,7 +167,6 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
if ( pVCLPopupMenu )
pPopupMenu = static_cast<PopupMenu *>(pVCLPopupMenu->GetMenu());
OUString aCmd;
OUString aCmd_Dialog;
OUString aCmd_Language;
if( eMode == MODE_SetLanguageSelectionMenu )
......@@ -205,8 +204,7 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
!langItem.isEmpty()) // 'no language found' from language guessing
{
pPopupMenu->InsertItem( nItemId, langItem);
aCmd = aCmd_Language;
aCmd += langItem;
OUString aCmd = aCmd_Language + langItem;
pPopupMenu->SetItemCommand( nItemId, aCmd );
if (langItem == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu )
{
......@@ -220,7 +218,7 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
// entry for LANGUAGE_NONE
++nItemId;
pPopupMenu->InsertItem( nItemId, FwkResId(STR_LANGSTATUS_NONE) );
aCmd = aCmd_Language + "LANGUAGE_NONE";
OUString aCmd = aCmd_Language + "LANGUAGE_NONE";
pPopupMenu->SetItemCommand( nItemId, aCmd );
// entry for 'Reset to default language'
......
......@@ -778,7 +778,7 @@ bool Converter::convertDuration(double& rfTime,
if ( *(pStr++) != 'P' ) // duration must start with "P"
return false;
OUString sDoubleStr;
OUStringBuffer sDoubleStr;
bool bSuccess = true;
bool bDone = false;
bool bTimePart = false;
......@@ -807,7 +807,7 @@ bool Converter::convertDuration(double& rfTime,
}
else
{
sDoubleStr += OUStringLiteral1(c);
sDoubleStr.append(c);
}
}
}
......@@ -870,7 +870,7 @@ bool Converter::convertDuration(double& rfTime,
double fHour = nHours;
double fMin = nMins;
double fSec = nSecs;
double fFraction = sDoubleStr.toDouble();
double fFraction = sDoubleStr.makeStringAndClear().toDouble();
double fTempTime = fHour / 24;
fTempTime += fMin / (24 * 60);
fTempTime += fSec / (24 * 60 * 60);
......
......@@ -1843,14 +1843,13 @@ void SvtFileView_Impl::CreateDisplayText_Impl()
{
::osl::MutexGuard aGuard( maMutex );
OUString aValue;
OUString const aTab( "\t" );
OUString const aDateSep( ", " );
for (auto const& elem : maContent)
{
// title, type, size, date
aValue = elem->GetTitle();
OUString aValue = elem->GetTitle();
ReplaceTabWithString( aValue );
aValue += aTab + elem->maType + aTab;
// folders don't have a size
......
......@@ -232,7 +232,7 @@ OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry ) const
OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry, sal_uInt16 nCol )
{
DBG_ASSERT(pEntry,"GetEntryText:Invalid Entry");
OUString aResult;
OUStringBuffer aResult;
if( pEntry )
{
sal_uInt16 nCount = pEntry->ItemCount();
......@@ -245,8 +245,8 @@ OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry, sal_uInt16 nCol )
if( nCol == 0xffff )
{
if (!aResult.isEmpty())
aResult += "\t";
aResult += static_cast<const SvLBoxString&>(rStr).GetText();
aResult.append("\t");
aResult.append(static_cast<const SvLBoxString&>(rStr).GetText());
}
else
{
......@@ -258,7 +258,7 @@ OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry, sal_uInt16 nCol )
nCur++;
}
}
return aResult;
return aResult.makeStringAndClear();
}
OUString SvTabListBox::GetEntryText( sal_uLong nPos, sal_uInt16 nCol ) const
......@@ -363,7 +363,7 @@ OUString SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const
{
SvTreeListEntry* pEntry = SvTreeListBox::GetEntry( nPos );
DBG_ASSERT( pEntry, "GetTabEntryText(): Invalid entry " );
OUString aResult;
OUStringBuffer aResult;
if ( pEntry )
{
sal_uInt16 nCount = pEntry->ItemCount();
......@@ -376,8 +376,8 @@ OUString SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const
if ( nCol == 0xffff )
{
if (!aResult.isEmpty())
aResult += "\t";
aResult += static_cast<const SvLBoxString&>(rBoxItem).GetText();
aResult.append("\t");
aResult.append(static_cast<const SvLBoxString&>(rBoxItem).GetText());
}
else
{
......@@ -394,7 +394,7 @@ OUString SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const
++nCur;
}
}
return aResult;
return aResult.makeStringAndClear();
}
SvTreeListEntry* SvTabListBox::GetEntryOnPos( sal_uLong _nEntryPos ) const
......
......@@ -1314,7 +1314,7 @@ OUString SvTreeListBox::GetEntryLongDescription( SvTreeListEntry* ) const
OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry )
{
assert(pEntry);
OUString sRet;
OUStringBuffer sRet;
sal_uInt16 nCount = pEntry->ItemCount();
sal_uInt16 nCur = 0;
......@@ -1324,14 +1324,14 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry )
if ( (rItem.GetType() == SvLBoxItemType::String) &&
!static_cast<SvLBoxString&>( rItem ).GetText().isEmpty() )
{
sRet += static_cast<SvLBoxString&>( rItem ).GetText() + ",";
sRet.append(static_cast<SvLBoxString&>( rItem ).GetText()).append(",");
}
nCur++;
}
if (!sRet.isEmpty())
sRet = sRet.copy(0, sRet.getLength() - 1);
return sRet;
return sRet.makeStringAndClear();
}
SvTreeListBox::~SvTreeListBox()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment