File tree 3 files changed +18
-8
lines changed
3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 12
12
13
13
import PackageDescription
14
14
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 ] = [
16
23
. target(
17
24
name: " SystemPackage " ,
18
25
dependencies: [ " CSystem " ] ,
19
26
path: " Sources/System " ,
27
+ cSettings: [
28
+ . define( " _CRT_SECURE_NO_WARNINGS " , . when( platforms: windowsPlatform) ) ,
29
+ ] ,
20
30
swiftSettings: [
21
31
. define( " SYSTEM_PACKAGE " ) ,
22
32
. 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 {
146
146
147
147
private func mockImpl(
148
148
name: String ,
149
- path: UnsafePointer < CChar > ? ,
149
+ path: UnsafePointer < CInterop . PlatformChar > ? ,
150
150
_ args: [ AnyHashable ]
151
151
) -> CInt {
152
152
precondition ( mockingEnabled)
@@ -177,18 +177,18 @@ private func mockImpl(
177
177
}
178
178
179
179
internal func _mock(
180
- name: String = #function, path: UnsafePointer < CChar > ? = nil , _ args: AnyHashable ...
180
+ name: String = #function, path: UnsafePointer < CInterop . PlatformChar > ? = nil , _ args: AnyHashable ...
181
181
) -> CInt {
182
182
return mockImpl ( name: name, path: path, args)
183
183
}
184
184
internal func _mockInt(
185
- name: String = #function, path: UnsafePointer < CChar > ? = nil , _ args: AnyHashable ...
185
+ name: String = #function, path: UnsafePointer < CInterop . PlatformChar > ? = nil , _ args: AnyHashable ...
186
186
) -> Int {
187
187
Int ( mockImpl ( name: name, path: path, args) )
188
188
}
189
189
190
190
internal func _mockOffT(
191
- name: String = #function, path: UnsafePointer < CChar > ? = nil , _ args: AnyHashable ...
191
+ name: String = #function, path: UnsafePointer < CInterop . PlatformChar > ? = nil , _ args: AnyHashable ...
192
192
) -> _COffT {
193
193
_COffT ( mockImpl ( name: name, path: path, args) )
194
194
}
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ internal func system_lseek(
79
79
#if ENABLE_MOCKING
80
80
if mockingEnabled { return _mockOffT ( fd, off, whence) }
81
81
#endif
82
- return lseek ( fd, off, whence)
82
+ return _lseek ( fd, off, whence)
83
83
}
84
84
85
85
// write
@@ -106,12 +106,12 @@ internal func system_dup(_ fd: Int32) -> Int32 {
106
106
#if ENABLE_MOCKING
107
107
if mockingEnabled { return _mock ( fd) }
108
108
#endif
109
- return dup ( fd)
109
+ return _dup ( fd)
110
110
}
111
111
112
112
internal func system_dup2( _ fd: Int32 , _ fd2: Int32 ) -> Int32 {
113
113
#if ENABLE_MOCKING
114
114
if mockingEnabled { return _mock ( fd, fd2) }
115
115
#endif
116
- return dup2 ( fd, fd2)
116
+ return _dup2 ( fd, fd2)
117
117
}
You can’t perform that action at this time.
0 commit comments