mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
Add braces to C++ single-line loops and conditionals (NFC) (#2973)
This makes code easier to read and more consistent between C++ and Java. Also update clang-format settings to always add a line break (even if no braces are used).
This commit is contained in:
@@ -21,25 +21,33 @@ void ThrowError(JNIEnv* env, int32_t status, int32_t minRange, int32_t maxRange,
|
||||
int32_t requestedValue);
|
||||
|
||||
inline bool CheckStatus(JNIEnv* env, int32_t status, bool doThrow = true) {
|
||||
if (status != 0) ReportError(env, status, doThrow);
|
||||
if (status != 0) {
|
||||
ReportError(env, status, doThrow);
|
||||
}
|
||||
return status == 0;
|
||||
}
|
||||
|
||||
inline bool CheckStatusRange(JNIEnv* env, int32_t status, int32_t minRange,
|
||||
int32_t maxRange, int32_t requestedValue) {
|
||||
if (status != 0) ThrowError(env, status, minRange, maxRange, requestedValue);
|
||||
if (status != 0) {
|
||||
ThrowError(env, status, minRange, maxRange, requestedValue);
|
||||
}
|
||||
return status == 0;
|
||||
}
|
||||
|
||||
inline bool CheckStatusForceThrow(JNIEnv* env, int32_t status) {
|
||||
if (status != 0) ThrowError(env, status, 0, 0, 0);
|
||||
if (status != 0) {
|
||||
ThrowError(env, status, 0, 0, 0);
|
||||
}
|
||||
return status == 0;
|
||||
}
|
||||
|
||||
void ReportCANError(JNIEnv* env, int32_t status, int32_t message_id);
|
||||
|
||||
inline bool CheckCANStatus(JNIEnv* env, int32_t status, int32_t message_id) {
|
||||
if (status != 0) ReportCANError(env, status, message_id);
|
||||
if (status != 0) {
|
||||
ReportCANError(env, status, message_id);
|
||||
}
|
||||
return status == 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user