diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-14 14:27:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-15 14:33:57 +0200 |
commit | f13c6ad5f020a196a0e3aa6f28bda3dc185d465b (patch) | |
tree | f9aaab122974d36c134fb1723ec3c1c8df51eeef /cppu | |
parent | 9270f74466d0eb841babaa24997f608631c70341 (diff) |
new loplugin:bufferadd
look for OUStringBuffer append sequences that can be turned
into creating an OUString with + operations
Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6
Reviewed-on: https://gerrit.libreoffice.org/80809
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppu')
-rw-r--r-- | cppu/source/cppu/cppu_opt.cxx | 12 | ||||
-rw-r--r-- | cppu/source/typelib/typelib.cxx | 15 | ||||
-rw-r--r-- | cppu/source/uno/loadmodule.cxx | 10 |
3 files changed, 17 insertions, 20 deletions
diff --git a/cppu/source/cppu/cppu_opt.cxx b/cppu/source/cppu/cppu_opt.cxx index b41ecf821cb7..9ad9fbd98f0f 100644 --- a/cppu/source/cppu/cppu_opt.cxx +++ b/cppu/source/cppu/cppu_opt.cxx @@ -60,13 +60,11 @@ extern "C" rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg( uno_Any const * pAny, typelib_TypeDescriptionReference * pType ) SAL_THROW_EXTERN_C() { - OUStringBuffer buf; - buf.append( "Cannot extract an Any(" ); - buf.append( OUString::unacquired(&pAny->pType->pTypeName) ); - buf.append( ") to " ); - buf.append( OUString::unacquired(&pType->pTypeName) ); - buf.append( '!' ); - const OUString ret( buf.makeStringAndClear() ); + OUString ret = "Cannot extract an Any(" + + OUString::unacquired(&pAny->pType->pTypeName) + + ") to " + + OUString::unacquired(&pType->pTypeName) + + "!"; rtl_uString_acquire( ret.pData ); return ret.pData; } diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index d9fe276a6c3b..1604cf7b7997 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -1006,14 +1006,13 @@ extern "C" void SAL_CALL typelib_typedescription_newMIInterface( for (sal_Int32 j = 0; j < pBase->nMembers; ++j) { typelib_TypeDescriptionReference const * pDirectBaseMember = pDirectBase->ppAllMembers[rEntry.directBaseMemberOffset + j]; - OUStringBuffer aBuf(pDirectBaseMember->pTypeName); - aBuf.append(":@"); - aBuf.append(rEntry.directBaseIndex); - aBuf.append(','); - aBuf.append(rEntry.memberOffset + j); - aBuf.append(':'); - aBuf.append(pITD->aBase.pTypeName); - OUString aName(aBuf.makeStringAndClear()); + OUString aName = OUString::unacquired(&pDirectBaseMember->pTypeName) + + ":@" + + OUString::number(rEntry.directBaseIndex) + + "," + + OUString::number(rEntry.memberOffset + j) + + ":" + + OUString::unacquired(&pITD->aBase.pTypeName); typelib_TypeDescriptionReference * pDerivedMember = nullptr; typelib_typedescriptionreference_new( &pDerivedMember, pDirectBaseMember->eTypeClass, diff --git a/cppu/source/uno/loadmodule.cxx b/cppu/source/uno/loadmodule.cxx index b56c03965518..9e970b754536 100644 --- a/cppu/source/uno/loadmodule.cxx +++ b/cppu/source/uno/loadmodule.cxx @@ -32,15 +32,15 @@ namespace cppu { namespace detail { #ifndef DISABLE_DYNLOADING bool loadModule(osl::Module& rModule, OUString const & name) { - OUStringBuffer b; + OUString b = #if defined SAL_DLLPREFIX - b.append(SAL_DLLPREFIX); + SAL_DLLPREFIX + #endif - b.append(name); - b.append(SAL_DLLEXTENSION); + name + + SAL_DLLEXTENSION; return rModule.loadRelative( reinterpret_cast< oslGenericFunction >(&loadModule), - b.makeStringAndClear(), + b, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY); } |