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:
@@ -21,9 +21,7 @@
|
||||
/* Return true if the YUV format is packed pixels */
|
||||
static SDL_bool is_packed_yuv_format(Uint32 format)
|
||||
{
|
||||
return (format == SDL_PIXELFORMAT_YUY2 ||
|
||||
format == SDL_PIXELFORMAT_UYVY ||
|
||||
format == SDL_PIXELFORMAT_YVYU);
|
||||
return format == SDL_PIXELFORMAT_YUY2 || format == SDL_PIXELFORMAT_UYVY || format == SDL_PIXELFORMAT_YVYU;
|
||||
}
|
||||
|
||||
/* Create a surface with a good pattern for verifying YUV conversion */
|
||||
@@ -75,7 +73,7 @@ static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch,
|
||||
SDL_bool result = SDL_FALSE;
|
||||
|
||||
rgb = (Uint8 *)SDL_malloc(size);
|
||||
if (!rgb) {
|
||||
if (rgb == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
@@ -126,7 +124,7 @@ static int run_automated_tests(int pattern_size, int extra_pitch)
|
||||
int yuv1_pitch, yuv2_pitch;
|
||||
int result = -1;
|
||||
|
||||
if (!pattern || !yuv1 || !yuv2) {
|
||||
if (pattern == NULL || yuv1 == NULL || yuv2 == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces");
|
||||
goto done;
|
||||
}
|
||||
@@ -328,7 +326,7 @@ main(int argc, char **argv)
|
||||
filename = "testyuv.bmp";
|
||||
}
|
||||
original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0);
|
||||
if (!original) {
|
||||
if (original == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
|
||||
return 3;
|
||||
}
|
||||
@@ -340,7 +338,7 @@ main(int argc, char **argv)
|
||||
pitch = CalculateYUVPitch(yuv_format, original->w);
|
||||
|
||||
converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format);
|
||||
if (!converted) {
|
||||
if (converted == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError());
|
||||
return 3;
|
||||
}
|
||||
@@ -357,13 +355,13 @@ main(int argc, char **argv)
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
original->w, original->h,
|
||||
0);
|
||||
if (!window) {
|
||||
if (window == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
|
||||
return 4;
|
||||
}
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
if (!renderer) {
|
||||
if (renderer == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||
return 4;
|
||||
}
|
||||
@@ -398,8 +396,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
{ int done = 0;
|
||||
while ( !done )
|
||||
{
|
||||
while ( !done ) {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event) > 0) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
|
||||
Reference in New Issue
Block a user