diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-04-04 18:49:05 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-04-04 21:49:51 +0200 |
commit | b78aa4fe1925a6dd14324fee98c512d56e36a255 (patch) | |
tree | f4f2c20380a8f1625159b5a4d56a99694ee5d7ac | |
parent | 1abb5ebf6532944a9fd0d1acf9ad61a0df1bb0ed (diff) |
Style: Apply clang-tidy to current code, add `readability-redundant-member-init`
-rw-r--r-- | .clang-tidy | 2 | ||||
-rw-r--r-- | drivers/gles3/texture_loader_gles3.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/collision_polygon_2d_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/light_occluder_2d_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/line_2d_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/navigation_polygon_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/physical_bone_3d_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/polygon_2d_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | modules/navigation/godot_navigation_server.cpp | 4 | ||||
-rw-r--r-- | modules/openxr/openxr_api.cpp | 10 | ||||
-rw-r--r-- | modules/text_server_adv/text_server_adv.cpp | 8 | ||||
-rw-r--r-- | modules/text_server_fb/text_server_fb.cpp | 8 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 2 |
13 files changed, 23 insertions, 40 deletions
diff --git a/.clang-tidy b/.clang-tidy index b623aef133..fa57c94a21 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr,readability-braces-around-statements' +Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr,readability-braces-around-statements,readability-redundant-member-init' WarningsAsErrors: '' HeaderFilterRegex: '' AnalyzeTemporaryDtors: false diff --git a/drivers/gles3/texture_loader_gles3.cpp b/drivers/gles3/texture_loader_gles3.cpp index f8d4cfdc61..8c8724686d 100644 --- a/drivers/gles3/texture_loader_gles3.cpp +++ b/drivers/gles3/texture_loader_gles3.cpp @@ -52,7 +52,7 @@ RES ResourceFormatGLES2Texture::load(const String &p_path, const String &p_origi uint8_t **row_p = memnew_arr(uint8_t *, height); for (unsigned int i = 0; i < height; i++) { - row_p[i] = 0; //No colors any more, I want them to turn black + row_p[i] = nullptr; // No colors any more, I want them to turn black. } memdelete_arr(row_p); diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 5d769e7987..f018376e4b 100644 --- a/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -38,10 +38,7 @@ void CollisionPolygon2DEditor::_set_node(Node *p_polygon) { node = Object::cast_to<CollisionPolygon2D>(p_polygon); } -CollisionPolygon2DEditor::CollisionPolygon2DEditor() : - AbstractPolygon2DEditor() { - node = nullptr; -} +CollisionPolygon2DEditor::CollisionPolygon2DEditor() {} CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin() : AbstractPolygon2DEditorPlugin(memnew(CollisionPolygon2DEditor), "CollisionPolygon2D") { diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp index 6a5ead58d0..4fbc8188b9 100644 --- a/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -102,10 +102,7 @@ void LightOccluder2DEditor::_create_resource() { _menu_option(MODE_CREATE); } -LightOccluder2DEditor::LightOccluder2DEditor() : - AbstractPolygon2DEditor() { - node = nullptr; -} +LightOccluder2DEditor::LightOccluder2DEditor() {} LightOccluder2DEditorPlugin::LightOccluder2DEditorPlugin() : AbstractPolygon2DEditorPlugin(memnew(LightOccluder2DEditor), "LightOccluder2D") { diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp index 0f81b17cb3..31053f90b8 100644 --- a/editor/plugins/line_2d_editor_plugin.cpp +++ b/editor/plugins/line_2d_editor_plugin.cpp @@ -56,10 +56,7 @@ void Line2DEditor::_action_set_polygon(int p_idx, const Variant &p_previous, con undo_redo->add_undo_method(node, "set_points", p_previous); } -Line2DEditor::Line2DEditor() : - AbstractPolygon2DEditor() { - node = nullptr; -} +Line2DEditor::Line2DEditor() {} Line2DEditorPlugin::Line2DEditorPlugin() : AbstractPolygon2DEditorPlugin(memnew(Line2DEditor), "Line2D") { diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp index fe31f254df..17eaf45bb5 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -112,10 +112,7 @@ void NavigationPolygonEditor::_create_resource() { _menu_option(MODE_CREATE); } -NavigationPolygonEditor::NavigationPolygonEditor() : - AbstractPolygon2DEditor() { - node = nullptr; -} +NavigationPolygonEditor::NavigationPolygonEditor() {} NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin() : AbstractPolygon2DEditorPlugin(memnew(NavigationPolygonEditor), "NavigationRegion2D") { diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp index e815a9c9f6..9dc89133c4 100644 --- a/editor/plugins/physical_bone_3d_editor_plugin.cpp +++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp @@ -82,8 +82,7 @@ void PhysicalBone3DEditor::show() { spatial_editor_hb->show(); } -PhysicalBone3DEditorPlugin::PhysicalBone3DEditorPlugin() : - physical_bone_editor() {} +PhysicalBone3DEditorPlugin::PhysicalBone3DEditorPlugin() {} void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) { if (p_visible) { diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 2812c4aaaf..8566e92b22 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -1228,9 +1228,7 @@ Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const { return p_target; } -Polygon2DEditor::Polygon2DEditor() : - AbstractPolygon2DEditor() { - node = nullptr; +Polygon2DEditor::Polygon2DEditor() { snap_offset = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_offset", Vector2()); snap_step = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_step", Vector2(10, 10)); use_snap = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_enabled", false); diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp index f3da85063a..ca4fc4f628 100644 --- a/modules/navigation/godot_navigation_server.cpp +++ b/modules/navigation/godot_navigation_server.cpp @@ -109,9 +109,7 @@ } \ void GodotNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) -GodotNavigationServer::GodotNavigationServer() : - NavigationServer3D() { -} +GodotNavigationServer::GodotNavigationServer() {} GodotNavigationServer::~GodotNavigationServer() { flush_queries(); diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index e92f4c2cff..861038be33 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -408,7 +408,7 @@ bool OpenXRAPI::load_supported_view_configuration_views(XrViewConfigurationType for (uint32_t i = 0; i < view_count; i++) { view_configuration_views[i].type = XR_TYPE_VIEW_CONFIGURATION_VIEW; - view_configuration_views[i].next = NULL; + view_configuration_views[i].next = nullptr; } result = xrEnumerateViewConfigurationViews(instance, system_id, p_configuration_type, view_count, &view_count, view_configuration_views); @@ -680,10 +680,10 @@ bool OpenXRAPI::create_main_swapchain() { for (uint32_t i = 0; i < view_count; i++) { views[i].type = XR_TYPE_VIEW; - views[i].next = NULL; + views[i].next = nullptr; projection_views[i].type = XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW; - projection_views[i].next = NULL; + projection_views[i].next = nullptr; projection_views[i].subImage.swapchain = swapchain; projection_views[i].subImage.imageArrayIndex = i; projection_views[i].subImage.imageRect.offset.x = 0; @@ -1147,7 +1147,7 @@ bool OpenXRAPI::get_view_transform(uint32_t p_view, Transform3D &r_transform) { } // we don't have valid view info - if (views == NULL || !view_pose_valid) { + if (views == nullptr || !view_pose_valid) { return false; } @@ -1167,7 +1167,7 @@ bool OpenXRAPI::get_view_projection(uint32_t p_view, double p_z_near, double p_z } // we don't have valid view info - if (views == NULL || !view_pose_valid) { + if (views == nullptr || !view_pose_valid) { return false; } diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index e02ddbb3f4..71b09a5e69 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -1044,7 +1044,7 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_msdf( if (RenderingServer::get_singleton() != nullptr) { Ref<Image> img; img.instantiate(); - img->create_from_data(tex.texture_w, tex.texture_h, 0, Image::FORMAT_RGBA8, tex.imgdata); + img->create_from_data(tex.texture_w, tex.texture_h, false, Image::FORMAT_RGBA8, tex.imgdata); if (tex.texture.is_null()) { tex.texture.instantiate(); tex.texture->create_from_image(img); @@ -1129,7 +1129,7 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_bitma if (RenderingServer::get_singleton() != nullptr) { Ref<Image> img; img.instantiate(); - img->create_from_data(tex.texture_w, tex.texture_h, 0, require_format, tex.imgdata); + img->create_from_data(tex.texture_w, tex.texture_h, false, require_format, tex.imgdata); if (tex.texture.is_null()) { tex.texture.instantiate(); @@ -2306,7 +2306,7 @@ void TextServerAdvanced::font_set_texture_image(const RID &p_font_rid, const Vec Ref<Image> img; img.instantiate(); - img->create_from_data(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata); + img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata); tex.texture = Ref<ImageTexture>(); tex.texture.instantiate(); @@ -2325,7 +2325,7 @@ Ref<Image> TextServerAdvanced::font_get_texture_image(const RID &p_font_rid, con const FontTexture &tex = fd->cache[size]->textures[p_texture_index]; Ref<Image> img; img.instantiate(); - img->create_from_data(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata); + img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata); return img; } diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 6c2e5a6084..2e8ccf28b9 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -486,7 +486,7 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_msdf( if (RenderingServer::get_singleton() != nullptr) { Ref<Image> img; img.instantiate(); - img->create_from_data(tex.texture_w, tex.texture_h, 0, Image::FORMAT_RGBA8, tex.imgdata); + img->create_from_data(tex.texture_w, tex.texture_h, false, Image::FORMAT_RGBA8, tex.imgdata); if (tex.texture.is_null()) { tex.texture.instantiate(); tex.texture->create_from_image(img); @@ -571,7 +571,7 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_bitma if (RenderingServer::get_singleton() != nullptr) { Ref<Image> img; img.instantiate(); - img->create_from_data(tex.texture_w, tex.texture_h, 0, require_format, tex.imgdata); + img->create_from_data(tex.texture_w, tex.texture_h, false, require_format, tex.imgdata); if (tex.texture.is_null()) { tex.texture.instantiate(); @@ -1467,7 +1467,7 @@ void TextServerFallback::font_set_texture_image(const RID &p_font_rid, const Vec Ref<Image> img; img.instantiate(); - img->create_from_data(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata); + img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata); tex.texture = Ref<ImageTexture>(); tex.texture.instantiate(); @@ -1486,7 +1486,7 @@ Ref<Image> TextServerFallback::font_get_texture_image(const RID &p_font_rid, con const FontTexture &tex = fd->cache[size]->textures[p_texture_index]; Ref<Image> img; img.instantiate(); - img->create_from_data(tex.texture_w, tex.texture_h, 0, tex.format, tex.imgdata); + img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata); return img; } diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index a66d9d9f27..44da90de30 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -1142,7 +1142,7 @@ bool Texture3D::has_mipmaps() const { if (GDVIRTUAL_REQUIRED_CALL(_has_mipmaps, ret)) { return ret; } - return 0; + return false; } Vector<Ref<Image>> Texture3D::get_data() const { |