[RICHEDIT] a few quick fixes to the RTF parser

Krzysztof Foltman kfoltman at portal.onet.pl
Tue Mar 8 12:18:39 CST 2005


ChangeLog:
  * Single quotes are now handled properly (previously they were 
inserted as [[']])
  * Better handling of callback function's results

Krzysztof

-------------- next part --------------
Index: reader.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/reader.c,v
retrieving revision 1.1
diff -u -r1.1 reader.c
--- reader.c	7 Mar 2005 17:15:33 -0000	1.1
+++ reader.c	8 Mar 2005 18:14:42 -0000
@@ -95,7 +95,7 @@
   rtfSC_dollar  	 ,'$',
   rtfSC_percent 	 ,'%',
   rtfSC_ampersand	 ,'&',
-  rtfSC_quoteright	 ,'\\',
+  rtfSC_quoteright	 ,'\'',
   rtfSC_parenleft	 ,'(',
   rtfSC_parenright	 ,')',
   rtfSC_asterisk	 ,'*',
@@ -936,11 +936,19 @@
 
 	TRACE("\n");
 
-	if (info->dwInputSize <= info->dwInputUsed)
+	/* if the last buffer wasn't full, it's EOF */
+  if (info->dwInputSize > 0 &&
+    info->dwInputSize == info->dwInputUsed && info->dwInputSize < sizeof(info->InputBuffer))
+    return EOF;
+  if (info->dwInputSize <= info->dwInputUsed)
 	{
 		long count = 0;
-		info->editstream.pfnCallback(info->editstream.dwCookie, 
+		info->editstream.dwError = info->editstream.pfnCallback(info->editstream.dwCookie, 
 			info->InputBuffer, sizeof(info->InputBuffer), &count);
+  	/* if error, it's EOF */
+		if (info->editstream.dwError)
+		  return EOF;
+  	/* if no bytes read, it's EOF */
 		if(count == 0)
 			return EOF;
 		info->dwInputSize = count;


More information about the wine-patches mailing list