From 97d64be723328996c1a8bb40d17e30f711af987f Mon Sep 17 00:00:00 2001 From: Eric Schofield Date: Fri, 29 Nov 2019 19:05:36 -0700 Subject: [PATCH] Use 'let' instead of 'var' to satisfy a warning --- Sources/UDPClient.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/UDPClient.swift b/Sources/UDPClient.swift index 305ffb0..a3c39f5 100644 --- a/Sources/UDPClient.swift +++ b/Sources/UDPClient.swift @@ -116,7 +116,7 @@ open class UDPClient: Socket { guard let fd = self.fd else { return (nil, "no ip", 0) } - var buff: [Byte] = [Byte](repeating: 0x0, count: expectlen) + let buff: [Byte] = [Byte](repeating: 0x0, count: expectlen) var remoteipbuff: [Int8] = [Int8](repeating: 0x0, count: 16) var remoteport: Int32 = 0 let readLen: Int32 = c_yudpsocket_recive(fd, buff: buff, len: Int32(expectlen), ip: &remoteipbuff, port: &remoteport) @@ -154,7 +154,7 @@ open class UDPServer: Socket { //TODO add multycast and boardcast open func recv(_ expectlen: Int) -> ([Byte]?, String, Int) { if let fd = self.fd { - var buff: [Byte] = [Byte](repeating: 0x0,count: expectlen) + let buff: [Byte] = [Byte](repeating: 0x0,count: expectlen) var remoteipbuff: [Int8] = [Int8](repeating: 0x0,count: 16) var remoteport: Int32 = 0 let readLen: Int32 = c_yudpsocket_recive(fd, buff: buff, len: Int32(expectlen), ip: &remoteipbuff, port: &remoteport)