summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-10-16 22:53:34 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-10-17 09:03:53 +0200
commitc8eaadb5d70f42723517bb028f363e37726be256 (patch)
tree6d91ba30db1dde2c0ad00f0bd453bed937d98660 /unotools
parent7972ce0d6bc22a36d7fbaaa19bed11ec4cfe52d7 (diff)
Remaining loplugin:bufferadd
...that had been missing because the plugin didn't implement postRun, so it didn't report anything when run as part of the shared plugin. (But did report the expected warnings when run as a standalone plugin during CompilerTest_compilerplugins_clang.) Most fixes are straightforward. A noteworthy one is PreparedStatement::setBytes in connectivity/source/drivers/postgresql/pq_preparedstatement.cxx: The old preallocation of a 20 character OStringBuffer might have prevented buf.append( reinterpret_cast<char *>(escapedString), len -1 ); from potentially throwing std::bad_alloc, which would have caused escapedString to be leaked. Even though that 20-character preallocation was likely just random junk and not meant to address the potential leak, lets address it now. Change-Id: Ib506332d061684a22a74e5e39e591539fd2c4900 Reviewed-on: https://gerrit.libreoffice.org/80925 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/eventcfg.cxx7
-rw-r--r--unotools/source/config/moduleoptions.cxx7
-rw-r--r--unotools/source/config/syslocaleoptions.cxx7
3 files changed, 3 insertions, 18 deletions
diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx
index deb87647599c..b0e36fc62c4d 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -26,7 +26,6 @@
#include <o3tl/enumarray.hxx>
#include <o3tl/enumrange.hxx>
#include <rtl/ref.hxx>
-#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include "itemholder1.hxx"
@@ -194,11 +193,7 @@ void GlobalEventConfig_Impl::initBindingInfo()
Sequence< OUString > lMacros(1);
for (const auto& rEventName : lEventNames )
{
- OUStringBuffer aBuffer( 32 );
- aBuffer.append( aSetNode );
- aBuffer.append( rEventName );
- aBuffer.append( aCommandKey );
- lMacros[0] = aBuffer.makeStringAndClear();
+ lMacros[0] = aSetNode + rEventName + aCommandKey;
SAL_INFO("unotools", "reading binding for: " << lMacros[0]);
Sequence< Any > lValues = GetProperties( lMacros );
OUString sMacroURL;
diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx
index 103bf2a7bd3e..c6442a16ab9e 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -24,7 +24,6 @@
#include <comphelper/sequence.hxx>
#include <osl/diagnose.h>
#include <o3tl/enumarray.hxx>
-#include <rtl/ustrbuf.hxx>
#include <rtl/instance.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -728,11 +727,7 @@ void SvtModuleOptions_Impl::MakeReadonlyStatesAvailable()
css::uno::Sequence< OUString > lFactories = GetNodeNames(OUString());
std::transform(lFactories.begin(), lFactories.end(), lFactories.begin(),
[](const OUString& rFactory) -> OUString {
- OUStringBuffer sPath(256);
- sPath.append(rFactory );
- sPath.append(PATHSEPARATOR );
- sPath.append(PROPERTYNAME_DEFAULTFILTER);
- return sPath.makeStringAndClear();
+ return rFactory + PATHSEPARATOR PROPERTYNAME_DEFAULTFILTER;
});
css::uno::Sequence< sal_Bool > lReadonlyStates = GetReadOnlyStates(lFactories);
diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index f3942f5b7c4d..7cbb817ee1bf 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -18,7 +18,6 @@
*/
#include <com/sun/star/uno/Sequence.hxx>
-#include <rtl/ustrbuf.hxx>
#include <rtl/instance.hxx>
#include <sal/log.hxx>
#include <i18nlangtag/mslangid.hxx>
@@ -660,11 +659,7 @@ OUString SvtSysLocaleOptions::CreateCurrencyConfigString(
OUString aIsoStr( LanguageTag::convertToBcp47( eLang ) );
if ( !aIsoStr.isEmpty() )
{
- OUStringBuffer aStr( rAbbrev.getLength() + 1 + aIsoStr.getLength() );
- aStr.append( rAbbrev );
- aStr.append( '-' );
- aStr.append( aIsoStr );
- return aStr.makeStringAndClear();
+ return rAbbrev + "-" + aIsoStr;
}
else
return rAbbrev;