startup_checks: Resolve -Wformat

This commit is contained in:
Morph 2022-10-21 02:34:08 -04:00
parent 42c4ef7373
commit f86774c1ac

View File

@ -49,7 +49,7 @@ bool CheckEnvVars(bool* is_child) {
*is_child = true; *is_child = true;
return false; return false;
} else if (!SetEnvironmentVariableA(IS_CHILD_ENV_VAR, ENV_VAR_ENABLED_TEXT)) { } else if (!SetEnvironmentVariableA(IS_CHILD_ENV_VAR, ENV_VAR_ENABLED_TEXT)) {
std::fprintf(stderr, "SetEnvironmentVariableA failed to set %s with error %d\n", std::fprintf(stderr, "SetEnvironmentVariableA failed to set %s with error %lu\n",
IS_CHILD_ENV_VAR, GetLastError()); IS_CHILD_ENV_VAR, GetLastError());
return true; return true;
} }
@ -62,7 +62,7 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan, bool perform_vulka
// Set the startup variable for child processes // Set the startup variable for child processes
const bool env_var_set = SetEnvironmentVariableA(STARTUP_CHECK_ENV_VAR, ENV_VAR_ENABLED_TEXT); const bool env_var_set = SetEnvironmentVariableA(STARTUP_CHECK_ENV_VAR, ENV_VAR_ENABLED_TEXT);
if (!env_var_set) { if (!env_var_set) {
std::fprintf(stderr, "SetEnvironmentVariableA failed to set %s with error %d\n", std::fprintf(stderr, "SetEnvironmentVariableA failed to set %s with error %lu\n",
STARTUP_CHECK_ENV_VAR, GetLastError()); STARTUP_CHECK_ENV_VAR, GetLastError());
return false; return false;
} }
@ -81,22 +81,22 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan, bool perform_vulka
DWORD exit_code = STILL_ACTIVE; DWORD exit_code = STILL_ACTIVE;
const int err = GetExitCodeProcess(process_info.hProcess, &exit_code); const int err = GetExitCodeProcess(process_info.hProcess, &exit_code);
if (err == 0) { if (err == 0) {
std::fprintf(stderr, "GetExitCodeProcess failed with error %d\n", GetLastError()); std::fprintf(stderr, "GetExitCodeProcess failed with error %lu\n", GetLastError());
} }
// Vulkan is broken if the child crashed (return value is not zero) // Vulkan is broken if the child crashed (return value is not zero)
*has_broken_vulkan = (exit_code != 0); *has_broken_vulkan = (exit_code != 0);
if (CloseHandle(process_info.hProcess) == 0) { if (CloseHandle(process_info.hProcess) == 0) {
std::fprintf(stderr, "CloseHandle failed with error %d\n", GetLastError()); std::fprintf(stderr, "CloseHandle failed with error %lu\n", GetLastError());
} }
if (CloseHandle(process_info.hThread) == 0) { if (CloseHandle(process_info.hThread) == 0) {
std::fprintf(stderr, "CloseHandle failed with error %d\n", GetLastError()); std::fprintf(stderr, "CloseHandle failed with error %lu\n", GetLastError());
} }
} }
if (!SetEnvironmentVariableA(STARTUP_CHECK_ENV_VAR, nullptr)) { if (!SetEnvironmentVariableA(STARTUP_CHECK_ENV_VAR, nullptr)) {
std::fprintf(stderr, "SetEnvironmentVariableA failed to clear %s with error %d\n", std::fprintf(stderr, "SetEnvironmentVariableA failed to clear %s with error %lu\n",
STARTUP_CHECK_ENV_VAR, GetLastError()); STARTUP_CHECK_ENV_VAR, GetLastError());
} }
@ -149,7 +149,7 @@ bool SpawnChild(const char* arg0, PROCESS_INFORMATION* pi, int flags) {
pi // lpProcessInformation pi // lpProcessInformation
); );
if (!process_created) { if (!process_created) {
std::fprintf(stderr, "CreateProcessA failed with error %d\n", GetLastError()); std::fprintf(stderr, "CreateProcessA failed with error %lu\n", GetLastError());
return false; return false;
} }