From b74c4b7c675883e23bea9fd52682ae89d36539f6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 30 Sep 2019 15:11:25 +0200 Subject: [PATCH] loplugin:stringadd in package..sax Change-Id: I1f8b626ae99bca6e31e7c4aa9c8a1fc016b76e5c Reviewed-on: https://gerrit.libreoffice.org/79890 Tested-by: Jenkins Reviewed-by: Noel Grandin --- package/qa/cppunit/test_package.cxx | 6 +-- package/source/manifest/ManifestImport.cxx | 3 +- package/source/xstor/owriteablestream.cxx | 7 +-- package/source/xstor/xstorage.cxx | 6 +-- registry/source/keyimpl.cxx | 27 ++++------ registry/source/regimpl.cxx | 6 +-- reportdesign/source/filter/xml/xmlExport.cxx | 10 +--- .../source/ui/inspection/GeometryHandler.cxx | 3 +- reportdesign/source/ui/misc/UITools.cxx | 6 +-- reportdesign/source/ui/report/propbrw.cxx | 4 +- sal/qa/osl/file/osl_File.cxx | 54 +++++++++---------- sal/qa/osl/file/test_cpy_wrt_file.cxx | 6 +-- sax/source/expatwrap/sax_expat.cxx | 14 ++--- 13 files changed, 61 insertions(+), 91 deletions(-) diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx index ec65d7a88351..2353e7b3de07 100644 --- a/package/qa/cppunit/test_package.cxx +++ b/package/qa/cppunit/test_package.cxx @@ -152,8 +152,7 @@ namespace for (char c = 'a'; c <= 'z'; ++c, ++itBuf) { - OUString aName(c); - aName += ".txt"; + OUString aName = OUString(c) + ".txt"; uno::Reference xStrm; mxNA->getByName(aName) >>= xStrm; @@ -175,8 +174,7 @@ namespace for (char c = 'a'; c <= 'z'; ++c, ++itBuf) { - OUString aName(c); - aName += ".txt"; + OUString aName = OUString(c) + ".txt"; uno::Reference xStrm; //Size of each stream is 1mb (>10000) => XBufferedThreadedStream diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index b333cf5c9831..4014bf3d0a4d 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -581,8 +581,7 @@ OUString ManifestImport::ConvertNameWithNamespace( const OUString& aName, const if ( aIter != aNamespaces.end() && ( aIter->second == MANIFEST_NAMESPACE || aIter->second == MANIFEST_OASIS_NAMESPACE ) ) { // no check for manifest.xml consistency currently since the old versions have supported inconsistent documents as well - aResult = MANIFEST_NSPREFIX; - aResult += aPureName; + aResult = MANIFEST_NSPREFIX + aPureName; } return aResult; diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index e4935b94c81d..a781dc4bdac9 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -1510,11 +1510,8 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora if ( m_nRelInfoStatus == RELINFO_BROKEN || m_nRelInfoStatus == RELINFO_CHANGED_BROKEN ) throw io::IOException(); // TODO: - OUString aOrigRelStreamName = aOrigStreamName; - aOrigRelStreamName += ".rels"; - - OUString aNewRelStreamName = aNewStreamName; - aNewRelStreamName += ".rels"; + OUString aOrigRelStreamName = aOrigStreamName + ".rels"; + OUString aNewRelStreamName = aNewStreamName + ".rels"; bool bRenamed = aOrigRelStreamName != aNewRelStreamName; if ( m_nRelInfoStatus == RELINFO_CHANGED diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 5a375e4bfcfa..6a5b62a6edd2 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1591,8 +1591,7 @@ void OStorage_Impl::RemoveStreamRelInfo( const OUString& aOriginalName ) if ( m_nStorageType == embed::StorageFormats::OFOPXML && m_xRelStorage.is() ) { - OUString aRelStreamName = aOriginalName; - aRelStreamName += ".rels"; + OUString aRelStreamName = aOriginalName + ".rels"; if ( m_xRelStorage->hasByName( aRelStreamName ) ) m_xRelStorage->removeElement( aRelStreamName ); @@ -1654,8 +1653,7 @@ uno::Reference< io::XInputStream > OStorage_Impl::GetRelInfoStreamForName( const ReadContents(); if ( m_xRelStorage.is() ) { - OUString aRelStreamName = aName; - aRelStreamName += ".rels"; + OUString aRelStreamName = aName + ".rels"; if ( m_xRelStorage->hasByName( aRelStreamName ) ) { uno::Reference< io::XStream > xStream = m_xRelStorage->openStreamElement( aRelStreamName, embed::ElementModes::READ ); diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index e5aef0675199..d969cbaa32c5 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -228,8 +228,7 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy accessMode = storeAccessMode::ReadOnly; } - OUString sImplValueName( VALUE_PREFIX ); - sImplValueName += valueName; + OUString sImplValueName = VALUE_PREFIX + valueName; REG_GUARD(m_pRegistry->m_mutex); @@ -288,8 +287,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal return RegError::INVALID_VALUE; } - OUString sImplValueName( VALUE_PREFIX ); - sImplValueName += valueName; + OUString sImplValueName = VALUE_PREFIX + valueName; REG_GUARD(m_pRegistry->m_mutex); @@ -355,8 +353,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32 const * return RegError::REGISTRY_READONLY; } - OUString sImplValueName( VALUE_PREFIX ); - sImplValueName += valueName; + OUString sImplValueName = VALUE_PREFIX + valueName; REG_GUARD(m_pRegistry->m_mutex); @@ -411,8 +408,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu return RegError::REGISTRY_READONLY; } - OUString sImplValueName( VALUE_PREFIX ); - sImplValueName += valueName; + OUString sImplValueName = VALUE_PREFIX + valueName; REG_GUARD(m_pRegistry->m_mutex); @@ -476,8 +472,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p return RegError::REGISTRY_READONLY; } - OUString sImplValueName( VALUE_PREFIX ); - sImplValueName += valueName; + OUString sImplValueName = VALUE_PREFIX + valueName; REG_GUARD(m_pRegistry->m_mutex); @@ -544,8 +539,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const accessMode = storeAccessMode::ReadOnly; } - OUString sImplValueName( VALUE_PREFIX ); - sImplValueName += valueName; + OUString sImplValueName = VALUE_PREFIX + valueName; REG_GUARD(m_pRegistry->m_mutex); @@ -630,8 +624,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue accessMode = storeAccessMode::ReadOnly; } - OUString sImplValueName( VALUE_PREFIX ); - sImplValueName += valueName; + OUString sImplValueName = VALUE_PREFIX + valueName; REG_GUARD(m_pRegistry->m_mutex); @@ -734,8 +727,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal accessMode = storeAccessMode::ReadOnly; } - OUString sImplValueName( VALUE_PREFIX ); - sImplValueName += valueName; + OUString sImplValueName = VALUE_PREFIX + valueName; REG_GUARD(m_pRegistry->m_mutex); @@ -832,8 +824,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** accessMode = storeAccessMode::ReadOnly; } - OUString sImplValueName( VALUE_PREFIX ); - sImplValueName += valueName; + OUString sImplValueName = VALUE_PREFIX + valueName; REG_GUARD(m_pRegistry->m_mutex); diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 63c937a1109a..ab7dcb09888e 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -796,8 +796,7 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName) return _ret; } - OUString tmpName(sRelativKey); - tmpName += ROOT; + OUString tmpName = sRelativKey + ROOT; OStoreFile sFile(pKey->getStoreFile()); if (sFile.isValid() && sFile.remove(sFullPath, tmpName)) @@ -1198,8 +1197,7 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, if (sRelPath.getLength() > 1 || sFullPath.isEmpty()) sFullPath += ROOT; - OUString sFullKeyName = sFullPath; - sFullKeyName += keyName; + OUString sFullKeyName = sFullPath + keyName; OStoreDirectory rStoreDir; if (rStoreDir.create(pTargetKey->getStoreFile(), sFullPath, keyName, storeAccessMode::Create)) diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 4c991cd87732..b548f991dcc6 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -1082,14 +1082,11 @@ void ORptExport::exportGroup(const Reference& _xReportDefinit sExpression = sExpression.replaceAt(nIndex, 1, "\"\""); nIndex = sExpression.indexOf('"',nIndex+2); } - OUString sFormula("rpt:HASCHANGED(\""); TGroupFunctionMap::const_iterator aGroupFind = m_aGroupFunctionMap.find(xGroup); if ( aGroupFind != m_aGroupFunctionMap.end() ) sExpression = aGroupFind->second->getName(); - sFormula += sExpression; - sFormula += "\")"; - sExpression = sFormula; + sExpression = "rpt:HASCHANGED(\"" + sExpression + "\")"; } AddAttribute(XML_NAMESPACE_REPORT, XML_SORT_EXPRESSION, sField); AddAttribute(XML_NAMESPACE_REPORT, XML_GROUP_EXPRESSION,sExpression); @@ -1556,10 +1553,7 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG xFunction->setName(sFunctionName); if ( !sInitialFormula.isEmpty() ) xFunction->setInitialFormula(beans::Optional< OUString>(true, sInitialFormula)); - sFunction = "rpt:" + sFunction; - sFunction += "(["; - sFunction += sExpression; - sFunction += "]"; + sFunction = "rpt:" + sFunction + "([" + sExpression + "]"; if ( !sPrefix.isEmpty() ) sFunction += sPrefix; diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 20e37bf6413c..eaf9d679f509 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -2157,8 +2157,7 @@ void GeometryHandler::impl_setCounterFunction_throw() { OUString sNamePostfix; fillScope_throw(sNamePostfix); - OUString sFunctionName = m_aCounterFunction.m_sName; - sFunctionName += sNamePostfix; + OUString sFunctionName = m_aCounterFunction.m_sName + sNamePostfix; const OUString sQuotedFunctionName = lcl_getQuotedFunctionName(sFunctionName); OUString sScope; if ( !(!sFunctionName.isEmpty() && m_aFunctionNames.find(sQuotedFunctionName) != m_aFunctionNames.end() && impl_isCounterFunction_throw(sQuotedFunctionName,sScope)) ) diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index bde0449a34b1..51d7b5e7cf69 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -162,15 +162,13 @@ void adjustSectionName(const uno::Reference< report::XGroup >& _xGroup,sal_Int32 OSL_ENSURE(_xGroup.is(),"Group is NULL -> GPF"); if ( _xGroup->getHeaderOn() && _xGroup->getHeader()->getName().isEmpty() ) { - OUString sName = RptResId(RID_STR_GROUPHEADER); - sName += OUString::number(_nPos); + OUString sName = RptResId(RID_STR_GROUPHEADER) + OUString::number(_nPos); _xGroup->getHeader()->setName(sName); } if ( _xGroup->getFooterOn() && _xGroup->getFooter()->getName().isEmpty() ) { - OUString sName = RptResId(RID_STR_GROUPFOOTER); - sName += OUString::number(_nPos); + OUString sName = RptResId(RID_STR_GROUPFOOTER) + OUString::number(_nPos); _xGroup->getFooter()->setName(sName); } } diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 633d5faea46a..ad6d8f1d494e 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -389,8 +389,8 @@ OUString PropBrw::GetHeadlineName( const uno::Sequence< Reference