-
Notifications
You must be signed in to change notification settings - Fork 470
Open
Description
Building in linux gives the following error
/home/x/Zip/Zip/Zip.swift:219:61: error: value of optional type 'UnsafeMutablePointer<FILE>?' (aka 'Optional<UnsafeMutablePointer<_IO_FILE>>') must be unwrapped to a value of type 'UnsafeMutablePointer<FILE>' (aka 'UnsafeMutablePointer<_IO_FILE>')
217 | let readBytes = unzReadCurrentFile(zip, &buffer, bufferSize)
218 | if readBytes > 0 {
219 | guard fwrite(buffer, Int(readBytes), 1, filePointer) == 1 else {
| |- error: value of optional type 'UnsafeMutablePointer<FILE>?' (aka 'Optional<UnsafeMutablePointer<_IO_FILE>>') must be unwrapped to a value of type 'UnsafeMutablePointer<FILE>' (aka 'UnsafeMutablePointer<_IO_FILE>')
| |- note: coalesce using '??' to provide a default when the optional value contains 'nil'
| `- note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
220 | throw ZipError.unzipFail
221 | }
/home/x/Zip/Zip/Zip.swift:219:61: error: value of optional type 'UnsafeMutablePointer<FILE>?' (aka 'Optional<UnsafeMutablePointer<_IO_FILE>>') must be unwrapped to a value of type 'UnsafeMutablePointer<FILE>' (aka 'UnsafeMutablePointer<_IO_FILE>')
217 | let readBytes = unzReadCurrentFile(zip, &buffer, bufferSize)
218 | if readBytes > 0 {
219 | guard fwrite(buffer, Int(readBytes), 1, filePointer) == 1 else {
| |- error: value of optional type 'UnsafeMutablePointer<FILE>?' (aka 'Optional<UnsafeMutablePointer<_IO_FILE>>') must be unwrapped to a value of type 'UnsafeMutablePointer<FILE>' (aka 'UnsafeMutablePointer<_IO_FILE>')
| |- note: coalesce using '??' to provide a default when the optional value contains 'nil'
| `- note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
220 | throw ZipError.unzipFail
221 | }
/home/x/Zip/Zip/Zip.swift:219:61: error: value of optional type 'UnsafeMutablePointer<FILE>?' (aka 'Optional<UnsafeMutablePointer<_IO_FILE>>') must be unwrapped to a value of type 'UnsafeMutablePointer<FILE>' (aka 'UnsafeMutablePointer<_IO_FILE>')
217 | let readBytes = unzReadCurrentFile(zip, &buffer, bufferSize)
218 | if readBytes > 0 {
219 | guard fwrite(buffer, Int(readBytes), 1, filePointer) == 1 else {
| |- error: value of optional type 'UnsafeMutablePointer<FILE>?' (aka 'Optional<UnsafeMutablePointer<_IO_FILE>>') must be unwrapped to a value of type 'UnsafeMutablePointer<FILE>' (aka 'UnsafeMutablePointer<_IO_FILE>')
| |- note: coalesce using '??' to provide a default when the optional value contains 'nil'
| `- note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
220 | throw ZipError.unzipFail
221 | }
You can see this in building a dependand library using github actions here.
It seems that Swift is unwilling to implicitly unwrap the optional UnsafeMutablePointer? when passing it to fwrite in linux enviroments.
Environment Informations
Zip: 2.1.2
Swift version: 6.0
Tested On: Ubuntu 24.04.2 LTS
Metadata
Metadata
Assignees
Labels
No labels