Browse Source

dtoolutil: fix compile warnings on Windows

rdb 5 years ago
parent
commit
d403b16249
2 changed files with 8 additions and 0 deletions
  1. 4 0
      dtool/src/dtoolutil/executionEnvironment.cxx
  2. 4 0
      dtool/src/dtoolutil/filename.cxx

+ 4 - 0
dtool/src/dtoolutil/executionEnvironment.cxx

@@ -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
 }
 
 /**

+ 4 - 0
dtool/src/dtoolutil/filename.cxx

@@ -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);