mirror of
https://github.com/NixOS/nix
synced 2025-07-02 21:51:50 +02:00
Merge pull request #12633 from xokdvium/wstring-ctor-fiasco
libutil/windows: Finally use the correct constructor for std::wstring
This commit is contained in:
commit
d1b21e812d
1 changed files with 4 additions and 2 deletions
|
@ -13,8 +13,10 @@ std::optional<OsString> getEnvOs(const OsString & key)
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
// Allocate a buffer to hold the environment variable value
|
||||
std::wstring value{bufferSize, L'\0'};
|
||||
/* Allocate a buffer to hold the environment variable value.
|
||||
WARNING: Do not even think about using uniform initialization here,
|
||||
we DONT want to call the initializer list ctor accidentally. */
|
||||
std::wstring value(bufferSize, L'\0');
|
||||
|
||||
// Retrieve the environment variable value
|
||||
DWORD resultSize = GetEnvironmentVariableW(key.c_str(), &value[0], bufferSize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue