diff --git a/direct/src/plugin/fhandle.h b/direct/src/plugin/fhandle.h index 0a0ba8a851..7f71b810dd 100644 --- a/direct/src/plugin/fhandle.h +++ b/direct/src/plugin/fhandle.h @@ -19,6 +19,7 @@ // pass around a handle to an open file object. #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include typedef HANDLE FHandle; static const HANDLE invalid_fhandle = INVALID_HANDLE_VALUE; diff --git a/direct/src/plugin/p3dPythonMain.cxx b/direct/src/plugin/p3dPythonMain.cxx index 0dbeb8eb9c..68c6bec259 100644 --- a/direct/src/plugin/p3dPythonMain.cxx +++ b/direct/src/plugin/p3dPythonMain.cxx @@ -109,7 +109,7 @@ main(int argc, char *argv[]) { stringstream stream(interactive_console_str); int flag; stream >> flag; - if (stream) { + if (!stream.fail()) { interactive_console = (flag != 0); } } diff --git a/direct/src/plugin/p3dPythonRun.cxx b/direct/src/plugin/p3dPythonRun.cxx index 595368124f..b92d061ad7 100755 --- a/direct/src/plugin/p3dPythonRun.cxx +++ b/direct/src/plugin/p3dPythonRun.cxx @@ -75,7 +75,7 @@ P3DPythonRun(const char *program_name, const char *archive_file, // Open the error output before we do too much more. _error_log.open_write(error_handle); - if (_error_log) { + if (!_error_log.fail()) { // Set up the indicated error log as the Notify output. _error_log.setf(ios::unitbuf); Notify::ptr()->set_ostream_ptr(&_error_log, false); diff --git a/direct/src/plugin/p3dSession.cxx b/direct/src/plugin/p3dSession.cxx index 02712eb393..1cced8eeab 100644 --- a/direct/src/plugin/p3dSession.cxx +++ b/direct/src/plugin/p3dSession.cxx @@ -974,7 +974,7 @@ start_p3dpython(P3DInstance *inst) { NULL, CREATE_ALWAYS, 0, NULL); if (handle != INVALID_HANDLE_VALUE) { _error_handle = handle; - SetHandleInformation(error_handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); + SetHandleInformation(_error_handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); _got_error_handle = true; } else { nout << "Unable to open " << _log_pathname << "\n"; @@ -1240,7 +1240,7 @@ win_create_process() { PROCESS_INFORMATION process_info; BOOL result = CreateProcess (_p3dpython_exe.c_str(), command_line, NULL, NULL, TRUE, 0, - (void *)_env.c_str(), _start_dir_cstr, + (void *)_env.c_str(), start_dir_cstr, &startup_info, &process_info); bool started_program = (result != 0); @@ -1372,15 +1372,15 @@ p3dpython_thread_run() { size_t zero = _env.find('\0', p); while (zero != string::npos) { const char *start = _env.data() + p; +#ifdef _WIN32 + _putenv(start); +#else const char *equals = strchr(start, '='); if (equals != NULL) { string variable(start, equals - start); -#ifdef _WIN32 - _putenv_s(variable.c_str(), equals + 1); -#else setenv(variable.c_str(), equals + 1, true); -#endif // _WIN32 } +#endif // _WIN32 p = zero + 1; zero = _env.find('\0', p); } diff --git a/direct/src/plugin/run_p3dpython.cxx b/direct/src/plugin/run_p3dpython.cxx index ae9d7c9a62..c2a54769be 100644 --- a/direct/src/plugin/run_p3dpython.cxx +++ b/direct/src/plugin/run_p3dpython.cxx @@ -12,8 +12,8 @@ // //////////////////////////////////////////////////////////////////// -#include "run_p3dpython.h" #include "p3dPythonRun.h" +#include "run_p3dpython.h" //////////////////////////////////////////////////////////////////// // Function: run_p3dpython diff --git a/direct/src/plugin/run_p3dpython.h b/direct/src/plugin/run_p3dpython.h index 00f15602c2..ee3b605441 100644 --- a/direct/src/plugin/run_p3dpython.h +++ b/direct/src/plugin/run_p3dpython.h @@ -31,7 +31,7 @@ run_p3dpython_func(const char *program_name, const char *archive_file, FHandle input_handle, FHandle output_handle, FHandle error_handle, bool interactive_console); -EXPCL_P3DPYTHON extern "C" bool +extern "C" EXPCL_P3DPYTHON bool run_p3dpython(const char *program_name, const char *archive_file, FHandle input_handle, FHandle output_handle, FHandle error_handle, bool interactive_console);