Skip to content

Commit

Permalink
Merge pull request #283 from ambiapps/development
Browse files Browse the repository at this point in the history
Fixes so repo builds with Xcode 15
  • Loading branch information
weichsel committed Aug 16, 2023
2 parents 22bfd0a + e504d6b commit 797dac7
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Package@swift-4.0.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// swift-tools-version:4.0
import PackageDescription

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
let dependencies: [Package.Dependency] = []
#else
let dependencies: [Package.Dependency] = [.package(url: "https://github.com/IBM-Swift/CZlib.git", .exact("0.1.2"))]
Expand Down
4 changes: 2 additions & 2 deletions Sources/ZIPFoundation/Archive+MemoryFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MemoryFile {
let cookie = Unmanaged.passRetained(self)
let writable = mode.count > 0 && (mode.first! != "r" || mode.last! == "+")
let append = mode.count > 0 && mode.first! == "a"
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Android)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS) || os(Android)
let result = writable
? funopen(cookie.toOpaque(), readStub, writeStub, seekStub, closeStub)
: funopen(cookie.toOpaque(), readStub, nil, seekStub, closeStub)
Expand Down Expand Up @@ -99,7 +99,7 @@ private func closeStub(_ cookie: UnsafeMutableRawPointer?) -> Int32 {
return 0
}

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Android)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS) || os(Android)
private func readStub(_ cookie: UnsafeMutableRawPointer?,
_ bytePtr: UnsafeMutablePointer<Int8>?,
_ count: Int32) -> Int32 {
Expand Down
2 changes: 1 addition & 1 deletion Sources/ZIPFoundation/Archive+Writing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ extension Archive {
#endif
} else {
let fileManager = FileManager()
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
do {
_ = try fileManager.replaceItemAt(self.url, withItemAt: archive.url)
} catch {
Expand Down
8 changes: 4 additions & 4 deletions Sources/ZIPFoundation/Data+Compression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extension Data {
/// - consumer: A closure that processes the result of the compress operation.
/// - Returns: The checksum of the processed content.
public static func compress(size: Int64, bufferSize: Int, provider: Provider, consumer: Consumer) throws -> CRC32 {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
return try self.process(operation: COMPRESSION_STREAM_ENCODE, size: size, bufferSize: bufferSize,
provider: provider, consumer: consumer)
#else
Expand All @@ -84,7 +84,7 @@ extension Data {
/// - Returns: The checksum of the processed content.
public static func decompress(size: Int64, bufferSize: Int, skipCRC32: Bool,
provider: Provider, consumer: Consumer) throws -> CRC32 {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
return try self.process(operation: COMPRESSION_STREAM_DECODE, size: size, bufferSize: bufferSize,
skipCRC32: skipCRC32, provider: provider, consumer: consumer)
#else
Expand All @@ -95,7 +95,7 @@ extension Data {

// MARK: - Apple Platforms

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
import Compression

extension Data {
Expand Down Expand Up @@ -351,7 +351,7 @@ extension Data {
}
}

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
#else
mutating func withUnsafeMutableBytes<T>(_ body: (UnsafeMutableRawBufferPointer) throws -> T) rethrows -> T {
let count = self.count
Expand Down
4 changes: 2 additions & 2 deletions Sources/ZIPFoundation/Date+ZIP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extension Date {
private extension Date {

enum Constants {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
static let absoluteTimeIntervalSince1970 = kCFAbsoluteTimeIntervalSince1970
#else
static let absoluteTimeIntervalSince1970: Double = 978307200.0
Expand All @@ -77,7 +77,7 @@ private extension Date {
extension stat {

var lastAccessDate: Date {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
return Date(timespec: st_atimespec)
#else
return Date(timespec: st_atim)
Expand Down
8 changes: 4 additions & 4 deletions Sources/ZIPFoundation/FileManager+ZIP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ extension FileManager {
return
}

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
guard let posixPermissions = attributes[.posixPermissions] as? NSNumber else {
throw Entry.EntryError.missingPermissionsAttributeError
}
Expand Down Expand Up @@ -224,7 +224,7 @@ extension FileManager {
let defaultPermissions = entryType == .directory ? defaultDirectoryPermissions : defaultFilePermissions
var attributes = [.posixPermissions: defaultPermissions] as [FileAttributeKey: Any]
// Certain keys are not yet supported in swift-corelibs
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
attributes[.modificationDate] = Date(dateTime: (fileDate, fileTime))
#endif
let versionMadeBy = centralDirectoryStructure.versionMadeBy
Expand Down Expand Up @@ -280,7 +280,7 @@ extension FileManager {
let entryFileSystemRepresentation = fileManager.fileSystemRepresentation(withPath: url.path)
var fileStat = stat()
lstat(entryFileSystemRepresentation, &fileStat)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
let modTimeSpec = fileStat.st_mtimespec
#else
let modTimeSpec = fileStat.st_mtim
Expand Down Expand Up @@ -331,7 +331,7 @@ extension CocoaError {
#if swift(>=4.2)
#else

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
#else

// The swift-corelibs-foundation version of NSError.swift was missing a convenience method to create
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ extension ZIPFoundationTests {
} catch {
XCTFail("Unexpected error while trying to transfer symlink attributes")
}
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
do {
var resourceValues = URLResourceValues()
resourceValues.isUserImmutable = true
Expand Down
2 changes: 1 addition & 1 deletion Tests/ZIPFoundationTests/ZIPFoundationProgressTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import XCTest
@testable import ZIPFoundation

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
extension ZIPFoundationTests {

func testArchiveAddUncompressedEntryProgress() {
Expand Down
4 changes: 2 additions & 2 deletions Tests/ZIPFoundationTests/ZIPFoundationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class ZIPFoundationTests: XCTestCase {
}

func runWithFileDescriptorLimit(_ limit: UInt64, handler: () -> Void) {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Android)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS) || os(Android)
let fileNoFlag = RLIMIT_NOFILE
#else
let fileNoFlag = Int32(RLIMIT_NOFILE.rawValue)
Expand Down Expand Up @@ -365,7 +365,7 @@ extension Archive {

extension Data {
static func makeRandomData(size: Int) -> Data {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(xrOS)
let bytes = [UInt32](repeating: 0, count: size).map { _ in UInt32.random(in: 0...UInt32.max) }
#else
let bytes = [UInt32](repeating: 0, count: size).map { _ in random() }
Expand Down

0 comments on commit 797dac7

Please sign in to comment.