diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2011-08-08 17:26:42 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2011-08-08 17:26:42 +0400 |
commit | d41b9d61c2d645b62ced173e4b335beeba34afbc (patch) | |
tree | da224a55c2c8fca85d1ddee4a029bed3fe8a8da6 | |
parent | 3cb9ce92bc8ad9732b2e6c959b0c360fb6e33e16 (diff) | |
parent | 71b1f58d41ed16177bc192b7f653ca991e46c4dc (diff) |
Merge pull request #150 from bassamtabbara/mono-2-10
Some fixes to mono-2-10
-rw-r--r-- | mcs/class/System.Web.Routing/System.Web.Routing/Route.cs | 18 | ||||
-rw-r--r-- | mcs/class/System/System.Net.Sockets/NetworkStream.cs | 48 | ||||
-rw-r--r-- | mcs/class/corlib/System.IO/DriveInfo.cs | 1 |
3 files changed, 51 insertions, 16 deletions
diff --git a/mcs/class/System.Web.Routing/System.Web.Routing/Route.cs b/mcs/class/System.Web.Routing/System.Web.Routing/Route.cs index ebc947a0f6f..1a7ce99e833 100644 --- a/mcs/class/System.Web.Routing/System.Web.Routing/Route.cs +++ b/mcs/class/System.Web.Routing/System.Web.Routing/Route.cs @@ -188,22 +188,22 @@ namespace System.Web.Routing 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) diff --git a/mcs/class/System/System.Net.Sockets/NetworkStream.cs b/mcs/class/System/System.Net.Sockets/NetworkStream.cs index 29c5b8bb51c..95d3b4dd51a 100644 --- a/mcs/class/System/System.Net.Sockets/NetworkStream.cs +++ b/mcs/class/System/System.Net.Sockets/NetworkStream.cs @@ -214,8 +214,14 @@ namespace System.Net.Sockets 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 @@ namespace System.Net.Sockets 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 @@ namespace System.Net.Sockets 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 @@ namespace System.Net.Sockets 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 @@ namespace System.Net.Sockets 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 @@ namespace System.Net.Sockets 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); diff --git a/mcs/class/corlib/System.IO/DriveInfo.cs b/mcs/class/corlib/System.IO/DriveInfo.cs index a94f94bb724..e7db8879559 100644 --- a/mcs/class/corlib/System.IO/DriveInfo.cs +++ b/mcs/class/corlib/System.IO/DriveInfo.cs @@ -232,7 +232,6 @@ namespace System.IO { int i = 0; foreach (string s in drives) { infos [i++] = new DriveInfo (s, GetDriveFormat (s)); - Console.WriteLine (infos [i-1].path); } return infos; |