richedit: Properly handle lack of semicolon after font name in rtf. (Bug 17183)

Dylan Smith dylan.ah.smith at gmail.com
Mon Mar 23 12:24:27 CDT 2009


This was partially handled by ungetting the end group token (i.e. '}')
so that it was read again at the proper place.  Unfortunately there is a
read hook that maintains a stackTop variable, which is decremented when
receiving this end group token.  Therefore stackTop would get
decremented twice, and the rich text file would end prematurely.

This is fixed by incrementing the stackTop variable to compensate for it
being decremented twice.
---
 dlls/riched20/reader.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c
index 3df7109..fa1ef79 100644
--- a/dlls/riched20/reader.c
+++ b/dlls/riched20/reader.c
@@ -475,6 +475,11 @@ static void RTFUngetToken(RTF_Info *info)
 	info->pushedMinor = info->rtfMinor;
 	info->pushedParam = info->rtfParam;
 	lstrcpyA (info->pushedTextBuf, info->rtfTextBuf);
+	/* The read hook decrements stackTop on rtfEndGroup, so
+	 * increment the value to compensate for it being decremented
+	 * twice due to the RTFUngetToken. */
+	if(RTFCheckCM (info, rtfGroup, rtfEndGroup))
+		info->stackTop++;
 }
 
 


More information about the wine-patches mailing list