fix. 紧急修复msvc warning

This commit is contained in:
lhhxxxxx
2022-07-31 22:51:48 +08:00
parent 2a6e2ac9f7
commit 2aa203e08a
2 changed files with 19 additions and 0 deletions

View File

@@ -201,10 +201,15 @@ namespace asst::utils
auto pipe_buffer = std::make_unique<char[]>(PipeBuffSize);
#ifdef _WIN32
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
SECURITY_ATTRIBUTES pipe_sec_attr = { 0 };
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
pipe_sec_attr.nLength = sizeof(SECURITY_ATTRIBUTES);
pipe_sec_attr.lpSecurityDescriptor = nullptr;
pipe_sec_attr.bInheritHandle = TRUE;
@@ -212,20 +217,28 @@ namespace asst::utils
HANDLE pipe_child_write = nullptr;
CreatePipe(&pipe_read, &pipe_child_write, &pipe_sec_attr, PipeBuffSize);
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
STARTUPINFOA si = { 0 };
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESTDHANDLES;
si.wShowWindow = SW_HIDE;
si.hStdOutput = pipe_child_write;
si.hStdError = pipe_child_write;
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
PROCESS_INFORMATION pi = { nullptr };
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
BOOL p_ret = CreateProcessA(nullptr, const_cast<LPSTR>(cmdline.c_str()), nullptr, nullptr, TRUE, CREATE_NO_WINDOW, nullptr, nullptr, &si, &pi);
if (p_ret) {

View File

@@ -100,15 +100,21 @@ namespace asst
HANDLE m_pipe_write = nullptr; // 写管道句柄
HANDLE m_pipe_child_read = nullptr; // 子进程的读管道句柄
HANDLE m_pipe_child_write = nullptr; // 子进程的写管道句柄
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
SECURITY_ATTRIBUTES m_pipe_sec_attr = { 0 }; // 管道安全描述符
STARTUPINFOA m_child_startup_info = { 0 }; // 子进程启动信息
WSADATA m_wsa_data = { 0 };
SOCKET m_server_sock = 0ULL;
sockaddr_in m_server_addr = { 0 };
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#else
constexpr static int PIPE_READ = 0;
constexpr static int PIPE_WRITE = 1;