[Libreoffice-commits] core.git: sd/source

Stephan Bergmann sbergman at redhat.com
Fri Jan 9 06:43:02 PST 2015


 sd/source/filter/eppt/epptbase.hxx        |    6 +++---
 sd/source/filter/eppt/pptx-epptbase.cxx   |    2 +-
 sd/source/filter/eppt/pptx-stylesheet.cxx |   14 +++++++-------
 sd/source/filter/eppt/pptx-text.cxx       |   14 +++++++-------
 sd/source/filter/eppt/text.hxx            |    6 +++---
 5 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 8a50042889c138a6efbb395f3cb748beaac22189
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 9 15:39:25 2015 +0100

    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

diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
index 4b552a5..c3554cd 100644
--- a/sd/source/filter/eppt/epptbase.hxx
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -289,12 +289,12 @@ struct PPTExParaLevel
 
 struct PPTExParaSheet
 {
-                PPTExBulletProvider& rBuProv;
+                PPTExBulletProvider* pBuProv;
 
                 sal_uInt32  mnInstance;
 
                 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 > &,
                                         FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel );
@@ -310,7 +310,7 @@ class PPTExStyleSheet
                 PPTExCharSheet*     mpCharSheet[ PPTEX_STYLESHEETENTRYS ];
                 PPTExParaSheet*     mpParaSheet[ PPTEX_STYLESHEETENTRYS ];
 
-                PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv );
+                PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider* pBuProv );
                 ~PPTExStyleSheet();
 
                 PPTExParaSheet& GetParaSheet( int nInstance ) { return *mpParaSheet[ nInstance ]; };
diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx
index 2ec0569..2cb8998 100644
--- a/sd/source/filter/eppt/pptx-epptbase.cxx
+++ b/sd/source/filter/eppt/pptx-epptbase.cxx
@@ -540,7 +540,7 @@ bool PPTWriterBase::GetStyleSheets()
             ? (sal_uInt16)( *(sal_Int32*)mAny.getValue() / 4.40972 )
             : 1250;
 
-        maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, *dynamic_cast<PPTExBulletProvider*>(this) ) );
+        maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, dynamic_cast<PPTExBulletProvider*>(this) ) );
         SetCurrentStyleSheet( nPageNum );
         if ( GetPageByIndex( nPageNum, MASTER ) )
             aXNamed = Reference< XNamed >
diff --git a/sd/source/filter/eppt/pptx-stylesheet.cxx b/sd/source/filter/eppt/pptx-stylesheet.cxx
index 1961326..8278b61 100644
--- a/sd/source/filter/eppt/pptx-stylesheet.cxx
+++ b/sd/source/filter/eppt/pptx-stylesheet.cxx
@@ -129,8 +129,8 @@ void PPTExCharSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool,
     }
 }
 
-PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv ) :
-    rBuProv     ( rProv ),
+PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider* pProv ) :
+    pBuProv     ( pProv ),
     mnInstance  ( nInstance )
 {
     bool bHasBullet = false;
@@ -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,
                                         FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel )
 {
-    ParagraphObj aParagraphObj( rXPropSet, rBuProv );
+    ParagraphObj aParagraphObj( rXPropSet, pBuProv );
     aParagraphObj.CalculateGraphicBulletSize( rCharLevel.mnFontHeight );
     PPTExParaLevel& rLev = maParaLevel[ nLevel ];
 
@@ -292,7 +292,7 @@ void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::co
             {
                 PPTExParaLevel& rLevel = maParaLevel[ i ];
                 if ( i )
-                    aParagraphObj.ImplGetNumberingLevel( rBuProv, i, false );
+                    aParagraphObj.ImplGetNumberingLevel( pBuProv, i, false );
                 rLevel.mnTextOfs = aParagraphObj.nTextOfs;
                 rLevel.mnBulletOfs = (sal_uInt16)aParagraphObj.nBulletOfs;
                 rLevel.mnBulletChar = aParagraphObj.cBulletId;
@@ -321,7 +321,7 @@ void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool,
             maParaLevel[ 2 ].mbExtendedBulletsUsed || maParaLevel[ 3 ].mbExtendedBulletsUsed ||
                 maParaLevel[ 4 ].mbExtendedBulletsUsed )
     {
-        SvStream& rOut = rBuProv.aBuExMasterStream;
+        SvStream& rOut = pBuProv->aBuExMasterStream;
         if ( !nLev )
         {
             rOut.WriteUInt32( ( ( EPP_PST_ExtendedParagraphMasterAtom << 16 ) | ( mnInstance << 4 ) ) )
@@ -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++ )
     {
-        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 );
     }
 }
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index 86bf44b..06f21bb 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -647,7 +647,7 @@ PortionObj& PortionObj::operator=( const PortionObj& rPortionObj )
 }
 
 ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
-    PPTExBulletProvider& rProv)
+    PPTExBulletProvider* pProv)
     : PropStateValue()
     , SOParagraph()
     , mvPortions()
@@ -673,7 +673,7 @@ ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::s
     nBulletFlags = 0;
     nParaFlags = 0;
 
-    ImplGetParagraphValues( rProv, false );
+    ImplGetParagraphValues( pProv, false );
 }
 
 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
                 }
             }
         }
-        ImplGetParagraphValues( rProv, true );
+        ImplGetParagraphValues( &rProv, true );
     }
 }
 
@@ -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;
     if ( GetPropertyValue( aAny, mXPropSet, OUString( "ParaLeftMargin" ) ) )
@@ -914,7 +914,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1
                                 OString aUniqueId( OUStringToOString(aGraphicURL.copy(nIndex), RTL_TEXTENCODING_UTF8) );
                                 if ( !aUniqueId.isEmpty() )
                                 {
-                                    nBulletId = rBuProv.GetId( aUniqueId, aBuGraSize );
+                                    nBulletId = pBuProv->GetId( aUniqueId, aBuGraSize );
                                     if ( nBulletId != 0xffff )
                                         bExtendedBulletsUsed = true;
                                 }
@@ -1103,7 +1103,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1
         nBulletOfs = 0;
 }
 
-void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, bool bGetPropStateValue )
+void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bGetPropStateValue )
 {
     ::com::sun::star::uno::Any aAny;
     if ( GetPropertyValue( aAny, mXPropSet, "NumberingLevel", true ) )
@@ -1129,7 +1129,7 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, bool bG
         nDepth = 0;
         mbIsBullet = false;
     }
-    ImplGetNumberingLevel( rBuProv, nDepth, mbIsBullet, bGetPropStateValue );
+    ImplGetNumberingLevel( pBuProv, nDepth, mbIsBullet, bGetPropStateValue );
 
     if ( ImplGetPropertyValue( OUString( "ParaTabStops" ), bGetPropStateValue ) )
         maTabStop = *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue();
diff --git a/sd/source/filter/eppt/text.hxx b/sd/source/filter/eppt/text.hxx
index 15d87ba..eb58689 100644
--- a/sd/source/filter/eppt/text.hxx
+++ b/sd/source/filter/eppt/text.hxx
@@ -186,8 +186,8 @@ class ParagraphObj : public PropStateValue, public SOParagraph
         void            ImplConstruct( const ParagraphObj& rParagraphObj );
         void            ImplClear();
         sal_uInt32      ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
-        void            ImplGetParagraphValues( PPTExBulletProvider& rBuProv, bool bGetPropStateValue = false );
-        void            ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, bool bIsBullet, bool bGetPropStateValue = false );
+        void            ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bGetPropStateValue = false );
+        void            ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int16 nDepth, bool bIsBullet, bool bGetPropStateValue = false );
 
     public :
 
@@ -222,7 +222,7 @@ class ParagraphObj : public PropStateValue, public SOParagraph
                                 PPTExBulletProvider& rBuProv );
                         ParagraphObj( const ParagraphObj& rParargraphObj );
                         ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
-                                        PPTExBulletProvider& rBuProv );
+                                      PPTExBulletProvider* pBuProv );
 
     bool empty() const { return mvPortions.empty(); }
 


More information about the Libreoffice-commits mailing list