diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-10-30 20:27:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-10-31 09:14:39 +0100 |
commit | d526bd7dd5b94be6fe5a823372da1facca3d43fa (patch) | |
tree | 656b49726096326e7832cde5c177f85fd8c8c454 /framework | |
parent | 7eeb484e7d1faf87fbb8774a8bda4328d047dde3 (diff) |
Fix StringAdd::isCompileTimeConstant
...to find StringLiteral on the RHS of +=. Which revealed that the
VisitCompoundStmt/checkForCompoundAssign logic needed to be fixed, too, so that
s += side_effect();
s += "literal";
s += side_effect();
only gets combined to
s += side_effect() + "literal";
s += side_effect();
and not all the way to
s += side_effect() + "literal" + side_effect();
Change-Id: I432e3458b933a7d0ad6141c747b675cc8b0f0ba4
Reviewed-on: https://gerrit.libreoffice.org/81804
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'framework')
5 files changed, 46 insertions, 92 deletions
diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index 0a30b76cadec..8b9384f672fc 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -230,8 +230,7 @@ void SAL_CALL OReadMenuDocumentHandler::endDocument() { if ( m_nElementDepth > 0 ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "A closing element is missing!"; + OUString aErrorMessage = getErrorLineString() + "A closing element is missing!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -277,14 +276,12 @@ void SAL_CALL OReadMenuDocumentHandler::endElement( const OUString& aName ) m_xReader.clear(); if ( m_eReaderMode == ReaderMode::MenuBar && aName != ELEMENT_MENUBAR ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "closing element menubar expected!"; + OUString aErrorMessage = getErrorLineString() + "closing element menubar expected!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } else if ( m_eReaderMode == ReaderMode::MenuPopup && aName != ELEMENT_MENUPOPUP ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "closing element menupopup expected!"; + OUString aErrorMessage = getErrorLineString() + "closing element menupopup expected!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } m_eReaderMode = ReaderMode::None; @@ -384,8 +381,7 @@ void SAL_CALL OReadMenuBarHandler::startElement( } else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "attribute id for element menu required!"; + OUString aErrorMessage = getErrorLineString() + "attribute id for element menu required!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -395,8 +391,7 @@ void SAL_CALL OReadMenuBarHandler::startElement( } else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "element menu expected!"; + OUString aErrorMessage = getErrorLineString() + "element menu expected!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -417,8 +412,7 @@ void OReadMenuBarHandler::endElement( const OUString& aName ) m_bMenuMode = false; if ( aName != ELEMENT_MENU ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "closing element menu expected!"; + OUString aErrorMessage = getErrorLineString() + "closing element menu expected!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -466,8 +460,7 @@ void SAL_CALL OReadMenuHandler::startElement( } else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "unknown element found!"; + OUString aErrorMessage = getErrorLineString() + "unknown element found!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -488,8 +481,7 @@ void SAL_CALL OReadMenuHandler::endElement( const OUString& aName ) m_bMenuPopupMode = false; if ( aName != ELEMENT_MENUPOPUP ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "closing element menupopup expected!"; + OUString aErrorMessage = getErrorLineString() + "closing element menupopup expected!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -585,8 +577,7 @@ void SAL_CALL OReadMenuPopupHandler::startElement( } else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "attribute id for element menu required!"; + OUString aErrorMessage = getErrorLineString() + "attribute id for element menu required!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -654,8 +645,7 @@ void SAL_CALL OReadMenuPopupHandler::startElement( } else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "unknown element found!"; + OUString aErrorMessage = getErrorLineString() + "unknown element found!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -676,8 +666,7 @@ void SAL_CALL OReadMenuPopupHandler::endElement( const OUString& aName ) m_bMenuMode = false; if ( aName != ELEMENT_MENU ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "closing element menu expected!"; + OUString aErrorMessage = getErrorLineString() + "closing element menu expected!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -690,8 +679,7 @@ void SAL_CALL OReadMenuPopupHandler::endElement( const OUString& aName ) { if ( aName != ELEMENT_MENUITEM ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "closing element menuitem expected!"; + OUString aErrorMessage = getErrorLineString() + "closing element menuitem expected!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -699,8 +687,7 @@ void SAL_CALL OReadMenuPopupHandler::endElement( const OUString& aName ) { if ( aName != ELEMENT_MENUSEPARATOR ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "closing element menuseparator expected!"; + OUString aErrorMessage = getErrorLineString() + "closing element menuseparator expected!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx index b0289933114e..18b6388d41d3 100644 --- a/framework/source/fwe/xml/statusbardocumenthandler.cxx +++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx @@ -187,8 +187,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::endDocument() if ( m_bStatusBarStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "No matching start or end element 'statusbar' found!"; + OUString aErrorMessage = getErrorLineString() + "No matching start or end element 'statusbar' found!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -207,8 +206,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( { if ( m_bStatusBarStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element 'statusbar:statusbar' cannot be embedded into 'statusbar:statusbar'!"; + OUString aErrorMessage = getErrorLineString() + "Element 'statusbar:statusbar' cannot be embedded into 'statusbar:statusbar'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -220,15 +218,13 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( { if ( !m_bStatusBarStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element 'statusbar:statusbaritem' must be embedded into element 'statusbar:statusbar'!"; + OUString aErrorMessage = getErrorLineString() + "Element 'statusbar:statusbaritem' must be embedded into element 'statusbar:statusbar'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } if ( m_bStatusBarItemStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element statusbar:statusbaritem is not a container!"; + OUString aErrorMessage = getErrorLineString() + "Element statusbar:statusbaritem is not a container!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -272,8 +268,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( } else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Attribute statusbar:align must have one value of 'left','right' or 'center'!"; + OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:align must have one value of 'left','right' or 'center'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -297,8 +292,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( } else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Attribute statusbar:autosize must have value 'true' or 'false'!"; + OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:autosize must have value 'true' or 'false'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -312,8 +306,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( nItemBits &= ~ItemStyle::AUTO_SIZE; else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Attribute statusbar:autosize must have value 'true' or 'false'!"; + OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:autosize must have value 'true' or 'false'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -327,8 +320,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( nItemBits &= ~ItemStyle::OWNER_DRAW; else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Attribute statusbar:ownerdraw must have value 'true' or 'false'!"; + OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:ownerdraw must have value 'true' or 'false'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -360,8 +352,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( nItemBits &= ~ItemStyle::MANDATORY; else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Attribute statusbar:mandatory must have value 'true' or 'false'!"; + OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:mandatory must have value 'true' or 'false'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -375,8 +366,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( if ( !bCommandURL ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Required attribute statusbar:url must have a value!"; + OUString aErrorMessage = getErrorLineString() + "Required attribute statusbar:url must have a value!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } else @@ -420,8 +410,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::endElement(const OUString& aName) { if ( !m_bStatusBarStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "End element 'statusbar' found, but no start element 'statusbar'"; + OUString aErrorMessage = getErrorLineString() + "End element 'statusbar' found, but no start element 'statusbar'"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -433,8 +422,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::endElement(const OUString& aName) { if ( !m_bStatusBarItemStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "End element 'statusbar:statusbaritem' found, but no start element 'statusbar:statusbaritem'"; + OUString aErrorMessage = getErrorLineString() + "End element 'statusbar:statusbaritem' found, but no start element 'statusbar:statusbaritem'"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 509a7235cd50..9b3927839110 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -178,8 +178,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::endDocument() if ( m_bToolBarStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "No matching start or end element 'toolbar' found!"; + OUString aErrorMessage = getErrorLineString() + "No matching start or end element 'toolbar' found!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -198,8 +197,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( { if ( m_bToolBarStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element 'toolbar:toolbar' cannot be embedded into 'toolbar:toolbar'!"; + OUString aErrorMessage = getErrorLineString() + "Element 'toolbar:toolbar' cannot be embedded into 'toolbar:toolbar'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } else @@ -246,8 +244,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( { if ( !m_bToolBarStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element 'toolbar:toolbaritem' must be embedded into element 'toolbar:toolbar'!"; + OUString aErrorMessage = getErrorLineString() + "Element 'toolbar:toolbaritem' must be embedded into element 'toolbar:toolbar'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -256,8 +253,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( m_bToolBarSpaceStartFound || m_bToolBarItemStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element toolbar:toolbaritem is not a container!"; + OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbaritem is not a container!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -297,8 +293,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( bVisible = false; else { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Attribute toolbar:visible must have value 'true' or 'false'!"; + OUString aErrorMessage = getErrorLineString() + "Attribute toolbar:visible must have value 'true' or 'false'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -346,8 +341,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( if ( !bAttributeURL ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Required attribute toolbar:url must have a value!"; + OUString aErrorMessage = getErrorLineString() + "Required attribute toolbar:url must have a value!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -390,8 +384,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( m_bToolBarSpaceStartFound || m_bToolBarItemStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element toolbar:toolbarspace is not a container!"; + OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbarspace is not a container!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -415,8 +408,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( m_bToolBarSpaceStartFound || m_bToolBarItemStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element toolbar:toolbarbreak is not a container!"; + OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbarbreak is not a container!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -440,8 +432,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( m_bToolBarSpaceStartFound || m_bToolBarItemStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element toolbar:toolbarseparator is not a container!"; + OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbarseparator is not a container!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -477,8 +468,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::endElement(const OUString& aName) { if ( !m_bToolBarStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "End element 'toolbar' found, but no start element 'toolbar'"; + OUString aErrorMessage = getErrorLineString() + "End element 'toolbar' found, but no start element 'toolbar'"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -490,8 +480,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::endElement(const OUString& aName) { if ( !m_bToolBarItemStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "End element 'toolbar:toolbaritem' found, but no start element 'toolbar:toolbaritem'"; + OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbaritem' found, but no start element 'toolbar:toolbaritem'"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -503,8 +492,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::endElement(const OUString& aName) { if ( !m_bToolBarBreakStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "End element 'toolbar:toolbarbreak' found, but no start element 'toolbar:toolbarbreak'"; + OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbarbreak' found, but no start element 'toolbar:toolbarbreak'"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -516,8 +504,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::endElement(const OUString& aName) { if ( !m_bToolBarSpaceStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "End element 'toolbar:toolbarspace' found, but no start element 'toolbar:toolbarspace'"; + OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbarspace' found, but no start element 'toolbar:toolbarspace'"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -529,8 +516,7 @@ void SAL_CALL OReadToolBoxDocumentHandler::endElement(const OUString& aName) { if ( !m_bToolBarSeparatorStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "End element 'toolbar:toolbarseparator' found, but no start element 'toolbar:toolbarseparator'"; + OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbarseparator' found, but no start element 'toolbar:toolbarseparator'"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } diff --git a/framework/source/uiconfiguration/CommandImageResolver.cxx b/framework/source/uiconfiguration/CommandImageResolver.cxx index 3822f7eb2fa3..b443936684d9 100644 --- a/framework/source/uiconfiguration/CommandImageResolver.cxx +++ b/framework/source/uiconfiguration/CommandImageResolver.cxx @@ -103,8 +103,7 @@ void CommandImageResolver::registerCommands(Sequence<OUString>& aCommandSequence // Image names are not case-dependent. Always use lower case characters to // reflect this. - aImageName = aImageName.toAsciiLowerCase(); - aImageName += ".png"; + aImageName = aImageName.toAsciiLowerCase() + ".png"; m_aImageNameVector[i] = aImageName; m_aCommandToImageNameMap[aCommandName] = aImageName; diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index 381b0f1aec2a..00aa56bef709 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -133,8 +133,7 @@ void SAL_CALL OReadImagesDocumentHandler::endDocument() if (m_bImageContainerStartFound != m_bImageContainerEndFound) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "No matching start or end element 'image:imagecontainer' found!"; + OUString aErrorMessage = getErrorLineString() + "No matching start or end element 'image:imagecontainer' found!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } } @@ -154,8 +153,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( // image:imagecontainer element (container element for all further image elements) if ( m_bImageContainerStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element 'image:imagecontainer' cannot be embedded into 'image:imagecontainer'!"; + OUString aErrorMessage = getErrorLineString() + "Element 'image:imagecontainer' cannot be embedded into 'image:imagecontainer'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -167,15 +165,13 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( { if ( !m_bImageContainerStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element 'image:images' must be embedded into element 'image:imagecontainer'!"; + OUString aErrorMessage = getErrorLineString() + "Element 'image:images' must be embedded into element 'image:imagecontainer'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } if ( m_bImagesStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element 'image:images' cannot be embedded into 'image:images'!"; + OUString aErrorMessage = getErrorLineString() + "Element 'image:images' cannot be embedded into 'image:images'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -188,8 +184,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( // Check that image:entry is embedded into image:images! if ( !m_bImagesStartFound ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Element 'image:entry' must be embedded into element 'image:images'!"; + OUString aErrorMessage = getErrorLineString() + "Element 'image:entry' must be embedded into element 'image:images'!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } @@ -219,8 +214,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( // Check required attribute "command" if ( aItem.aCommandURL.isEmpty() ) { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += "Required attribute 'image:command' must have a value!"; + OUString aErrorMessage = getErrorLineString() + "Required attribute 'image:command' must have a value!"; throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); } |