summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-16 10:13:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-16 12:12:31 +0200
commit4a96fb8ec0130e1036913093836bcf28bc37a49b (patch)
treee7aad9be4ca417e9e64f688cc99bee0638037741 /sdext
parentf33b6e341fb7dd1ab3acd4fe5457b716be316e89 (diff)
loplugin:bufferadd loosen some constraints
and extend O*StringView to have a constructor that takes a pointer and a length Change-Id: I6120e96280f030757e855a6596efdae438b7e1e8 Reviewed-on: https://gerrit.libreoffice.org/80872 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/pdfimport/misc/pdfihelper.cxx5
-rw-r--r--sdext/source/pdfimport/pdfparse/pdfentries.cxx34
-rw-r--r--sdext/source/pdfimport/sax/emitcontext.cxx10
-rw-r--r--sdext/source/pdfimport/tree/drawtreevisiting.cxx5
-rw-r--r--sdext/source/pdfimport/tree/writertreevisiting.cxx5
5 files changed, 22 insertions, 37 deletions
diff --git a/sdext/source/pdfimport/misc/pdfihelper.cxx b/sdext/source/pdfimport/misc/pdfihelper.cxx
index 2936a62965d8..3c6c85538158 100644
--- a/sdext/source/pdfimport/misc/pdfihelper.cxx
+++ b/sdext/source/pdfimport/misc/pdfihelper.cxx
@@ -101,10 +101,7 @@ OUString pdfi::getColorString( const rendering::ARGBColor& rCol )
OUString pdfi::getPercentString(double value)
{
- OUStringBuffer buf(32);
- buf.append(value);
- buf.append("%");
- return buf.makeStringAndClear();
+ return OUString::number(value) + "%";
}
OUString pdfi::unitMMString( double fMM )
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index 92cb45ab5a12..e57cf3f701b7 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -428,12 +428,12 @@ PDFObjectRef::~PDFObjectRef()
bool PDFObjectRef::emit( EmitContext& rWriteContext ) const
{
- OStringBuffer aBuf( 16 );
- aBuf.append( ' ' );
- aBuf.append( sal_Int32( m_nNumber ) );
- aBuf.append( ' ' );
- aBuf.append( sal_Int32( m_nGeneration ) );
- aBuf.append( " R" );
+ OString aBuf =
+ " " +
+ OString::number( sal_Int32( m_nNumber ) ) +
+ " " +
+ OString::number( sal_Int32( m_nGeneration ) ) +
+ " R";
return rWriteContext.write( aBuf.getStr(), aBuf.getLength() );
}
@@ -806,11 +806,11 @@ bool PDFObject::emit( EmitContext& rWriteContext ) const
if( pEData )
pEData->insertXref( m_nNumber, m_nGeneration, rWriteContext.getCurPos() );
- OStringBuffer aBuf( 32 );
- aBuf.append( sal_Int32( m_nNumber ) );
- aBuf.append( ' ' );
- aBuf.append( sal_Int32( m_nGeneration ) );
- aBuf.append( " obj\n" );
+ OString aBuf =
+ OString::number( sal_Int32( m_nNumber ) ) +
+ " " +
+ OString::number( sal_Int32( m_nGeneration ) ) +
+ " obj\n";
if( ! rWriteContext.write( aBuf.getStr(), aBuf.getLength() ) )
return false;
@@ -1426,12 +1426,12 @@ bool PDFFile::emit( EmitContext& rWriteContext ) const
{
setEmitData( rWriteContext, new EmitImplData( this ) );
- OStringBuffer aBuf( 32 );
- aBuf.append( "%PDF-" );
- aBuf.append( sal_Int32( m_nMajor ) );
- aBuf.append( '.' );
- aBuf.append( sal_Int32( m_nMinor ) );
- aBuf.append( "\n" );
+ OString aBuf =
+ "%PDF-" +
+ OString::number( sal_Int32( m_nMajor ) ) +
+ "." +
+ OString::number( sal_Int32( m_nMinor ) ) +
+ "\n";
if( ! rWriteContext.write( aBuf.getStr(), aBuf.getLength() ) )
return false;
return emitSubElements( rWriteContext );
diff --git a/sdext/source/pdfimport/sax/emitcontext.cxx b/sdext/source/pdfimport/sax/emitcontext.cxx
index 4b1f7de41172..48c91811f23d 100644
--- a/sdext/source/pdfimport/sax/emitcontext.cxx
+++ b/sdext/source/pdfimport/sax/emitcontext.cxx
@@ -60,10 +60,7 @@ SaxEmitter::SaxEmitter( const uno::Reference< xml::sax::XDocumentHandler >& xDoc
OUString aStr( OStringToOUString( pDir, RTL_TEXTENCODING_UTF8 ) );
OUString aFileURL;
osl_getFileURLFromSystemPath( aStr.pData, &aFileURL.pData );
- OUStringBuffer aBuf( 256 );
- aBuf.append( aFileURL );
- aBuf.append( "/pdfimport.xml" );
- pStream = new osl::File( aBuf.makeStringAndClear() );
+ pStream = new osl::File( aFileURL + "/pdfimport.xml" );
if( pStream->open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ) )
{
pStream->open( osl_File_OpenFlag_Write );
@@ -168,10 +165,7 @@ void SaxEmitter::endTag( const char* pTag )
for( int i = 0; i < nIndent; i++ )
pStream->write( " ", 4, nWritten );
- OStringBuffer aBuf( 1024 );
- aBuf.append( "</" );
- aBuf.append( pTag );
- aBuf.append( ">\n" );
+ OString aBuf = "</" + rtl::OStringView(pTag) + ">\n";
pStream->write( aBuf.getStr(), aBuf.getLength(), nWritten );
nIndent--;
#endif
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 3985d07fdeb8..f4376d41af25 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -813,10 +813,7 @@ void DrawXmlFinalizer::visit( HyperlinkElement&, const std::list< std::unique_pt
static void SetFontsizeProperties(PropertyMap& props, double fontSize)
{
- OUStringBuffer aBuf(32);
- aBuf.append(fontSize * 72 / PDFI_OUTDEV_RESOLUTION);
- aBuf.append("pt");
- OUString aFSize = aBuf.makeStringAndClear();
+ OUString aFSize = OUString::number(fontSize * 72 / PDFI_OUTDEV_RESOLUTION) + "pt";
props["fo:font-size"] = aFSize;
props["style:font-size-asian"] = aFSize;
props["style:font-size-complex"] = aFSize;
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index dd30b0f91c61..00cbad2ac47c 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -925,10 +925,7 @@ void WriterXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_
aFontProps[ "style:text-outline" ] = "true";
}
// size
- OUStringBuffer aBuf( 32 );
- aBuf.append( rFont.size*72/PDFI_OUTDEV_RESOLUTION );
- aBuf.append( "pt" );
- OUString aFSize = aBuf.makeStringAndClear();
+ OUString aFSize = OUString::number( rFont.size*72/PDFI_OUTDEV_RESOLUTION ) + "pt";
aFontProps[ "fo:font-size" ] = aFSize;
aFontProps[ "style:font-size-asian" ] = aFSize;
aFontProps[ "style:font-size-complex" ] = aFSize;