From 599547e1aef099a251f76accb6ee29ba6a59ff41 Mon Sep 17 00:00:00 2001 From: Anton Anikin Date: Thu, 27 Feb 2025 16:40:36 +0800 Subject: [PATCH] clang-format --- .clang-format | 198 +++++++++++++++++++++++++++++++++++++++ src/ipc.cpp | 89 ++++++++++++------ src/ipc.hpp | 26 ++--- src/ipc_c.cpp | 16 +++- src/ipc_c.h | 6 +- src/ipc_nix.cpp | 13 ++- src/ipc_win.cpp | 90 +++++++++--------- test/test_ipc.cpp | 4 +- test/test_ipc_c_api.cpp | 4 +- test/test_ipc_python.cpp | 4 +- 10 files changed, 347 insertions(+), 103 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..54c368e --- /dev/null +++ b/.clang-format @@ -0,0 +1,198 @@ +# # https://clang.llvm.org/docs/ClangFormatStyleOptions.html +# # https://clang-format-configurator.site + +IndentWidth: 4 +TabWidth: 4 +UseTab: Never +ColumnLimit: 80 + +AlignAfterOpenBracket: AlwaysBreak # Align, DontAlign, AlwaysBreak, BlockIndent +AlignArrayOfStructures: Right # Left, Right +AlignConsecutiveAssignments: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true + AlignCompound: true + PadOperators: true +AlignConsecutiveBitFields: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true + AlignCompound: true + PadOperators: true +AlignConsecutiveDeclarations: None +AlignConsecutiveMacros: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true + AlignCompound: true + PadOperators: true +AlignEscapedNewlines: Right # DontAlign, Left, Right + +AllowShortCaseLabelsOnASingleLine: true +AlignConsecutiveShortCaseStatements: # AllowShortCaseLabelsOnASingleLine: true + Enabled: false + +BreakBeforeBinaryOperators: true +AlignOperands: AlignAfterOperator # Align, AlignAfterOperator + +AlignTrailingComments: + Kind: Always # Leave, Always, Never + OverEmptyLines: 1 + +AllowShortBlocksOnASingleLine: Never # Never, Empty, Always +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None # None, InlineOnly, Empty, Inline, All +AllowShortIfStatementsOnASingleLine: Never # Never, WithoutElse, OnlyFirstIf, AllIfsAndElse +AllowShortLambdasOnASingleLine: None # None, Empty, Inline, All +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: All # None, All, TopLevel, AllDefinitions, TopLevelDefinitions +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes # No, MultiLine, Yes + +# AttributeMacros # TODO + +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +BinPackArguments: false +BinPackParameters: false + +BitFieldColonSpacing: Both # Both, None, Before, After + +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: MultiLine # Never, MultiLine, Always + AfterEnum: true + AfterFunction: true + AfterNamespace: false + AfterStruct: true + AfterUnion: true + AfterExternBlock: false + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true + +# BracedInitializerIndentWidth: 4 +BreakAfterAttributes: Always # Always, Leave, Never +# BreakBeforeBinaryOperators # TODO +# BreakBeforeConceptDeclarations # TODO +# BreakBeforeInlineASMColon # TODO +BreakBeforeTernaryOperators: true + +ConstructorInitializerIndentWidth: 2 +BreakConstructorInitializers: BeforeComma # BeforeColon, BeforeComma, AfterColon +BreakInheritanceList: BeforeComma # BeforeColon, BeforeComma, AfterColon, AfterComma + +BreakStringLiterals: true +# ColumnLimit # TODO +# CommentPragmas # TODO +CompactNamespaces: false +# ContinuationIndentWidth: 4 +Cpp11BracedListStyle: false +DerivePointerAlignment: false +# DisableFormat: false +EmptyLineAfterAccessModifier: Never # Never, Leave, Always +EmptyLineBeforeAccessModifier: Always # Never, Leave, LogicalBlock, Always +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +# ForEachMacros: +# IfMacros: +IncludeBlocks: Preserve # Preserve, Merge, Regroup +# IncludeCategories: # TODO +# IncludeIsMainRegex +# IncludeIsMainSourceRegex + +AccessModifierOffset: -2 +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: NoIndent # AfterExternBlock, NoIndent, Indent +IndentGotoLabels: false +IndentPPDirectives: None # None, AfterHash, BeforeHash +IndentRequiresClause: true # C++ +# IndentWrappedFunctionNames: false +InsertBraces: true +InsertNewlineAtEOF: true +# InsertTrailingCommas: #TODO + +# works only for C++14 and C23 +# IntegerLiteralSeparator: +# Binary: 4 +# Decimal: 3 +# Hex: 2 +IntegerLiteralSeparator: + Binary: -1 + Decimal: -1 + Hex: -1 + +KeepEmptyLinesAtEOF: false +KeepEmptyLinesAtTheStartOfBlocks: false +LambdaBodyIndentation: Signature # Signature, OuterScope +# LineEnding: +# MacroBlockBegin: +# MacroBlockEnd: +# Macros: +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None # None, Inner, All +# NamespaceMacros: +PPIndentWidth: -1 +PackConstructorInitializers: Never # Never, BinPack, CurrentLine, NextLine, NextLineOnly +# PenaltyBreakAssignment: +# PenaltyBreakBeforeFirstCallParameter: +# PenaltyBreakComment +# PenaltyBreakFirstLessLess +# PenaltyBreakOpenParenthesis +# PenaltyBreakString +# PenaltyBreakTemplateDeclaration +# PenaltyExcessCharacter +# PenaltyIndentedWhitespace +# PenaltyReturnTypeOnItsOwnLine +PointerAlignment: Left +QualifierAlignment: Left +# QualifierOrder: TODO +# RawStringFormats: +ReferenceAlignment: Left +ReflowComments: true +RemoveBracesLLVM: false +RemoveParentheses: ReturnStatement +RemoveSemicolon: true +# RequiresClausePositionStyle: # TODO, C++ +# RequiresExpressionIndentation: # TODO, C++ +SeparateDefinitionBlocks: Always +# ShortNamespaceLines: 1 +SortIncludes: CaseSensitive +SortUsingDeclarations: LexicographicNumeric +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInContainerLiterals: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParens: Never +# SpacesInParensOptions: +SpacesInSquareBrackets: false +# StatementAttributeLikeMacros: +# StatementMacros: +# TypeNames: +# TypenameMacros: +# WhitespaceSensitiveMacros: diff --git a/src/ipc.cpp b/src/ipc.cpp index 2fc59f8..7271a44 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -7,18 +7,19 @@ #include "ipc.hpp" -namespace ipc -{ +namespace ipc { -#define set_message(verbose, s, ...) { \ - m_message = fmt::format(s __VA_OPT__(,) __VA_ARGS__); \ - if (verbose < 0) { \ - throw std::runtime_error(m_message); \ - } else if (verbose <= m_verbose) { \ - fmt::print(m_message); \ - fmt::print("\n"); \ - } \ -} +#define set_message(verbose, s, ...) \ + { \ + m_message = fmt::format(s __VA_OPT__(, ) __VA_ARGS__); \ + if (verbose < 0) { \ + throw std::runtime_error(m_message); \ + } \ + else if (verbose <= m_verbose) { \ + fmt::print(m_message); \ + fmt::print("\n"); \ + } \ + } std::string default_name(); @@ -36,9 +37,13 @@ start_external(const std::string& executable, bool is_server) } void -start_external(const std::string& executable, const std::string& ipc_name, bool is_server) +start_external( + const std::string& executable, + const std::string& ipc_name, + bool is_server) { - auto command = fmt::format("{} {} {}", executable, ipc_name, is_server ? "1" : "0"); + auto command + = fmt::format("{} {} {}", executable, ipc_name, is_server ? "1" : "0"); fmt::print("execute: {}\n", command); auto thread_func = [command] { @@ -49,7 +54,7 @@ start_external(const std::string& executable, const std::string& ipc_name, bool } Ipc::Ipc(bool is_server, int verbose) - : Ipc(default_name(), is_server, verbose) + : Ipc(default_name(), is_server, verbose) { } @@ -67,17 +72,29 @@ Ipc::write(const void* buffer, size_t count, size_t size) ssize_t bytes_sent = 0; do { - bytes_current = _write(&bytes_buffer[bytes_sent], bytes_required - bytes_sent); + bytes_current + = _write(&bytes_buffer[bytes_sent], bytes_required - bytes_sent); bytes_sent += bytes_current; - // set_message(2, "write {} -> {}/{}\n", bytes_current, bytes_sent, bytes_required); + // set_message(2, "write {} -> {}/{}\n", bytes_current, bytes_sent, + // bytes_required); } while ((bytes_current > 0) && (bytes_sent != bytes_required)); if (bytes_sent != bytes_required) { - set_message(-1, "c : (-) write ({} * {}) = {} bytes error: only {} bytes are sent", - count, size, bytes_required, bytes_sent); + set_message( + -1, + "c : (-) write ({} * {}) = {} bytes error: only {} bytes are sent", + count, + size, + bytes_required, + bytes_sent); } - set_message(1, "c : (+) write ({} * {}) = {} bytes", count, size, bytes_required); + set_message( + 1, + "c : (+) write ({} * {}) = {} bytes", + count, + size, + bytes_required); } void @@ -89,22 +106,40 @@ Ipc::read(void* buffer, size_t count, size_t size) const ssize_t bytes_required = size * count; - char* bytes_buffer = (char*)buffer; - ssize_t bytes_current = 0; + char* bytes_buffer = (char*)buffer; + ssize_t bytes_current = 0; ssize_t bytes_received = 0; do { - bytes_current = _read(&bytes_buffer[bytes_received], bytes_required - bytes_received); + bytes_current = _read( + &bytes_buffer[bytes_received], + bytes_required - bytes_received); bytes_received += bytes_current; - set_message(2, "read {} -> {}/{}\n", bytes_current, bytes_received, bytes_required); + set_message( + 2, + "read {} -> {}/{}\n", + bytes_current, + bytes_received, + bytes_required); } while ((bytes_current > 0) && (bytes_received != bytes_required)); if (bytes_received != bytes_required) { - set_message(-1, "c : (-) read ({} * {}) = {} bytes error: only {} bytes are recieved", - count, size, bytes_required, bytes_received); + set_message( + -1, + "c : (-) read ({} * {}) = {} bytes error: only {} bytes are " + "recieved", + count, + size, + bytes_required, + bytes_received); } - set_message(1, "c : (+) read ({} * {}) = {} bytes", size, count, bytes_required); + set_message( + 1, + "c : (+) read ({} * {}) = {} bytes", + size, + count, + bytes_required); } void @@ -123,4 +158,4 @@ Ipc::read(char* str) read(str, 1, len); } -} +} // namespace ipc diff --git a/src/ipc.hpp b/src/ipc.hpp index e4d5b31..c042a76 100644 --- a/src/ipc.hpp +++ b/src/ipc.hpp @@ -6,11 +6,10 @@ #include #if defined(_WIN32) - #include +#include #endif -namespace ipc -{ +namespace ipc { void init(); @@ -22,11 +21,14 @@ void start_external(const std::string& executable, bool is_server); void -start_external(const std::string& executable, const std::string& ipc_name, bool is_server); +start_external( + const std::string& executable, + const std::string& ipc_name, + bool is_server); class Ipc { -public: + public: Ipc(bool is_server, int verbose = 0); Ipc(const std::string& name, bool is_server, int verbose = 0); @@ -36,14 +38,14 @@ public: void write(const char* str); - template + template void write(const T& data) { write(&data, 1, sizeof(T)); } - template + template void write(const T* data, size_t count) { @@ -56,14 +58,14 @@ public: void read(char* str); - template + template void read(T& data) { read(&data, 1, sizeof(T)); } - template + template void read(T* data, size_t count) { @@ -73,14 +75,14 @@ public: void read(void* buffer, size_t count, size_t size); -protected: + protected: ssize_t _write(const void* buffer, size_t bytes); ssize_t _read(void* buffer, size_t bytes); -protected: + protected: int m_verbose; std::string m_message; @@ -92,4 +94,4 @@ protected: #endif }; -} +} // namespace ipc diff --git a/src/ipc_c.cpp b/src/ipc_c.cpp index b2e54c6..a5858e8 100644 --- a/src/ipc_c.cpp +++ b/src/ipc_c.cpp @@ -87,7 +87,7 @@ ipc_read_string(void* ipc, char* str) i->read(str); } -template +template void ipc_write(void* ipc, const T* data, size_t count) { @@ -97,7 +97,7 @@ ipc_write(void* ipc, const T* data, size_t count) i->write(data, count); } -template +template void ipc_read(void* ipc, T* data, size_t count) { @@ -107,8 +107,16 @@ ipc_read(void* ipc, T* data, size_t count) i->read(data, count); } -#define _IPC_WRITE_FN(data_type) _IPC_WRITE_FN_NAME(data_type) { return ipc_write(ipc, data, count); } -#define _IPC_READ_FN(data_type) _IPC_READ_FN_NAME (data_type) { return ipc_read (ipc, data, count); } +#define _IPC_WRITE_FN(data_type) \ + _IPC_WRITE_FN_NAME(data_type) \ + { \ + return ipc_write(ipc, data, count); \ + } +#define _IPC_READ_FN(data_type) \ + _IPC_READ_FN_NAME(data_type) \ + { \ + return ipc_read(ipc, data, count); \ + } _IPC_WRITE_FN(char); _IPC_WRITE_FN(int); diff --git a/src/ipc_c.h b/src/ipc_c.h index ff441dd..8aee6c1 100644 --- a/src/ipc_c.h +++ b/src/ipc_c.h @@ -40,8 +40,10 @@ ipc_write_string(void* ipc, const char* str); void ipc_read_string(void* ipc, char* str); -#define _IPC_WRITE_FN_NAME(type) void ipc_write_ ## type (void* ipc, const type * data, size_t count) -#define _IPC_READ_FN_NAME(type) void ipc_read_ ## type (void* ipc, type * data, size_t count) +#define _IPC_WRITE_FN_NAME(type) \ + void ipc_write_##type(void* ipc, const type* data, size_t count) +#define _IPC_READ_FN_NAME(type) \ + void ipc_read_##type(void* ipc, type* data, size_t count) _IPC_WRITE_FN_NAME(char); _IPC_WRITE_FN_NAME(int); diff --git a/src/ipc_nix.cpp b/src/ipc_nix.cpp index 3be94de..6db4124 100644 --- a/src/ipc_nix.cpp +++ b/src/ipc_nix.cpp @@ -8,8 +8,7 @@ #include "ipc.hpp" -namespace ipc -{ +namespace ipc { std::string default_name() @@ -20,8 +19,7 @@ default_name() void make_fifo(const std::string& name, unsigned int mode) { - if (mkfifo(name.c_str(), mode) < 0) - { + if (mkfifo(name.c_str(), mode) < 0) { auto message = fmt::format("mkfifo '{}' : {}", name, strerror(errno)); throw std::runtime_error(message); } @@ -35,7 +33,7 @@ init(const std::string& name, unsigned int mode) } Ipc::Ipc(const std::string& name, bool is_server, int verbose) - : m_verbose(verbose) + : m_verbose(verbose) { auto fifo_open = [](std::string name, int flags) -> int { int fd = open(name.c_str(), flags); @@ -50,7 +48,8 @@ Ipc::Ipc(const std::string& name, bool is_server, int verbose) if (is_server) { m_reader_fd = fifo_open(name + "_c", O_RDONLY); m_writer_fd = fifo_open(name + "_s", O_WRONLY); - } else { + } + else { m_writer_fd = fifo_open(name + "_c", O_WRONLY); m_reader_fd = fifo_open(name + "_s", O_RDONLY); } @@ -72,4 +71,4 @@ Ipc::_read(void* buffer, size_t bytes) return ::read(m_reader_fd, buffer, bytes); } -} +} // namespace ipc diff --git a/src/ipc_win.cpp b/src/ipc_win.cpp index fcbab3f..99c5841 100644 --- a/src/ipc_win.cpp +++ b/src/ipc_win.cpp @@ -11,8 +11,7 @@ #define UNUSED(x) (void)(x) -namespace ipc -{ +namespace ipc { // https://stackoverflow.com/a/17387176 // Returns the last Win32 error, in string format. @@ -22,29 +21,29 @@ getLastErrorAsString() { // Get the error message ID, if any. DWORD errorMessageID = ::GetLastError(); - if(errorMessageID == 0) { - return std::string(); //No error message has been recorded + if (errorMessageID == 0) { + return std::string(); // No error message has been recorded } LPSTR messageBuffer = nullptr; // Ask Win32 to give us the string version of that message ID. // The parameters we pass in, tell Win32 to create the buffer that holds the - // message for us (because we don't yet know how long the message string will be). + // message for us (because we don't yet know how long the message string + // will be). // // https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-formatmessagea // size_t size = FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, // dwFlags + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS, // dwFlags - NULL, // lpSource - errorMessageID, // dwMessageId - MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), // dwLanguageId - (LPSTR)&messageBuffer, // lpBuffer - 0, // nSize - NULL // *Arguments + NULL, // lpSource + errorMessageID, // dwMessageId + MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), // dwLanguageId + (LPSTR)&messageBuffer, // lpBuffer + 0, // nSize + NULL // *Arguments ); // Copy the error message into a std::string. @@ -75,7 +74,7 @@ init(const std::string& name, unsigned int mode) // https://habr.com/ru/post/166155/ Ipc::Ipc(const std::string& name, bool is_server, int verbose) - : m_verbose(verbose) + : m_verbose(verbose) { using namespace std::chrono_literals; @@ -83,21 +82,22 @@ Ipc::Ipc(const std::string& name, bool is_server, int verbose) // fmt::print("full name = {}\n", full_name); auto throw_failed = [](const std::string& name) { - auto message = fmt::format("{}() failed: {}", name, getLastErrorAsString()); + auto message + = fmt::format("{}() failed: {}", name, getLastErrorAsString()); throw std::runtime_error(message); }; if (is_server) { // https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createnamedpipea m_pipe = CreateNamedPipe( - (LPSTR)full_name.c_str(), // lpName - PIPE_ACCESS_DUPLEX, // dwOpenMode - PIPE_TYPE_BYTE, // dwPipeMode - 1, // nMaxInstances - 0, // nOutBufferSize - 0, // nInBufferSize - 0, // nDefaultTimeOut - NULL // lpSecurityAttributes + (LPSTR)full_name.c_str(), // lpName + PIPE_ACCESS_DUPLEX, // dwOpenMode + PIPE_TYPE_BYTE, // dwPipeMode + 1, // nMaxInstances + 0, // nOutBufferSize + 0, // nInBufferSize + 0, // nDefaultTimeOut + NULL // lpSecurityAttributes ); if (m_pipe == INVALID_HANDLE_VALUE) { @@ -112,18 +112,18 @@ Ipc::Ipc(const std::string& name, bool is_server, int verbose) return; } - auto time_step = 500ms; + auto time_step = 500ms; auto time_current = 0ms; while (time_current < 10s) { // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea m_pipe = CreateFile( - (LPSTR)full_name.c_str(), // lpFileName - GENERIC_READ | GENERIC_WRITE, // dwDesiredAccess - 0, // dwShareMode - NULL, // lpSecurityAttributes - OPEN_EXISTING, // dwCreationDisposition - FILE_ATTRIBUTE_NORMAL, // dwFlagsAndAttributes - NULL // hTemplateFile + (LPSTR)full_name.c_str(), // lpFileName + GENERIC_READ | GENERIC_WRITE, // dwDesiredAccess + 0, // dwShareMode + NULL, // lpSecurityAttributes + OPEN_EXISTING, // dwCreationDisposition + FILE_ATTRIBUTE_NORMAL, // dwFlagsAndAttributes + NULL // hTemplateFile ); if (m_pipe != INVALID_HANDLE_VALUE) { @@ -150,12 +150,12 @@ Ipc::_write(const void* buffer, size_t bytes) // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-writefile DWORD numBytesWritten = 0; - auto result = WriteFile( - m_pipe, // hFile - buffer, // lpBuffer - bytes, // nNumberOfBytesToWrite - &numBytesWritten, // lpNumberOfBytesWritten - NULL // lpOverlapped + auto result = WriteFile( + m_pipe, // hFile + buffer, // lpBuffer + bytes, // nNumberOfBytesToWrite + &numBytesWritten, // lpNumberOfBytesWritten + NULL // lpOverlapped ); if (!result) { @@ -171,12 +171,12 @@ Ipc::_read(void* buffer, size_t bytes) // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile DWORD numBytesRead = 0; - auto result = ReadFile( - m_pipe, // hFile - buffer, // lpBuffer - bytes, // nNumberOfBytesToRead - &numBytesRead, // lpNumberOfBytesRead - NULL // lpOverlapped + auto result = ReadFile( + m_pipe, // hFile + buffer, // lpBuffer + bytes, // nNumberOfBytesToRead + &numBytesRead, // lpNumberOfBytesRead + NULL // lpOverlapped ); if (!result) { @@ -186,4 +186,4 @@ Ipc::_read(void* buffer, size_t bytes) return numBytesRead; } -} +} // namespace ipc diff --git a/test/test_ipc.cpp b/test/test_ipc.cpp index 9188123..6247226 100644 --- a/test/test_ipc.cpp +++ b/test/test_ipc.cpp @@ -9,9 +9,9 @@ int main(int /* argc */, char** /* argv */) { - using ipc::Ipc; using fmt::format; using fmt::print; + using ipc::Ipc; using namespace std::chrono_literals; int verbose = 0; @@ -34,7 +34,7 @@ main(int /* argc */, char** /* argv */) int value; double result; - while(1) { + while (1) { { server.read(value); print("[server] read int({})\n", value); diff --git a/test/test_ipc_c_api.cpp b/test/test_ipc_c_api.cpp index fc8caa2..b57c25f 100644 --- a/test/test_ipc_c_api.cpp +++ b/test/test_ipc_c_api.cpp @@ -13,7 +13,7 @@ main(int /* argc */, char** /* argv */) int verbose = 0; printf("\n"); - ipc_init_default(); // default name + ipc_init_default(); // default name std::thread server_thread([verbose] { printf("[c-server] pre-start\n"); @@ -24,7 +24,7 @@ main(int /* argc */, char** /* argv */) int value; double result; - while(1) { + while (1) { { ipc_read_int(server, &value, 1); printf("[c-server] read int(%d)\n", value); diff --git a/test/test_ipc_python.cpp b/test/test_ipc_python.cpp index 5fb69e4..41b758a 100644 --- a/test/test_ipc_python.cpp +++ b/test/test_ipc_python.cpp @@ -9,13 +9,13 @@ int main(int /* argc */, char** /* argv */) { - using ipc::Ipc; using fmt::format; using fmt::print; + using ipc::Ipc; using namespace std::chrono_literals; int verbose = 0; - ipc::init(); // default name + ipc::init(); // default name ipc::start_external("python test_server.py", true);