Apply cmake-format and clang-format

This commit is contained in:
Martchus 2023-05-16 21:39:10 +02:00
parent 0341316b4b
commit a19ee41a39
4 changed files with 21 additions and 21 deletions

View File

@ -101,11 +101,8 @@ if (MINGW)
list(APPEND SCRIPT_FILES scripts/wine.sh)
endif ()
if (WIN32)
list(APPEND CMAKE_TEMPLATE_FILES
cmake/templates/windows.rc.in
cmake/templates/windows-cli-wrapper.rc.in
cmake/templates/cli-wrapper.cpp
)
list(APPEND CMAKE_TEMPLATE_FILES cmake/templates/windows.rc.in cmake/templates/windows-cli-wrapper.rc.in
cmake/templates/cli-wrapper.cpp)
endif ()
set(EXCLUDED_FILES cmake/templates/cli-wrapper.cpp)

View File

@ -198,7 +198,7 @@ void startConsole()
// attach to the parent process' console or allocate a new console if that's not possible
if (!skip && (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())) {
FILE* fp;
FILE *fp;
#ifdef _MSC_VER
// take care of normal streams
if (!skipstdout) {
@ -215,8 +215,10 @@ void startConsole()
std::cin.clear();
}
// take care of wide streams
auto hConOut = CreateFile(_T("CONOUT$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
auto hConIn = CreateFile(_T("CONIN$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
auto hConOut = CreateFile(
_T("CONOUT$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
auto hConIn = CreateFile(
_T("CONIN$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (!skipstdout) {
SetStdHandle(STD_OUTPUT_HANDLE, hConOut);
std::wcout.clear();

View File

@ -8,7 +8,9 @@ set(TEMPLATE_FINDER_LOADED YES)
function (find_template_file FILE_NAME_WITHOUT_EXTENSION PROJECT_VAR_NAME OUTPUT_VAR)
find_template_file_full_name("${FILE_NAME_WITHOUT_EXTENSION}.in" "${PROJECT_VAR_NAME}" "${OUTPUT_VAR}")
set(${OUTPUT_VAR} "${${OUTPUT_VAR}}" PARENT_SCOPE)
set(${OUTPUT_VAR}
"${${OUTPUT_VAR}}"
PARENT_SCOPE)
endfunction ()
function (find_template_file_full_name FILE_NAME PROJECT_VAR_NAME OUTPUT_VAR)

View File

@ -3,8 +3,8 @@
#include <cstdlib>
#include <cwchar>
#include <iostream>
#include <system_error>
#include <string_view>
#include <system_error>
/*!
* \brief Returns \a replacement if \a value matches \a key; otherwise returns \a value.
@ -58,17 +58,16 @@ int main()
startupInfo.dwFlags |= STARTF_USESTDHANDLES;
// start main executable in new group and print debug information if that's not possible
auto res = CreateProcessW(
pathBuffer, // path of main executable
commadLine, // command line arguments
nullptr, // process handle not inheritable
nullptr, // thread handle not inheritable
true, // set handle inheritance to true
CREATE_NEW_PROCESS_GROUP, // creation flags
nullptr, // use parent's environment block
nullptr, // use parent's starting directory
&startupInfo, // pointer to STARTUPINFO structure
&processInformation); // pointer to PROCESS_INFORMATION structure
auto res = CreateProcessW(pathBuffer, // path of main executable
commadLine, // command line arguments
nullptr, // process handle not inheritable
nullptr, // thread handle not inheritable
true, // set handle inheritance to true
CREATE_NEW_PROCESS_GROUP, // creation flags
nullptr, // use parent's environment block
nullptr, // use parent's starting directory
&startupInfo, // pointer to STARTUPINFO structure
&processInformation); // pointer to PROCESS_INFORMATION structure
if (!res) {
std::cerr << "Unable to launch main executable: " << std::error_code(GetLastError(), std::system_category()) << '\n';
std::wcerr << L" - assumed path: " << pathBuffer << L'\n';