[Libreoffice-commits] core.git: starmath/inc

Takeshi Abe tabe at fixedpoint.jp
Tue Jan 12 06:25:16 PST 2016


 starmath/inc/node.hxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 1de4bd9088bf9311e41bbe3eef098ba79504c071
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Sat Jan 2 12:29:50 2016 +0900

    starmath: Assert that SmRootNode always has three children
    
    Change-Id: I9d1b47fc7fc26254f331967dd58f60d88bd2112f
    Reviewed-on: https://gerrit.libreoffice.org/21036
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index cf6e472..90e7a57 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -26,6 +26,7 @@
 #include "rect.hxx"
 #include "format.hxx"
 
+#include <cassert>
 #include <memory>
 #include <vector>
 #include <deque>
@@ -1319,7 +1320,7 @@ public:
 
 inline SmNode* SmRootNode::Argument()
 {
-    OSL_ASSERT( GetNumSubNodes() > 0 );
+    assert( GetNumSubNodes() == 3 );
     return GetSubNode( 0 );
 }
 inline const SmNode* SmRootNode::Argument() const
@@ -1328,7 +1329,8 @@ inline const SmNode* SmRootNode::Argument() const
 }
 inline SmRootSymbolNode* SmRootNode::Symbol()
 {
-    OSL_ASSERT( GetNumSubNodes() > 1 && GetSubNode( 1 )->GetType() == NROOTSYMBOL );
+    assert( GetNumSubNodes() == 3 );
+    OSL_ASSERT( GetSubNode( 1 )->GetType() == NROOTSYMBOL );
     return static_cast< SmRootSymbolNode* >( GetSubNode( 1 ));
 }
 inline const SmRootSymbolNode* SmRootNode::Symbol() const
@@ -1337,7 +1339,7 @@ inline const SmRootSymbolNode* SmRootNode::Symbol() const
 }
 inline SmNode* SmRootNode::Body()
 {
-    OSL_ASSERT( GetNumSubNodes() > 2 );
+    assert( GetNumSubNodes() == 3 );
     return GetSubNode( 2 );
 }
 inline const SmNode* SmRootNode::Body() const


More information about the Libreoffice-commits mailing list