Skip to content

Commit 9ca1e17

Browse files
committed
Windows: make _NSErrorWithWindowsError easier to use
`GetLastError` returns a `DWORD` rather than `Int32`. Adjust the signature to avoid the need for the explicit cast as it is an internal helper.
1 parent 1a81780 commit 9ca1e17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Foundation/FoundationErrors.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ internal func _NSErrorWithErrno(_ posixErrno : Int32, reading : Bool, path : Str
207207
// https://docs.microsoft.com/en-us/windows/desktop/Debug/system-error-codes
208208
internal let _NSWindowsErrorDomain = "org.swift.Foundation.WindowsError"
209209

210-
internal func _NSErrorWithWindowsError(_ windowsError: Int32, reading: Bool) -> NSError {
210+
internal func _NSErrorWithWindowsError(_ windowsError: DWORD, reading: Bool) -> NSError {
211211
// <#TODO#> os(Windows): Map Win32 errors to Cocoa errors as _NSErrorWithErrno() does.
212212
let code: CocoaError.Code = reading ? .fileReadUnknown : .fileWriteUnknown
213213
return NSError(domain: NSCocoaErrorDomain, code: code.rawValue, userInfo: [

0 commit comments

Comments
 (0)