diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-30 15:24:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-30 18:54:15 +0200 |
commit | 4bef6511332073fbe3899fa2003caf88d9f2ac49 (patch) | |
tree | dca0d58c3fc86d6c88abc2a72fd91f149a917058 /sw/source/uibase/dbui | |
parent | c9dcd0a6197160fdc8bf086ae4d8a78558e7d078 (diff) |
loplugin:stringloop in sw
Change-Id: Ie316aee8d1e4f772dc25725b46e130c6717458c2
Reviewed-on: https://gerrit.libreoffice.org/58331
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/dbui')
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 22 | ||||
-rw-r--r-- | sw/source/uibase/dbui/mailmergehelper.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/dbui/mmconfigitem.cxx | 18 |
3 files changed, 23 insertions, 26 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 3ce9d2c14156..14ad312e916d 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -609,7 +609,7 @@ void SwDBManager::ImportFromConnection( SwWrtShell* pSh ) static OUString lcl_FindColumn(const OUString& sFormatStr,sal_uInt16 &nUsedPos, sal_uInt8 &nSeparator) { - OUString sReturn; + OUStringBuffer sReturn; sal_uInt16 nLen = sFormatStr.getLength(); nSeparator = 0xff; while(nUsedPos < nLen && nSeparator == 0xff) @@ -630,12 +630,12 @@ static OUString lcl_FindColumn(const OUString& sFormatStr,sal_uInt16 &nUsedPos nSeparator = DB_SEP_NEWLINE; break; default: - sReturn += OUStringLiteral1(cCurrent); + sReturn.append(cCurrent); } nUsedPos++; } - return sReturn; + return sReturn.makeStringAndClear(); } void SwDBManager::ImportDBEntry(SwWrtShell* pSh) @@ -687,7 +687,7 @@ void SwDBManager::ImportDBEntry(SwWrtShell* pSh) } else { - OUString sStr; + OUStringBuffer sStr; uno::Sequence<OUString> aColNames = xCols->getElementNames(); const OUString* pColNames = aColNames.getConstArray(); long nLength = aColNames.getLength(); @@ -697,11 +697,11 @@ void SwDBManager::ImportDBEntry(SwWrtShell* pSh) uno::Reference< beans::XPropertySet > xColumnProp; aCol >>= xColumnProp; SwDBFormatData aDBFormat; - sStr += GetDBField( xColumnProp, aDBFormat); + sStr.append(GetDBField( xColumnProp, aDBFormat)); if (i < nLength - 1) - sStr += "\t"; + sStr.append("\t"); } - pSh->SwEditShell::Insert2(sStr); + pSh->SwEditShell::Insert2(sStr.makeStringAndClear()); pSh->SwFEShell::SplitNode(); // line feed } } @@ -1063,7 +1063,7 @@ static SwMailMessage* lcl_CreateMailFromDoc( pMessage->addRecipient( sMailRecipient ); pMessage->SetSenderAddress( rMergeDescriptor.pMailMergeConfigItem->GetMailAddress() ); - OUString sBody; + OUStringBuffer sBody; if( rMergeDescriptor.bSendAsAttachment ) { sBody = rMergeDescriptor.sMailBody; @@ -1086,13 +1086,13 @@ static SwMailMessage* lcl_CreateMailFromDoc( OString sLine; while ( pInStream->ReadLine( sLine ) ) { - sBody += OStringToOUString( sLine, sMailEncoding ); - sBody += "\n"; + sBody.append(OStringToOUString( sLine, sMailEncoding )); + sBody.append("\n"); } } pMessage->setSubject( rMergeDescriptor.sSubject ); uno::Reference< datatransfer::XTransferable> xBody = - new SwMailTransferable( sBody, sMailBodyMimeType ); + new SwMailTransferable( sBody.makeStringAndClear(), sMailBodyMimeType ); pMessage->setBody( xBody ); for( const OUString& sCcRecipient : rMergeDescriptor.aCopiesTo ) diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index 7345797b1d67..e742e88b8583 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -464,7 +464,6 @@ OUString SwAddressPreview::FillData( rConfigItem.GetCurrentDBData() ); const OUString* pAssignment = aAssignment.getConstArray(); const std::vector<std::pair<OUString, int>>& rDefHeaders = rConfigItem.GetDefaultAddressHeaders(); - OUString sAddress(rAddress); OUString sNotAssigned = "<" + SwResId(STR_NOTASSIGNED) + ">"; bool bIncludeCountry = rConfigItem.IsIncludeCountry(); @@ -480,8 +479,8 @@ OUString SwAddressPreview::FillData( sCountryColumn = aSpecialAssignment[MM_PART_COUNTRY]; } - SwAddressIterator aIter(sAddress); - sAddress.clear(); + SwAddressIterator aIter(rAddress); + OUStringBuffer sAddress; while(aIter.HasMore()) { SwMergeAddressItem aItem = aIter.Next(); @@ -540,9 +539,9 @@ OUString SwAddressPreview::FillData( } } - sAddress += aItem.sText; + sAddress.append(aItem.sText); } - return sAddress; + return sAddress.makeStringAndClear(); } SwMergeAddressItem SwAddressIterator::Next() diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index e1a66d04a86e..7c46b9aa45ea 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -363,8 +363,7 @@ static OUString lcl_CreateNodeName(Sequence<OUString>& rAssignments ) do { bFound = false; - sNewName = "_"; - sNewName += OUString::number(nStart); + sNewName = "_" + OUString::number(nStart); //search if the name exists for(sal_Int32 nAssign = 0; nAssign < rAssignments.getLength(); ++nAssign) { @@ -400,9 +399,8 @@ static void lcl_ConvertFromNumbers(OUString& rBlock, const std::vector<std::pair { //convert the numbers used for the configuration to strings used for UI to numbers //doesn't use ReplaceAll to prevent expansion of numbers inside of the headers - OUString sBlock(rBlock.replaceAll("\\n", "\n")); - SwAddressIterator aGreetingIter(sBlock); - sBlock.clear(); + SwAddressIterator aGreetingIter(rBlock.replaceAll("\\n", "\n")); + OUStringBuffer sBlock; while(aGreetingIter.HasMore()) { SwMergeAddressItem aNext = aGreetingIter.Next(); @@ -412,11 +410,11 @@ static void lcl_ConvertFromNumbers(OUString& rBlock, const std::vector<std::pair sal_Unicode cChar = aNext.sText[0]; if(cChar >= '0' && cChar <= 'c') { - sBlock += "<"; + sBlock.append("<"); sal_uInt16 nHeader = cChar - '0'; if(nHeader < rHeaders.size()) - sBlock += rHeaders[nHeader].first; - sBlock += ">"; + sBlock.append(rHeaders[nHeader].first); + sBlock.append(">"); } else { @@ -424,9 +422,9 @@ static void lcl_ConvertFromNumbers(OUString& rBlock, const std::vector<std::pair } } else - sBlock += aNext.sText; + sBlock.append(aNext.sText); } - rBlock = sBlock; + rBlock = sBlock.makeStringAndClear(); } const Sequence<OUString>& SwMailMergeConfigItem_Impl::GetPropertyNames() |