Skip to content

Commit eec85d0

Browse files
committed
fix c++17 build errors with VS2019
1 parent 237eb0f commit eec85d0

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*.opensdf
2020
*.VC.db
2121
BuildLog.htm
22+
packages/
2223
bin/
2324
obj/
2425
Debug/

PythonScript.Tests/stdafx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <algorithm>
2020
#include <fstream>
2121

22+
#include <boost/bind/bind.hpp>
2223
#include <boost/regex.hpp>
2324
#include <boost/python.hpp>
2425

PythonScript.Tests/tests/TestMenuManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ TEST_P(MenuManagerFindMenuCommandTest, testFindOptionFindsCorrectOption) {
218218
}
219219

220220

221-
INSTANTIATE_TEST_CASE_P(findMenuCommand, MenuManagerFindMenuCommandTest,
221+
INSTANTIATE_TEST_SUITE_P(findMenuCommand, MenuManagerFindMenuCommandTest,
222222
::testing::Values(MenuTestCase(L"File", L"Open", MENUID_FILE_OPEN), // First option
223223
MenuTestCase(L"File", L"Close", MENUID_FILE_CLOSE), // First menu, middle option
224224
MenuTestCase(L"Edit", L"Copy", MENUID_EDIT_COPY), // Mid menu, first option
@@ -245,7 +245,7 @@ TEST_P(MenuManagerFindPluginCommandTest, testFindPluginCommand) {
245245
}
246246

247247

248-
INSTANTIATE_TEST_CASE_P(findPluginMenuCommand, MenuManagerFindPluginCommandTest,
248+
INSTANTIATE_TEST_SUITE_P(findPluginMenuCommand, MenuManagerFindPluginCommandTest,
249249
::testing::Values(MenuTestCase(L"XML Tools", L"About", MENUID_XMLTOOLS_ABOUT), // First plugin, last option
250250
MenuTestCase(L"Second Plugin", L"About", MENUID_SECONDPLUGIN_ABOUT), // Second plugin, repeated option name from other plugin
251251
MenuTestCase(L"XML Tools", L"Recent 1", MENUID_XMLTOOLS_RECENT_1), // First plugin, repeated option name from main menu

PythonScript/src/DynamicIDManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class DynamicIDManager
4141
bool inRange(idx_t id);
4242

4343
private:
44-
DynamicIDManager(); // default constructor disabled
44+
DynamicIDManager() = delete; // default constructor disabled
4545

4646
// Methods
4747
bool allocateIDs(size_t quantity, idx_t *start);

PythonScript/src/IDAllocator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class IDAllocator
66
{
77
public:
8+
virtual ~IDAllocator() = default;
89
virtual bool allocate(size_t quantity, idx_t *start) = 0;
910
};
1011

PythonScript/src/ProcessExecute.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ProcessExecute::~ProcessExecute()
2626

2727
bool ProcessExecute::isWindowsNT()
2828
{
29-
OSVERSIONINFO osv;
29+
OSVERSIONINFO osv{};
3030
osv.dwOSVersionInfoSize = sizeof(osv);
3131
::GetVersionEx(&osv);
3232
return (osv.dwPlatformId >= VER_PLATFORM_WIN32_NT);
@@ -42,18 +42,18 @@ DWORD ProcessExecute::execute(const TCHAR *commandLine, boost::python::object py
4242
throw process_start_exception("stderr cannot be None");
4343

4444
// Create out, err, and in pipes (ignore in, initially)
45-
SECURITY_DESCRIPTOR sd;
46-
SECURITY_ATTRIBUTES sa;
45+
SECURITY_DESCRIPTOR sd{};
46+
SECURITY_ATTRIBUTES sa{};
4747
process_start_exception exceptionThrown("");
4848

4949
bool thrown = false;
5050

51-
PipeReaderArgs stdoutReaderArgs;
52-
PipeReaderArgs stderrReaderArgs;
51+
PipeReaderArgs stdoutReaderArgs{};
52+
PipeReaderArgs stderrReaderArgs{};
5353
// Only used if spooling, but we need to delete it later.
5454
TCHAR tmpFilename[MAX_PATH] = {0};
55-
HANDLE hStdOutReadPipe, hStdOutWritePipe;
56-
HANDLE hStdErrReadPipe, hStdErrWritePipe;
55+
HANDLE hStdOutReadPipe = nullptr, hStdOutWritePipe = nullptr;
56+
HANDLE hStdErrReadPipe = nullptr, hStdErrWritePipe = nullptr;
5757

5858
Py_BEGIN_ALLOW_THREADS
5959
try
@@ -180,8 +180,8 @@ DWORD ProcessExecute::execute(const TCHAR *commandLine, boost::python::object py
180180
::ZeroMemory( &pi, sizeof(PROCESS_INFORMATION) );
181181

182182
size_t commandLineLength = _tcslen(commandLine) + 1;
183-
// We use an auto_ptr here because of a potential early out due to an exception thrown.
184-
std::auto_ptr<TCHAR> cmdLine(new TCHAR[commandLineLength]);
183+
// We use an unique_ptr here because of a potential early out due to an exception thrown.
184+
std::unique_ptr<TCHAR> cmdLine(new TCHAR[commandLineLength]);
185185
_tcscpy_s(cmdLine.get(), commandLineLength, commandLine);
186186
bool processStartSuccess;
187187

@@ -283,7 +283,7 @@ DWORD WINAPI ProcessExecute::pipeReader(void *args)
283283

284284
DWORD bytesRead;
285285

286-
char buffer[PIPE_READBUFSIZE];
286+
char buffer[PIPE_READBUFSIZE]{};
287287
BOOL processFinished = FALSE;
288288

289289
for(;;)

0 commit comments

Comments
 (0)