From c7c6f0af6c836ebe0968967a1e7c8320b0ac17d6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 23 Apr 2021 16:07:32 +0200 Subject: loplugin:stringadd convert chained append to + which can use the more efficient *StringConcat Also fix a crash in stringview plugin which started happening while I working on this. Change-Id: I91a5b9b7707d1594d27d80b73930f5afac8ae608 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114568 Tested-by: Jenkins Reviewed-by: Noel Grandin --- unotools/source/config/bootstrap.cxx | 7 +++---- unotools/source/config/configpaths.cxx | 4 ++-- unotools/source/i18n/localedatawrapper.cxx | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'unotools') diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index 98a2ac802f69..ad6202cf1479 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -416,15 +416,14 @@ static void addFileError(OUStringBuffer& _rBuf, OUString const& _aPath, AsciiStr OUString sSimpleFileName = _aPath.copy(1 +_aPath.lastIndexOf(cURLSeparator)); _rBuf.append("The configuration file"); - _rBuf.append(" '").append(sSimpleFileName).append("' "); + _rBuf.append(" '" + sSimpleFileName + "' "); _rBuf.appendAscii(_sWhat).append(PERIOD); } static void addMissingDirectoryError(OUStringBuffer& _rBuf, std::u16string_view _aPath) { - _rBuf.append("The configuration directory"); - _rBuf.append(" '").append(_aPath).append("' "); - _rBuf.append(IS_MISSING).append(PERIOD); + _rBuf.append(OUString::Concat("The configuration directory '") + _aPath + "' " + + IS_MISSING + PERIOD); } static void addUnexpectedError(OUStringBuffer& _rBuf, AsciiString _sExtraInfo = nullptr) diff --git a/unotools/source/config/configpaths.cxx b/unotools/source/config/configpaths.cxx index 8c206d03a3cd..8c3ee31f2641 100644 --- a/unotools/source/config/configpaths.cxx +++ b/unotools/source/config/configpaths.cxx @@ -53,7 +53,7 @@ void lcl_resolveCharEntities(OUString & aLocalString) OSL_ENSURE(ch,"Configuration path contains '&' that is not part of a valid character escape"); if (ch) { - aResult.append(aLocalString.subView(nStart,nEscapePos-nStart)).append(ch); + aResult.append(aLocalString.subView(nStart,nEscapePos-nStart) + OUStringChar(ch)); sal_Int32 nEscapeEnd=aLocalString.indexOf(';',nEscapePos); nStart = nEscapeEnd+1; @@ -245,7 +245,7 @@ OUString lcl_wrapName(const OUString& _sContent, const OUString& _sType) OUStringBuffer aNormalized(_sType.getLength() + _sContent.getLength() + 4); // reserve approximate size initially // prefix: type, opening bracket and quote - aNormalized.append( _sType ).append( "['" ); + aNormalized.append( _sType + "['" ); // content: copy over each char and handle escaping for(const sal_Unicode* pCur = pBeginContent; pCur != pEndContent; ++pCur) diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 0565e7f291a2..8c59d0a6267c 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -1384,13 +1384,13 @@ OUString LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCa switch ( getLongDateOrder() ) { case DateOrder::DMY : - aStr.append(aDay).append(getLongDateDaySep()).append(aMonth).append(getLongDateMonthSep()).append(aYear); + aStr.append(aDay + getLongDateDaySep() + aMonth + getLongDateMonthSep() + aYear); break; case DateOrder::MDY : - aStr.append(aMonth).append(getLongDateMonthSep()).append(aDay).append(getLongDateDaySep()).append(aYear); + aStr.append(aMonth + getLongDateMonthSep() + aDay + getLongDateDaySep() + aYear); break; default: // YMD - aStr.append(aYear).append(getLongDateYearSep()).append(aMonth).append(getLongDateMonthSep()).append(aDay); + aStr.append(aYear + getLongDateYearSep() + aMonth + getLongDateMonthSep() + aDay); } return aStr.makeStringAndClear(); } -- cgit