diff --git a/swift/Arrow/Package.swift b/swift/Arrow/Package.swift index 6f19136fd4292..6944d7b910656 100644 --- a/swift/Arrow/Package.swift +++ b/swift/Arrow/Package.swift @@ -44,16 +44,27 @@ let package = Package( targets: [ .target( name: "ArrowC", - path: "Sources/ArrowC" + path: "Sources/ArrowC", + swiftSettings: [ + .unsafeFlags(["-warnings-as-errors"]) + ] ), .target( name: "Arrow", dependencies: ["ArrowC", .product(name: "FlatBuffers", package: "flatbuffers"), .product(name: "Atomics", package: "swift-atomics") - ]), + ], + swiftSettings: [ + .unsafeFlags(["-warnings-as-errors"]) + ] + ), .testTarget( name: "ArrowTests", - dependencies: ["Arrow", "ArrowC"]) + dependencies: ["Arrow", "ArrowC"], + swiftSettings: [ + .unsafeFlags(["-warnings-as-errors"]) + ] + ) ] ) diff --git a/swift/Arrow/Sources/Arrow/ArrowCExporter.swift b/swift/Arrow/Sources/Arrow/ArrowCExporter.swift index aa93f0cb7e389..f2dd8ab56d897 100644 --- a/swift/Arrow/Sources/Arrow/ArrowCExporter.swift +++ b/swift/Arrow/Sources/Arrow/ArrowCExporter.swift @@ -61,12 +61,18 @@ public class ArrowCExporter { // deallocated self.arrowData = arrowData for arrowBuffer in arrowData.buffers { - data.append(arrowBuffer.rawPointer) + self.data.append(arrowBuffer.rawPointer) } - self.buffers = UnsafeMutablePointer(mutating: data) + self.buffers = UnsafeMutablePointer.allocate(capacity: self.data.count) + self.buffers.initialize(from: &self.data, count: self.data.count) super.init() } + + deinit { + self.buffers.deinitialize(count: self.data.count) + self.buffers.deallocate() + } } private static var exportedData = [Int: ExportData]() diff --git a/swift/Arrow/Tests/ArrowTests/CodableTests.swift b/swift/Arrow/Tests/ArrowTests/CodableTests.swift index d7d3414cf6250..160beea17c9fa 100644 --- a/swift/Arrow/Tests/ArrowTests/CodableTests.swift +++ b/swift/Arrow/Tests/ArrowTests/CodableTests.swift @@ -98,7 +98,7 @@ final class CodableTests: XCTestCase { switch result { case .success(let rb): let decoder = ArrowDecoder(rb) - var testClasses = try decoder.decode(TestClass.self) + let testClasses = try decoder.decode(TestClass.self) for index in 0..