Kaydet (Commit) 8a500428 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Work around -fsanitize=null

...at least in CppunitTest_sd_export_tests, the dynamic_cast in
PPTWriterBase::GetStyleSheets (sd/source/filter/eppt/pptx-epptbase.cxx) can
fail, but the resulting reference appears to not be accessed then.  So change
from reference to (potentially null) pointer.

Change-Id: Ide49be7bffefa7906e84349642f7c3d0666d414e
üst 05fb5e87
...@@ -289,12 +289,12 @@ struct PPTExParaLevel ...@@ -289,12 +289,12 @@ struct PPTExParaLevel
struct PPTExParaSheet struct PPTExParaSheet
{ {
PPTExBulletProvider& rBuProv; PPTExBulletProvider* pBuProv;
sal_uInt32 mnInstance; sal_uInt32 mnInstance;
PPTExParaLevel maParaLevel[ 5 ]; PPTExParaLevel maParaLevel[ 5 ];
PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv ); PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider* pProv );
void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel ); FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel );
...@@ -310,7 +310,7 @@ class PPTExStyleSheet ...@@ -310,7 +310,7 @@ class PPTExStyleSheet
PPTExCharSheet* mpCharSheet[ PPTEX_STYLESHEETENTRYS ]; PPTExCharSheet* mpCharSheet[ PPTEX_STYLESHEETENTRYS ];
PPTExParaSheet* mpParaSheet[ PPTEX_STYLESHEETENTRYS ]; PPTExParaSheet* mpParaSheet[ PPTEX_STYLESHEETENTRYS ];
PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv ); PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider* pBuProv );
~PPTExStyleSheet(); ~PPTExStyleSheet();
PPTExParaSheet& GetParaSheet( int nInstance ) { return *mpParaSheet[ nInstance ]; }; PPTExParaSheet& GetParaSheet( int nInstance ) { return *mpParaSheet[ nInstance ]; };
......
...@@ -540,7 +540,7 @@ bool PPTWriterBase::GetStyleSheets() ...@@ -540,7 +540,7 @@ bool PPTWriterBase::GetStyleSheets()
? (sal_uInt16)( *(sal_Int32*)mAny.getValue() / 4.40972 ) ? (sal_uInt16)( *(sal_Int32*)mAny.getValue() / 4.40972 )
: 1250; : 1250;
maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, *dynamic_cast<PPTExBulletProvider*>(this) ) ); maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, dynamic_cast<PPTExBulletProvider*>(this) ) );
SetCurrentStyleSheet( nPageNum ); SetCurrentStyleSheet( nPageNum );
if ( GetPageByIndex( nPageNum, MASTER ) ) if ( GetPageByIndex( nPageNum, MASTER ) )
aXNamed = Reference< XNamed > aXNamed = Reference< XNamed >
......
...@@ -129,8 +129,8 @@ void PPTExCharSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool, ...@@ -129,8 +129,8 @@ void PPTExCharSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool,
} }
} }
PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv ) : PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider* pProv ) :
rBuProv ( rProv ), pBuProv ( pProv ),
mnInstance ( nInstance ) mnInstance ( nInstance )
{ {
bool bHasBullet = false; bool bHasBullet = false;
...@@ -226,7 +226,7 @@ PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBull ...@@ -226,7 +226,7 @@ PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBull
void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel ) FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel )
{ {
ParagraphObj aParagraphObj( rXPropSet, rBuProv ); ParagraphObj aParagraphObj( rXPropSet, pBuProv );
aParagraphObj.CalculateGraphicBulletSize( rCharLevel.mnFontHeight ); aParagraphObj.CalculateGraphicBulletSize( rCharLevel.mnFontHeight );
PPTExParaLevel& rLev = maParaLevel[ nLevel ]; PPTExParaLevel& rLev = maParaLevel[ nLevel ];
...@@ -292,7 +292,7 @@ void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::co ...@@ -292,7 +292,7 @@ void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::co
{ {
PPTExParaLevel& rLevel = maParaLevel[ i ]; PPTExParaLevel& rLevel = maParaLevel[ i ];
if ( i ) if ( i )
aParagraphObj.ImplGetNumberingLevel( rBuProv, i, false ); aParagraphObj.ImplGetNumberingLevel( pBuProv, i, false );
rLevel.mnTextOfs = aParagraphObj.nTextOfs; rLevel.mnTextOfs = aParagraphObj.nTextOfs;
rLevel.mnBulletOfs = (sal_uInt16)aParagraphObj.nBulletOfs; rLevel.mnBulletOfs = (sal_uInt16)aParagraphObj.nBulletOfs;
rLevel.mnBulletChar = aParagraphObj.cBulletId; rLevel.mnBulletChar = aParagraphObj.cBulletId;
...@@ -321,7 +321,7 @@ void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool, ...@@ -321,7 +321,7 @@ void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool,
maParaLevel[ 2 ].mbExtendedBulletsUsed || maParaLevel[ 3 ].mbExtendedBulletsUsed || maParaLevel[ 2 ].mbExtendedBulletsUsed || maParaLevel[ 3 ].mbExtendedBulletsUsed ||
maParaLevel[ 4 ].mbExtendedBulletsUsed ) maParaLevel[ 4 ].mbExtendedBulletsUsed )
{ {
SvStream& rOut = rBuProv.aBuExMasterStream; SvStream& rOut = pBuProv->aBuExMasterStream;
if ( !nLev ) if ( !nLev )
{ {
rOut.WriteUInt32( ( ( EPP_PST_ExtendedParagraphMasterAtom << 16 ) | ( mnInstance << 4 ) ) ) rOut.WriteUInt32( ( ( EPP_PST_ExtendedParagraphMasterAtom << 16 ) | ( mnInstance << 4 ) ) )
...@@ -384,11 +384,11 @@ void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool, ...@@ -384,11 +384,11 @@ void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool,
} }
} }
PPTExStyleSheet::PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv ) PPTExStyleSheet::PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider* pBuProv )
{ {
for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
{ {
mpParaSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExParaSheet( nInstance, nDefaultTab, rBuProv ); mpParaSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExParaSheet( nInstance, nDefaultTab, pBuProv );
mpCharSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExCharSheet( nInstance ); mpCharSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExCharSheet( nInstance );
} }
} }
......
...@@ -647,7 +647,7 @@ PortionObj& PortionObj::operator=( const PortionObj& rPortionObj ) ...@@ -647,7 +647,7 @@ PortionObj& PortionObj::operator=( const PortionObj& rPortionObj )
} }
ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
PPTExBulletProvider& rProv) PPTExBulletProvider* pProv)
: PropStateValue() : PropStateValue()
, SOParagraph() , SOParagraph()
, mvPortions() , mvPortions()
...@@ -673,7 +673,7 @@ ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::s ...@@ -673,7 +673,7 @@ ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::s
nBulletFlags = 0; nBulletFlags = 0;
nParaFlags = 0; nParaFlags = 0;
ImplGetParagraphValues( rProv, false ); ImplGetParagraphValues( pProv, false );
} }
ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent, ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent,
...@@ -743,7 +743,7 @@ ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::t ...@@ -743,7 +743,7 @@ ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::t
} }
} }
} }
ImplGetParagraphValues( rProv, true ); ImplGetParagraphValues( &rProv, true );
} }
} }
...@@ -789,7 +789,7 @@ void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight ) ...@@ -789,7 +789,7 @@ void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight )
} }
} }
void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nNumberingDepth, bool bIsBullet, bool bGetPropStateValue ) void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int16 nNumberingDepth, bool bIsBullet, bool bGetPropStateValue )
{ {
::com::sun::star::uno::Any aAny; ::com::sun::star::uno::Any aAny;
if ( GetPropertyValue( aAny, mXPropSet, OUString( "ParaLeftMargin" ) ) ) if ( GetPropertyValue( aAny, mXPropSet, OUString( "ParaLeftMargin" ) ) )
...@@ -914,7 +914,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 ...@@ -914,7 +914,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1
OString aUniqueId( OUStringToOString(aGraphicURL.copy(nIndex), RTL_TEXTENCODING_UTF8) ); OString aUniqueId( OUStringToOString(aGraphicURL.copy(nIndex), RTL_TEXTENCODING_UTF8) );
if ( !aUniqueId.isEmpty() ) if ( !aUniqueId.isEmpty() )
{ {
nBulletId = rBuProv.GetId( aUniqueId, aBuGraSize ); nBulletId = pBuProv->GetId( aUniqueId, aBuGraSize );
if ( nBulletId != 0xffff ) if ( nBulletId != 0xffff )
bExtendedBulletsUsed = true; bExtendedBulletsUsed = true;
} }
...@@ -1103,7 +1103,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 ...@@ -1103,7 +1103,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1
nBulletOfs = 0; nBulletOfs = 0;
} }
void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, bool bGetPropStateValue ) void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bGetPropStateValue )
{ {
::com::sun::star::uno::Any aAny; ::com::sun::star::uno::Any aAny;
if ( GetPropertyValue( aAny, mXPropSet, "NumberingLevel", true ) ) if ( GetPropertyValue( aAny, mXPropSet, "NumberingLevel", true ) )
...@@ -1129,7 +1129,7 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, bool bG ...@@ -1129,7 +1129,7 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, bool bG
nDepth = 0; nDepth = 0;
mbIsBullet = false; mbIsBullet = false;
} }
ImplGetNumberingLevel( rBuProv, nDepth, mbIsBullet, bGetPropStateValue ); ImplGetNumberingLevel( pBuProv, nDepth, mbIsBullet, bGetPropStateValue );
if ( ImplGetPropertyValue( OUString( "ParaTabStops" ), bGetPropStateValue ) ) if ( ImplGetPropertyValue( OUString( "ParaTabStops" ), bGetPropStateValue ) )
maTabStop = *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue(); maTabStop = *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue();
......
...@@ -186,8 +186,8 @@ class ParagraphObj : public PropStateValue, public SOParagraph ...@@ -186,8 +186,8 @@ class ParagraphObj : public PropStateValue, public SOParagraph
void ImplConstruct( const ParagraphObj& rParagraphObj ); void ImplConstruct( const ParagraphObj& rParagraphObj );
void ImplClear(); void ImplClear();
sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ); sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
void ImplGetParagraphValues( PPTExBulletProvider& rBuProv, bool bGetPropStateValue = false ); void ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bGetPropStateValue = false );
void ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, bool bIsBullet, bool bGetPropStateValue = false ); void ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int16 nDepth, bool bIsBullet, bool bGetPropStateValue = false );
public : public :
...@@ -222,7 +222,7 @@ class ParagraphObj : public PropStateValue, public SOParagraph ...@@ -222,7 +222,7 @@ class ParagraphObj : public PropStateValue, public SOParagraph
PPTExBulletProvider& rBuProv ); PPTExBulletProvider& rBuProv );
ParagraphObj( const ParagraphObj& rParargraphObj ); ParagraphObj( const ParagraphObj& rParargraphObj );
ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
PPTExBulletProvider& rBuProv ); PPTExBulletProvider* pBuProv );
bool empty() const { return mvPortions.empty(); } bool empty() const { return mvPortions.empty(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment