don't need to keep count manually

This commit is contained in:
Erik 2015-12-25 11:28:08 -05:00
parent ca90938675
commit aeb52de72f

View File

@ -27,7 +27,6 @@ import Foundation
struct SocketPacket { struct SocketPacket {
private let placeholders: Int private let placeholders: Int
private var currentPlace = 0
private static let logType = "SocketPacket" private static let logType = "SocketPacket"
@ -73,14 +72,13 @@ struct SocketPacket {
} }
mutating func addData(data: NSData) -> Bool { mutating func addData(data: NSData) -> Bool {
if placeholders == currentPlace { if placeholders == binary.count {
return true return true
} }
binary.append(data) binary.append(data)
currentPlace += 1
if placeholders == currentPlace { if placeholders == binary.count {
fillInPlaceholders() fillInPlaceholders()
return true return true
} else { } else {