Permalink
Browse files

Merge pull request #150 from bassamtabbara/mono-2-10

Some fixes to mono-2-10
  • Loading branch information...
2 parents 3cb9ce9 + 71b1f58 commit d41b9d61c2d645b62ced173e4b335beeba34afbc @gonzalop gonzalop committed Aug 8, 2011
View
18 mcs/class/System.Web.Routing/System.Web.Routing/Route.cs
@@ -188,22 +188,22 @@ public override VirtualPathData GetVirtualPath (RequestContext requestContext, R
return false;
}
- static bool MatchConstraintRegex (string rx, string constraint)
+ static bool MatchConstraintRegex (string value, string constraint)
{
- int rxlen = rx.Length;
- if (rxlen > 0) {
+ int len = constraint.Length;
+ if (len > 0) {
// Bug #651966 - regexp constraints must be treated
// as absolute expressions
- if (rx [0] != '^') {
- rx = "^" + rx;
- rxlen++;
+ if (constraint [0] != '^') {
+ constraint = "^" + constraint;
+ len++;
}
- if (rx [rxlen - 1] != '$')
- rx += "$";
+ if (constraint [len - 1] != '$')
+ constraint += "$";
}
- return Regex.Match (rx, constraint).Success;
+ return Regex.Match (value, constraint).Success;
}
protected virtual bool ProcessConstraint (HttpContextBase httpContext, object constraint, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
View
48 mcs/class/System/System.Net.Sockets/NetworkStream.cs
@@ -214,8 +214,14 @@ public override int WriteTimeout
throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
}
+ Socket s = socket;
+
+ if (s == null) {
+ throw new IOException("Connection closed");
+ }
+
try {
- retval = socket.BeginReceive (buffer, offset, size, 0, callback, state);
+ retval = s.BeginReceive (buffer, offset, size, 0, callback, state);
} catch (Exception e) {
throw new IOException ("BeginReceive failure", e);
}
@@ -240,8 +246,14 @@ public override int WriteTimeout
throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
}
+ Socket s = socket;
+
+ if (s == null) {
+ throw new IOException("Connection closed");
+ }
+
try {
- retval = socket.BeginSend (buffer, offset, size, 0, callback, state);
+ retval = s.BeginSend (buffer, offset, size, 0, callback, state);
} catch {
throw new IOException ("BeginWrite failure");
}
@@ -316,8 +328,14 @@ public override int EndRead (IAsyncResult ar)
if (ar == null)
throw new ArgumentNullException ("async result is null");
+ Socket s = socket;
+
+ if (s == null) {
+ throw new IOException("Connection closed");
+ }
+
try {
- res = socket.EndReceive (ar);
+ res = s.EndReceive (ar);
} catch (Exception e) {
throw new IOException ("EndRead failure", e);
}
@@ -330,8 +348,14 @@ public override void EndWrite (IAsyncResult ar)
if (ar == null)
throw new ArgumentNullException ("async result is null");
+ Socket s = socket;
+
+ if (s == null) {
+ throw new IOException("Connection closed");
+ }
+
try {
- socket.EndSend (ar);
+ s.EndSend (ar);
} catch (Exception e) {
throw new IOException ("EndWrite failure", e);
}
@@ -363,8 +387,14 @@ public override int Read ([In,Out] byte [] buffer, int offset, int size)
throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
}
+ Socket s = socket;
+
+ if (s == null) {
+ throw new IOException("Connection closed");
+ }
+
try {
- res = socket.Receive (buffer, offset, size, 0);
+ res = s.Receive (buffer, offset, size, 0);
} catch (Exception e) {
throw new IOException ("Read failure", e);
}
@@ -398,10 +428,16 @@ public override void Write (byte [] buffer, int offset, int size)
if (size < 0 || size > buffer.Length - offset)
throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
+ Socket s = socket;
+
+ if (s == null) {
+ throw new IOException("Connection closed");
+ }
+
try {
int count = 0;
while (size - count > 0) {
- count += socket.Send (buffer, offset + count, size - count, 0);
+ count += s.Send (buffer, offset + count, size - count, 0);
}
} catch (Exception e) {
throw new IOException ("Write failure", e);
View
1 mcs/class/corlib/System.IO/DriveInfo.cs
@@ -232,7 +232,6 @@ static string Unescape (string path)
int i = 0;
foreach (string s in drives) {
infos [i++] = new DriveInfo (s, GetDriveFormat (s));
- Console.WriteLine (infos [i-1].path);
}
return infos;

0 comments on commit d41b9d6

Please sign in to comment.