diff options
author | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2013-02-16 13:53:59 -0200 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@alta.org.br> | 2013-02-16 17:19:32 +0000 |
commit | 92064bb2c265069de33d0ced7aa9d94d4c2829c3 (patch) | |
tree | 6e9598c40bedca8635243efa4479489e36655ed4 /filter/source | |
parent | c4bbbe82f72aedb76c9dc8d3503fc67f92d01fc0 (diff) |
fdo#57950: Remove more chained appends in filter
And also sanitize some OUStringBuffer uses.
Change-Id: I338b18981e1f925d76c0d640159de30bab219122
Reviewed-on: https://gerrit.libreoffice.org/2186
Reviewed-by: Olivier Hallot <olivier.hallot@alta.org.br>
Tested-by: Olivier Hallot <olivier.hallot@alta.org.br>
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/msfilter/msvbahelper.cxx | 8 | ||||
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 16 | ||||
-rw-r--r-- | filter/source/pdf/pdfexport.cxx | 5 | ||||
-rw-r--r-- | filter/source/svg/svgwriter.cxx | 6 | ||||
-rw-r--r-- | filter/source/svg/test/odfserializer.cxx | 23 | ||||
-rw-r--r-- | filter/source/xsltfilter/XSLTFilter.cxx | 4 |
6 files changed, 17 insertions, 45 deletions
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 9b8353dc51a5..e143ba47ed9b 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -48,11 +48,7 @@ const OUString sUrlPart1( "?language=Basic&location=document" ); 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 resolveVBAMacro( SfxObjectShell* pShell, const OUString& rLibName, cons 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 057f7e54bd07..b307db45c1a3 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -4110,24 +4110,20 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd { 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 c9f313300384..57d538bfbdb1 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -878,10 +878,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue 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 8ba1446bf0dd..14e115effbc2 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -2935,8 +2935,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, { 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 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, 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 77c997126e79..fbba0173880a 100644 --- a/filter/source/svg/test/odfserializer.cxx +++ b/filter/source/svg/test/odfserializer.cxx @@ -76,32 +76,19 @@ void SAL_CALL ODFSerializer::endDocument() throw (xml::sax::SAXException, uno::R 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 30f7e0dc3ed2..a16627fd06c7 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -241,9 +241,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) 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); |