From 25dace2fc98cd893f65595a9dfee90df40aa054e Mon Sep 17 00:00:00 2001 From: sta Date: Sun, 16 Dec 2018 21:30:23 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/HttpUtility.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/websocket-sharp/Net/HttpUtility.cs b/websocket-sharp/Net/HttpUtility.cs index f53ac6e6..0f0ac146 100644 --- a/websocket-sharp/Net/HttpUtility.cs +++ b/websocket-sharp/Net/HttpUtility.cs @@ -559,11 +559,14 @@ namespace WebSocketSharp.Net } } - output.WriteByte ((byte) '%'); - var i = (int) b; - output.WriteByte ((byte) _hexChars[i >> 4]); - output.WriteByte ((byte) _hexChars[i & 0x0F]); + + var buff = new byte[3]; + buff[0] = (byte) '%'; + buff[1] = (byte) _hexChars[i >> 4]; + buff[2] = (byte) _hexChars[i & 0x0F]; + + output.Write (buff, 0, 3); } private static byte[] urlEncodeToBytes (byte[] bytes, int offset, int count)