From 241bee7e4be6a205fae0d3f5508e084462c7ca55 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 10 Oct 2019 11:54:27 +0200 Subject: convert WriteCharPtr..getStr to WriteOString and improve the WriteOString method, we can avoid the strlen here, we already have the length One change in behaviour to be noted - if the string contains trailing zero bytes, which ARE INCLUDED IN THE STRING LENGTH, i.e. I'm not talking about the normal terminating zero, then this patch changes behaviour because we will now write those zeros to the stream. Change-Id: I4668b9b9eb877f820b1dc70d6cd10ba2623bc0a2 Reviewed-on: https://gerrit.libreoffice.org/80597 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sot/source/sdstor/stgole.cxx | 2 +- sot/source/sdstor/storinfo.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sot') diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx index 87a42b92f61b..f91da70ba66e 100644 --- a/sot/source/sdstor/stgole.cxx +++ b/sot/source/sdstor/stgole.cxx @@ -148,7 +148,7 @@ bool StgCompObjStream::Store() WriteInt32( -1 ); WriteClsId( *this, m_aClsId ); // Class ID WriteInt32( aAsciiUserName.getLength() + 1 ); - WriteCharPtr( aAsciiUserName.getStr() ); + WriteOString( aAsciiUserName ); WriteUChar( 0 ); // string terminator WriteClipboardFormat( *this, m_nCbFormat ); WriteInt32( 0 ); // terminator diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx index c4c21145f815..adbcba212828 100644 --- a/sot/source/sdstor/storinfo.cxx +++ b/sot/source/sdstor/storinfo.cxx @@ -80,7 +80,7 @@ void WriteClipboardFormat( SvStream & rStm, SotClipboardFormatId nFormat ) OString aAsciiCbFmt(OUStringToOString(aCbFmt, RTL_TEXTENCODING_ASCII_US)); rStm.WriteInt32( aAsciiCbFmt.getLength() + 1 ); - rStm.WriteCharPtr( aAsciiCbFmt.getStr() ); + rStm.WriteOString( aAsciiCbFmt ); rStm.WriteUChar( 0 ); } else if( nFormat != SotClipboardFormatId::NONE ) -- cgit