[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Thu Dec 10 08:12:01 PST 2015


 lotuswordpro/source/filter/lwpdoc.cxx     |    2 +-
 lotuswordpro/source/filter/lwpfoundry.cxx |   24 +++++++++++++-----------
 lotuswordpro/source/filter/lwpstory.cxx   |    2 +-
 3 files changed, 15 insertions(+), 13 deletions(-)

New commits:
commit 26b447a8ff041ab168e82c018dd7a10b7cb95f24
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 10 16:10:20 2015 +0000

    need dynamic casts here, etc.
    
    Change-Id: I578343719d2d7feff51775ff1b073b6584e76f82
    (cherry picked from commit 46fe3bddebf30775ae19eaa0fefe1d8e2f78eced)

diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index 140e00d..12975e3 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -294,7 +294,7 @@ void LwpDocument::RegisterStylesInPara()
         {
             //Register the child para
             pStory->SetFoundry(m_pFoundry);
-            pStory->RegisterStyle();
+            pStory->DoRegisterStyle();
             pStory = dynamic_cast<LwpStory*>(pStory->GetNext().obj(VO_STORY).get());
         }
     }
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index 64897e2..74bfded 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -219,18 +219,21 @@ void LwpFoundry::RegisterAllLayouts()
 
 LwpBookMark* LwpFoundry::GetBookMark(LwpObjectID objMarker)
 {
-    LwpDLVListHeadHolder* pHeadHolder= static_cast
+    LwpDLVListHeadHolder* pHeadHolder= dynamic_cast
                     <LwpDLVListHeadHolder*>(m_BookMarkHead.obj().get());
+
+    if (!pHeadHolder)
+        return nullptr;
+
     LwpObjectID& rObjID = pHeadHolder->GetHeadID();
-    LwpBookMark* pBookMark;
-    pBookMark = static_cast<LwpBookMark*>(rObjID.obj().get());
+    LwpBookMark* pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get());
 
     while (pBookMark)
     {
         if (pBookMark->IsRightMarker(objMarker))
             return pBookMark;
         rObjID = pBookMark->GetNext();
-        pBookMark = static_cast<LwpBookMark*>(rObjID.obj().get());
+        pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get());
     }
     return nullptr;
 }
@@ -475,23 +478,22 @@ LwpListList* LwpOrderedObjectManager::GetNextActiveListList(LwpListList * pLast)
 {
     LwpListList* pList = nullptr;
     if(pLast)
-        pList = static_cast<LwpListList*>(pLast->GetNext().obj().get());
+        pList = dynamic_cast<LwpListList*>(pLast->GetNext().obj().get());
     else
     {
-        LwpDLVListHeadHolder* pHeadHolder= static_cast<LwpDLVListHeadHolder*>(m_Head.obj().get());
+        LwpDLVListHeadHolder* pHeadHolder= dynamic_cast<LwpDLVListHeadHolder*>(m_Head.obj().get());
         if(pHeadHolder)
         {
-            pList = static_cast<LwpListList*>(pHeadHolder->GetHeadID().obj().get());
+            pList = dynamic_cast<LwpListList*>(pHeadHolder->GetHeadID().obj().get());
         }
     }
 
     while(pList)
     {
-        LwpContent* pContent = static_cast<LwpContent*>(pList->GetObject().obj().get());
-        if(pContent && pContent->HasNonEmbeddedLayouts() &&
-            !pContent->IsStyleContent())
+        LwpContent* pContent = dynamic_cast<LwpContent*>(pList->GetObject().obj().get());
+        if (pContent && pContent->HasNonEmbeddedLayouts() && !pContent->IsStyleContent())
             return pList;
-        pList = static_cast<LwpListList*>(pList->GetNext().obj().get());
+        pList = dynamic_cast<LwpListList*>(pList->GetNext().obj().get());
     }
     return nullptr;
 }
diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
index 1300b15..b165647 100644
--- a/lotuswordpro/source/filter/lwpstory.cxx
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -134,7 +134,7 @@ void LwpStory::RegisterStyle()
     while(pPara)
     {
         pPara->SetFoundry(m_pFoundry);
-        pPara->RegisterStyle();
+        pPara->DoRegisterStyle();
         pPara = dynamic_cast<LwpPara*>(pPara->GetNext().obj().get());
     }
 }


More information about the Libreoffice-commits mailing list