[Libreoffice-commits] core.git: extensions/source starmath/source sw/source vcl/osx vcl/unx writerfilter/source

2018-02-02 Thread Julien Nabet
 extensions/source/ole/servprov.cxx|8 
 starmath/source/mathmlimport.cxx  |6 +++---
 sw/source/core/docnode/finalthreadmanager.cxx |6 +++---
 sw/source/core/text/redlnitr.cxx  |   11 +--
 sw/source/filter/html/swhtml.cxx  |   16 +++-
 vcl/osx/clipboard.cxx |7 +++
 vcl/unx/generic/dtrans/X11_clipboard.cxx  |7 +++
 vcl/unx/generic/print/printerjob.cxx  |5 ++---
 vcl/unx/generic/window/salframe.cxx   |8 
 writerfilter/source/rtftok/rtfdispatchdestination.cxx |9 -
 10 files changed, 38 insertions(+), 45 deletions(-)

New commits:
commit d27ef675ec23f45562972da66bde02d99d778141
Author: Julien Nabet 
Date:   Thu Feb 1 16:42:19 2018 +0100

Replace some front/pop_front by for-range loops+clear

Change-Id: I8a9239667b0d80ee2fa6ebbc8a19ba4c0076c2fb
Reviewed-on: https://gerrit.libreoffice.org/49107
Reviewed-by: Noel Grandin 
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/extensions/source/ole/servprov.cxx 
b/extensions/source/ole/servprov.cxx
index 4fa08a3a6181..fc1841951762 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -629,12 +629,12 @@ OleServer_Impl::OleServer_Impl( const 
Reference& smgr):
 
 OleServer_Impl::~OleServer_Impl()
 {
-while (!m_wrapperList.empty())
+for (auto const& elem : m_wrapperList)
 {
-(*m_wrapperList.begin())->deregisterClass();
-(*m_wrapperList.begin())->Release();
-m_wrapperList.pop_front();
+elem->deregisterClass();
+elem->Release();
 }
+m_wrapperList.clear();
 }
 
 OUString OleServer_Impl::getImplementationName()
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index f549cda0ad88..85361823fbf2 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -2696,14 +2696,14 @@ void SmXMLTableContext_Impl::EndElement()
 throw std::range_error("row limit");
 aExpressionArray.resize(nCols*nRows);
 size_t j=0;
-while ( !aReverseStack.empty() )
+for (auto & elem : aReverseStack)
 {
-std::unique_ptr 
xArray(static_cast(aReverseStack.front().release()));
-aReverseStack.pop_front();
+std::unique_ptr 
xArray(static_cast(elem.release()));
 for (size_t i = 0; i < xArray->GetNumSubNodes(); ++i)
 aExpressionArray[j++] = xArray->GetSubNode(i);
 xArray->SetSubNodes(SmNodeArray());
 }
+aReverseStack.clear();
 
 SmToken aToken;
 aToken.cMathChar = '\0';
diff --git a/sw/source/core/docnode/finalthreadmanager.cxx 
b/sw/source/core/docnode/finalthreadmanager.cxx
index 4d90b7fa158b..83d0fe3fff13 100644
--- a/sw/source/core/docnode/finalthreadmanager.cxx
+++ b/sw/source/core/docnode/finalthreadmanager.cxx
@@ -337,11 +337,11 @@ void SAL_CALL FinalThreadManager::cancelAllJobs()
 {
 delete mpCancelJobsThread;
 mpCancelJobsThread = nullptr;
-while ( !aThreads.empty() )
+for (auto const& elem : aThreads)
 {
-aThreads.front()->cancel();
-aThreads.pop_front();
+elem->cancel();
 }
+aThreads.clear();
 }
 }
 else
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index da8da1b27e90..e16d7b3b1e34 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -316,16 +316,15 @@ void SwRedlineItr::Clear_( SwFont* pFnt )
 {
 OSL_ENSURE( bOn, "SwRedlineItr::Clear: Off?" );
 bOn = false;
-while (!m_Hints.empty())
+for (auto const& hint : m_Hints)
 {
-SwTextAttr *pPos = m_Hints.front();
-m_Hints.pop_front();
 if( pFnt )
-rAttrHandler.PopAndChg( *pPos, *pFnt );
+rAttrHandler.PopAndChg( *hint, *pFnt );
 else
-rAttrHandler.Pop( *pPos );
-SwTextAttr::Destroy(pPos, const_cast(rDoc).GetAttrPool() );
+rAttrHandler.Pop( *hint );
+SwTextAttr::Destroy(hint, const_cast(rDoc).GetAttrPool() );
 }
+m_Hints.clear();
 }
 
 sal_Int32 SwRedlineItr::GetNextRedln_( sal_Int32 nNext )
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index a02448657dd5..c21a373315ed 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2971,13 +2971,11 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool 
bBeforeTable,
 m_aMoveFlyCnts.erase( m_aMoveFlyCnts.begin() + n );
 }
 }
-while( !aFields.empty() )
+

[Libreoffice-commits] core.git: extensions/source starmath/source

2017-11-22 Thread qzheng
 extensions/source/config/ldap/ldapaccess.cxx |   31 +--
 starmath/source/dialog.cxx   |5 +---
 2 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 1783b33b52c4332be6163d15ae78bbeb4e16c172
Author: qzheng 
Date:   Tue Nov 14 15:19:26 2017 +0800

tdf#112689 Replace chained O(U)StringBuffer::append with operator+

Change OUStringBuffer::append() to operator+.

Change-Id: I13232cb69b1d62acfcf15d5ba5a2d72e5ab5d253
Reviewed-on: https://gerrit.libreoffice.org/44703
Tested-by: Jenkins 
Reviewed-by: Mark Hung 
Reviewed-by: Michael Stahl 

diff --git a/extensions/source/config/ldap/ldapaccess.cxx 
b/extensions/source/config/ldap/ldapaccess.cxx
index 1f6667ce4851..caece9d1cde5 100644
--- a/extensions/source/config/ldap/ldapaccess.cxx
+++ b/extensions/source/config/ldap/ldapaccess.cxx
@@ -66,13 +66,13 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
 {
 if (aRetCode == LDAP_SUCCESS) { return ; }
 
-OUStringBuffer message;
+OUString message;
 
 if (aOperation != nullptr)
 {
-message.appendAscii(aOperation).append(": ") ;
+message += OUString::createFromAscii(aOperation) + ": ";
 }
-message.appendAscii(ldap_err2string(aRetCode)).append(" (") ;
+message += OUString::createFromAscii(ldap_err2string(aRetCode)) + " (" ;
 sal_Char *stub = nullptr ;
 
 #ifndef LDAP_OPT_SIZELIMIT // for use with OpenLDAP
@@ -80,7 +80,7 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
 #endif
 if (stub != nullptr)
 {
-message.appendAscii(stub) ;
+message += OUString::createFromAscii(stub) ;
 // It would seem the message returned is actually
 // not a copy of a string but rather some static
 // string itself. At any rate freeing it seems to
@@ -88,10 +88,9 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
 // This call is thus disabled for the moment.
 //ldap_memfree(stub) ;
 }
-else { message.append("No additional information") ; }
-message.append(")") ;
-throw ldap::LdapGenericException(message.makeStringAndClear(),
- nullptr, aRetCode) ;
+else { message += "No additional information" ; }
+message += ")" ;
+throw ldap::LdapGenericException(message, nullptr, aRetCode) ;
 }
 
 void  LdapConnection::connectSimple(const LdapDefinition& aDefinition)
@@ -234,11 +233,13 @@ void LdapConnection::initConnection()
 nullptr, 0) ;
 }
 
-
-OUStringBuffer filter( "(&(objectclass=" );
-
-filter.append( mLdapDefinition.mUserObjectClass ).append(")(") ;
-filter.append( mLdapDefinition.mUserUniqueAttr 
).append("=").append(aUser).append("))") ;
+OUString filter = "(&(objectclass="
++ mLdapDefinition.mUserObjectClass
++ ")("
++ mLdapDefinition.mUserUniqueAttr
++ "="
++ aUser
++ "))";
 
 LdapMessageHolder result;
 #ifdef _WIN32
@@ -246,13 +247,13 @@ void LdapConnection::initConnection()
 LdapErrCode retCode = ldap_search_sW(mConnection,
   
const_cast(o3tl::toW(mLdapDefinition.mBaseDN.getStr())),
   LDAP_SCOPE_SUBTREE,
-  
const_cast(o3tl::toW(filter.makeStringAndClear().getStr())), attributes, 
0, ) ;
+  
const_cast(o3tl::toW(filter.getStr())), attributes, 0, ) ;
 #else
 sal_Char * attributes [2] = { const_cast(LDAP_NO_ATTRS), 
nullptr };
 LdapErrCode retCode = ldap_search_s(mConnection,
   OUStringToOString( 
mLdapDefinition.mBaseDN, RTL_TEXTENCODING_UTF8 ).getStr(),
   LDAP_SCOPE_SUBTREE,
-  OUStringToOString( 
filter.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ).getStr(), attributes, 0, 
) ;
+  OUStringToOString( filter, 
RTL_TEXTENCODING_UTF8 ).getStr(), attributes, 0, ) ;
 #endif
 checkLdapReturnCode("FindUserDn", retCode) ;
 OUString userDn ;
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index f710aa1988f0..e02ad89b86c6 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1484,12 +1484,11 @@ IMPL_LINK_NOARG( SmSymbolDialog, GetClickHdl, Button*, 
void )
 const SmSym *pSym = GetSymbol();
 if (pSym)
 {
-OUStringBuffer aText;
-aText.append('%').append(pSym->GetName()).append(' ');
+OUString aText = "%" + pSym->GetName() + " ";
 
 rViewSh.GetViewFrame()->GetDispatcher()->ExecuteList(
 SID_INSERTSYMBOL, SfxCallMode::RECORD,
-{ new SfxStringItem(SID_INSERTSYMBOL, 
aText.makeStringAndClear())