removing zewo/core dependence
This commit is contained in:
parent
0cc0c5332e
commit
e888bdd8f0
|
@ -3,7 +3,6 @@ import PackageDescription
|
|||
let package = Package(
|
||||
name: "ZeroMQ",
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/Zewo/Core.git", majorVersion: 0, minor: 13),
|
||||
.Package(url: "https://github.com/Zewo/CZeroMQ.git", majorVersion: 1, minor: 0),
|
||||
]
|
||||
)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
// SOFTWARE.
|
||||
|
||||
import CZeroMQ
|
||||
import Core
|
||||
import struct Foundation.Data
|
||||
|
||||
public struct SendMode : OptionSet {
|
||||
public let rawValue: Int
|
||||
|
@ -197,11 +197,11 @@ public struct SocketEvent : OptionSet {
|
|||
extension Socket {
|
||||
func setOption(_ option: Int32, _ value: Bool) throws {
|
||||
var value = value ? 1 : 0
|
||||
try setOption(option, value: &value, length: strideof(Int32.self))
|
||||
try setOption(option, value: &value, length: MemoryLayout<Int32>.stride)
|
||||
}
|
||||
func setOption(_ option: Int32, _ value: Int32) throws {
|
||||
var value = value
|
||||
try setOption(option, value: &value, length: strideof(Int32.self))
|
||||
try setOption(option, value: &value, length: MemoryLayout<Int32>.stride)
|
||||
}
|
||||
func setOption(_ option: Int32, _ value: String) throws {
|
||||
try value.withCString { v in
|
||||
|
@ -227,7 +227,7 @@ extension Socket {
|
|||
extension Socket {
|
||||
public func setAffinity(_ value: UInt64) throws {
|
||||
var value = value
|
||||
try setOption(ZMQ_AFFINITY, value: &value, length: strideof(UInt64.self))
|
||||
try setOption(ZMQ_AFFINITY, value: &value, length: MemoryLayout<UInt64>.stride)
|
||||
}
|
||||
|
||||
public func setBacklog(_ value: Int32) throws {
|
||||
|
@ -316,7 +316,7 @@ extension Socket {
|
|||
|
||||
public func setMaxMessageSize(_ value: Int64) throws {
|
||||
var value = value
|
||||
try setOption(ZMQ_MAXMSGSIZE, value: &value, length: strideof(Int64.self))
|
||||
try setOption(ZMQ_MAXMSGSIZE, value: &value, length: MemoryLayout<Int64>.stride)
|
||||
}
|
||||
|
||||
public func setMulticastHops(_ value: Int32) throws {
|
||||
|
@ -463,7 +463,7 @@ extension Socket {
|
|||
extension Socket {
|
||||
func getOption(_ option: Int32) throws -> Int32 {
|
||||
var value: Int32 = 0
|
||||
var length = strideof(Int32.self)
|
||||
var length = MemoryLayout<Int32>.stride
|
||||
try getOption(option, value: &value, length: &length)
|
||||
return value
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ extension Socket {
|
|||
extension Socket {
|
||||
public func getAffinity() throws -> UInt64 {
|
||||
var value: UInt64 = 0
|
||||
var length = strideof(UInt64.self)
|
||||
var length = MemoryLayout<UInt64>.stride
|
||||
try getOption(ZMQ_AFFINITY, value: &value, length: &length)
|
||||
return value
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ extension Socket {
|
|||
|
||||
public func getMaxMessageSize() throws -> Int64 {
|
||||
var value: Int64 = 0
|
||||
var length = strideof(Int64.self)
|
||||
var length = MemoryLayout<Int64>.stride
|
||||
try getOption(ZMQ_MAXMSGSIZE, value: &value, length: &length)
|
||||
return value
|
||||
}
|
||||
|
@ -696,13 +696,13 @@ extension SecurityMechanism {
|
|||
|
||||
extension Socket {
|
||||
public func sendString(_ string: String, mode: SendMode = []) throws -> Bool {
|
||||
return try send(Data(string), mode: mode)
|
||||
return try send(Data(string.utf8), mode: mode)
|
||||
}
|
||||
|
||||
public func receiveString(_ mode: ReceiveMode = []) throws -> String? {
|
||||
guard let buffer = try receive(mode: mode) else {
|
||||
return nil
|
||||
}
|
||||
return try? String(data: buffer)
|
||||
return String(data: buffer, encoding: String.Encoding.utf8)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue