vcl/source/gdi/pdfwriter_impl.cxx | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-)
New commits: commit 86168b986e10bcb1d8b7895b2b8df3190b18bd9d Author: Julien Nabet <[email protected]> AuthorDate: Sun Sep 28 18:40:07 2025 +0200 Commit: Julien Nabet <[email protected]> CommitDate: Mon Sep 29 08:29:11 2025 +0200 loplugin:stringadd in pdfwriter_impl.cxx (part 1) Change-Id: Ie6f5b04229c51a19f83930e732ad2aea4d47ca15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191580 Reviewed-by: Julien Nabet <[email protected]> Tested-by: Jenkins diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index be2ebc17199a..4b22ca32d61d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1248,12 +1248,8 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, } // write header - OStringBuffer aBuffer( 20 ); - aBuffer.append( "%PDF-" ); - aBuffer.append(getPDFVersionStr(m_aContext.Version)); - // append something binary as comment (suggested in PDF Reference) - aBuffer.append( " %äüöß " ); - if( !writeBuffer( aBuffer ) ) + if (!writeBuffer(Concat2View(OString::Concat("%PDF-") + getPDFVersionStr(m_aContext.Version) + + " %äüöß "))) { m_aFile.close(); m_bOpen = false; @@ -1872,10 +1868,10 @@ OString PDFWriterImpl::emitStructureAttributes( PDFStructureElement& i_rEle ) } auto const WriteAttrs = [&](char const*const pName, OStringBuffer & rBuf) { - aRet.append(" <</O"); - aRet.append(pName); - aRet.append(rBuf); - aRet.append(">>"); + aRet.append(OString::Concat(" <</O") + + pName + + rBuf + + ">>"); }; if( !aLayout.isEmpty() ) { @@ -3433,11 +3429,10 @@ bool PDFWriterImpl::emitScreenAnnotations() SvMemoryStream aMemoryStream; aMemoryStream.WriteStream(aFileStream); - aLine.append(rScreen.m_nTempFileObject); - aLine.append(" 0 obj "); - aLine.append("<< /Type /EmbeddedFile /Length "); - aLine.append(static_cast<sal_Int64>(aMemoryStream.GetSize())); - aLine.append(" >> stream "); + aLine.append(OString::number(rScreen.m_nTempFileObject) + + " 0 obj << /Type /EmbeddedFile /Length " + + OString::number(static_cast<sal_Int64>(aMemoryStream.GetSize())) + + " >> stream "); if (!writeBuffer(aLine)) return false; aLine.setLength(0); @@ -3485,9 +3480,9 @@ bool PDFWriterImpl::emitScreenAnnotations() { // ISO 14289-1:2014, Clause: 7.11 aLine.append("/UF (<embedded file>) "); } - aLine.append("/EF << /F "); - aLine.append(rScreen.m_nTempFileObject); - aLine.append(" 0 R >>"); + aLine.append("/EF << /F " + + OString::number(rScreen.m_nTempFileObject) + + " 0 R >>"); } else {
