Browse Source

Update arrayOfBytes to latest Swift. Use OpaquePointer to convert pointers

Marcin Krzyżanowski 9 years ago
parent
commit
450003c3c8
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Sources/CryptoSwift/Generics.swift

+ 2 - 2
Sources/CryptoSwift/Generics.swift

@@ -63,8 +63,8 @@ func arrayOfBytes<T>(value:T, length:Int? = nil) -> Array<UInt8> {
 
     let valuePointer = UnsafeMutablePointer<T>.allocate(capacity: 1)
     valuePointer.pointee = value
-    
-    let bytesPointer = UnsafeMutablePointer<UInt8>(valuePointer)
+
+    let bytesPointer = UnsafeMutablePointer<UInt8>(OpaquePointer(valuePointer))
     var bytes = Array<UInt8>(repeating: 0, count: totalBytes)
     for j in 0..<min(sizeof(T.self),totalBytes) {
         bytes[totalBytes - 1 - j] = (bytesPointer + j).pointee