Skip to content

Commit

Permalink
Merge pull request #15 from N3TWORK/master
Browse files Browse the repository at this point in the history
Fix for large numbers on TCompactProtocol.
  • Loading branch information
wyland committed Apr 9, 2018
2 parents c4dc1da + 9f0b6ad commit 756b902
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/TCompactProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ public class TCompactProtocol: TProtocol {
///
/// - returns: zigzaged UInt32
func i32ToZigZag(_ n : Int32) -> UInt32 {
return UInt32(n << 1) ^ UInt32(n >> 31)
return UInt32(bitPattern: Int32(n << 1) ^ Int32(n >> 31))
}

func i64ToZigZag(_ n : Int64) -> UInt64 {
return UInt64(n << 1) ^ UInt64(n >> 63)
return UInt64(bitPattern: Int64(n << 1) ^ Int64(n >> 63))
}

func zigZagToi32(_ n: UInt32) -> Int32 {
Expand Down
4 changes: 2 additions & 2 deletions Sources/TSocketTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public class TCFSocketTransport: TStreamTransport {
CFWriteStreamSetProperty(writeStream, .shouldCloseNativeSocket, kCFBooleanTrue)

if secure {
CFReadStreamSetProperty(readStream, .socketSecurityLevel, StreamSocketSecurityLevel.negotiatedSSL._rawValue)
CFWriteStreamSetProperty(writeStream, .socketSecurityLevel, StreamSocketSecurityLevel.negotiatedSSL._rawValue)
CFReadStreamSetProperty(readStream, .socketSecurityLevel, StreamSocketSecurityLevel.negotiatedSSL.rawValue as CFString)
CFWriteStreamSetProperty(writeStream, .socketSecurityLevel, StreamSocketSecurityLevel.negotiatedSSL.rawValue as CFString)
}

inputStream = readStream as InputStream
Expand Down

0 comments on commit 756b902

Please sign in to comment.