Swift 5 migration: Handle changes in Data's pointer interface

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander
2019-04-09 11:25:04 +05:30
parent d9e88c51bd
commit cef3957875
4 changed files with 37 additions and 11 deletions
@@ -31,7 +31,7 @@ class ZipArchive {
let fileName = input.fileName
let contents = input.contents
zipOpenNewFileInZip(zipFile, fileName.cString(using: .utf8), nil, nil, 0, nil, 0, nil, Z_DEFLATED, Z_DEFAULT_COMPRESSION)
contents.withUnsafeBytes { (ptr: UnsafePointer<UInt8>) -> Void in
contents.withUnsafeUInt8Bytes { ptr -> Void in
zipWriteInFileInZip(zipFile, UnsafeRawPointer(ptr), UInt32(contents.count))
}
zipCloseFileInZip(zipFile)