Alex Villacís Lasso : riched20: Reject RTF that is recognized as invalid.

Alexandre Julliard julliard at winehq.org
Thu Apr 24 15:56:37 CDT 2008


Module: wine
Branch: master
Commit: 4f95cf707254653a3199caff3553fd0f732f23df
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4f95cf707254653a3199caff3553fd0f732f23df

Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date:   Thu Apr 24 10:07:12 2008 -0500

riched20: Reject RTF that is recognized as invalid.

---

 dlls/riched20/editor.c       |    6 +++---
 dlls/riched20/tests/editor.c |    8 --------
 dlls/riched32/tests/editor.c |    4 ----
 3 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 04b0e80..e635e9f 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1029,6 +1029,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
   int from, to, to2, nUndoMode;
   int nEventMask = editor->nEventMask;
   ME_InStream inStream;
+  BOOL invalidRTF = FALSE;
 
   TRACE("stream==%p hWnd==%p format==0x%X\n", stream, editor->hWnd, format);
   editor->nEventMask = 0;
@@ -1071,13 +1072,12 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
       if ((!editor->bEmulateVersion10 && strncmp(inStream.buffer, "{\\rtf", 5) && strncmp(inStream.buffer, "{\\urtf", 6))
 	|| (editor->bEmulateVersion10 && *inStream.buffer != '{'))
       {
-        format &= ~SF_RTF;
-        format |= SF_TEXT;
+        invalidRTF = TRUE;
       }
     }
   }
 
-  if (!inStream.editstream->dwError)
+  if (!invalidRTF && !inStream.editstream->dwError)
   {
     if (format & SF_RTF) {
       /* setup the RTF parser */
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 1593d09..554d7ba 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -2415,28 +2415,20 @@ static void test_EM_STREAMIN(void)
               (WPARAM)(SF_RTF), (LPARAM)&es);
 
   result = SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
-  todo_wine {
   ok (result  == 0,
       "EM_STREAMIN: Test 2 returned %ld, expected 0\n", result);
-  }
-  todo_wine {
   ok (strlen(buffer)  == 0,
       "EM_STREAMIN: Test 2 set wrong text: Result: %s\n",buffer);
-  }
 
   es.dwCookie = (DWORD_PTR)&streamText3;
   SendMessage(hwndRichEdit, EM_STREAMIN,
               (WPARAM)(SF_RTF), (LPARAM)&es);
 
   result = SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
-  todo_wine {
   ok (result  == 0,
       "EM_STREAMIN: Test 3 returned %ld, expected 9\n", result);
-  }
-  todo_wine {
   ok (strlen(buffer)  == 0,
       "EM_STREAMIN: Test 3 set wrong text: Result: %s\n",buffer);
-  }
 
   DestroyWindow(hwndRichEdit);
 }
diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c
index 22dac0a..c8b7181 100644
--- a/dlls/riched32/tests/editor.c
+++ b/dlls/riched32/tests/editor.c
@@ -276,14 +276,10 @@ static void test_EM_STREAMIN(void)
               (WPARAM)(SF_RTF), (LPARAM)&es);
 
   result = SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
-  todo_wine {
   ok (result  == 0,
       "EM_STREAMIN: Test 3 returned %ld, expected 0\n", result);
-  }
-  todo_wine {
   ok (strlen(buffer)  == 0,
       "EM_STREAMIN: Test 3 set wrong text: Result: %s\n",buffer);
-  }
 
   DestroyWindow(hwndRichEdit);
 }




More information about the wine-cvs mailing list