@@ -96,14 +96,14 @@ static HANDLE spawn_command (const std::vector<std::string>& command, HANDLE std
96
96
97
97
std::string cmdline (format_cmdline (command));
98
98
99
- if (!CreateProcessA (NULL , // application name (NULL to use command line)
99
+ if (!CreateProcessA (nullptr , // application name (nullptr to use command line)
100
100
const_cast <char *>(cmdline.c_str ()),
101
- NULL , // process security attributes
102
- NULL , // primary thread security attributes
101
+ nullptr , // process security attributes
102
+ nullptr , // primary thread security attributes
103
103
TRUE , // handles are inherited
104
104
0 , // creation flags
105
- NULL , // use parent's environment
106
- NULL , // use parent's current directory
105
+ nullptr , // use parent's environment
106
+ nullptr , // use parent's current directory
107
107
&start_info,
108
108
&proc_info)) {
109
109
throw System_error (" CreateProcess" , cmdline, GetLastError ());
@@ -117,13 +117,13 @@ static HANDLE spawn_command (const std::vector<std::string>& command, HANDLE std
117
117
118
118
Coprocess::Coprocess ()
119
119
{
120
- proc_handle = NULL ;
121
- stdin_pipe_reader = NULL ;
122
- stdin_pipe_writer = NULL ;
123
- stdin_pipe_ostream = NULL ;
124
- stdout_pipe_reader = NULL ;
125
- stdout_pipe_writer = NULL ;
126
- stdout_pipe_istream = NULL ;
120
+ proc_handle = nullptr ;
121
+ stdin_pipe_reader = nullptr ;
122
+ stdin_pipe_writer = nullptr ;
123
+ stdin_pipe_ostream = nullptr ;
124
+ stdout_pipe_reader = nullptr ;
125
+ stdout_pipe_writer = nullptr ;
126
+ stdout_pipe_istream = nullptr ;
127
127
}
128
128
129
129
Coprocess::~Coprocess ()
@@ -143,7 +143,7 @@ std::ostream* Coprocess::stdin_pipe ()
143
143
// Set the bInheritHandle flag so pipe handles are inherited.
144
144
sec_attr.nLength = sizeof (SECURITY_ATTRIBUTES);
145
145
sec_attr.bInheritHandle = TRUE ;
146
- sec_attr.lpSecurityDescriptor = NULL ;
146
+ sec_attr.lpSecurityDescriptor = nullptr ;
147
147
148
148
// Create a pipe for the child process's STDIN.
149
149
if (!CreatePipe (&stdin_pipe_reader, &stdin_pipe_writer, &sec_attr, 0 )) {
@@ -163,14 +163,14 @@ std::ostream* Coprocess::stdin_pipe ()
163
163
void Coprocess::close_stdin ()
164
164
{
165
165
delete stdin_pipe_ostream;
166
- stdin_pipe_ostream = NULL ;
166
+ stdin_pipe_ostream = nullptr ;
167
167
if (stdin_pipe_writer) {
168
168
CloseHandle (stdin_pipe_writer);
169
- stdin_pipe_writer = NULL ;
169
+ stdin_pipe_writer = nullptr ;
170
170
}
171
171
if (stdin_pipe_reader) {
172
172
CloseHandle (stdin_pipe_reader);
173
- stdin_pipe_reader = NULL ;
173
+ stdin_pipe_reader = nullptr ;
174
174
}
175
175
}
176
176
@@ -182,7 +182,7 @@ std::istream* Coprocess::stdout_pipe ()
182
182
// Set the bInheritHandle flag so pipe handles are inherited.
183
183
sec_attr.nLength = sizeof (SECURITY_ATTRIBUTES);
184
184
sec_attr.bInheritHandle = TRUE ;
185
- sec_attr.lpSecurityDescriptor = NULL ;
185
+ sec_attr.lpSecurityDescriptor = nullptr ;
186
186
187
187
// Create a pipe for the child process's STDOUT.
188
188
if (!CreatePipe (&stdout_pipe_reader, &stdout_pipe_writer, &sec_attr, 0 )) {
@@ -202,27 +202,27 @@ std::istream* Coprocess::stdout_pipe ()
202
202
void Coprocess::close_stdout ()
203
203
{
204
204
delete stdout_pipe_istream;
205
- stdout_pipe_istream = NULL ;
205
+ stdout_pipe_istream = nullptr ;
206
206
if (stdout_pipe_writer) {
207
207
CloseHandle (stdout_pipe_writer);
208
- stdout_pipe_writer = NULL ;
208
+ stdout_pipe_writer = nullptr ;
209
209
}
210
210
if (stdout_pipe_reader) {
211
211
CloseHandle (stdout_pipe_reader);
212
- stdout_pipe_reader = NULL ;
212
+ stdout_pipe_reader = nullptr ;
213
213
}
214
214
}
215
215
216
216
void Coprocess::spawn (const std::vector<std::string>& args)
217
217
{
218
- proc_handle = spawn_command (args, stdin_pipe_reader, stdout_pipe_writer, NULL );
218
+ proc_handle = spawn_command (args, stdin_pipe_reader, stdout_pipe_writer, nullptr );
219
219
if (stdin_pipe_reader) {
220
220
CloseHandle (stdin_pipe_reader);
221
- stdin_pipe_reader = NULL ;
221
+ stdin_pipe_reader = nullptr ;
222
222
}
223
223
if (stdout_pipe_writer) {
224
224
CloseHandle (stdout_pipe_writer);
225
- stdout_pipe_writer = NULL ;
225
+ stdout_pipe_writer = nullptr ;
226
226
}
227
227
}
228
228
@@ -243,7 +243,7 @@ int Coprocess::wait ()
243
243
size_t Coprocess::write_stdin (void * handle, const void * buf, size_t count)
244
244
{
245
245
DWORD bytes_written;
246
- if (!WriteFile (static_cast <Coprocess*>(handle)->stdin_pipe_writer , buf, count, &bytes_written, NULL )) {
246
+ if (!WriteFile (static_cast <Coprocess*>(handle)->stdin_pipe_writer , buf, count, &bytes_written, nullptr )) {
247
247
throw System_error (" WriteFile" , " " , GetLastError ());
248
248
}
249
249
return bytes_written;
@@ -257,7 +257,7 @@ size_t Coprocess::read_stdout (void* handle, void* buf, size_t count)
257
257
// fails with ERROR_BROKEN_PIPE.
258
258
DWORD bytes_read;
259
259
do {
260
- if (!ReadFile (static_cast <Coprocess*>(handle)->stdout_pipe_reader , buf, count, &bytes_read, NULL )) {
260
+ if (!ReadFile (static_cast <Coprocess*>(handle)->stdout_pipe_reader , buf, count, &bytes_read, nullptr )) {
261
261
const DWORD read_error = GetLastError ();
262
262
if (read_error != ERROR_BROKEN_PIPE) {
263
263
throw System_error (" ReadFile" , " " , read_error);
0 commit comments