Skip to content

Commit bd19181

Browse files
Add braces on if statements to match linter style (flutter#22130)
1 parent 9945db3 commit bd19181

File tree

2 files changed

+34
-20
lines changed

2 files changed

+34
-20
lines changed

shell/platform/linux/testing/fl_test.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2013 The Flutter Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
// FLUTTER_NOLINT
54

65
#include "gtest/gtest.h"
76

@@ -11,19 +10,21 @@
1110
#include "flutter/shell/platform/linux/testing/mock_renderer.h"
1211

1312
static uint8_t hex_digit_to_int(char value) {
14-
if (value >= '0' && value <= '9')
13+
if (value >= '0' && value <= '9') {
1514
return value - '0';
16-
else if (value >= 'a' && value <= 'f')
15+
} else if (value >= 'a' && value <= 'f') {
1716
return value - 'a' + 10;
18-
else if (value >= 'F' && value <= 'F')
17+
} else if (value >= 'F' && value <= 'F') {
1918
return value - 'A' + 10;
20-
else
19+
} else {
2120
return 0;
21+
}
2222
}
2323

2424
static uint8_t parse_hex8(const gchar* hex_string) {
25-
if (hex_string[0] == '\0')
25+
if (hex_string[0] == '\0') {
2626
return 0x00;
27+
}
2728
return hex_digit_to_int(hex_string[0]) << 4 | hex_digit_to_int(hex_string[1]);
2829
}
2930

@@ -41,8 +42,9 @@ gchar* bytes_to_hex_string(GBytes* bytes) {
4142
size_t data_length;
4243
const uint8_t* data =
4344
static_cast<const uint8_t*>(g_bytes_get_data(bytes, &data_length));
44-
for (size_t i = 0; i < data_length; i++)
45+
for (size_t i = 0; i < data_length; i++) {
4546
g_string_append_printf(hex_string, "%02x", data[i]);
47+
}
4648
return g_string_free(hex_string, FALSE);
4749
}
4850

shell/platform/linux/testing/mock_egl.cc

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,14 @@ EGLBoolean eglChooseConfig(EGLDisplay dpy,
9797
EGLConfig* configs,
9898
EGLint config_size,
9999
EGLint* num_config) {
100-
if (!check_display(dpy) || !check_initialized(dpy))
100+
if (!check_display(dpy) || !check_initialized(dpy)) {
101101
return EGL_FALSE;
102+
}
102103

103104
if (configs == nullptr) {
104-
if (num_config != nullptr)
105+
if (num_config != nullptr) {
105106
*num_config = 1;
107+
}
106108
return bool_success();
107109
}
108110

@@ -112,8 +114,9 @@ EGLBoolean eglChooseConfig(EGLDisplay dpy,
112114
n_returned++;
113115
}
114116

115-
if (num_config != nullptr)
117+
if (num_config != nullptr) {
116118
*num_config = n_returned;
119+
}
117120

118121
return bool_success();
119122
}
@@ -122,8 +125,9 @@ EGLContext eglCreateContext(EGLDisplay dpy,
122125
EGLConfig config,
123126
EGLContext share_context,
124127
const EGLint* attrib_list) {
125-
if (!check_display(dpy) || !check_initialized(dpy) || !check_config(config))
128+
if (!check_display(dpy) || !check_initialized(dpy) || !check_config(config)) {
126129
return EGL_NO_CONTEXT;
130+
}
127131

128132
mock_error = EGL_SUCCESS;
129133
return &mock_context;
@@ -132,8 +136,9 @@ EGLContext eglCreateContext(EGLDisplay dpy,
132136
EGLSurface eglCreatePbufferSurface(EGLDisplay dpy,
133137
EGLConfig config,
134138
const EGLint* attrib_list) {
135-
if (!check_display(dpy) || !check_initialized(dpy) || !check_config(config))
139+
if (!check_display(dpy) || !check_initialized(dpy) || !check_config(config)) {
136140
return EGL_NO_SURFACE;
141+
}
137142

138143
mock_error = EGL_SUCCESS;
139144
return &mock_surface;
@@ -143,8 +148,9 @@ EGLSurface eglCreateWindowSurface(EGLDisplay dpy,
143148
EGLConfig config,
144149
EGLNativeWindowType win,
145150
const EGLint* attrib_list) {
146-
if (!check_display(dpy) || !check_initialized(dpy) || !check_config(config))
151+
if (!check_display(dpy) || !check_initialized(dpy) || !check_config(config)) {
147152
return EGL_NO_SURFACE;
153+
}
148154

149155
mock_error = EGL_SUCCESS;
150156
return &mock_surface;
@@ -154,8 +160,9 @@ EGLBoolean eglGetConfigAttrib(EGLDisplay dpy,
154160
EGLConfig config,
155161
EGLint attribute,
156162
EGLint* value) {
157-
if (!check_display(dpy) || !check_initialized(dpy) || !check_config(config))
163+
if (!check_display(dpy) || !check_initialized(dpy) || !check_config(config)) {
158164
return EGL_FALSE;
165+
}
159166

160167
MockConfig* c = static_cast<MockConfig*>(config);
161168
switch (attribute) {
@@ -261,8 +268,9 @@ void (*eglGetProcAddress(const char* procname))(void) {
261268
}
262269

263270
EGLBoolean eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) {
264-
if (!check_display(dpy))
271+
if (!check_display(dpy)) {
265272
return EGL_FALSE;
273+
}
266274

267275
if (!display_initialized) {
268276
mock_config.config_id = 1;
@@ -295,10 +303,12 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) {
295303
display_initialized = true;
296304
}
297305

298-
if (major != nullptr)
306+
if (major != nullptr) {
299307
*major = 1;
300-
if (minor != nullptr)
301-
*major = 5;
308+
}
309+
if (minor != nullptr) {
310+
*minor = 5;
311+
}
302312

303313
return bool_success();
304314
}
@@ -307,15 +317,17 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy,
307317
EGLSurface draw,
308318
EGLSurface read,
309319
EGLContext ctx) {
310-
if (!check_display(dpy) || !check_initialized(dpy))
320+
if (!check_display(dpy) || !check_initialized(dpy)) {
311321
return EGL_FALSE;
322+
}
312323

313324
return bool_success();
314325
}
315326

316327
EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) {
317-
if (!check_display(dpy) || !check_initialized(dpy))
328+
if (!check_display(dpy) || !check_initialized(dpy)) {
318329
return EGL_FALSE;
330+
}
319331

320332
return bool_success();
321333
}

0 commit comments

Comments
 (0)