Fix a bunch of issues found by static analyzer.
This commit is contained in:
parent
739019e4e4
commit
c188ccf95d
@ -1239,7 +1239,7 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
|
||||
}
|
||||
}
|
||||
|
||||
if (p_include_docs && class_doc != nullptr) {
|
||||
if (p_include_docs) {
|
||||
d["brief_description"] = fix_doc_description(class_doc->brief_description);
|
||||
d["description"] = fix_doc_description(class_doc->description);
|
||||
}
|
||||
|
@ -1111,7 +1111,7 @@ static const char *script_list[][2] = {
|
||||
{ "Meitei Mayek", "Mtei" },
|
||||
{ "Multani", "Mult" },
|
||||
{ "Myanmar / Burmese", "Mymr" },
|
||||
{ "Nag Mundari", "Nagm" },
|
||||
{ "Nag Mundari", "Nagm" },
|
||||
{ "Nandinagari", "Nand" },
|
||||
{ "Old North Arabian", "Narb" },
|
||||
{ "Nabataean", "Nbat" },
|
||||
|
@ -227,6 +227,9 @@ bool Dictionary::recursive_equal(const Dictionary &p_dictionary, int recursion_c
|
||||
}
|
||||
|
||||
void Dictionary::_ref(const Dictionary &p_from) const {
|
||||
if (!p_from._p) {
|
||||
return;
|
||||
}
|
||||
//make a copy first (thread safe)
|
||||
if (!p_from._p->refcount.ref()) {
|
||||
return; // couldn't copy
|
||||
|
@ -2175,6 +2175,7 @@ void RasterizerCanvasGLES3::canvas_begin(RID p_to_render_target, bool p_to_backb
|
||||
GLES3::Config *config = GLES3::Config::get_singleton();
|
||||
|
||||
GLES3::RenderTarget *render_target = texture_storage->get_render_target(p_to_render_target);
|
||||
ERR_FAIL_NULL(render_target);
|
||||
|
||||
if (p_to_backbuffer) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, render_target->backbuffer_fbo);
|
||||
|
@ -1001,7 +1001,7 @@ void MaterialData::update_textures(const HashMap<StringName, Variant> &p_paramet
|
||||
}
|
||||
tex->detect_normal_callback(tex->detect_normal_callback_ud);
|
||||
}
|
||||
if (tex->detect_roughness_callback && (p_texture_uniforms[i].hint >= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_R || p_texture_uniforms[i].hint <= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_GRAY)) {
|
||||
if (tex->detect_roughness_callback && p_texture_uniforms[i].hint >= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_R && p_texture_uniforms[i].hint <= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_GRAY) {
|
||||
//find the normal texture
|
||||
roughness_detect_texture = tex;
|
||||
roughness_channel = RS::TextureDetectRoughnessChannel(p_texture_uniforms[i].hint - ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_R);
|
||||
|
@ -1298,7 +1298,7 @@ void MeshStorage::update_mesh_instances() {
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
GLuint vertex_array_gl = 0;
|
||||
uint64_t mask = RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_NORMAL | RS::ARRAY_FORMAT_VERTEX;
|
||||
uint64_t mask = RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_NORMAL | RS::ARRAY_FORMAT_TANGENT;
|
||||
uint64_t format = mi->mesh->surfaces[i]->format & mask; // Format should only have vertex, normal, tangent (as necessary).
|
||||
mesh_surface_get_vertex_arrays_and_format(mi->mesh->surfaces[i], format, vertex_array_gl);
|
||||
glBindVertexArray(vertex_array_gl);
|
||||
@ -1412,7 +1412,7 @@ void MeshStorage::update_mesh_instances() {
|
||||
skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::INVERSE_TRANSFORM_OFFSET, inverse_transform[2], skeleton_shader.shader_version, variant, specialization);
|
||||
|
||||
GLuint vertex_array_gl = 0;
|
||||
uint64_t mask = RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_NORMAL | RS::ARRAY_FORMAT_VERTEX;
|
||||
uint64_t mask = RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_NORMAL | RS::ARRAY_FORMAT_TANGENT;
|
||||
uint64_t format = mi->mesh->surfaces[i]->format & mask; // Format should only have vertex, normal, tangent (as necessary).
|
||||
mesh_surface_get_vertex_arrays_and_format(mi->mesh->surfaces[i], format, vertex_array_gl);
|
||||
glBindVertexArray(vertex_array_gl);
|
||||
|
@ -1215,9 +1215,7 @@ void EditorNode::_titlebar_resized() {
|
||||
int w = (gui_base->is_layout_rtl()) ? margin.x : margin.y;
|
||||
right_menu_spacer->set_custom_minimum_size(Size2(w, 0));
|
||||
}
|
||||
if (title_bar) {
|
||||
title_bar->set_custom_minimum_size(Size2(0, margin.z - title_bar->get_global_position().y));
|
||||
}
|
||||
title_bar->set_custom_minimum_size(Size2(0, margin.z - title_bar->get_global_position().y));
|
||||
}
|
||||
|
||||
void EditorNode::_update_undo_redo_allowed() {
|
||||
|
@ -682,12 +682,7 @@ void AnimationNodeStateMachineEditor::_delete_all() {
|
||||
}
|
||||
|
||||
void AnimationNodeStateMachineEditor::_delete_tree_draw() {
|
||||
TreeItem *item = delete_tree->get_next_selected(nullptr);
|
||||
while (item) {
|
||||
delete_window->get_cancel_button()->set_disabled(false);
|
||||
return;
|
||||
}
|
||||
delete_window->get_cancel_button()->set_disabled(true);
|
||||
delete_window->get_cancel_button()->set_disabled(!delete_tree->get_next_selected(nullptr));
|
||||
}
|
||||
|
||||
void AnimationNodeStateMachineEditor::_file_opened(const String &p_file) {
|
||||
|
@ -1031,9 +1031,7 @@ void ProjectManager::_titlebar_resized() {
|
||||
right_menu_spacer->set_custom_minimum_size(Size2(w, 0));
|
||||
left_spacer->set_custom_minimum_size(Size2(w, 0));
|
||||
}
|
||||
if (title_bar) {
|
||||
title_bar->set_custom_minimum_size(Size2(0, margin.z - title_bar->get_global_position().y));
|
||||
}
|
||||
title_bar->set_custom_minimum_size(Size2(0, margin.z - title_bar->get_global_position().y));
|
||||
}
|
||||
|
||||
// Object methods.
|
||||
|
@ -376,7 +376,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
|
||||
while (str[non_op] == '-' || str[non_op] == '+' || str[non_op] == '~') {
|
||||
non_op++;
|
||||
}
|
||||
if (is_digit(str[non_op]) || (str[non_op] == '.' && non_op < line_length && is_digit(str[non_op + 1]))) {
|
||||
if (is_digit(str[non_op]) || (str[non_op] == '.' && non_op + 1 < line_length && is_digit(str[non_op + 1]))) {
|
||||
in_number = true;
|
||||
}
|
||||
}
|
||||
|
@ -988,7 +988,7 @@ void GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode *p_class,
|
||||
if (member.variable->initializer) {
|
||||
// Check if it is call to get_node() on self (using shorthand $ or not), so we can check if @onready is needed.
|
||||
// This could be improved by traversing the expression fully and checking the presence of get_node at any level.
|
||||
if (!member.variable->is_static && !member.variable->onready && member.variable->initializer && (member.variable->initializer->type == GDScriptParser::Node::GET_NODE || member.variable->initializer->type == GDScriptParser::Node::CALL || member.variable->initializer->type == GDScriptParser::Node::CAST)) {
|
||||
if (!member.variable->is_static && !member.variable->onready && (member.variable->initializer->type == GDScriptParser::Node::GET_NODE || member.variable->initializer->type == GDScriptParser::Node::CALL || member.variable->initializer->type == GDScriptParser::Node::CAST)) {
|
||||
GDScriptParser::Node *expr = member.variable->initializer;
|
||||
if (expr->type == GDScriptParser::Node::CAST) {
|
||||
expr = static_cast<GDScriptParser::CastNode *>(expr)->operand;
|
||||
@ -4804,7 +4804,7 @@ void GDScriptAnalyzer::reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternar
|
||||
|
||||
GDScriptParser::DataType result;
|
||||
|
||||
if (p_ternary_op->condition && p_ternary_op->condition->is_constant && p_ternary_op->true_expr->is_constant && p_ternary_op->false_expr && p_ternary_op->false_expr->is_constant) {
|
||||
if (p_ternary_op->condition && p_ternary_op->condition->is_constant && p_ternary_op->true_expr && p_ternary_op->true_expr->is_constant && p_ternary_op->false_expr && p_ternary_op->false_expr->is_constant) {
|
||||
p_ternary_op->is_constant = true;
|
||||
if (p_ternary_op->condition->reduced_value.booleanize()) {
|
||||
p_ternary_op->reduced_value = p_ternary_op->true_expr->reduced_value;
|
||||
|
@ -255,7 +255,7 @@ void GridMapEditor::_update_cursor_transform() {
|
||||
cursor_transform = node->get_global_transform() * cursor_transform;
|
||||
|
||||
if (selected_palette >= 0) {
|
||||
if (node && !node->get_mesh_library().is_null()) {
|
||||
if (!node->get_mesh_library().is_null()) {
|
||||
cursor_transform *= node->get_mesh_library()->get_item_mesh_transform(selected_palette);
|
||||
}
|
||||
}
|
||||
@ -829,11 +829,11 @@ void GridMapEditor::_mesh_library_palette_input(const Ref<InputEvent> &p_ie) {
|
||||
|
||||
// Zoom in/out using Ctrl + mouse wheel
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->is_command_or_control_pressed()) {
|
||||
if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
|
||||
if (mb->get_button_index() == MouseButton::WHEEL_UP) {
|
||||
size_slider->set_value(size_slider->get_value() + 0.2);
|
||||
}
|
||||
|
||||
if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
|
||||
if (mb->get_button_index() == MouseButton::WHEEL_DOWN) {
|
||||
size_slider->set_value(size_slider->get_value() - 0.2);
|
||||
}
|
||||
}
|
||||
@ -1142,7 +1142,7 @@ void GridMapEditor::_update_cursor_instance() {
|
||||
cursor_instance = RID();
|
||||
|
||||
if (selected_palette >= 0) {
|
||||
if (node && !node->get_mesh_library().is_null()) {
|
||||
if (!node->get_mesh_library().is_null()) {
|
||||
Ref<Mesh> mesh = node->get_mesh_library()->get_item_mesh(selected_palette);
|
||||
if (!mesh.is_null() && mesh->get_rid().is_valid()) {
|
||||
cursor_instance = RenderingServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world_3d()->get_scenario());
|
||||
|
@ -2107,7 +2107,7 @@ void DisplayServerX11::window_set_transient(WindowID p_window, WindowID p_parent
|
||||
// RevertToPointerRoot is used to make sure we don't lose all focus in case
|
||||
// a subwindow and its parent are both destroyed.
|
||||
if (!wd_window.no_focus && !wd_window.is_popup && wd_window.focused) {
|
||||
if ((xwa.map_state == IsViewable) && !wd_parent.no_focus && !wd_window.is_popup && _window_focus_check()) {
|
||||
if ((xwa.map_state == IsViewable) && !wd_parent.no_focus && !wd_parent.is_popup && _window_focus_check()) {
|
||||
_set_input_focus(wd_parent.x11_window, RevertToPointerRoot);
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ void CharacterBody3D::_set_collision_direction(const PhysicsServer3D::MotionResu
|
||||
if (r_state.wall) {
|
||||
if (wall_collision_count > 1 && !r_state.floor) {
|
||||
// Check if wall normals cancel out to floor support.
|
||||
if (!r_state.floor && motion_mode == MOTION_MODE_GROUNDED) {
|
||||
if (motion_mode == MOTION_MODE_GROUNDED) {
|
||||
combined_wall_normal.normalize();
|
||||
real_t floor_angle = Math::acos(combined_wall_normal.dot(up_direction));
|
||||
if (floor_angle <= floor_max_angle + FLOOR_ANGLE_THRESHOLD) {
|
||||
|
@ -652,7 +652,7 @@ void ItemList::gui_input(const Ref<InputEvent> &p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
#define CAN_SELECT(i) (items[i].selectable && !items[i].disabled)
|
||||
#define IS_SAME_ROW(i, row) (i / current_columns == row)
|
||||
#define IS_SAME_ROW(i, row) ((i) / current_columns == (row))
|
||||
|
||||
double prev_scroll = scroll_bar->get_value();
|
||||
|
||||
|
@ -2020,7 +2020,7 @@ Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_fi
|
||||
if (kpk.y >= 0x80 && kpk.y <= 0xFF) {
|
||||
kpk.y = _oem_to_unicode[encoding][kpk.y - 0x80];
|
||||
} else if (kpk.y > 0xFF) {
|
||||
WARN_PRINT(vformat("Invalid BMFont OEM character %x (should be 0x00-0xFF).", kpk.x));
|
||||
WARN_PRINT(vformat("Invalid BMFont OEM character %x (should be 0x00-0xFF).", kpk.y));
|
||||
kpk.y = 0x00;
|
||||
}
|
||||
}
|
||||
|
@ -929,7 +929,7 @@ void MaterialStorage::MaterialData::update_textures(const HashMap<StringName, Va
|
||||
}
|
||||
tex->detect_normal_callback(tex->detect_normal_callback_ud);
|
||||
}
|
||||
if (tex->detect_roughness_callback && (p_texture_uniforms[i].hint >= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_R || p_texture_uniforms[i].hint <= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_GRAY)) {
|
||||
if (tex->detect_roughness_callback && p_texture_uniforms[i].hint >= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_R && p_texture_uniforms[i].hint <= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_GRAY) {
|
||||
//find the normal texture
|
||||
roughness_detect_texture = tex;
|
||||
roughness_channel = RS::TextureDetectRoughnessChannel(p_texture_uniforms[i].hint - ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_R);
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "servers/rendering_server.h"
|
||||
#include "shader_types.h"
|
||||
|
||||
#define HAS_WARNING(flag) (warning_flags & flag)
|
||||
#define HAS_WARNING(flag) (warning_flags & (flag))
|
||||
|
||||
int ShaderLanguage::instance_counter = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user