Fix MSVC++ portability issues (#3812)

This commit is contained in:
Kritik Bhimani
2022-12-12 18:45:32 -05:00
committed by GitHub
parent 424faa883e
commit 7b073fec7d
4 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -80,10 +80,10 @@ string V3Os::getenvStr(const string& envvar, const string& defaultValue) {
#if defined(_MSC_VER)
// Note: MinGW does not offer _dupenv_s
const char* envvalue = nullptr;
_dupenv_s(&envvalue, nullptr, envvar.c_str());
_dupenv_s((char **)&envvalue, nullptr, envvar.c_str());
if (envvalue != nullptr) {
const std::string result{envvalue};
free(envvalue);
free((void *)envvalue);
ret = result;
} else {
ret = defaultValue;