Author: zoltan
Date: 2008-02-13 16:21:39 -0500 (Wed, 13 Feb 2008)
New Revision: 95599

Modified:
   trunk/mcs/class/System/System.Text.RegularExpressions/CILCompiler.cs
   trunk/mcs/class/System/System.Text.RegularExpressions/ChangeLog
Log:
2008-02-13  Zoltan Varga  <[EMAIL PROTECTED]>

        * CILCompiler.cs: Fix the unsafe string matching code.


Modified: trunk/mcs/class/System/System.Text.RegularExpressions/CILCompiler.cs
===================================================================
--- trunk/mcs/class/System/System.Text.RegularExpressions/CILCompiler.cs        
2008-02-13 21:07:40 UTC (rev 95598)
+++ trunk/mcs/class/System/System.Text.RegularExpressions/CILCompiler.cs        
2008-02-13 21:21:39 UTC (rev 95599)
@@ -453,6 +453,8 @@
                                        break;
                                }
                                case RxOp.String: {
+                                       int i;
+
                                        start = pc + 2;
                                        length = program [pc + 1];
                                        //if (strpos + length > string_end)
@@ -478,14 +480,14 @@
                                        ilgen.Emit (OpCodes.Stloc, 
local_strptr);
 
                                        end = start + length;
-                                       for (; start < end; ++start) {
-                                               // if (*(strptr + start) != 
program [start])
+                                       for (i = 0; i < length; ++i) {
+                                               // if (*(strptr + i) != program 
[start + i])
                                                //   return false;
                                                ilgen.Emit (OpCodes.Ldloc, 
local_strptr);
-                                               ilgen.Emit (OpCodes.Ldc_I4, 
start * 2);
+                                               ilgen.Emit (OpCodes.Ldc_I4, i * 
2);
                                                ilgen.Emit (OpCodes.Add);
                                                ilgen.Emit (OpCodes.Ldind_I2);
-                                               ilgen.Emit (OpCodes.Ldc_I4, 
(int)program [start]);
+                                               ilgen.Emit (OpCodes.Ldc_I4, 
(int)program [start + i]);
                                                ilgen.Emit (OpCodes.Bne_Un, 
frame.label_fail);
                                        }
 

Modified: trunk/mcs/class/System/System.Text.RegularExpressions/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Text.RegularExpressions/ChangeLog     
2008-02-13 21:07:40 UTC (rev 95598)
+++ trunk/mcs/class/System/System.Text.RegularExpressions/ChangeLog     
2008-02-13 21:21:39 UTC (rev 95599)
@@ -1,7 +1,9 @@
 2008-02-13  Zoltan Varga  <[EMAIL PROTECTED]>
 
+       * CILCompiler.cs: Fix the unsafe string matching code.
+       
        * CILCompiler.cs: Improved version which emits only one method in most 
cases.
-       
+
        * CILCompiler.cs: Fix some comments.
 
        * CILCompiler.cs: New file, extracted from RxCompiler.cs.

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to