File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 1212
1313import PackageDescription
1414
15- let targets : [ PackageDescription . Target ] = [
15+ let windowsPlatform : [ Platform ]
16+ #if os(Windows)
17+ windowsPlatform = [ . windows]
18+ #else
19+ windowsPlatform = [ ]
20+ #endif
21+
22+ let targets : [ Target ] = [
1623 . target(
1724 name: " SystemPackage " ,
1825 dependencies: [ " CSystem " ] ,
1926 path: " Sources/System " ,
27+ cSettings: [
28+ . define( " _CRT_SECURE_NO_WARNINGS " , . when( platforms: windowsPlatform) ) ,
29+ ] ,
2030 swiftSettings: [
2131 . define( " SYSTEM_PACKAGE " ) ,
2232 . define( " ENABLE_MOCKING " , . when( configuration: . debug) )
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ private func originalSyscallName(_ function: String) -> String {
146146
147147private func mockImpl(
148148 name: String ,
149- path: UnsafePointer < CChar > ? ,
149+ path: UnsafePointer < CInterop . PlatformChar > ? ,
150150 _ args: [ AnyHashable ]
151151) -> CInt {
152152 precondition ( mockingEnabled)
@@ -177,18 +177,18 @@ private func mockImpl(
177177}
178178
179179internal func _mock(
180- name: String = #function, path: UnsafePointer < CChar > ? = nil , _ args: AnyHashable ...
180+ name: String = #function, path: UnsafePointer < CInterop . PlatformChar > ? = nil , _ args: AnyHashable ...
181181) -> CInt {
182182 return mockImpl ( name: name, path: path, args)
183183}
184184internal func _mockInt(
185- name: String = #function, path: UnsafePointer < CChar > ? = nil , _ args: AnyHashable ...
185+ name: String = #function, path: UnsafePointer < CInterop . PlatformChar > ? = nil , _ args: AnyHashable ...
186186) -> Int {
187187 Int ( mockImpl ( name: name, path: path, args) )
188188}
189189
190190internal func _mockOffT(
191- name: String = #function, path: UnsafePointer < CChar > ? = nil , _ args: AnyHashable ...
191+ name: String = #function, path: UnsafePointer < CInterop . PlatformChar > ? = nil , _ args: AnyHashable ...
192192) -> _COffT {
193193 _COffT ( mockImpl ( name: name, path: path, args) )
194194}
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ internal func system_lseek(
7979#if ENABLE_MOCKING
8080 if mockingEnabled { return _mockOffT ( fd, off, whence) }
8181#endif
82- return lseek ( fd, off, whence)
82+ return _lseek ( fd, off, whence)
8383}
8484
8585// write
@@ -106,12 +106,12 @@ internal func system_dup(_ fd: Int32) -> Int32 {
106106 #if ENABLE_MOCKING
107107 if mockingEnabled { return _mock ( fd) }
108108 #endif
109- return dup ( fd)
109+ return _dup ( fd)
110110}
111111
112112internal func system_dup2( _ fd: Int32 , _ fd2: Int32 ) -> Int32 {
113113 #if ENABLE_MOCKING
114114 if mockingEnabled { return _mock ( fd, fd2) }
115115 #endif
116- return dup2 ( fd, fd2)
116+ return _dup2 ( fd, fd2)
117117}
You can’t perform that action at this time.
0 commit comments