Changeset View
Changeset View
Standalone View
Standalone View
source/Host/windows/HostInfoWindows.cpp
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
bool HostInfoWindows::GetHostname(std::string &s) { | bool HostInfoWindows::GetHostname(std::string &s) { | ||||
wchar_t buffer[MAX_COMPUTERNAME_LENGTH + 1]; | wchar_t buffer[MAX_COMPUTERNAME_LENGTH + 1]; | ||||
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; | DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; | ||||
if (!::GetComputerNameW(buffer, &dwSize)) | if (!::GetComputerNameW(buffer, &dwSize)) | ||||
return false; | return false; | ||||
s.clear(); | |||||
labath: Move this into a separate patch, add a unit test checking that string is cleared when this… | |||||
return llvm::convertWideToUTF8(buffer, s); | return llvm::convertWideToUTF8(buffer, s); | ||||
} | } | ||||
FileSpec HostInfoWindows::GetProgramFileSpec() { | FileSpec HostInfoWindows::GetProgramFileSpec() { | ||||
static llvm::once_flag g_once_flag; | static llvm::once_flag g_once_flag; | ||||
llvm::call_once(g_once_flag, []() { | llvm::call_once(g_once_flag, []() { | ||||
std::vector<wchar_t> buffer(PATH_MAX); | std::vector<wchar_t> buffer(PATH_MAX); | ||||
::GetModuleFileNameW(NULL, buffer.data(), buffer.size()); | ::GetModuleFileNameW(NULL, buffer.data(), buffer.size()); | ||||
Show All 34 Lines |
Move this into a separate patch, add a unit test checking that string is cleared when this function is called.