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

Stephan Bergmann sbergman at redhat.com
Thu Aug 21 05:14:16 PDT 2014


 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit c52e417505f1ab7193a17bf24348e5962436ea26
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Aug 21 14:13:27 2014 +0200

    Avoid invalid downcasts
    
    Change-Id: I1666321916d08b326bb0c1c1f21273d568523691

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index d8673c0..1942b90 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1982,14 +1982,12 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
     bool bInNamespaces = mMyNamespaces.find(nNameSpace) != mMyNamespaces.end();
     bool bInTokens = mMyTokens.find( Element ) != mMyTokens.end( );
 
-    OOXMLFastContextHandlerShape* pShapeCtx = (OOXMLFastContextHandlerShape*)mpParent;
-
     // We have methods to _add_ individual tokens or whole namespaces to be
     // processed by writerfilter (instead of oox), but we have no method to
     // filter out a single token. Just hardwire the wrap token here till we
     // need a more generic solution.
     bool bIsWrap = Element == static_cast<sal_Int32>(NMSP_vmlWord | XML_wrap);
-    if ( bInNamespaces && ((pShapeCtx->isShapeSent() && bIsWrap) || !bIsWrap) )
+    if ( bInNamespaces && ((static_cast<OOXMLFastContextHandlerShape*>(mpParent)->isShapeSent() && bIsWrap) || !bIsWrap) )
         xResult.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
     else if (mxContext.is())
     {
@@ -2004,7 +2002,7 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
         xResult.set(this);
 
     if ( bInTokens )
-        pShapeCtx->sendShape( Element );
+        static_cast<OOXMLFastContextHandlerShape*>(mpParent)->sendShape( Element );
 
     return xResult;
 }


More information about the Libreoffice-commits mailing list