Kaydet (Commit) 1783b33b authored tarafından qzheng's avatar qzheng Kaydeden (comit) Michael Stahl

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

Change OUStringBuffer::append() to operator+.

Change-Id: I13232cb69b1d62acfcf15d5ba5a2d72e5ab5d253
Reviewed-on: https://gerrit.libreoffice.org/44703Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMark Hung <marklh9@gmail.com>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 95da9d4c
...@@ -66,13 +66,13 @@ static void checkLdapReturnCode(const sal_Char *aOperation, ...@@ -66,13 +66,13 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
{ {
if (aRetCode == LDAP_SUCCESS) { return ; } if (aRetCode == LDAP_SUCCESS) { return ; }
OUStringBuffer message; OUString message;
if (aOperation != nullptr) 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 ; sal_Char *stub = nullptr ;
#ifndef LDAP_OPT_SIZELIMIT // for use with OpenLDAP #ifndef LDAP_OPT_SIZELIMIT // for use with OpenLDAP
...@@ -80,7 +80,7 @@ static void checkLdapReturnCode(const sal_Char *aOperation, ...@@ -80,7 +80,7 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
#endif #endif
if (stub != nullptr) if (stub != nullptr)
{ {
message.appendAscii(stub) ; message += OUString::createFromAscii(stub) ;
// It would seem the message returned is actually // It would seem the message returned is actually
// not a copy of a string but rather some static // not a copy of a string but rather some static
// string itself. At any rate freeing it seems to // string itself. At any rate freeing it seems to
...@@ -88,10 +88,9 @@ static void checkLdapReturnCode(const sal_Char *aOperation, ...@@ -88,10 +88,9 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
// This call is thus disabled for the moment. // This call is thus disabled for the moment.
//ldap_memfree(stub) ; //ldap_memfree(stub) ;
} }
else { message.append("No additional information") ; } else { message += "No additional information" ; }
message.append(")") ; message += ")" ;
throw ldap::LdapGenericException(message.makeStringAndClear(), throw ldap::LdapGenericException(message, nullptr, aRetCode) ;
nullptr, aRetCode) ;
} }
void LdapConnection::connectSimple(const LdapDefinition& aDefinition) void LdapConnection::connectSimple(const LdapDefinition& aDefinition)
...@@ -234,11 +233,13 @@ void LdapConnection::initConnection() ...@@ -234,11 +233,13 @@ void LdapConnection::initConnection()
nullptr, 0) ; nullptr, 0) ;
} }
OUString filter = "(&(objectclass="
OUStringBuffer filter( "(&(objectclass=" ); + mLdapDefinition.mUserObjectClass
+ ")("
filter.append( mLdapDefinition.mUserObjectClass ).append(")(") ; + mLdapDefinition.mUserUniqueAttr
filter.append( mLdapDefinition.mUserUniqueAttr ).append("=").append(aUser).append("))") ; + "="
+ aUser
+ "))";
LdapMessageHolder result; LdapMessageHolder result;
#ifdef _WIN32 #ifdef _WIN32
...@@ -246,13 +247,13 @@ void LdapConnection::initConnection() ...@@ -246,13 +247,13 @@ void LdapConnection::initConnection()
LdapErrCode retCode = ldap_search_sW(mConnection, LdapErrCode retCode = ldap_search_sW(mConnection,
const_cast<PWSTR>(o3tl::toW(mLdapDefinition.mBaseDN.getStr())), const_cast<PWSTR>(o3tl::toW(mLdapDefinition.mBaseDN.getStr())),
LDAP_SCOPE_SUBTREE, LDAP_SCOPE_SUBTREE,
const_cast<PWSTR>(o3tl::toW(filter.makeStringAndClear().getStr())), attributes, 0, &result.msg) ; const_cast<PWSTR>(o3tl::toW(filter.getStr())), attributes, 0, &result.msg) ;
#else #else
sal_Char * attributes [2] = { const_cast<sal_Char *>(LDAP_NO_ATTRS), nullptr }; sal_Char * attributes [2] = { const_cast<sal_Char *>(LDAP_NO_ATTRS), nullptr };
LdapErrCode retCode = ldap_search_s(mConnection, LdapErrCode retCode = ldap_search_s(mConnection,
OUStringToOString( mLdapDefinition.mBaseDN, RTL_TEXTENCODING_UTF8 ).getStr(), OUStringToOString( mLdapDefinition.mBaseDN, RTL_TEXTENCODING_UTF8 ).getStr(),
LDAP_SCOPE_SUBTREE, LDAP_SCOPE_SUBTREE,
OUStringToOString( filter.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ).getStr(), attributes, 0, &result.msg) ; OUStringToOString( filter, RTL_TEXTENCODING_UTF8 ).getStr(), attributes, 0, &result.msg) ;
#endif #endif
checkLdapReturnCode("FindUserDn", retCode) ; checkLdapReturnCode("FindUserDn", retCode) ;
OUString userDn ; OUString userDn ;
......
...@@ -1484,12 +1484,11 @@ IMPL_LINK_NOARG( SmSymbolDialog, GetClickHdl, Button*, void ) ...@@ -1484,12 +1484,11 @@ IMPL_LINK_NOARG( SmSymbolDialog, GetClickHdl, Button*, void )
const SmSym *pSym = GetSymbol(); const SmSym *pSym = GetSymbol();
if (pSym) if (pSym)
{ {
OUStringBuffer aText; OUString aText = "%" + pSym->GetName() + " ";
aText.append('%').append(pSym->GetName()).append(' ');
rViewSh.GetViewFrame()->GetDispatcher()->ExecuteList( rViewSh.GetViewFrame()->GetDispatcher()->ExecuteList(
SID_INSERTSYMBOL, SfxCallMode::RECORD, SID_INSERTSYMBOL, SfxCallMode::RECORD,
{ new SfxStringItem(SID_INSERTSYMBOL, aText.makeStringAndClear()) }); { new SfxStringItem(SID_INSERTSYMBOL, aText) });
} }
} }
......
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