Skip to content

Commit

Permalink
some renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
goloveychuk committed Oct 26, 2016
1 parent e888bdd commit 3df492a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Sources/Proxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

import CZeroMQ

public func proxy(_ frontend: Socket, backend: Socket, capture: Socket? = nil) {
zmq_proxy(frontend.socket, backend.socket, capture?.socket ?? nil)
public func proxy(frontend: Socket, backend: Socket, capture: Socket? = nil) {
zmq_proxy(frontend.socket, backend.socket, capture?.socket)
}
18 changes: 9 additions & 9 deletions Sources/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: MemoryLayout<Int32>.stride)
try setOption(option, value: &value, length: MemoryLayout<Int32>.size)
}
func setOption(_ option: Int32, _ value: Int32) throws {
var value = value
try setOption(option, value: &value, length: MemoryLayout<Int32>.stride)
try setOption(option, value: &value, length: MemoryLayout<Int32>.size)
}
func setOption(_ option: Int32, _ value: String) throws {
try value.withCString { v in
Expand All @@ -227,7 +227,7 @@ extension Socket {
extension Socket {
public func setAffinity(_ value: UInt64) throws {
var value = value
try setOption(ZMQ_AFFINITY, value: &value, length: MemoryLayout<UInt64>.stride)
try setOption(ZMQ_AFFINITY, value: &value, length: MemoryLayout<UInt64>.size)
}

public func setBacklog(_ value: Int32) throws {
Expand Down Expand Up @@ -316,7 +316,7 @@ extension Socket {

public func setMaxMessageSize(_ value: Int64) throws {
var value = value
try setOption(ZMQ_MAXMSGSIZE, value: &value, length: MemoryLayout<Int64>.stride)
try setOption(ZMQ_MAXMSGSIZE, value: &value, length: MemoryLayout<Int64>.size)
}

public func setMulticastHops(_ value: Int32) throws {
Expand Down Expand Up @@ -463,7 +463,7 @@ extension Socket {
extension Socket {
func getOption(_ option: Int32) throws -> Int32 {
var value: Int32 = 0
var length = MemoryLayout<Int32>.stride
var length = MemoryLayout<Int32>.size
try getOption(option, value: &value, length: &length)
return value
}
Expand All @@ -482,7 +482,7 @@ extension Socket {
extension Socket {
public func getAffinity() throws -> UInt64 {
var value: UInt64 = 0
var length = MemoryLayout<UInt64>.stride
var length = MemoryLayout<UInt64>.size
try getOption(ZMQ_AFFINITY, value: &value, length: &length)
return value
}
Expand Down Expand Up @@ -566,7 +566,7 @@ extension Socket {

public func getMaxMessageSize() throws -> Int64 {
var value: Int64 = 0
var length = MemoryLayout<Int64>.stride
var length = MemoryLayout<Int64>.size
try getOption(ZMQ_MAXMSGSIZE, value: &value, length: &length)
return value
}
Expand Down Expand Up @@ -695,11 +695,11 @@ extension SecurityMechanism {
}

extension Socket {
public func sendString(_ string: String, mode: SendMode = []) throws -> Bool {
public func send(_ string: String, mode: SendMode = []) throws -> Bool {
return try send(Data(string.utf8), mode: mode)
}

public func receiveString(_ mode: ReceiveMode = []) throws -> String? {
public func receive(_ mode: ReceiveMode = []) throws -> String? {
guard let buffer = try receive(mode: mode) else {
return nil
}
Expand Down

0 comments on commit 3df492a

Please sign in to comment.