Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Easy hacks "align ASSERT (& friends) macro foo" patch.
From dd7f673f6398ce9472451221693f08f048fdfeeb Mon Sep 17 00:00:00 2001
From: Jacek Wolszczak <shutdownrunner@gmail.com>
Date: Thu, 17 Mar 2011 23:17:47 +0100
Subject: [PATCH] REPLACE j_assert with OSL_

---
 starmath/inc/caret.hxx       |    2 +-
 starmath/inc/node.hxx        |    2 -
 starmath/inc/visitors.hxx    |    2 +-
 starmath/source/cursor.cxx   |   46 ++++++++++++------------
 starmath/source/node.cxx     |    2 +-
 starmath/source/visitors.cxx |   78 +++++++++++++++++++++---------------------
 starmath/visual-editor-todo  |    5 +--
 7 files changed, 67 insertions(+), 70 deletions(-)

diff --git a/starmath/inc/caret.hxx b/starmath/inc/caret.hxx
index be40598..c0bda17 100644
--- a/starmath/inc/caret.hxx
+++ b/starmath/inc/caret.hxx
@@ -188,7 +188,7 @@ public:
     SmCaretPosGraphEntry* Add(SmCaretPos pos,
                             SmCaretPosGraphEntry* left = NULL,
                             SmCaretPosGraphEntry* right = NULL){
-        j_assert(pos.Index >= 0, "Index shouldn't be -1!");
+        OSL_ENSURE(pos.Index >= 0, "Index shouldn't be -1!");
         return Add(SmCaretPosGraphEntry(pos, left, right));
     }
     /** Get an iterator for this graph */
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 85667b0..3b8e742 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -34,8 +34,6 @@
 #include <iostream>
 #include <stdio.h>
 
-#define j_assert(cond, msg) DBG_ASSERT(cond, msg)
-
 #include "parse.hxx"
 #include "types.hxx"
 #include "rect.hxx"
diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx
index 3dbe887..8960a24 100644
--- a/starmath/inc/visitors.hxx
+++ b/starmath/inc/visitors.hxx
@@ -176,7 +176,7 @@ public:
     SmCaretPos2LineVisitor( OutputDevice *pDevice, SmCaretPos position ) {
         pDev = pDevice;
         pos = position;
-        j_assert( position.IsValid( ), "Cannot draw invalid position!" );
+        OSL_ENSURE( position.IsValid( ), "Cannot draw invalid position!" );
 
         pos.pSelectedNode->Accept( this );
     }
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index e9eb200..c7bd66f 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -38,12 +38,12 @@ void SmCursor::Move(OutputDevice* pDev, SmMovementDirection direction, bool bMov
         case MoveLeft:
         {
             NewPos = position->Left;
-            j_assert(NewPos, "NewPos shouldn't be NULL here!");
+            OSL_ENSURE(NewPos, "NewPos shouldn't be NULL here!");
         }break;
         case MoveRight:
         {
             NewPos = position->Right;
-            j_assert(NewPos, "NewPos shouldn't be NULL here!");
+            OSL_ENSURE(NewPos, "NewPos shouldn't be NULL here!");
         }break;
         case MoveUp:
             //Implementation is practically identical to MoveDown, except for a single if statement
@@ -82,7 +82,7 @@ void SmCursor::Move(OutputDevice* pDev, SmMovementDirection direction, bool bMov
             }
         }break;
         default:
-            j_assert(false, "Movement direction not supported!");
+            OSL_FAIL("Movement direction not supported!");
     }
     if(NewPos){
         position = NewPos;
@@ -100,7 +100,7 @@ void SmCursor::MoveTo(OutputDevice* pDev, Point pos, bool bMoveAnchor){
          dbp_sq = 1;    //Distance to best line squared
     SmCaretPosGraphIterator it = pGraph->GetIterator();
     while(it.Next()){
-        j_assert(it->CaretPos.IsValid(), "The caret position graph may not have invalid 
positions!");
+        OSL_ENSURE(it->CaretPos.IsValid(), "The caret position graph may not have invalid 
positions!");
         //Compute current line
         curr_line = SmCaretPos2LineVisitor(pDev, it->CaretPos).GetResult();
         //If we have a position compare to it
@@ -160,8 +160,8 @@ void SmCursor::BuildGraph(){
     if(!anchor)
         anchor = position;
 
-    j_assert(position->CaretPos.IsValid(), "Position must be valid");
-    j_assert(anchor->CaretPos.IsValid(), "Anchor must be valid");
+    OSL_ENSURE(position->CaretPos.IsValid(), "Position must be valid");
+    OSL_ENSURE(anchor->CaretPos.IsValid(), "Anchor must be valid");
 }
 
 bool SmCursor::SetCaretPosition(SmCaretPos pos, bool moveAnchor){
@@ -203,7 +203,7 @@ void SmCursor::DeletePrev(OutputDevice* pDev){
         BeginEdit();
         //Line to merge things into, so we can delete pLine
         SmNode* pMergeLine = pLineParent->GetSubNode(nLineOffset-1);
-        j_assert(pMergeLine, "pMergeLine cannot be NULL!");
+        OSL_ENSURE(pMergeLine, "pMergeLine cannot be NULL!");
         //Convert first line to list
         SmNodeList *pLineList = NodeToList(pMergeLine);
         //Find iterator to patch
@@ -269,17 +269,17 @@ void SmCursor::Delete(){
 
     //Find an arbitrary selected node
     SmNode* pSNode = FindSelectedNode(pTree);
-    j_assert(pSNode != NULL, "There must be a selection when HasSelection is true!");
+    OSL_ENSURE(pSNode != NULL, "There must be a selection when HasSelection is true!");
 
     //Find the topmost node of the line that holds the selection
     SmNode* pLine = FindTopMostNodeInLine(pSNode, true);
-    j_assert(pLine != pTree, "Shouldn't be able to select the entire tree");
+    OSL_ENSURE(pLine != pTree, "Shouldn't be able to select the entire tree");
 
     //Get the parent of the line
     SmStructureNode* pLineParent = pLine->GetParent();
     //Find line offset in parent
     int nLineOffset = pLineParent->IndexOfSubNode(pLine);
-    j_assert(nLineOffset != -1, "pLine must be a child of it's parent!");
+    OSL_ENSURE(nLineOffset != -1, "pLine must be a child of it's parent!");
 
     //Position after delete
     SmCaretPos PosAfterDelete;
@@ -317,7 +317,7 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){
     //Find line parent and line index in parent
     SmStructureNode* pLineParent = pLine->GetParent();
     int nParentIndex = pLineParent->IndexOfSubNode(pLine);
-    j_assert(nParentIndex != -1, "pLine must be a subnode of pLineParent!");
+    OSL_ENSURE(nParentIndex != -1, "pLine must be a subnode of pLineParent!");
 
     //Convert line to list
     SmNodeList* pLineList = NodeToList(pLine);
@@ -506,7 +506,7 @@ void SmCursor::InsertSubSup(SmSubSup eSubSup) {
     SmNode *pLine;
     if(HasSelection()) {
         SmNode *pSNode = FindSelectedNode(pTree);
-        j_assert(pSNode != NULL, "There must be a selected node when HasSelection is true!");
+        OSL_ENSURE(pSNode != NULL, "There must be a selected node when HasSelection is true!");
         pLine = FindTopMostNodeInLine(pSNode, TRUE);
     } else
         pLine = FindTopMostNodeInLine(position->CaretPos.pSelectedNode, FALSE);
@@ -514,7 +514,7 @@ void SmCursor::InsertSubSup(SmSubSup eSubSup) {
     //Find Parent and offset in parent
     SmStructureNode *pLineParent = pLine->GetParent();
     int nParentIndex = pLineParent->IndexOfSubNode(pLine);
-    j_assert(nParentIndex != -1, "pLine must be a subnode of pLineParent!");
+    OSL_ENSURE(nParentIndex != -1, "pLine must be a subnode of pLineParent!");
 
     //TODO: Consider handling special cases where parent is an SmOperNode,
     //      Maybe this method should be able to add limits to an SmOperNode...
@@ -677,7 +677,7 @@ void SmCursor::InsertBrackets(SmBracketType eBracketType) {
     SmNode *pLine;
     if(HasSelection()) {
         SmNode *pSNode = FindSelectedNode(pTree);
-        j_assert(pSNode != NULL, "There must be a selected node if HasSelection()");
+        OSL_ENSURE(pSNode != NULL, "There must be a selected node if HasSelection()");
         pLine = FindTopMostNodeInLine(pSNode, TRUE);
     } else
         pLine = FindTopMostNodeInLine(position->CaretPos.pSelectedNode, FALSE);
@@ -685,7 +685,7 @@ void SmCursor::InsertBrackets(SmBracketType eBracketType) {
     //Find parent and offset in parent
     SmStructureNode *pLineParent = pLine->GetParent();
     int nParentIndex = pLineParent->IndexOfSubNode(pLine);
-    j_assert( nParentIndex != -1, "pLine must be a subnode of pLineParent!");
+    OSL_ENSURE( nParentIndex != -1, "pLine must be a subnode of pLineParent!");
 
     //Convert line to list
     SmNodeList *pLineList = NodeToList(pLine);
@@ -813,7 +813,7 @@ bool SmCursor::InsertRow() {
     SmNode *pLine;
     if(HasSelection()) {
         SmNode *pSNode = FindSelectedNode(pTree);
-        j_assert(pSNode != NULL, "There must be a selected node if HasSelection()");
+        OSL_ENSURE(pSNode != NULL, "There must be a selected node if HasSelection()");
         pLine = FindTopMostNodeInLine(pSNode, TRUE);
     } else
         pLine = FindTopMostNodeInLine(position->CaretPos.pSelectedNode, FALSE);
@@ -821,7 +821,7 @@ bool SmCursor::InsertRow() {
     //Find parent and offset in parent
     SmStructureNode *pLineParent = pLine->GetParent();
     int nParentIndex = pLineParent->IndexOfSubNode(pLine);
-    j_assert( nParentIndex != -1, "pLine must be a subnode of pLineParent!");
+    OSL_ENSURE( nParentIndex != -1, "pLine must be a subnode of pLineParent!");
 
     //Discover the context of this command
     SmTableNode  *pTable  = NULL;
@@ -836,7 +836,7 @@ bool SmCursor::InsertRow() {
         //NOTE: This hack might give problems if we stop ignoring SmAlignNode
         pTable = (SmTableNode*)pLineParent->GetParent();
         nTableIndex = pTable->IndexOfSubNode(pLineParent);
-        j_assert(nTableIndex != -1, "pLineParent must be a child of its parent!");
+        OSL_ENSURE(nTableIndex != -1, "pLineParent must be a child of its parent!");
     }
     if(pLineParent->GetType() == NMATRIX)
         pMatrix = (SmMatrixNode*)pLineParent;
@@ -916,7 +916,7 @@ bool SmCursor::InsertRow() {
         }
         pMatrix->SetRowCol(rows + 1, cols);
     } else
-        j_assert(FALSE, "We must be either the context of a table or matrix!");
+        OSL_FAIL("We must be either the context of a table or matrix!");
 
     //Finish editing
     FinishEdit(pLineList, pLineParent, nParentIndex, PosAfterInsert);
@@ -933,7 +933,7 @@ void SmCursor::InsertFraction() {
     SmNode *pLine;
     if(HasSelection()) {
         SmNode *pSNode = FindSelectedNode(pTree);
-        j_assert(pSNode != NULL, "There must be a selected node when HasSelection is true!");
+        OSL_ENSURE(pSNode != NULL, "There must be a selected node when HasSelection is true!");
         pLine = FindTopMostNodeInLine(pSNode, TRUE);
     } else
         pLine = FindTopMostNodeInLine(position->CaretPos.pSelectedNode, FALSE);
@@ -941,7 +941,7 @@ void SmCursor::InsertFraction() {
     //Find Parent and offset in parent
     SmStructureNode *pLineParent = pLine->GetParent();
     int nParentIndex = pLineParent->IndexOfSubNode(pLine);
-    j_assert(nParentIndex != -1, "pLine must be a subnode of pLineParent!");
+    OSL_ENSURE(nParentIndex != -1, "pLine must be a subnode of pLineParent!");
 
     //We begin modifying the tree here
     BeginEdit();
@@ -1090,9 +1090,9 @@ void SmCursor::InsertElement(SmFormulaElement element){
             pNewNode = new SmMathSymbolNode(token);
         }break;
         default:
-            j_assert(false, "Element unknown!");
+            OSL_FAIL("Element unknown!");
     }
-    j_assert(pNewNode != NULL, "No new node was created!");
+    OSL_ENSURE(pNewNode != NULL, "No new node was created!");
     if(!pNewNode)
         return;
 
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 926e308..0dcd1b9 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -2999,7 +2999,7 @@ void SmNode::Accept(SmVisitor*){
     //obscure copy constructor is used... I can't find it's implementation, and
     //don't want to figure out how to fix it... If you want to, just delete this
     //method, making SmNode abstract, and see where you can an problem with that.
-    j_assert(false, "SmNode should not be visitable!");
+    OSL_FAIL("SmNode should not be visitable!");
 }
 
 void SmTableNode::Accept(SmVisitor* pVisitor) {
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index d89abb8..273e65f 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -32,163 +32,163 @@
 
 void SmVisitorTest::Visit( SmTableNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NTABLE, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NTABLE, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBraceNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NBRACE, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NBRACE, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBracebodyNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NBRACEBODY, "the visitor-patterns isn't implemented correctly" 
);
+    OSL_ENSURE( pNode->GetType( ) == NBRACEBODY, "the visitor-patterns isn't implemented 
correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmOperNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NOPER, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NOPER, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmAlignNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NALIGN, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NALIGN, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmAttributNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NATTRIBUT, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NATTRIBUT, "the visitor-patterns isn't implemented correctly" 
);
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmFontNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NFONT, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NFONT, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmUnHorNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NUNHOR, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NUNHOR, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBinHorNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NBINHOR, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NBINHOR, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBinVerNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NBINVER, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NBINVER, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBinDiagonalNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NBINDIAGONAL, "the visitor-patterns isn't implemented 
correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NBINDIAGONAL, "the visitor-patterns isn't implemented 
correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmSubSupNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NSUBSUP, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NSUBSUP, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmMatrixNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NMATRIX, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NMATRIX, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmPlaceNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NPLACE, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NPLACE, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmTextNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NTEXT, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NTEXT, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmSpecialNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NSPECIAL, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NSPECIAL, "the visitor-patterns isn't implemented correctly" 
);
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmGlyphSpecialNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NGLYPH_SPECIAL, "the visitor-patterns isn't implemented 
correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NGLYPH_SPECIAL, "the visitor-patterns isn't implemented 
correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmMathSymbolNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NMATH, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NMATH, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBlankNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NBLANK, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NBLANK, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmErrorNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NERROR, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NERROR, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmLineNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NLINE, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NLINE, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmExpressionNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NEXPRESSION, "the visitor-patterns isn't implemented correctly" 
);
+    OSL_ENSURE( pNode->GetType( ) == NEXPRESSION, "the visitor-patterns isn't implemented 
correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmPolyLineNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NPOLYLINE, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NPOLYLINE, "the visitor-patterns isn't implemented correctly" 
);
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmRootNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NROOT, "the visitor-patterns isn't implemented correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NROOT, "the visitor-patterns isn't implemented correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmRootSymbolNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NROOTSYMBOL, "the visitor-patterns isn't implemented correctly" 
);
+    OSL_ENSURE( pNode->GetType( ) == NROOTSYMBOL, "the visitor-patterns isn't implemented 
correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmRectangleNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NRECTANGLE, "the visitor-patterns isn't implemented correctly" 
);
+    OSL_ENSURE( pNode->GetType( ) == NRECTANGLE, "the visitor-patterns isn't implemented 
correctly" );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmVerticalBraceNode* pNode )
 {
-    j_assert( pNode->GetType( ) == NVERTICAL_BRACE, "the visitor-patterns isn't implemented 
correctly" );
+    OSL_ENSURE( pNode->GetType( ) == NVERTICAL_BRACE, "the visitor-patterns isn't implemented 
correctly" );
     VisitChildren( pNode );
 }
 
@@ -347,7 +347,7 @@ SmCaretDrawingVisitor::SmCaretDrawingVisitor( OutputDevice& rDevice,
     pos = position;
     Offset = offset;
     isCaretVisible = caretVisible;
-    j_assert( position.IsValid( ), "Cannot draw invalid position!" );
+    OSL_ENSURE( position.IsValid( ), "Cannot draw invalid position!" );
     if( !position.IsValid( ) )
         return;
 
@@ -789,7 +789,7 @@ SmSetSelectionVisitor::SmSetSelectionVisitor( SmCaretPos startPos, SmCaretPos en
     IsSelecting = false;
 
     //Assume that pTree is a SmTableNode
-    j_assert(pTree->GetType() == NTABLE, "pTree should be a SmTableNode!");
+    OSL_ENSURE(pTree->GetType() == NTABLE, "pTree should be a SmTableNode!");
     //Visit root node, this is special as this node cannot be selected, but it's children can!
     if(pTree->GetType() == NTABLE){
         //Change state if StartPos is infront of this node
@@ -798,7 +798,7 @@ SmSetSelectionVisitor::SmSetSelectionVisitor( SmCaretPos startPos, SmCaretPos en
         //Change state if EndPos is infront of this node
         if( EndPos.pSelectedNode == pTree && EndPos.Index == 0 )
             IsSelecting = !IsSelecting;
-        j_assert(!IsSelecting, "Caret positions needed to set IsSelecting about, shouldn't be 
possible!");
+        OSL_ENSURE(!IsSelecting, "Caret positions needed to set IsSelecting about, shouldn't be 
possible!");
 
         //Visit lines
         SmNodeIterator it( pTree );
@@ -814,7 +814,7 @@ SmSetSelectionVisitor::SmSetSelectionVisitor( SmCaretPos startPos, SmCaretPos en
             }
         }
         //Check if pTree isn't selected
-        j_assert(!pTree->IsSelected(), "pTree should never be selected!");
+        OSL_ENSURE(!pTree->IsSelected(), "pTree should never be selected!");
         //Discard the selection if there's a bug (it's better than crashing)
         if(pTree->IsSelected())
             SetSelectedOnAll(pTree, false);
@@ -985,7 +985,7 @@ SmCaretPosGraphBuildingVisitor::SmCaretPosGraphBuildingVisitor( SmNode* pRootNod
     pRightMost  = NULL;
     pGraph = new SmCaretPosGraph( );
     //pRootNode should always be a table
-    j_assert( pRootNode->GetType( ) == NTABLE, "pRootNode must be a table node");
+    OSL_ENSURE( pRootNode->GetType( ) == NTABLE, "pRootNode must be a table node");
     //Handle the special case where NTABLE is used a rootnode
     if( pRootNode->GetType( ) == NTABLE ){
         //Children are SmLineNodes
@@ -1077,10 +1077,10 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmSubSupNode* pNode )
                          *bodyRight;
 
     left = pRightMost;
-    j_assert( pRightMost, "pRightMost shouldn't be NULL here!" );
+    OSL_ENSURE( pRightMost, "pRightMost shouldn't be NULL here!" );
 
     //Create bodyLeft
-    j_assert( pNode->GetBody( ), "SmSubSupNode Doesn't have a body!" );
+    OSL_ENSURE( pNode->GetBody( ), "SmSubSupNode Doesn't have a body!" );
     bodyLeft = pGraph->Add( SmCaretPos( pNode->GetBody( ), 0 ), left );
     left->SetRight( bodyLeft ); //TODO: Don't make this if LSUP or LSUB are NULL ( not sure??? )
 
@@ -1329,7 +1329,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmMatrixNode* pNode )
  */
 void SmCaretPosGraphBuildingVisitor::Visit( SmTextNode* pNode )
 {
-    j_assert( pNode->GetText( ).Len( ) > 0, "Empty SmTextNode is bad" );
+    OSL_ENSURE( pNode->GetText( ).Len( ) > 0, "Empty SmTextNode is bad" );
 
     int size = pNode->GetText( ).Len( );
     for( int i = 1; i <= size; i++ ){
@@ -1370,7 +1370,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmBinVerNode* pNode )
 
     //Set left
     left = pRightMost;
-    j_assert( pRightMost, "There must be a position infront of this" );
+    OSL_ENSURE( pRightMost, "There must be a position infront of this" );
 
     //Create right
     right = pGraph->Add( SmCaretPos( pNode, 1 ) );
@@ -1609,7 +1609,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmRootNode* pNode )
 {
     SmNode  *pExtra = pNode->GetSubNode( 0 ), //Argument, NULL for sqrt, and SmTextNode if 
cubicroot
             *pBody  = pNode->GetSubNode( 2 ); //Body of the root
-    j_assert( pBody, "pBody cannot be NULL" );
+    OSL_ENSURE( pBody, "pBody cannot be NULL" );
 
     SmCaretPosGraphEntry  *left,
                         *right,
@@ -1617,7 +1617,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmRootNode* pNode )
                         *bodyRight;
 
     //Get left and save it
-    j_assert( pRightMost, "There must be a position infront of this" );
+    OSL_ENSURE( pRightMost, "There must be a position infront of this" );
     left = pRightMost;
 
     //Create body left
@@ -2051,7 +2051,7 @@ SmSelectionDrawingVisitor::SmSelectionDrawingVisitor( OutputDevice& rDevice, 
SmN
     bHasSelectionArea = false;
 
     //Visit everything
-    j_assert( pTree, "pTree can't be null!" );
+    OSL_ENSURE( pTree, "pTree can't be null!" );
     if( pTree )
         pTree->Accept( this );
 
diff --git a/starmath/visual-editor-todo b/starmath/visual-editor-todo
index 3be3fd2..f378d2d 100644
--- a/starmath/visual-editor-todo
+++ b/starmath/visual-editor-todo
@@ -15,9 +15,8 @@ Easy
 1. SmGraphicWindow::KeyInput relies on comparison of sal_Char, a better way must be available for 
CTRL+c
 2. Code style (missing spaces, linebreaks and a few renames)
 3. More documentation
-4. Replace j_assert with DBG_ASSERT (don't do this yet).
-5. Remove the CreateTextFromNode methods and replace calls to it with NodeToTextVisitor
-6. Extend NodeToTextVisitor to update token offsets so SmNode::GetRow and SmNode::GetColumn will 
work.
+4. Remove the CreateTextFromNode methods and replace calls to it with NodeToTextVisitor
+5. Extend NodeToTextVisitor to update token offsets so SmNode::GetRow and SmNode::GetColumn will 
work.
    (These methods can be used to enable synchronization of caret positions between visual and 
non-visual editor).
 
 Medium
-- 
1.7.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.