[Libreoffice-commits] core.git: 2 commits - lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Sun Mar 26 20:24:47 UTC 2017


 lotuswordpro/source/filter/lwpframelayout.cxx |    7 ++++++-
 lotuswordpro/source/filter/lwpframelayout.hxx |    1 +
 lotuswordpro/source/filter/lwpuidoc.cxx       |   12 +++++-------
 3 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 19882e0c7daeaa16cbdbca2838064d4ad8762649
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 26 21:23:44 2017 +0100

    lwp: convert hopeful asserts to exceptions
    
    Change-Id: I3111929ea84aa8280607811c851d033156c65731

diff --git a/lotuswordpro/source/filter/lwpuidoc.cxx b/lotuswordpro/source/filter/lwpuidoc.cxx
index 1f45c1da0544..8e26b0daea37 100644
--- a/lotuswordpro/source/filter/lwpuidoc.cxx
+++ b/lotuswordpro/source/filter/lwpuidoc.cxx
@@ -92,11 +92,9 @@ void LwpNamedProperties::Read(LwpObjectStream *pStrm)
 {
     sal_uInt16 numEntries = pStrm->QuickReaduInt16();
 
-    for (sal_uInt16 k = 0 ; k < numEntries; k++)
-    {
-        assert(false);
-        // TODO: Read each NamedProperties
-    }
+    if (numEntries)
+        throw std::runtime_error("TODO: Read each NamedProperties");
+
     pStrm->SkipExtra();
 }
 /**
@@ -121,8 +119,8 @@ void LwpMergeOptions::Read(LwpObjectStream *pStrm)
     m_nType = pStrm->QuickReaduInt16();
 
     //Does not process m_nType here. Assume m_nType is 0.
-    // TODO: Read the CMergeDataFile
-    assert(m_nType==0);
+    if (m_nType != 0)
+        throw std::runtime_error("TODO: Read the CMergeDataFile");
 
     m_nLastActionFlag = pStrm->QuickReaduInt16();
     pStrm->SkipExtra();
commit 7eb92eea21e2af47b17c9901107f6e4833567928
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 26 21:21:22 2017 +0100

    ofz#944 avoid recurse to death
    
    Change-Id: I27ed8cf5e8296a1ad91c33614913fc7af4a56d45

diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index c4de8630c4be..c26d61f75378 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -761,7 +761,7 @@ void LwpFrameLink::Read(LwpObjectStream* pStrm)
 }
 
 LwpFrameLayout::LwpFrameLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
-    : LwpPlacableLayout(objHdr, pStrm), m_pFrame(nullptr)
+    : LwpPlacableLayout(objHdr, pStrm), m_pFrame(nullptr), m_bGettingMaxWidth(false)
 {
 }
 
@@ -945,6 +945,10 @@ double LwpFrameLayout::GetWidth()
  */
 double LwpFrameLayout::GetMaxWidth()
 {
+    if (m_bGettingMaxWidth)
+        throw std::runtime_error("recursive GetMaxWidth");
+
+    m_bGettingMaxWidth = true;
     double fActualWidth = 0;
     rtl::Reference<LwpVirtualLayout> xLayout(GetContainerLayout());
     LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xLayout.get());
@@ -973,6 +977,7 @@ double LwpFrameLayout::GetMaxWidth()
         fActualWidth = fParentWidth - fXOffset - fParentMarginRight - fWrapRight;
     }
 
+    m_bGettingMaxWidth = false;
     return fActualWidth;
 }
 
diff --git a/lotuswordpro/source/filter/lwpframelayout.hxx b/lotuswordpro/source/filter/lwpframelayout.hxx
index 527e5fbd50b5..734fe88ae35f 100644
--- a/lotuswordpro/source/filter/lwpframelayout.hxx
+++ b/lotuswordpro/source/filter/lwpframelayout.hxx
@@ -141,6 +141,7 @@ private:
 private:
     LwpFrameLink m_Link;
     std::unique_ptr<LwpFrame> m_pFrame;
+    bool m_bGettingMaxWidth;
 };
 
 /**


More information about the Libreoffice-commits mailing list