Added internal EmptyByteArray field
This commit is contained in:
parent
e58ee06c4b
commit
d2ad08d88a
@ -69,6 +69,12 @@ namespace WebSocketSharp
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Fields
|
||||
|
||||
internal static readonly byte[] EmptyByteArray = new byte[0];
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static byte[] compress (this byte[] data)
|
||||
@ -670,13 +676,13 @@ namespace WebSocketSharp
|
||||
try {
|
||||
var len = stream.EndRead (ar);
|
||||
bytes = len < 1
|
||||
? new byte[0]
|
||||
? EmptyByteArray
|
||||
: len < length
|
||||
? stream.readBytes (buff, len, length - len)
|
||||
: buff;
|
||||
}
|
||||
catch {
|
||||
bytes = new byte[0];
|
||||
bytes = EmptyByteArray;
|
||||
}
|
||||
|
||||
if (completed != null)
|
||||
@ -1657,7 +1663,7 @@ namespace WebSocketSharp
|
||||
? BitConverter.GetBytes ((UInt32)(object) value)
|
||||
: type == typeof (UInt64)
|
||||
? BitConverter.GetBytes ((UInt64)(object) value)
|
||||
: new byte[0];
|
||||
: EmptyByteArray;
|
||||
|
||||
if (bytes.Length > 1 && !order.IsHostOrder ())
|
||||
Array.Reverse (bytes);
|
||||
|
Loading…
Reference in New Issue
Block a user