Author: gonzalo
Date: 2006-03-20 16:58:43 -0500 (Mon, 20 Mar 2006)
New Revision: 58207
Modified:
trunk/mcs/class/System.Web/System.Web/ChangeLog
trunk/mcs/class/System.Web/System.Web/HttpRequest.cs
Log:
2006-03-20 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* HttpRequest.cs:
(CheckString): style and don't index the string twice per iteration.
Modified: trunk/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web/ChangeLog 2006-03-20 21:53:54 UTC
(rev 58206)
+++ trunk/mcs/class/System.Web/System.Web/ChangeLog 2006-03-20 21:58:43 UTC
(rev 58207)
@@ -1,3 +1,8 @@
+2006-03-20 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+ * HttpRequest.cs:
+ (CheckString): style and don't index the string twice per iteration.
+
2006-03-19 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* TempFileStream.cs: a FileStream that removes the file once
Modified: trunk/mcs/class/System.Web/System.Web/HttpRequest.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpRequest.cs 2006-03-20
21:53:54 UTC (rev 58206)
+++ trunk/mcs/class/System.Web/System.Web/HttpRequest.cs 2006-03-20
21:58:43 UTC (rev 58207)
@@ -1379,20 +1379,22 @@
static bool CheckString (string val)
{
int len = val.Length;
+ if (len < 2)
+ return false;
- for (int idx = 0; idx < len - 1; idx ++) {
- char c1 = val[idx];
- char c2 = val[idx+1];
- if (c1 == '<' || c1 == '\xff1c') {
- if (c2 == '!'
- || (c2 >= 'a' && c2 <= 'z')
- || (c2 >= 'A' && c2 <= 'Z'))
+ char current = val [0];
+ for (int idx = 1; idx < len; idx++) {
+ char next = val [idx];
+ if (current == '<' || current == '\xff1c') {
+ if (next == '!'
+ || (next >= 'a' && next <= 'z')
+ || (next >= 'A' && next <= 'Z'))
return true;
+ } else if (current == '&' && next == '#') {
+ return true;
}
- else if (c1 == '&') {
- if (c2 == '#')
- return true;
- }
+
+ current = next;
}
return false;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches