dtoolutil: fix compile warnings on Windows

This commit is contained in:
rdb 2020-04-13 12:33:02 +02:00
parent 202a871a7e
commit d403b16249
2 changed files with 8 additions and 0 deletions

View File

@ -415,7 +415,11 @@ ns_set_environment_variable(const string &var, const string &value) {
// putenv() requires us to malloc a new C-style string.
char *put = (char *)malloc(putstr.length() + 1);
strcpy(put, putstr.c_str());
#ifdef _MSC_VER
_putenv(put);
#else
putenv(put);
#endif
}
/**

View File

@ -433,7 +433,11 @@ temporary(const string &dirname, const string &prefix, const string &suffix,
if (fdirname.empty()) {
// If we are not given a dirname, use the system tempnam() function to
// create a system-defined temporary filename.
#ifdef _MSC_VER
char *name = _tempnam(nullptr, prefix.c_str());
#else
char *name = tempnam(nullptr, prefix.c_str());
#endif
Filename result = Filename::from_os_specific(name);
free(name);
result.set_type(type);