From a6831420903c8afd08ab89ba2bd585fbd2553ee8 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Tue, 5 Apr 2016 18:54:40 -0500 Subject: [PATCH] more updates for Swift 3.0 --- Sources/BluetoothLinux/IOCTL.swift | 14 ++++++-------- Sources/UnitTests/MathTests.swift | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Sources/BluetoothLinux/IOCTL.swift b/Sources/BluetoothLinux/IOCTL.swift index 473ab2e..cc3a909 100644 --- a/Sources/BluetoothLinux/IOCTL.swift +++ b/Sources/BluetoothLinux/IOCTL.swift @@ -55,21 +55,21 @@ internal struct IOC { /// ((type) << _IOC_TYPESHIFT) | \ /// ((nr) << _IOC_NRSHIFT) | \ /// ((size) << _IOC_SIZESHIFT)) - static func IOC(direction: CUnsignedInt, _ type: CInt, _ nr: CInt, _ size: CInt) -> CInt { + static func IOC(direction: CUnsignedInt, _ type: CInt, _ nr: CInt, _ size: CInt) -> CUnsignedLong { let dir = CInt(direction) - return (((dir) << DIRSHIFT) | ((type) << TYPESHIFT) | ((nr) << NRSHIFT) | ((size) << SIZESHIFT)) + return CUnsignedLong(bitPattern: CLong(((dir) << DIRSHIFT) | ((type) << TYPESHIFT) | ((nr) << NRSHIFT) | ((size) << SIZESHIFT))) } @inline(__always) - static func IOW(type: CInt, _ nr: CInt, _ size: T.Type) -> CInt { + static func IOW(type: CInt, _ nr: CInt, _ size: T.Type) -> CUnsignedLong { return IOC(WRITE, type, nr, TYPECHECK(size)) } @inline(__always) - static func IOR(type: CInt, _ nr: CInt, _ size: T.Type) -> CInt { + static func IOR(type: CInt, _ nr: CInt, _ size: T.Type) -> CUnsignedLong { return IOC(READ, type, nr, TYPECHECK(size)) } @@ -78,9 +78,7 @@ internal struct IOC { // MARK: - Darwin Stubs #if os(OSX) || os(iOS) - - func ioctl(d: CInt, _ request: UInt, _ varargs: Any...) -> CInt { stub() } - - func swift_bluetooth_ioctl(d: CInt, _ command: CInt, _ pointer: UnsafeMutablePointer) -> CInt { stub() } + + func swift_bluetooth_ioctl(fd: Int32, _ request: UInt, _ pointer: UnsafeMutablePointer) -> CInt { stub() } #endif diff --git a/Sources/UnitTests/MathTests.swift b/Sources/UnitTests/MathTests.swift index 3817383..c48a998 100644 --- a/Sources/UnitTests/MathTests.swift +++ b/Sources/UnitTests/MathTests.swift @@ -85,7 +85,7 @@ for (index, swiftDefinition) in swiftDefinitionList.enumerated() { - let cDefinition = cListPointer[index] + let cDefinition = CUnsignedLong(bitPattern: CLong(cListPointer[index])) guard swiftDefinition == cDefinition else {