clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I6e1b877213f3a2921d78ffe2a5fe71d93db65574
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
IndentWrappedFunctionNames: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -98,13 +98,14 @@
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
diff --git a/ikvm_args.cpp b/ikvm_args.cpp
index 681a9f8..7e824dc 100644
--- a/ikvm_args.cpp
+++ b/ikvm_args.cpp
@@ -12,15 +12,16 @@
{
int option;
const char* opts = "f:s:h:k:p:u:v:c";
- struct option lopts[] = {{"frameRate", 1, 0, 'f'},
- {"subsampling", 1, 0, 's'},
- {"help", 0, 0, 'h'},
- {"keyboard", 1, 0, 'k'},
- {"mouse", 1, 0, 'p'},
- {"udcName", 1, 0, 'u'},
- {"videoDevice", 1, 0, 'v'},
- {"calcCRC", 0, 0, 'c'},
- {0, 0, 0, 0}};
+ struct option lopts[] = {
+ {"frameRate", 1, 0, 'f'},
+ {"subsampling", 1, 0, 's'},
+ {"help", 0, 0, 'h'},
+ {"keyboard", 1, 0, 'k'},
+ {"mouse", 1, 0, 'p'},
+ {"udcName", 1, 0, 'u'},
+ {"videoDevice", 1, 0, 'v'},
+ {"calcCRC", 0, 0, 'c'},
+ {0, 0, 0, 0}};
while ((option = getopt_long(argc, argv, opts, lopts, NULL)) != -1)
{
diff --git a/ikvm_input.cpp b/ikvm_input.cpp
index c3930b5..8cdefe4 100644
--- a/ikvm_input.cpp
+++ b/ikvm_input.cpp
@@ -24,9 +24,8 @@
Input::Input(const std::string& kbdPath, const std::string& ptrPath,
const std::string& udc) :
- keyboardFd(-1),
- pointerFd(-1), keyboardReport{0}, pointerReport{0}, keyboardPath(kbdPath),
- pointerPath(ptrPath), udcName(udc)
+ keyboardFd(-1), pointerFd(-1), keyboardReport{0}, pointerReport{0},
+ keyboardPath(kbdPath), pointerPath(ptrPath), udcName(udc)
{
hidUdcStream.exceptions(std::ofstream::failbit | std::ofstream::badbit);
hidUdcStream.open(hidUdcPath, std::ios::out | std::ios::app);
@@ -105,8 +104,8 @@
if (!keyboardPath.empty())
{
- keyboardFd = open(keyboardPath.c_str(),
- O_RDWR | O_CLOEXEC | O_NONBLOCK);
+ keyboardFd =
+ open(keyboardPath.c_str(), O_RDWR | O_CLOEXEC | O_NONBLOCK);
if (keyboardFd < 0)
{
log<level::ERR>("Failed to open input device",
@@ -254,9 +253,9 @@
}
else
{
- input->pointerReport[0] = ((buttonMask & 0x4) >> 1) |
- ((buttonMask & 0x2) << 1) |
- (buttonMask & 0x1);
+ input->pointerReport[0] =
+ ((buttonMask & 0x4) >> 1) | ((buttonMask & 0x2) << 1) |
+ (buttonMask & 0x1);
input->pointerReport[5] = 0;
}
diff --git a/ikvm_server.cpp b/ikvm_server.cpp
index 6a6cd06..9274a9b 100644
--- a/ikvm_server.cpp
+++ b/ikvm_server.cpp
@@ -133,9 +133,9 @@
{
/* JFIF header contains some varying data so skip it for
* checksum calculation */
- frame_crc = boost::crc<32, 0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF,
- true, true>(data + 0x30,
- video.getFrameSize() - 0x30);
+ frame_crc =
+ boost::crc<32, 0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true,
+ true>(data + 0x30, video.getFrameSize() - 0x30);
}
if (cd->last_crc == frame_crc)
@@ -222,8 +222,8 @@
{
Server* server = (Server*)cl->screen->screenData;
- cl->clientData = new ClientData(server->video.getFrameRate(),
- &server->input);
+ cl->clientData =
+ new ClientData(server->video.getFrameRate(), &server->input);
cl->clientGoneHook = clientGone;
cl->clientFramebufferUpdateRequestHook = clientFramebufferUpdateRequest;
if (!server->numClients++)
diff --git a/ikvm_server.hpp b/ikvm_server.hpp
index 7ad48af..bc055f3 100644
--- a/ikvm_server.hpp
+++ b/ikvm_server.hpp
@@ -92,9 +92,8 @@
* @param[in] cl - Handle to the client object
* @param[in] furMsg - Pointer of the FUR message
*/
- static void
- clientFramebufferUpdateRequest(rfbClientPtr cl,
- rfbFramebufferUpdateRequestMsg* furMsg);
+ static void clientFramebufferUpdateRequest(
+ rfbClientPtr cl, rfbFramebufferUpdateRequestMsg* furMsg);
/*
* @brief Handler for a client disconnecting
*
@@ -134,47 +133,49 @@
/* @brief Cursor bitmap height */
static constexpr int cursorHeight = 20;
/* @brief Cursor bitmap */
- static constexpr char cursor[] = " "
- " x "
- " xx "
- " xxx "
- " xxxx "
- " xxxxx "
- " xxxxxx "
- " xxxxxxx "
- " xxxxxxxx "
- " xxxxxxxxx "
- " xxxxxxxxxx "
- " xxxxxxxxxxx "
- " xxxxxxx "
- " xxxxxxx "
- " xxx xxx "
- " xx xxx "
- " x xxx "
- " xxx "
- " x "
- " ";
+ static constexpr char cursor[] =
+ " "
+ " x "
+ " xx "
+ " xxx "
+ " xxxx "
+ " xxxxx "
+ " xxxxxx "
+ " xxxxxxx "
+ " xxxxxxxx "
+ " xxxxxxxxx "
+ " xxxxxxxxxx "
+ " xxxxxxxxxxx "
+ " xxxxxxx "
+ " xxxxxxx "
+ " xxx xxx "
+ " xx xxx "
+ " x xxx "
+ " xxx "
+ " x "
+ " ";
/* @brief Cursor bitmap mask */
- static constexpr char cursorMask[] = " o "
- "oxo "
- "oxxo "
- "oxxxo "
- "oxxxxo "
- "oxxxxxo "
- "oxxxxxxo "
- "oxxxxxxxo "
- "oxxxxxxxxo "
- "oxxxxxxxxxo "
- "oxxxxxxxxxxo "
- "oxxxxxxxxxxxo "
- "oxxxxxxxoooo "
- "oxxxxxxxo "
- "oxxxooxxxo "
- "oxxo oxxxo "
- "oxo oxxxo "
- " o oxxxo "
- " oxo "
- " o ";
+ static constexpr char cursorMask[] =
+ " o "
+ "oxo "
+ "oxxo "
+ "oxxxo "
+ "oxxxxo "
+ "oxxxxxo "
+ "oxxxxxxo "
+ "oxxxxxxxo "
+ "oxxxxxxxxo "
+ "oxxxxxxxxxo "
+ "oxxxxxxxxxxo "
+ "oxxxxxxxxxxxo "
+ "oxxxxxxxoooo "
+ "oxxxxxxxo "
+ "oxxxooxxxo "
+ "oxxo oxxxo "
+ "oxo oxxxo "
+ " o oxxxo "
+ " oxo "
+ " o ";
};
} // namespace ikvm