aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-13 19:25:17 +0200
committerEgor Tensin <egor@tensin.name>2026-06-13 19:25:17 +0200
commit97b796e7788ae69c0aaeec2644246d9f10d2739d (patch)
treeb6397ccbabde7ee3e470c6a9ae799c91d6e070e2 /src
parentupgrade winapi-utf8 (diff)
downloadwinapi-common-97b796e7788ae69c0aaeec2644246d9f10d2739d.tar.gz
winapi-common-97b796e7788ae69c0aaeec2644246d9f10d2739d.zip
finally, perfect .clang-format settings?
Diffstat (limited to '')
-rw-r--r--src/error.cpp6
-rw-r--r--src/file.cpp16
-rw-r--r--src/handle.cpp3
-rw-r--r--src/process.cpp25
-rw-r--r--src/shmem.cpp3
5 files changed, 31 insertions, 22 deletions
diff --git a/src/error.cpp b/src/error.cpp
index 7266e63..4993866 100644
--- a/src/error.cpp
+++ b/src/error.cpp
@@ -39,7 +39,8 @@ std::string format_message(int32_t code) {
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
reinterpret_cast<wchar_t*>(&buf),
0,
- NULL);
+ NULL
+ );
if (0 == len) {
::LocalFree(buf);
@@ -60,7 +61,8 @@ std::string CategoryWindows::message(int32_t code) const {
std::system_error windows(DWORD code, const char* function) {
static_assert(sizeof(DWORD) == sizeof(int32_t), "Aren't DWORDs the same size as ints?");
return std::system_error{
- static_cast<int32_t>(code), category_windows(), build_what(code, function)};
+ static_cast<int32_t>(code), category_windows(), build_what(code, function)
+ };
}
} // namespace winapi::error
diff --git a/src/file.cpp b/src/file.cpp
index 7d1df8e..9c004c2 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -65,13 +65,15 @@ File open_file(std::wstring_view path, const CreateFileParams& params) {
attributes.nLength = sizeof(attributes);
attributes.bInheritHandle = TRUE;
- const auto handle = ::CreateFileW(path.data(),
- params.dwDesiredAccess,
- params.dwShareMode,
- &attributes,
- params.dwCreationDisposition,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
+ const auto handle = ::CreateFileW(
+ path.data(),
+ params.dwDesiredAccess,
+ params.dwShareMode,
+ &attributes,
+ params.dwCreationDisposition,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL
+ );
if (handle == INVALID_HANDLE_VALUE) {
throw error::windows(GetLastError(), "CreateFileW");
diff --git a/src/handle.cpp b/src/handle.cpp
index 916b8ae..89a9c6e 100644
--- a/src/handle.cpp
+++ b/src/handle.cpp
@@ -21,7 +21,8 @@ namespace {
std::runtime_error write_file_incomplete(std::size_t expected, std::size_t actual) {
return std::runtime_error{
- std::format("WriteFile could only write {} bytes instead of {}", actual, expected)};
+ std::format("WriteFile could only write {} bytes instead of {}", actual, expected)
+ };
}
bool is_std_handle(HANDLE handle) {
diff --git a/src/process.cpp b/src/process.cpp
index e323135..b251003 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -92,16 +92,18 @@ Handle create_process(ProcessParameters& params) {
{
auto cmd_line = escape_command_line(params.cmd_line);
- const auto ret = ::CreateProcessW(NULL,
- cmd_line.data(),
- NULL,
- NULL,
- TRUE,
- dwCreationFlags,
- NULL,
- NULL,
- &startup_info,
- &child_info);
+ const auto ret = ::CreateProcessW(
+ NULL,
+ cmd_line.data(),
+ NULL,
+ NULL,
+ TRUE,
+ dwCreationFlags,
+ NULL,
+ NULL,
+ &startup_info,
+ &child_info
+ );
if (!ret) {
throw error::windows(GetLastError(), "CreateProcessW");
@@ -392,7 +394,8 @@ Resource Process::get_resource(uint32_t id) {
if (data == NULL)
throw std::runtime_error{
- std::format("Couldn't get data pointer for resource with ID {}", id)};
+ std::format("Couldn't get data pointer for resource with ID {}", id)
+ };
const auto nb = ::SizeofResource(module, src);
diff --git a/src/shmem.cpp b/src/shmem.cpp
index 0d747b3..fd42a6d 100644
--- a/src/shmem.cpp
+++ b/src/shmem.cpp
@@ -45,7 +45,8 @@ SharedMemory SharedMemory::create(std::string_view name, std::size_t nb) {
const auto nb_high = static_cast<DWORD>(nb64 >> 32);
const auto mapping_impl = ::CreateFileMappingW(
- INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, nb_high, nb_low, widen(name).c_str());
+ INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, nb_high, nb_low, widen(name).c_str()
+ );
if (mapping_impl == NULL) {
throw error::windows(GetLastError(), "CreateFileMappingW");