Skip to content

Commit fe658f3

Browse files
committed
Upgrade to Swift 6.2
1 parent 4b1653e commit fe658f3

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:6.0
1+
// swift-tools-version:6.2
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

Sources/BaseKit/Async/AsyncRandomAccessFile.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ public struct AsyncRandomAccessFile: ~Copyable, Sendable {
7373
}
7474
return stats.st_size
7575
}
76-
76+
7777
deinit {
7878
// Ensure we've closed the file if we're going out of scope
7979
if !isClosed {
80-
unistd.close(fileDescriptor)
80+
Darwin.close(fileDescriptor)
8181
}
8282
}
8383

8484
public consuming func close() {
8585
isClosed = true
86-
unistd.close(fileDescriptor)
86+
Darwin.close(fileDescriptor)
8787
}
8888
}
8989

@@ -213,7 +213,7 @@ private final class WriteOperation: AsyncIOOperation {
213213
private struct OperationResult {
214214
var dataToWrite: Data
215215
var controlBlockPointer: UnsafeMutablePointer<aiocb>?
216-
var externalDataToWrite: UnsafeMutablePointer<CChar>?
216+
var externalDataToWrite: UnsafeMutableRawBufferPointer?
217217
}
218218

219219
private let fileDescriptor: Int32
@@ -243,21 +243,21 @@ private final class WriteOperation: AsyncIOOperation {
243243
let error = mutableBits.withLock { [fileDescriptor, offset] mutableBits in
244244
let byteCount = mutableBits.dataToWrite.count
245245
let controlBlockPointer = UnsafeMutablePointer<aiocb>.allocate(capacity: 1)
246-
controlBlockPointer.pointee = mutableBits.dataToWrite.withUnsafeMutableBytes { rawPointer in
247-
let unsafeMutablePointer: UnsafeMutablePointer<CChar>
246+
controlBlockPointer.pointee = mutableBits.dataToWrite.withUnsafeMutableBytes { (rawBufferPointer: UnsafeMutableRawBufferPointer) in
247+
let unsafeMutablePointer: UnsafeMutableRawBufferPointer
248248
if byteCount > 16 {
249249
// This is probably not inline data, so use it as is. YOLO
250-
unsafeMutablePointer = rawPointer
250+
unsafeMutablePointer = rawBufferPointer
251251
} else {
252252
// This is probably inline data, so make a copy
253-
unsafeMutablePointer = UnsafeMutablePointer<CChar>.allocate(capacity: byteCount)
254-
unsafeMutablePointer.initialize(from: rawPointer, count: byteCount)
253+
unsafeMutablePointer = UnsafeMutableRawBufferPointer.allocate(byteCount: byteCount, alignment: 16)
254+
unsafeMutablePointer.copyBytes(from: rawBufferPointer)
255255
mutableBits.externalDataToWrite = unsafeMutablePointer
256256
}
257-
return aiocb(
257+
return aiocb(
258258
aio_fildes: fileDescriptor,
259259
aio_offset: offset,
260-
aio_buf: unsafeMutablePointer,
260+
aio_buf: unsafeMutablePointer.baseAddress,
261261
aio_nbytes: byteCount,
262262
aio_reqprio: 0,
263263
aio_sigevent: sigevent(

Sources/BaseKit/Extensions/Character+Ext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
extension Character: Codable {
3+
extension Character: @retroactive Codable {
44
public init(from decoder: Decoder) throws {
55
let container = try decoder.singleValueContainer()
66
let string = try container.decode(String.self)

Sources/BaseKit/XML/XMLUpdateBuilder/InsertXML.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public struct InsertXML<Content: XML>: XMLUpdate {
1+
public struct InsertXML<Content: XML & SendableMetatype>: XMLUpdate {
22
private let index: XMLIndex
33
private let content: @Sendable () -> Content
44
private let overrideParent: Override<XMLID?>

Sources/BaseKit/XML/XMLUpdateBuilder/UpsertXML.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public struct UpsertXML<Content: XML, Changes: XMLUpdate>: XMLUpdate {
1+
public struct UpsertXML<Content: XML & SendableMetatype, Changes: XMLUpdate & SendableMetatype>: XMLUpdate {
22
private let index: XMLIndex
33
private let existingElement: XMLUpsertQuery
44
private let content: @Sendable () -> Content

0 commit comments

Comments
 (0)