Make RTF reader stop processing input stream when outermost group is closed

Evan Deaubl wine at warpedview.com
Sun Aug 29 02:43:45 CDT 2004


ChangeLog:
 * Stop processing input stream when the outermost RTF group is closed

--- dlls/richedit/reader.c	27 Aug 2004 19:15:08 -0000	1.15
+++ dlls/richedit/reader.c	29 Aug 2004 07:23:58 -0000
@@ -540,10 +540,20 @@
 			info->csStack[info->csTop++] = info->curCharSet;
 			break;
 		case rtfEndGroup:
-			if (info->csTop <= 0)
+			/*
+			 * If stack top is 1 at this point, we are ending the
+			 * group started by the initial {, which ends the
+			 * RTF stream
+			 */
+			if (info->csTop <= 0)
 				RTFPanic (info,"_RTFGetToken: stack underflow");
-			info->curCharSet = info->csStack[--info->csTop];
-			RTFSetCharSet (info, info->curCharSet);
+			else if (info->csTop == 1)
+				info->rtfClass = rtfEOF;
+			else
+			{
+				info->curCharSet = info->csStack[--info->csTop];
+				RTFSetCharSet (info, info->curCharSet);
+			}
 			break;
 		}
 	}




More information about the wine-patches mailing list