Ver Fonte

Update arrayOfBytes to latest Swift. Use OpaquePointer to convert pointers

Marcin Krzyżanowski há 9 anos atrás
pai
commit
450003c3c8
1 ficheiros alterados com 2 adições e 2 exclusões
  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