Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
Fix clang-tidy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhb committed Aug 23, 2020
1 parent 3db32a6 commit d7ff522
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
9 changes: 6 additions & 3 deletions shell/platform/linux/fl_external_texture_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ bool fl_external_texture_gl_populate_texture(
FlutterOpenGLTexture* opengl_texture) {
size_t real_width = width, real_height = height;
if (!fl_external_texture_gl_copy_pixel_buffer(self, &real_width,
&real_height))
&real_height)) {
return false;
}

opengl_texture->target = GL_TEXTURE_2D;
opengl_texture->name = self->gl_texture_id;
Expand Down Expand Up @@ -93,13 +94,15 @@ bool fl_external_texture_gl_copy_pixel_buffer(FlExternalTextureGl* self,
size_t* height) {
const FlPixelBuffer* pixel_buffer =
self->callback(*width, *height, self->user_data);
if (!pixel_buffer || !pixel_buffer->buffer)
if (!pixel_buffer || !pixel_buffer->buffer) {
return false;
}
*width = pixel_buffer->width;
*height = pixel_buffer->height;

if (!self->gl.valid)
if (!self->gl.valid) {
fl_external_texture_gl_load_funcs(self);
}
if (self->gl_texture_id == 0) {
self->gl.genTextures(1, &self->gl_texture_id);
self->gl.bindTexture(GL_TEXTURE_2D, self->gl_texture_id);
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/linux/fl_plugin_registrar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ FlPluginRegistrar* fl_plugin_registrar_new(
g_object_new(fl_plugin_registrar_get_type(), nullptr));

self->view = view;
if (view != nullptr)
if (view != nullptr) {
g_object_weak_ref(G_OBJECT(view), view_weak_notify_cb, self);
}
self->messenger = FL_BINARY_MESSENGER(g_object_ref(messenger));
self->texture_registrar =
FL_TEXTURE_REGISTRAR(g_object_ref(texture_registrar));
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/linux/fl_texture_registrar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ bool fl_texture_registrar_populate_texture(
FlutterOpenGLTexture* opengl_texture) {
FlExternalTextureGl* texture = FL_EXTERNAL_TEXTURE_GL(g_hash_table_lookup(
self->textures, reinterpret_cast<gconstpointer>(texture_id)));
if (texture == nullptr)
if (texture == nullptr) {
return false;
}
return fl_external_texture_gl_populate_texture(texture, width, height,
opengl_texture);
}
Expand Down
14 changes: 9 additions & 5 deletions shell/platform/linux/testing/mock_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct _FlutterPlatformMessageResponseHandle {
bool released;

// Constructor for a response handle generated by the engine.
_FlutterPlatformMessageResponseHandle(std::string channel)
explicit _FlutterPlatformMessageResponseHandle(std::string channel)
: data_callback(nullptr),
user_data(nullptr),
channel(channel),
Expand Down Expand Up @@ -80,8 +80,9 @@ static void send_response(
const FlutterPlatformMessageResponseHandle* response_handle,
const uint8_t* message,
size_t message_size) {
if (response_handle == nullptr)
if (response_handle == nullptr) {
return;
}

FlutterTask task;
task.runner = new _FlutterTaskRunner(1234, channel, response_handle, message,
Expand Down Expand Up @@ -146,8 +147,9 @@ FlutterEngineResult FlutterEngineRun(size_t version,

FlutterEngineResult result =
FlutterEngineInitialize(version, config, args, user_data, engine_out);
if (result != kSuccess)
if (result != kSuccess) {
return result;
}
return FlutterEngineRunInitialized(*engine_out);
}

Expand Down Expand Up @@ -254,8 +256,9 @@ FlutterEngineResult FlutterEngineSendPlatformMessage(
? fl_value_get_string(message_value)
: nullptr;
}
if (fl_value_get_length(args) >= 3)
if (fl_value_get_length(args) >= 3) {
details = fl_value_get_list_value(args, 2);
}
response = fl_method_codec_encode_error_envelope(
FL_METHOD_CODEC(codec), code, message, details, &error);
EXPECT_EQ(error, nullptr);
Expand Down Expand Up @@ -336,8 +339,9 @@ FlutterEngineResult FlutterEngineSendPlatformMessageResponse(
EXPECT_TRUE(engine->running);

// Send a message so the shell can check the responses received.
if (handle->channel != "test/responses")
if (handle->channel != "test/responses") {
send_message(engine, "test/responses", data, data_length);
}

EXPECT_FALSE(handle->released);

Expand Down

0 comments on commit d7ff522

Please sign in to comment.