Skip to content

Commit 6f43121

Browse files
author
Rob Walker
committed
update .clang-format, re-format src/. accordingly
1 parent ab58f0c commit 6f43121

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2598
-1993
lines changed

.clang-format

+228-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,233 @@
11
---
22
Language: Cpp
3-
BasedOnStyle: WebKit
3+
# BasedOnStyle: WebKit
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Right
9+
AlignOperands: false
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Inline
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: true
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: true
25+
AfterControlStatement: true
26+
AfterEnum: true
27+
AfterFunction: true
28+
AfterNamespace: false
29+
AfterObjCDeclaration: true
30+
AfterStruct: true
31+
AfterUnion: true
32+
BeforeCatch: false
33+
BeforeElse: true
34+
IndentBraces: false
35+
SplitEmptyFunction: false
36+
SplitEmptyRecord: true
37+
SplitEmptyNamespace: true
38+
BreakBeforeBinaryOperators: None
39+
BreakBeforeBraces: Custom
40+
BreakBeforeInheritanceComma: false
41+
BreakBeforeTernaryOperators: true
42+
BreakConstructorInitializersBeforeComma: false
43+
BreakConstructorInitializers: AfterColon
44+
BreakAfterJavaFieldAnnotations: false
45+
BreakStringLiterals: true
46+
ColumnLimit: 132
47+
CommentPragmas: '^ IWYU pragma:'
48+
CompactNamespaces: false
49+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
50+
ConstructorInitializerIndentWidth: 4
51+
ContinuationIndentWidth: 4
52+
Cpp11BracedListStyle: false
53+
DerivePointerAlignment: false
54+
DisableFormat: false
55+
ExperimentalAutoDetectBinPacking: false
56+
FixNamespaceComments: true
57+
ForEachMacros:
58+
- foreach
59+
- Q_FOREACH
60+
- BOOST_FOREACH
61+
IncludeCategories:
62+
- Regex: '^<Weave/Core.*'
63+
Priority: 0
64+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
65+
Priority: 2
66+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
67+
Priority: 3
68+
- Regex: '.*'
69+
Priority: 1
70+
IncludeIsMainRegex: '(Test)?$'
71+
IndentCaseLabels: false
72+
IndentWidth: 4
73+
IndentWrappedFunctionNames: false
74+
JavaScriptQuotes: Leave
75+
JavaScriptWrapImports: true
76+
KeepEmptyLinesAtTheStartOfBlocks: true
77+
MacroBlockBegin: ''
78+
MacroBlockEnd: ''
79+
MaxEmptyLinesToKeep: 1
80+
NamespaceIndentation: None
81+
ObjCBlockIndentWidth: 4
82+
ObjCSpaceAfterProperty: true
83+
ObjCSpaceBeforeProtocolList: true
84+
PenaltyBreakAssignment: 2
85+
PenaltyBreakBeforeFirstCallParameter: 19
86+
PenaltyBreakComment: 300
87+
PenaltyBreakFirstLessLess: 120
88+
PenaltyBreakString: 1000
89+
PenaltyExcessCharacter: 1000000
90+
PenaltyReturnTypeOnItsOwnLine: 60
91+
PointerAlignment: Middle
92+
ReflowComments: true
93+
SortIncludes: false
94+
SortUsingDeclarations: true
95+
SpaceAfterCStyleCast: true
96+
SpaceAfterTemplateKeyword: true
97+
SpaceBeforeAssignmentOperators: true
98+
SpaceBeforeParens: ControlStatements
99+
SpaceInEmptyParentheses: false
100+
SpacesBeforeTrailingComments: 1
101+
SpacesInAngles: false
102+
SpacesInContainerLiterals: true
103+
SpacesInCStyleCastParentheses: false
104+
SpacesInParentheses: false
105+
SpacesInSquareBrackets: false
106+
Standard: Cpp11
107+
TabWidth: 8
108+
UseTab: Never
4109
---
5110
Language: ObjC
6-
BasedOnStyle: WebKit
111+
# BasedOnStyle: WebKit
112+
AccessModifierOffset: -4
113+
AlignAfterOpenBracket: DontAlign
114+
AlignConsecutiveAssignments: false
115+
AlignConsecutiveDeclarations: false
116+
AlignEscapedNewlines: Right
117+
AlignOperands: false
118+
AlignTrailingComments: false
119+
AllowAllArgumentsOnNextLine: true
120+
AllowAllConstructorInitializersOnNextLine: true
121+
AllowAllParametersOfDeclarationOnNextLine: true
122+
AllowShortBlocksOnASingleLine: false
123+
AllowShortCaseLabelsOnASingleLine: false
124+
AllowShortFunctionsOnASingleLine: All
125+
AllowShortLambdasOnASingleLine: All
126+
AllowShortIfStatementsOnASingleLine: Never
127+
AllowShortLoopsOnASingleLine: false
128+
AlwaysBreakAfterDefinitionReturnType: None
129+
AlwaysBreakAfterReturnType: None
130+
AlwaysBreakBeforeMultilineStrings: false
131+
AlwaysBreakTemplateDeclarations: MultiLine
132+
BinPackArguments: true
133+
BinPackParameters: true
134+
BraceWrapping:
135+
AfterCaseLabel: false
136+
AfterClass: false
137+
AfterControlStatement: false
138+
AfterEnum: true
139+
AfterFunction: true
140+
AfterNamespace: false
141+
AfterObjCDeclaration: false
142+
AfterStruct: false
143+
AfterUnion: false
144+
AfterExternBlock: false
145+
BeforeCatch: false
146+
BeforeElse: false
147+
IndentBraces: false
148+
SplitEmptyFunction: true
149+
SplitEmptyRecord: true
150+
SplitEmptyNamespace: true
151+
BreakBeforeBinaryOperators: All
152+
BreakBeforeBraces: WebKit
153+
BreakBeforeInheritanceComma: false
154+
BreakInheritanceList: BeforeColon
155+
BreakBeforeTernaryOperators: true
156+
BreakConstructorInitializersBeforeComma: false
157+
BreakConstructorInitializers: BeforeComma
158+
BreakAfterJavaFieldAnnotations: false
159+
BreakStringLiterals: true
160+
ColumnLimit: 132
161+
CommentPragmas: '^ IWYU pragma:'
162+
CompactNamespaces: false
163+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
164+
ConstructorInitializerIndentWidth: 4
165+
ContinuationIndentWidth: 4
166+
Cpp11BracedListStyle: false
167+
DerivePointerAlignment: false
168+
DisableFormat: false
169+
ExperimentalAutoDetectBinPacking: false
170+
FixNamespaceComments: false
171+
ForEachMacros:
172+
- foreach
173+
- Q_FOREACH
174+
- BOOST_FOREACH
175+
IncludeBlocks: Preserve
176+
IncludeCategories:
177+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
178+
Priority: 2
179+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
180+
Priority: 3
181+
- Regex: '.*'
182+
Priority: 1
183+
IncludeIsMainRegex: '(Test)?$'
184+
IndentCaseLabels: false
185+
IndentPPDirectives: None
186+
IndentWidth: 4
187+
IndentWrappedFunctionNames: false
188+
JavaScriptQuotes: Leave
189+
JavaScriptWrapImports: true
190+
KeepEmptyLinesAtTheStartOfBlocks: true
191+
MacroBlockBegin: ''
192+
MacroBlockEnd: ''
193+
MaxEmptyLinesToKeep: 1
194+
NamespaceIndentation: Inner
195+
ObjCBinPackProtocolList: Auto
196+
ObjCBlockIndentWidth: 4
197+
ObjCSpaceAfterProperty: true
198+
ObjCSpaceBeforeProtocolList: true
199+
PenaltyBreakAssignment: 2
200+
PenaltyBreakBeforeFirstCallParameter: 19
201+
PenaltyBreakComment: 300
202+
PenaltyBreakFirstLessLess: 120
203+
PenaltyBreakString: 1000
204+
PenaltyBreakTemplateDeclaration: 10
205+
PenaltyExcessCharacter: 1000000
206+
PenaltyReturnTypeOnItsOwnLine: 60
207+
PointerAlignment: Middle
208+
ReflowComments: true
209+
SortIncludes: false
210+
SortUsingDeclarations: true
211+
SpaceAfterCStyleCast: true
212+
SpaceAfterLogicalNot: false
213+
SpaceAfterTemplateKeyword: true
214+
SpaceBeforeAssignmentOperators: true
215+
SpaceBeforeCpp11BracedList: true
216+
SpaceBeforeCtorInitializerColon: true
217+
SpaceBeforeInheritanceColon: true
218+
SpaceBeforeParens: ControlStatements
219+
SpaceBeforeRangeBasedForLoopColon: true
220+
SpaceInEmptyParentheses: false
221+
SpacesBeforeTrailingComments: 1
222+
SpacesInAngles: false
223+
SpacesInContainerLiterals: true
224+
SpacesInCStyleCastParentheses: false
225+
SpacesInParentheses: false
226+
SpacesInSquareBrackets: false
227+
Standard: Cpp11
228+
StatementMacros:
229+
- Q_UNUSED
230+
- QT_REQUIRE_VERSION
231+
TabWidth: 8
232+
UseTab: Never
7233
...

src/ble/BLEEndPoint.cpp

+17-17
Original file line numberDiff line numberDiff line change
@@ -764,17 +764,17 @@ BLE_ERROR BLEEndPoint::SendNextMessage()
764764
data = NULL; // Ownership passed to fragmenter's tx buf on PrepareNextFragment success.
765765

766766
// Send first message fragment over the air.
767-
CHIP_FAULT_INJECT(chip::FaultInjection::kFault_WOBLESend,
768-
{
769-
if (mRole == kBleRole_Central)
770-
{
771-
err = BLE_ERROR_GATT_WRITE_FAILED;
772-
} else {
773-
err = BLE_ERROR_GATT_INDICATE_FAILED;
774-
}
775-
ExitNow();
776-
}
777-
);
767+
CHIP_FAULT_INJECT(chip::FaultInjection::kFault_WOBLESend, {
768+
if (mRole == kBleRole_Central)
769+
{
770+
err = BLE_ERROR_GATT_WRITE_FAILED;
771+
}
772+
else
773+
{
774+
err = BLE_ERROR_GATT_INDICATE_FAILED;
775+
}
776+
ExitNow();
777+
});
778778
err = SendCharacteristic(mWoBle.TxPacket());
779779
SuccessOrExit(err);
780780

@@ -929,7 +929,7 @@ BLE_ERROR BLEEndPoint::HandleFragmentConfirmationReceived()
929929
// the stand-alone ack, and also the case where a window size < the immediate ack threshold was detected in
930930
// Receive(), but the stand-alone ack was deferred due to a pending outbound message fragment.
931931
if (mLocalReceiveWindowSize <= BLE_CONFIG_IMMEDIATE_ACK_WINDOW_THRESHOLD &&
932-
!(mSendQueue != NULL || mWoBle.TxState() == WoBle::kState_InProgress) )
932+
!(mSendQueue != NULL || mWoBle.TxState() == WoBle::kState_InProgress))
933933
{
934934
err = DriveStandAloneAck(); // Encode stand-alone ack and drive sending.
935935
SuccessOrExit(err);
@@ -1167,7 +1167,7 @@ BLE_ERROR BLEEndPoint::HandleCapabilitiesRequestReceived(PacketBuffer * data)
11671167
// If BLE transport protocol versions incompatible, prepare to close connection after subscription has been
11681168
// received and capabilities response has been sent.
11691169
chipLogError(Ble, "incompatible BTP versions; peripheral expected between %d and %d",
1170-
CHIP_BLE_TRANSPORT_PROTOCOL_MIN_SUPPORTED_VERSION, CHIP_BLE_TRANSPORT_PROTOCOL_MAX_SUPPORTED_VERSION);
1170+
CHIP_BLE_TRANSPORT_PROTOCOL_MIN_SUPPORTED_VERSION, CHIP_BLE_TRANSPORT_PROTOCOL_MAX_SUPPORTED_VERSION);
11711171
mState = kState_Aborting;
11721172
}
11731173
else if ((resp.mSelectedProtocolVersion == kBleTransportProtocolVersion_V1) ||
@@ -1223,7 +1223,7 @@ BLE_ERROR BLEEndPoint::HandleCapabilitiesResponseReceived(PacketBuffer * data)
12231223
VerifyOrExit(resp.mFragmentSize > 0, err = BLE_ERROR_INVALID_FRAGMENT_SIZE);
12241224

12251225
chipLogProgress(Ble, "peripheral chose BTP version %d; central expected between %d and %d", resp.mSelectedProtocolVersion,
1226-
CHIP_BLE_TRANSPORT_PROTOCOL_MIN_SUPPORTED_VERSION, CHIP_BLE_TRANSPORT_PROTOCOL_MAX_SUPPORTED_VERSION);
1226+
CHIP_BLE_TRANSPORT_PROTOCOL_MIN_SUPPORTED_VERSION, CHIP_BLE_TRANSPORT_PROTOCOL_MAX_SUPPORTED_VERSION);
12271227

12281228
if ((resp.mSelectedProtocolVersion < CHIP_BLE_TRANSPORT_PROTOCOL_MIN_SUPPORTED_VERSION) ||
12291229
(resp.mSelectedProtocolVersion > CHIP_BLE_TRANSPORT_PROTOCOL_MAX_SUPPORTED_VERSION))
@@ -1420,8 +1420,8 @@ BLE_ERROR BLEEndPoint::Receive(PacketBuffer * data)
14201420

14211421
chipLogDebugBleEndPoint(Ble, "about to adjust remote rx window; got ack num = %u, newest unacked sent seq num = %u, \
14221422
old window size = %u, max window size = %u",
1423-
receivedAck, mWoBle.GetNewestUnackedSentSequenceNumber(), mRemoteReceiveWindowSize,
1424-
mReceiveWindowMaxSize);
1423+
receivedAck, mWoBle.GetNewestUnackedSentSequenceNumber(), mRemoteReceiveWindowSize,
1424+
mReceiveWindowMaxSize);
14251425

14261426
// Open remote device's receive window according to sequence number it just acknowledged.
14271427
mRemoteReceiveWindowSize =
@@ -1480,7 +1480,7 @@ BLE_ERROR BLEEndPoint::Receive(PacketBuffer * data)
14801480
if (mWoBle.RxPacketType() == kType_Control && OnCommandReceived && mState != kState_Closing)
14811481
{
14821482
chipLogDebugBleEndPoint(Ble, "%s: calling OnCommandReceived, seq# %u, len = %u, type %u", __FUNCTION__, receivedAck,
1483-
full_packet->DataLength(), mWoBle.RxPacketType());
1483+
full_packet->DataLength(), mWoBle.RxPacketType());
14841484
// Pass received control message up the stack.
14851485
mWoBle.SetRxPacketSeq(receivedAck);
14861486
OnCommandReceived(this, full_packet);

0 commit comments

Comments
 (0)