Fix a few

This commit is contained in:
sta 2014-03-25 17:50:27 +09:00
parent fefae5b72f
commit 6645a88418
2 changed files with 13 additions and 7 deletions

View File

@ -44,7 +44,6 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Runtime.Serialization;
using System.Text; using System.Text;
namespace WebSocketSharp.Net namespace WebSocketSharp.Net
@ -382,6 +381,7 @@ namespace WebSocketSharp.Net
var path = cookie.Path; var path = cookie.Path;
var domain = cookie.Domain; var domain = cookie.Domain;
var version = cookie.Version; var version = cookie.Version;
for (int i = _list.Count - 1; i >= 0; i--) { for (int i = _list.Count - 1; i >= 0; i--) {
var c = _list [i]; var c = _list [i];
if (c.Name.Equals (name, StringComparison.InvariantCultureIgnoreCase) && if (c.Name.Equals (name, StringComparison.InvariantCultureIgnoreCase) &&
@ -545,12 +545,12 @@ namespace WebSocketSharp.Net
/// <summary> /// <summary>
/// Copies the elements of the <see cref="CookieCollection"/> to the specified array of /// Copies the elements of the <see cref="CookieCollection"/> to the specified array of
/// <see cref="Cookie"/>, starting at the specified <paramref name="index"/> in the /// <see cref="Cookie"/>, starting at the specified <paramref name="index"/> in
/// <paramref name="array"/>. /// the <paramref name="array"/>.
/// </summary> /// </summary>
/// <param name="array"> /// <param name="array">
/// An array of <see cref="Cookie"/> is the destination of the elements copied from the /// An array of <see cref="Cookie"/> is the destination of the elements copied from
/// <see cref="CookieCollection"/>. /// the <see cref="CookieCollection"/>.
/// </param> /// </param>
/// <param name="index"> /// <param name="index">
/// An <see cref="int"/> that represents the zero-based index in <paramref name="array"/> /// An <see cref="int"/> that represents the zero-based index in <paramref name="array"/>
@ -585,7 +585,7 @@ namespace WebSocketSharp.Net
/// Gets the enumerator to use to iterate through the <see cref="CookieCollection"/>. /// Gets the enumerator to use to iterate through the <see cref="CookieCollection"/>.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// A <see cref="IEnumerator"/> instance to use to iterate through /// An <see cref="IEnumerator"/> instance to use to iterate through
/// the <see cref="CookieCollection"/>. /// the <see cref="CookieCollection"/>.
/// </returns> /// </returns>
public IEnumerator GetEnumerator () public IEnumerator GetEnumerator ()

View File

@ -38,9 +38,15 @@ namespace WebSocketSharp.Net
{ {
public int Compare (Cookie x, Cookie y) public int Compare (Cookie x, Cookie y)
{ {
if (x == null || y == null) if (x == null && y == null)
return 0; return 0;
if (x == null)
return -1;
if (y == null)
return 1;
var c1 = x.Name.Length + x.Value.Length; var c1 = x.Name.Length + x.Value.Length;
var c2 = y.Name.Length + y.Value.Length; var c2 = y.Name.Length + y.Value.Length;