diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-07-06 15:16:06 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-07-10 16:29:27 +0200 |
commit | b9bc45705bc3204c968fd6c902a1d5003c008023 (patch) | |
tree | f52d59bd42e3f0663bc3fb4a8bd0ec59b8a715a0 /sd | |
parent | 3bc3ddc11fd94877d9c5d2b8313ab53150818236 (diff) |
Make EscherPropertyContainer::CreatePolygonProperties safer
Additionally adapted EscherPropertyContainer's AddOpt
methods to be more safe and flexible. Added support for
SvMemoryStream. Changed Data handling in EscherPropSortStruct
to use std::vector<sal_uInt8>, adapted all usages and
converions throgh all modules. This makes memorty handling
for these parts much safer (no more local new-ops, no
longer delete[] there).
Currently there are quite some usages of nProp.size() and
&nProp[0] to access the data. but the base for further
changes to work more on std::vector is done.
Change-Id: I982225c5bfc06fdd9e195d18cd3c550d15f1d48d
Reviewed-on: https://gerrit.libreoffice.org/57061
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 957977041c36..7d5040e8664d 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -2054,19 +2054,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( !aControlName.isEmpty() ) { - sal_uInt16 nBufSize; - nBufSize = ( aControlName.getLength() + 1 ) << 1; - sal_uInt8* pBuf = new sal_uInt8[ nBufSize ]; - sal_uInt8* pTmp = pBuf; - for ( sal_Int32 i = 0; i < aControlName.getLength(); i++ ) - { - sal_Unicode nUnicode = aControlName[i]; - *pTmp++ = static_cast<sal_uInt8>(nUnicode); - *pTmp++ = static_cast<sal_uInt8>( nUnicode >> 8 ); - } - *pTmp++ = 0; - *pTmp = 0; - aPropOpt.AddOpt( ESCHER_Prop_wzName, true, nBufSize, pBuf, nBufSize ); + aPropOpt.AddOpt(ESCHER_Prop_wzName, aControlName); } } else if ( mType == "drawing.Connector" ) @@ -3140,7 +3128,6 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXSha EscherPropertyContainer aPropOpt2; SvMemoryStream aMemStrm; - aMemStrm.ObjectOwnsMemory( false ); aMemStrm.WriteUInt16( nRowCount ) .WriteUInt16( nRowCount ) .WriteUInt16( 4 ); @@ -3151,7 +3138,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXSha aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x1000100 ); aPropOpt2.AddOpt( ESCHER_Prop_tableProperties, 1 ); - aPropOpt2.AddOpt( ESCHER_Prop_tableRowProperties, true, aMemStrm.Tell(), static_cast< sal_uInt8* >( const_cast< void* >( aMemStrm.GetData() ) ), aMemStrm.Tell() ); + aPropOpt2.AddOpt(ESCHER_Prop_tableRowProperties, true, 0, aMemStrm); aPropOpt.CreateShapeProperties( rXShape ); aPropOpt.Commit( *mpStrm ); aPropOpt2.Commit( *mpStrm, 3, ESCHER_UDefProp ); |