Author: jackson
Date: 2007-04-04 19:10:43 -0400 (Wed, 04 Apr 2007)
New Revision: 75411
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs
Log:
* RTF.cs: look ahead for the end of the group, so we don't read
past the end and pull out a piece of the next token.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog
2007-04-04 22:47:52 UTC (rev 75410)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog
2007-04-04 23:10:43 UTC (rev 75411)
@@ -1,5 +1,10 @@
2007-04-04 Jackson Harper <[EMAIL PROTECTED]>
+ * RTF.cs: look ahead for the end of the group, so we don't read
+ past the end and pull out a piece of the next token.
+
+2007-04-04 Jackson Harper <[EMAIL PROTECTED]>
+
* Picture.cs: Correct twips calculation.
2007-03-27 Jackson Harper <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs
2007-04-04 22:47:52 UTC (rev 75410)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs
2007-04-04 23:10:43 UTC (rev 75411)
@@ -297,7 +297,6 @@
/// <summary>Parse the RTF stream</summary>
public void Read() {
while (GetToken() != TokenClass.EOF) {
-
RouteToken();
}
}
@@ -958,12 +957,23 @@
while (true) {
- while (hexDigit1 == '\n' ||
hexDigit1 == '\r')
+ while (hexDigit1 == '\n' ||
hexDigit1 == '\r') {
+ hexDigit1 = (char)
source.Peek ();
+ if (hexDigit1 == '}')
+ break;
hexDigit1 = (char)
source.Read ();
-
+ }
+
+ hexDigit2 = (char) source.Peek
();
+ if (hexDigit2 == '}')
+ break;
hexDigit2 = (char) source.Read
();
- while (hexDigit2 == '\n' ||
hexDigit2 == '\r')
+ while (hexDigit2 == '\n' ||
hexDigit2 == '\r') {
+ hexDigit2 = (char)
source.Peek ();
+ if (hexDigit2 == '}')
+ break;
hexDigit2 = (char)
source.Read ();
+ }
if (Char.IsDigit (hexDigit1))
digitValue1 = (uint)
(hexDigit1 - '0');
@@ -984,16 +994,20 @@
digitValue2 = (uint)
(hexDigit2 - 'A' + 10);
else if (hexDigit2 == '\n' ||
hexDigit2 == '\r')
continue;
- else
+ else
break;
image_data.Add ((byte) checked
(digitValue1 * 16 + digitValue2));
// We get the first hex digit
at the end, since in the very first
// iteration we use rtf.major
as the first hex digit
+ hexDigit1 = (char) source.Peek
();
+ if (hexDigit1 == '}')
+ break;
hexDigit1 = (char) source.Read
();
}
+
read_image_data = false;
picture.Data = (byte [])
image_data.ToArray (typeof (byte));
break;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches