Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2186

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/86/2186/1

fdo#57950: Remove more chained appends in filter

And also sanitize some OUStringBuffer uses.

Change-Id: I338b18981e1f925d76c0d640159de30bab219122
---
M filter/source/msfilter/msvbahelper.cxx
M filter/source/msfilter/svdfppt.cxx
M filter/source/pdf/pdfexport.cxx
M filter/source/svg/svgwriter.cxx
M filter/source/svg/test/odfserializer.cxx
M filter/source/xsltfilter/XSLTFilter.cxx
6 files changed, 17 insertions(+), 45 deletions(-)



diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 9b8353d..e143ba4 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -48,11 +48,7 @@
 
 OUString makeMacroURL( const OUString& sMacroName )
 {
-    return OUStringBuffer().
-        append( sUrlPart0 ).
-        append( sMacroName ).
-        append( sUrlPart1 ).
-        makeStringAndClear();
+    return sUrlPart0 + sMacroName + sUrlPart1;
 }
 
 OUString extractMacroName( const OUString& rMacroUrl )
@@ -282,7 +278,7 @@
         OUString aLibName = rLibName.isEmpty() ?  getDefaultProjectName( pShell ) : rLibName ;
         OUString aModuleName = rModuleName;
         if( hasMacro( pShell, aLibName, aModuleName, rMacroName ) )
-            return OUStringBuffer( aLibName ).append( sal_Unicode( '.' ) ).append( aModuleName 
).append( sal_Unicode( '.' ) ).append( rMacroName ).makeStringAndClear();
+            return aLibName + "." + aModuleName + "." + rMacroName;
     }
 #endif
     return OUString();
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 057f7e5..b307db4 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -4110,24 +4110,20 @@
             {
                 if ( rIn.GetError() == 0 )
                 {
-                    rtl::OStringBuffer aMsg;
+                    OStringBuffer aMsg;
                     if ( rIn.Tell() > aTxMasterStyleHd.GetRecEndFilePos() )
                     {
-                        aMsg.append(RTL_CONSTASCII_STRINGPARAM("\n  "));
-                        aMsg.append(RTL_CONSTASCII_STRINGPARAM("reading too many bytes:"));
-                        aMsg.append(static_cast<sal_Int32>(rIn.Tell() - 
aTxMasterStyleHd.GetRecEndFilePos()));
+                        aMsg.append("\n  " + "reading too many bytes:" +
+                                    OString::number(rIn.Tell() - 
aTxMasterStyleHd.GetRecEndFilePos()));
                     }
                     if ( rIn.Tell() < aTxMasterStyleHd.GetRecEndFilePos() )
                     {
-                        aMsg.append(RTL_CONSTASCII_STRINGPARAM("\n  "));
-                        aMsg.append(RTL_CONSTASCII_STRINGPARAM("reading too few bytes:"));
-                        aMsg.append(static_cast<sal_Int32>(aTxMasterStyleHd.GetRecEndFilePos() - 
rIn.Tell()));
+                        aMsg.append("\n  " + "reading too few bytes:" +
+                                    OString::number(aTxMasterStyleHd.GetRecEndFilePos() - 
rIn.Tell()));
                     }
                     if (aMsg.getLength())
                     {
-                        aMsg.insert(0, RTL_CONSTASCII_STRINGPARAM("]:"));
-                        aMsg.insert(0, RTL_CONSTASCII_STRINGPARAM(
-                            "PptStyleSheet::operator>>["));
+                        aMsg.insert(0, "PptStyleSheet::operator>>[]");
                         OSL_FAIL(aMsg.getStr());
                     }
                 }
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index c9f3133..57d538b 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -878,10 +878,7 @@
 
                 if( aPageRange.isEmpty() )
                 {
-                    aPageRange = OUStringBuffer()
-                        .append( static_cast< sal_Int32 >( 1 ) )
-                        .append( static_cast< sal_Unicode >( '-' ) )
-                        .append( nPageCount ).makeStringAndClear();
+                    aPageRange = OUString::number( 1 ) + "-" + OUString::number(nPageCount );
                 }
                 StringRangeEnumerator aRangeEnum( aPageRange, 0, nPageCount-1 );
 
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 8ba1446..14e115e 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2935,8 +2935,7 @@
             {
                 SvXMLElementExport aElem( mrExport,
                         XML_NAMESPACE_NONE, "desc", sal_False, sal_False );
-                OUStringBuffer sType;
-                sType.append(static_cast<sal_Int32>(nType));
+                OUStringBuffer sType(OUString::number(nType));
                 if (pAction && (nType == META_COMMENT_ACTION))
                 {
                     sType.append(": ");
@@ -2944,9 +2943,8 @@
                     rtl::OString sComment = pA->GetComment();
                     if (!sComment.isEmpty())
                     {
-                        OUString ssComment = OUString( sComment.getStr(),
+                        sType.append(OUString( sComment.getStr(),
                                 sComment.getLength(), RTL_TEXTENCODING_UTF8 );
-                        sType.append(ssComment);
                     }
                     if (sComment.equalsIgnoreAsciiCaseL(
                                 RTL_CONSTASCII_STRINGPARAM("FIELD_SEQ_BEGIN")))
diff --git a/filter/source/svg/test/odfserializer.cxx b/filter/source/svg/test/odfserializer.cxx
index 77c9971..fbba017 100644
--- a/filter/source/svg/test/odfserializer.cxx
+++ b/filter/source/svg/test/odfserializer.cxx
@@ -76,32 +76,19 @@
 void SAL_CALL ODFSerializer::startElement( const ::rtl::OUString& aName,
                                            const uno::Reference< xml::sax::XAttributeList >& 
xAttribs ) throw (xml::sax::SAXException, uno::RuntimeException)
 {
-    rtl::OUStringBuffer aElement;
-    aElement.appendAscii("<");
-    aElement.append(aName);
-    aElement.appendAscii(" ");
+    OUStringBuffer aElement("<" + aName + " ");
 
     const sal_Int16 nLen=xAttribs->getLength();
     for( sal_Int16 i=0; i<nLen; ++i )
-    {
-        rtl::OUStringBuffer aAttribute;
-        aElement.append(xAttribs->getNameByIndex(i));
-        aElement.appendAscii("=\"");
-        aElement.append(xAttribs->getValueByIndex(i));
-        aElement.appendAscii("\" ");
-    }
+        aElement.append(xAttribs->getNameByIndex(i) + "=\"" +
+                        xAttribs->getValueByIndex(i) + "\" ");
 
-    aElement.appendAscii(">");
-    characters(aElement.makeStringAndClear());
+    characters(aElement.makeStringAndClear() + ">");
 }
 
 void SAL_CALL ODFSerializer::endElement( const ::rtl::OUString& aName ) throw 
(xml::sax::SAXException, uno::RuntimeException)
 {
-    rtl::OUStringBuffer aElement;
-    aElement.appendAscii("</");
-    aElement.append(aName);
-    aElement.appendAscii(">");
-    characters(aElement.makeStringAndClear());
+    characters("</" + aName + ">");
 }
 
 void SAL_CALL ODFSerializer::characters( const ::rtl::OUString& aChars ) throw 
(xml::sax::SAXException, uno::RuntimeException)
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index 30f7e0d..a16627f 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -241,9 +241,7 @@
         Exception e;
         if (a >>= e)
         {
-            rtl::OStringBuffer aMessage(RTL_CONSTASCII_STRINGPARAM("XSLTFilter::error was called: 
"));
-            aMessage.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US));
-            OSL_FAIL(aMessage.getStr());
+            OSL_FAIL("XSLTFilter::error was called: " + OUStringToOString(e.Message, 
RTL_TEXTENCODING_ASCII_US));
         }
         m_bError = sal_True;
         osl_setCondition(m_cTransformed);

-- 
To view, visit https://gerrit.libreoffice.org/2186
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I338b18981e1f925d76c0d640159de30bab219122
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Marcos Souza <marcos.souza.org@gmail.com>

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.