Skip to content

Commit

Permalink
SwiftWin32: compensate for GetComputerNameW's disregard of the null…
Browse files Browse the repository at this point in the history
… terminator
  • Loading branch information
relgit committed Nov 29, 2023
1 parent fe0b6b8 commit 59be73c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/SwiftWin32/App and Environment/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public struct Device {
let value: [WCHAR] =
Array<WCHAR>(unsafeUninitializedCapacity: Int(MAX_COMPUTERNAME_LENGTH) + 1) {
var nSize: DWORD = DWORD($0.count)
$1 = GetComputerNameW($0.baseAddress!, &nSize) ? Int(nSize) : 0
$1 = GetComputerNameW($0.baseAddress!, &nSize) ? Int(nSize) + 1 : 0
}
return String(decodingCString: value, as: UTF16.self)
}
Expand Down

0 comments on commit 59be73c

Please sign in to comment.