Huw Davies : riched20: Remove the table corruption check function.

Alexandre Julliard julliard at winehq.org
Thu Oct 29 16:32:08 CDT 2020


Module: wine
Branch: master
Commit: f2d770d4913e19136c553f5bd638a9380ea68541
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f2d770d4913e19136c553f5bd638a9380ea68541

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Oct 29 10:49:15 2020 +0000

riched20: Remove the table corruption check function.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/editor.c |  3 --
 dlls/riched20/editor.h |  1 -
 dlls/riched20/table.c  | 89 --------------------------------------------------
 dlls/riched20/undo.c   |  2 --
 4 files changed, 95 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 797eb27b6b9..d1667dc9176 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1735,7 +1735,6 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
           if (parser.tableDef) parser.tableDef->row_start = NULL;
         }
       }
-      ME_CheckTablesForCorruption(editor);
       RTFDestroy(&parser);
 
       if (parser.stackTop > 0)
@@ -2515,7 +2514,6 @@ static BOOL handle_enter(ME_TextEditor *editor)
                     editor->pCursors[0].nOffset = 0;
                     editor->pCursors[1] = editor->pCursors[0];
                     ME_CommitUndo(editor);
-                    ME_CheckTablesForCorruption(editor);
                     ME_UpdateRepaint(editor, FALSE);
                     return TRUE;
                 }
@@ -2541,7 +2539,6 @@ static BOOL handle_enter(ME_TextEditor *editor)
                     editor->pCursors[1] = editor->pCursors[0];
                     para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART;
                     ME_CommitCoalescingUndo(editor);
-                    ME_CheckTablesForCorruption(editor);
                     ME_UpdateRepaint(editor, FALSE);
                     return TRUE;
                 }
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index b8916bc4ff3..5f93aa39db9 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -309,7 +309,6 @@ ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN;
 ME_Cell *table_row_end_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
 ME_Cell *table_row_first_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
 ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN;
-void ME_CheckTablesForCorruption(ME_TextEditor *editor) DECLSPEC_HIDDEN;
 struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) DECLSPEC_HIDDEN;
 void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN;
 static inline ME_DisplayItem *cell_get_di(ME_Cell *cell)
diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c
index c262d190b79..e08876d29bd 100644
--- a/dlls/riched20/table.c
+++ b/dlls/riched20/table.c
@@ -54,8 +54,6 @@
 #include "editor.h"
 #include "rtf.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(richedit_lists);
-
 static const WCHAR cr_lf[] = {'\r', '\n', 0};
 
 static ME_Paragraph* table_insert_end_para( ME_TextEditor *editor, ME_Cursor *cursor,
@@ -214,93 +212,6 @@ ME_Paragraph *cell_end_para( ME_Cell *cell )
     return &ME_FindItemBack( cell_get_di( next ), diParagraph )->member.para;
 }
 
-/* Make a bunch of assertions to make sure tables haven't been corrupted.
- *
- * These invariants may not hold true in the middle of streaming in rich text
- * or during an undo and redo of streaming in rich text. It should be safe to
- * call this method after an event is processed.
- */
-void ME_CheckTablesForCorruption(ME_TextEditor *editor)
-{
-  if(TRACE_ON(richedit_lists))
-  {
-    TRACE("---\n");
-    ME_DumpDocument(editor->pBuffer);
-  }
-#ifndef NDEBUG
-  {
-    ME_DisplayItem *p, *pPrev;
-    pPrev = editor->pBuffer->pFirst;
-    p = pPrev->next;
-    if (!editor->bEmulateVersion10) /* v4.1 */
-    {
-      while (p->type == diParagraph)
-      {
-        assert(p->member.para.fmt.dwMask & PFM_TABLE);
-        assert(p->member.para.fmt.dwMask & PFM_TABLEROWDELIMITER);
-        if (p->member.para.pCell)
-        {
-          assert(p->member.para.nFlags & MEPF_CELL);
-          assert(p->member.para.fmt.wEffects & PFE_TABLE);
-        }
-        if (p->member.para.pCell != pPrev->member.para.pCell)
-        {
-          /* There must be a diCell in between the paragraphs if pCell changes. */
-          ME_DisplayItem *pCell = ME_FindItemBack(p, diCell);
-          assert(pCell);
-          assert(ME_FindItemBack(p, diRun) == ME_FindItemBack(pCell, diRun));
-        }
-        if (p->member.para.nFlags & MEPF_ROWEND)
-        {
-          /* ROWEND must come after a cell. */
-          assert(pPrev->member.para.pCell);
-          assert(p->member.para.pCell
-                 == pPrev->member.para.pCell->member.cell.parent_cell);
-          assert(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER);
-        }
-        else if (p->member.para.pCell)
-        {
-          assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
-          assert(pPrev->member.para.pCell ||
-                 pPrev->member.para.nFlags & MEPF_ROWSTART);
-          if (pPrev->member.para.pCell &&
-              !(pPrev->member.para.nFlags & MEPF_ROWSTART))
-          {
-            assert(p->member.para.pCell->member.cell.parent_cell
-                   == pPrev->member.para.pCell->member.cell.parent_cell);
-            if (pPrev->member.para.pCell != p->member.para.pCell)
-              assert(pPrev->member.para.pCell
-                     == p->member.para.pCell->member.cell.prev_cell);
-          }
-        }
-        else if (!(p->member.para.nFlags & MEPF_ROWSTART))
-        {
-          assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
-          /* ROWSTART must be followed by a cell. */
-          assert(!(p->member.para.nFlags & MEPF_CELL));
-          /* ROWSTART must be followed by a cell. */
-          assert(!(pPrev->member.para.nFlags & MEPF_ROWSTART));
-        }
-        pPrev = p;
-        p = p->member.para.next_para;
-      }
-    } else { /* v1.0 - 3.0 */
-      while (p->type == diParagraph)
-      {
-        assert(!(p->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL)));
-        assert(p->member.para.fmt.dwMask & PFM_TABLE);
-        assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
-        assert(!p->member.para.pCell);
-        p = p->member.para.next_para;
-      }
-      return;
-    }
-    assert(p->type == diTextEnd);
-    assert(!pPrev->member.para.pCell);
-  }
-#endif
-}
-
 BOOL ME_IsInTable(ME_DisplayItem *pItem)
 {
   PARAFORMAT2 *pFmt;
diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c
index fe0a4f721cd..884f87b56fd 100644
--- a/dlls/riched20/undo.c
+++ b/dlls/riched20/undo.c
@@ -440,7 +440,6 @@ BOOL ME_Undo(ME_TextEditor *editor)
 
   table_move_from_row_start( editor );
   add_undo( editor, undo_end_transaction );
-  ME_CheckTablesForCorruption(editor);
   editor->nUndoStackSize--;
   editor->nUndoMode = nMode;
   ME_UpdateRepaint(editor, FALSE);
@@ -477,7 +476,6 @@ BOOL ME_Redo(ME_TextEditor *editor)
   }
   table_move_from_row_start( editor );
   add_undo( editor, undo_end_transaction );
-  ME_CheckTablesForCorruption(editor);
   editor->nUndoMode = nMode;
   ME_UpdateRepaint(editor, FALSE);
   return TRUE;




More information about the wine-cvs mailing list