Cleanup add brace (#6545)

* Add braces after if conditions

* More add braces after if conditions

* Add braces after while() conditions

* Fix compilation because of macro being modified

* Add braces to for loop

* Add braces after if/goto

* Move comments up

* Remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements after merge

* Fix inconsistent patterns are xxx == NULL vs !xxx

* More "{}" for "if() break;"  and "if() continue;"

* More "{}" after if() short statement

* More "{}" after "if () return;" statement

* More fix inconsistent patterns are xxx == NULL vs !xxx

* Revert some modificaion on SDL_RLEaccel.c

* SDL_RLEaccel: no short statement

* Cleanup 'if' where the bracket is in a new line

* Cleanup 'while' where the bracket is in a new line

* Cleanup 'for' where the bracket is in a new line

* Cleanup 'else' where the bracket is in a new line
This commit is contained in:
Sylvain Becker
2022-11-27 17:38:43 +01:00
committed by GitHub
parent 4958dafdc3
commit 6a2200823c
387 changed files with 6094 additions and 4633 deletions

View File

@@ -78,8 +78,10 @@ static SDL_hapticlist_item *SDL_hapticlist = NULL;
static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
static int numhaptics = 0;
#define EV_TEST(ev,f) \
if (test_bit((ev), features)) ret |= (f);
#define EV_TEST(ev,f) \
if (test_bit((ev), features)) { \
ret |= (f); \
}
/*
* Test whether a device has haptic properties.
* Returns available properties or 0 if there are none.
@@ -753,8 +755,9 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
/* Header */
dest->type = FF_CONSTANT;
if (SDL_SYS_ToDirection(&dest->direction, &constant->direction) == -1)
if (SDL_SYS_ToDirection(&dest->direction, &constant->direction) == -1) {
return -1;
}
/* Replay */
dest->replay.length = (constant->length == SDL_HAPTIC_INFINITY) ?
@@ -788,8 +791,9 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
/* Header */
dest->type = FF_PERIODIC;
if (SDL_SYS_ToDirection(&dest->direction, &periodic->direction) == -1)
if (SDL_SYS_ToDirection(&dest->direction, &periodic->direction) == -1) {
return -1;
}
/* Replay */
dest->replay.length = (periodic->length == SDL_HAPTIC_INFINITY) ?
@@ -801,17 +805,18 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
dest->trigger.interval = CLAMP(periodic->interval);
/* Periodic */
if (periodic->type == SDL_HAPTIC_SINE)
if (periodic->type == SDL_HAPTIC_SINE) {
dest->u.periodic.waveform = FF_SINE;
/* !!! FIXME: put this back when we have more bits in 2.1 */
/* else if (periodic->type == SDL_HAPTIC_SQUARE)
dest->u.periodic.waveform = FF_SQUARE; */
else if (periodic->type == SDL_HAPTIC_TRIANGLE)
} else if (periodic->type == SDL_HAPTIC_TRIANGLE) {
dest->u.periodic.waveform = FF_TRIANGLE;
else if (periodic->type == SDL_HAPTIC_SAWTOOTHUP)
} else if (periodic->type == SDL_HAPTIC_SAWTOOTHUP) {
dest->u.periodic.waveform = FF_SAW_UP;
else if (periodic->type == SDL_HAPTIC_SAWTOOTHDOWN)
} else if (periodic->type == SDL_HAPTIC_SAWTOOTHDOWN) {
dest->u.periodic.waveform = FF_SAW_DOWN;
}
dest->u.periodic.period = CLAMP(periodic->period);
dest->u.periodic.magnitude = periodic->magnitude;
dest->u.periodic.offset = periodic->offset;
@@ -835,14 +840,16 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
condition = &src->condition;
/* Header */
if (condition->type == SDL_HAPTIC_SPRING)
if (condition->type == SDL_HAPTIC_SPRING) {
dest->type = FF_SPRING;
else if (condition->type == SDL_HAPTIC_DAMPER)
} else if (condition->type == SDL_HAPTIC_DAMPER) {
dest->type = FF_DAMPER;
else if (condition->type == SDL_HAPTIC_INERTIA)
} else if (condition->type == SDL_HAPTIC_INERTIA) {
dest->type = FF_INERTIA;
else if (condition->type == SDL_HAPTIC_FRICTION)
} else if (condition->type == SDL_HAPTIC_FRICTION) {
dest->type = FF_FRICTION;
}
dest->direction = 0; /* Handled by the condition-specifics. */
/* Replay */
@@ -881,8 +888,9 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
/* Header */
dest->type = FF_RAMP;
if (SDL_SYS_ToDirection(&dest->direction, &ramp->direction) == -1)
if (SDL_SYS_ToDirection(&dest->direction, &ramp->direction) == -1) {
return -1;
}
/* Replay */
dest->replay.length = (ramp->length == SDL_HAPTIC_INFINITY) ?