[Libreoffice-commits] core.git: svgio/source ucb/source uui/source xmloff/source xmlsecurity/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jul 30 19:05:03 UTC 2018


 svgio/source/svgreader/svgstylenode.cxx             |    6 ++--
 ucb/source/ucp/cmis/cmis_url.cxx                    |    8 +++---
 uui/source/iahndl.cxx                               |    9 +++----
 uui/source/secmacrowarnings.cxx                     |    9 +++----
 xmloff/source/transform/StyleOASISTContext.cxx      |   12 ++++-----
 xmloff/source/transform/StyleOOoTContext.cxx        |   12 ++++-----
 xmlsecurity/source/framework/buffernode.cxx         |   19 ++++++++-------
 xmlsecurity/source/framework/saxeventkeeperimpl.cxx |   25 ++++++++++----------
 8 files changed, 50 insertions(+), 50 deletions(-)

New commits:
commit 83d8331581ab43cf35325ca674cf62d4ba5dc5ad
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 30 15:24:30 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 21:04:40 2018 +0200

    loplugin:stringloop in svgio..xmlsecurity
    
    Change-Id: I1b2fe5674c8350690efc3d3219b9273cc61d5b0c
    Reviewed-on: https://gerrit.libreoffice.org/58332
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svgio/source/svgreader/svgstylenode.cxx b/svgio/source/svgreader/svgstylenode.cxx
index c3ca2a5c540b..c909586724f5 100644
--- a/svgio/source/svgreader/svgstylenode.cxx
+++ b/svgio/source/svgreader/svgstylenode.cxx
@@ -114,12 +114,12 @@ namespace svgio
 
                 if(aSelectorParts.size())
                 {
-                    OUString aConcatenatedSelector;
+                    OUStringBuffer aConcatenatedSelector;
 
                     // re-combine without spaces, create a unique name (for now)
                     for(size_t a(0); a < aSelectorParts.size(); a++)
                     {
-                        aConcatenatedSelector += aSelectorParts[a];
+                        aConcatenatedSelector.append(aSelectorParts[a]);
                     }
 
                     // CssStyles in SVG are currently not completely supported; the current idea for
@@ -138,7 +138,7 @@ namespace svgio
                     // SvgStyleAttributes will not do it) will have to be adapted to make use of it.
 
                     // register new style at document for (evtl. concatenated) stylename
-                    const_cast< SvgDocument& >(getDocument()).addSvgStyleAttributesToMapper(aConcatenatedSelector, rNewStyle);
+                    const_cast< SvgDocument& >(getDocument()).addSvgStyleAttributesToMapper(aConcatenatedSelector.makeStringAndClear(), rNewStyle);
                 }
             }
         }
diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
index 8f5f9146d9eb..170c00cf9088 100644
--- a/ucb/source/ucp/cmis/cmis_url.cxx
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -86,7 +86,7 @@ namespace cmis
         if ( !m_sPath.isEmpty( ) )
         {
             sal_Int32 nPos = -1;
-            OUString sEncodedPath;
+            OUStringBuffer sEncodedPath;
             do
             {
                 sal_Int32 nStartPos = nPos + 1;
@@ -98,14 +98,14 @@ namespace cmis
 
                 if ( !sSegment.isEmpty( ) )
                 {
-                    sEncodedPath += "/" + rtl::Uri::encode( sSegment,
+                    sEncodedPath.append("/").append(rtl::Uri::encode( sSegment,
                             rtl_UriCharClassRelSegment,
                             rtl_UriEncodeKeepEscapes,
-                            RTL_TEXTENCODING_UTF8 );
+                            RTL_TEXTENCODING_UTF8 ));
                 }
             }
             while ( nPos != -1 );
-            sUrl += sEncodedPath;
+            sUrl += sEncodedPath.makeStringAndClear();
         } else if ( !m_sId.isEmpty( ) )
         {
             sUrl += "#" + rtl::Uri::encode( m_sId,
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 16fd450ce05c..2aec43bf5979 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -413,15 +413,14 @@ UUIInteractionHelper::handleRequest_impl(
                 = aModSizeException.Names;
             if ( sModules.getLength() )
             {
-                OUString aName;
+                OUStringBuffer aName;
                 for ( sal_Int32 index=0; index< sModules.getLength(); ++index )
                 {
                     if ( index )
-                        aName += "," + sModules[index];
-                    else
-                        aName = sModules[index]; // 1st name
+                        aName.append(",");
+                    aName.append(sModules[index]);
                 }
-                aArguments.push_back( aName );
+                aArguments.push_back( aName.makeStringAndClear() );
             }
             handleErrorHandlerRequest( task::InteractionClassification_WARNING,
                                        ERRCODE_UUI_IO_MODULESIZEEXCEEDED,
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index 1233ced8c86c..3030ab92520a 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -160,16 +160,15 @@ void MacroWarning::SetStorage( const css::uno::Reference < css::embed::XStorage
     {
         mpInfos = &rInfos;
         OUString aCN_Id("CN");
-        OUString s;
-        s = GetContentPart( rInfos[ 0 ].Signer->getSubjectName(), aCN_Id );
+        OUStringBuffer s = GetContentPart( rInfos[ 0 ].Signer->getSubjectName(), aCN_Id );
 
         for( sal_Int32 i = 1 ; i < nCnt ; ++i )
         {
-            s += "\n";
-            s += GetContentPart( rInfos[ i ].Signer->getSubjectName(), aCN_Id );
+            s.append("\n");
+            s.append(GetContentPart( rInfos[ i ].Signer->getSubjectName(), aCN_Id ));
         }
 
-        mxSignsFI->set_label(s);
+        mxSignsFI->set_label(s.makeStringAndClear());
         mxViewSignsBtn->set_sensitive(true);
     }
 }
diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx
index fafd8e9ace7e..091fb2eea0cc 100644
--- a/xmloff/source/transform/StyleOASISTContext.cxx
+++ b/xmloff/source/transform/StyleOASISTContext.cxx
@@ -471,30 +471,30 @@ void XMLPropertiesTContext_Impl::StartElement(
                     {
                         // keep original for writer graphic objects
                         // Adapts attribute values (#i49139#)
-                        OUString aNewAttrValue;
+                        OUStringBuffer aNewAttrValue;
                         SvXMLTokenEnumerator aTokenEnum( rAttrValue );
                         OUString aToken;
                         while( aTokenEnum.getNextToken( aToken ) )
                         {
                             if ( !aNewAttrValue.isEmpty() )
                             {
-                                aNewAttrValue += " ";
+                                aNewAttrValue.append(" ");
                             }
 
                             if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_EVEN ) )
                             {
-                                aNewAttrValue += GetXMLToken( XML_HORIZONTAL_ON_LEFT_PAGES );
+                                aNewAttrValue.append(GetXMLToken( XML_HORIZONTAL_ON_LEFT_PAGES ));
                             }
                             else if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_ODD ) )
                             {
-                                aNewAttrValue += GetXMLToken( XML_HORIZONTAL_ON_RIGHT_PAGES );
+                                aNewAttrValue.append(GetXMLToken( XML_HORIZONTAL_ON_RIGHT_PAGES ));
                             }
                             else
                             {
-                                aNewAttrValue += aToken;
+                                aNewAttrValue.append(aToken);
                             }
                         }
-                        pAttrList->AddAttribute( rAttrName, aNewAttrValue );
+                        pAttrList->AddAttribute( rAttrName, aNewAttrValue.makeStringAndClear() );
 
                         // create old draw:mirror for drawing graphic objects
                         const OUString& aAttrValue( GetXMLToken( IsXMLToken( rAttrValue, XML_HORIZONTAL ) ? XML_TRUE : XML_FALSE ) );
diff --git a/xmloff/source/transform/StyleOOoTContext.cxx b/xmloff/source/transform/StyleOOoTContext.cxx
index 6b1cceede346..ad530502d71f 100644
--- a/xmloff/source/transform/StyleOOoTContext.cxx
+++ b/xmloff/source/transform/StyleOOoTContext.cxx
@@ -382,7 +382,7 @@ void XMLPropertiesOOoTContext_Impl::StartElement(
        produces styles with both attributes. (#i49139#)
     */
     bool bExistStyleMirror( false );
-    OUString aStyleMirrorAttrValue;
+    OUStringBuffer aStyleMirrorAttrValue;
     bool bExistDrawMirror( false );
     OUString aDrawMirrorAttrValue;
     XMLTypedPropertiesOOoTContext_Impl* pMirrorContext( nullptr );
@@ -876,20 +876,20 @@ void XMLPropertiesOOoTContext_Impl::StartElement(
                 {
                     if ( !aStyleMirrorAttrValue.isEmpty() )
                     {
-                        aStyleMirrorAttrValue += " ";
+                        aStyleMirrorAttrValue.append(" ");
                     }
 
                     if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_LEFT_PAGES ) )
                     {
-                        aStyleMirrorAttrValue += GetXMLToken( XML_HORIZONTAL_ON_EVEN );
+                        aStyleMirrorAttrValue.append(GetXMLToken( XML_HORIZONTAL_ON_EVEN ));
                     }
                     else if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_RIGHT_PAGES ) )
                     {
-                        aStyleMirrorAttrValue += GetXMLToken( XML_HORIZONTAL_ON_ODD );
+                        aStyleMirrorAttrValue.append(GetXMLToken( XML_HORIZONTAL_ON_ODD ));
                     }
                     else
                     {
-                        aStyleMirrorAttrValue += aToken;
+                        aStyleMirrorAttrValue.append(aToken);
                     }
                 }
                 bExistStyleMirror = true;
@@ -937,7 +937,7 @@ void XMLPropertiesOOoTContext_Impl::StartElement(
         pMirrorContext->AddAttribute(
                         GetTransformer().GetNamespaceMap().GetQNameByKey(
                                 XML_NAMESPACE_STYLE, GetXMLToken( XML_MIRROR ) ),
-                        aStyleMirrorAttrValue);
+                        aStyleMirrorAttrValue.makeStringAndClear());
     }
     else if ( bExistDrawMirror )
     {
diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx
index 8a171ffa18f8..fb58e7b6232a 100644
--- a/xmlsecurity/source/framework/buffernode.cxx
+++ b/xmlsecurity/source/framework/buffernode.cxx
@@ -23,6 +23,7 @@
 #include "buffernode.hxx"
 #include <com/sun/star/xml/crypto/sax/ConstOfSecurityId.hpp>
 #include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
 
 namespace cssu = com::sun::star::uno;
 namespace cssxw = com::sun::star::xml::wrapper;
@@ -215,37 +216,37 @@ OUString BufferNode::printChildren() const
  *  result - the information string
  ******************************************************************************/
 {
-    OUString rc;
+    OUStringBuffer rc;
     std::vector< const ElementCollector* >::const_iterator ii = m_vElementCollectors.begin();
 
     for( ; ii != m_vElementCollectors.end() ; ++ii )
     {
-        rc += "BufID=" + OUString::number((*ii)->getBufferId());
+        rc.append("BufID=").append(OUString::number((*ii)->getBufferId()));
 
         if ((*ii)->getModify())
         {
-            rc += "[M]";
+            rc.append("[M]");
         }
 
-        rc += ",Pri=";
+        rc.append(",Pri=");
 
         switch ((*ii)->getPriority())
         {
             case cssxc::sax::ElementMarkPriority_BEFOREMODIFY:
-                rc += "BEFOREMODIFY";
+                rc.append("BEFOREMODIFY");
                 break;
             case cssxc::sax::ElementMarkPriority_AFTERMODIFY:
-                rc += "AFTERMODIFY";
+                rc.append("AFTERMODIFY");
                 break;
             default:
-                rc += "UNKNOWN";
+                rc.append("UNKNOWN");
                 break;
         }
 
-        rc += "(SecID=" + OUString::number((*ii)->getSecurityId()) + ") ";
+        rc.append("(SecID=").append(OUString::number((*ii)->getSecurityId())).append(") ");
     }
 
-    return rc;
+    return rc.makeStringAndClear();
 }
 
 bool BufferNode::hasAnything() const
diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
index 9659f420c70a..5fea1e76fe3b 100644
--- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
+++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/xml/crypto/sax/ConstOfSecurityId.hpp>
 #include <cppuhelper/supportsservice.hxx>
 #include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
 
 namespace cssu = com::sun::star::uno;
 namespace cssl = com::sun::star::lang;
@@ -301,51 +302,51 @@ OUString SAXEventKeeperImpl::printBufferNode(
  *  info - the information string
  ******************************************************************************/
 {
-    OUString rc;
+    OUStringBuffer rc;
 
     for ( int i=0; i<nIndent; ++i )
     {
-        rc += " ";
+        rc.append(" ");
     }
 
     if (pBufferNode == m_pCurrentBufferNode)
     {
-        rc += "[%]";
+        rc.append("[%]");
     }
 
     if (pBufferNode == m_pCurrentBlockingBufferNode)
     {
-        rc += "[B]";
+        rc.append("[B]");
     }
 
-    rc += " " + m_xXMLDocument->getNodeName(pBufferNode->getXMLElement());
+    rc.append(" ").append(m_xXMLDocument->getNodeName(pBufferNode->getXMLElement()));
 
     BufferNode* pParent = const_cast<BufferNode*>(pBufferNode->getParent());
     if (pParent != nullptr)
     {
-        rc += "[" + m_xXMLDocument->getNodeName(pParent->getXMLElement()) + "]";
+        rc.append("[").append(m_xXMLDocument->getNodeName(pParent->getXMLElement())).append("]");
     }
 
-    rc += ":EC=" + pBufferNode->printChildren() + " BR=";
+    rc.append(":EC=").append(pBufferNode->printChildren()).append(" BR=");
 
     ElementMark * pBlocker = pBufferNode->getBlocker();
     if (pBlocker != nullptr)
     {
-        rc += OUString::number( pBlocker->getBufferId() ) + "(SecId="
-            + OUString::number( pBlocker->getSecurityId() ) + ") ";
+        rc.append(OUString::number( pBlocker->getBufferId() )).append("(SecId=")
+            .append(OUString::number( pBlocker->getSecurityId() )).append(") ");
     }
-    rc += "\n";
+    rc.append("\n");
 
     std::vector< const BufferNode* >* vChildren = pBufferNode->getChildren();
     for( auto jj = vChildren->begin();
          jj != vChildren->end(); ++jj )
     {
-        rc += printBufferNode(*jj, nIndent+4);
+        rc.append(printBufferNode(*jj, nIndent+4));
     }
 
     delete vChildren;
 
-    return rc;
+    return rc.makeStringAndClear();
 }
 
 cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > >


More information about the Libreoffice-commits mailing list