diff --git a/SConstruct b/SConstruct index 2c79665465d..3734268cae8 100644 --- a/SConstruct +++ b/SConstruct @@ -336,12 +336,18 @@ if selected_platform in platform_list: env.Append(CCFLAGS=['/WX']) else: # Rest of the world disable_nonessential_warnings = ['-Wno-sign-compare'] + shadow_local_warning = [] + + if 'gcc' in os.path.basename(env["CC"]): + version = methods.get_compiler_version(env) + if version != None and version[0] >= '7': + shadow_local_warning = ['-Wshadow-local'] if (env["warnings"] == 'extra'): - env.Append(CCFLAGS=['-Wall', '-Wextra']) + env.Append(CCFLAGS=['-Wall', '-Wextra'] + shadow_local_warning) elif (env["warnings"] == 'all'): - env.Append(CCFLAGS=['-Wall'] + disable_nonessential_warnings) + env.Append(CCFLAGS=['-Wall'] + shadow_local_warning + disable_nonessential_warnings) elif (env["warnings"] == 'moderate'): - env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + disable_nonessential_warnings) + env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + shadow_local_warning + disable_nonessential_warnings) else: # 'no' env.Append(CCFLAGS=['-w']) if (env["werror"]): diff --git a/core/image.cpp b/core/image.cpp index 3d48db872c5..5a287ca50e2 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -2901,15 +2901,15 @@ void Image::fix_alpha_edges() { if (dist >= closest_dist) continue; - const uint8_t *rp = &srcptr[(k * width + l) << 2]; + const uint8_t *rp2 = &srcptr[(k * width + l) << 2]; - if (rp[3] < alpha_threshold) + if (rp2[3] < alpha_threshold) continue; closest_dist = dist; - closest_color[0] = rp[0]; - closest_color[1] = rp[1]; - closest_color[2] = rp[2]; + closest_color[0] = rp2[0]; + closest_color[1] = rp2[1]; + closest_color[2] = rp2[2]; } } diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index 66b911e83c6..be28c9a8770 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -168,10 +168,10 @@ bool ZipArchive::try_open_pack(const String &p_path) { zlib_filefunc_def io; - FileAccess *f = FileAccess::open(p_path, FileAccess::READ); - if (!f) + FileAccess *fa = FileAccess::open(p_path, FileAccess::READ); + if (!fa) return false; - io.opaque = f; + io.opaque = fa; io.zopen_file = godot_open; io.zread_file = godot_read; io.zwrite_file = godot_write; diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index eec1c55744e..5087a63b68f 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -889,11 +889,11 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo if (buf) { encode_uint32(uint32_t(np.get_name_count()) | 0x80000000, buf); //for compatibility with the old format encode_uint32(np.get_subname_count(), buf + 4); - uint32_t flags = 0; + uint32_t np_flags = 0; if (np.is_absolute()) - flags |= 1; + np_flags |= 1; - encode_uint32(flags, buf + 8); + encode_uint32(np_flags, buf + 8); buf += 12; } diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 4d4134b7457..77e3efb3a0a 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -296,9 +296,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } break; case VARIANT_OBJECT: { - uint32_t type = f->get_32(); + uint32_t objtype = f->get_32(); - switch (type) { + switch (objtype) { case OBJECT_EMPTY: { //do none @@ -317,7 +317,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { case OBJECT_EXTERNAL_RESOURCE: { //old file format, still around for compatibility - String type = get_unicode_string(); + String exttype = get_unicode_string(); String path = get_unicode_string(); if (path.find("://") == -1 && path.is_rel_path()) { @@ -329,7 +329,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { path = remaps[path]; } - RES res = ResourceLoader::load(path, type); + RES res = ResourceLoader::load(path, exttype); if (res.is_null()) { WARN_PRINT(String("Couldn't load resource: " + path).utf8().get_data()); @@ -346,7 +346,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { r_v = Variant(); } else { - String type = external_resources[erindex].type; + String exttype = external_resources[erindex].type; String path = external_resources[erindex].path; if (path.find("://") == -1 && path.is_rel_path()) { @@ -354,7 +354,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { path = ProjectSettings::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); } - RES res = ResourceLoader::load(path, type); + RES res = ResourceLoader::load(path, exttype); if (res.is_null()) { WARN_PRINT(String("Couldn't load resource: " + path).utf8().get_data()); @@ -1314,8 +1314,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia } else { f->store_32(VARIANT_INT); - int val = p_property; - f->store_32(int32_t(val)); + f->store_32(int32_t(p_property)); } } break; diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 10a32bae41f..98309048bb0 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -905,9 +905,9 @@ bool ResourceLoader::add_custom_resource_format_loader(String script_path) { void ResourceLoader::remove_custom_resource_format_loader(String script_path) { - Ref loader = _find_custom_resource_format_loader(script_path); - if (loader.is_valid()) - remove_resource_format_loader(loader); + Ref custom_loader = _find_custom_resource_format_loader(script_path); + if (custom_loader.is_valid()) + remove_resource_format_loader(custom_loader); } void ResourceLoader::add_custom_loaders() { diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 279788796cc..c992e2bf94b 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -233,9 +233,9 @@ bool ResourceSaver::add_custom_resource_format_saver(String script_path) { void ResourceSaver::remove_custom_resource_format_saver(String script_path) { - Ref saver = _find_custom_resource_format_saver(script_path); - if (saver.is_valid()) - remove_resource_format_saver(saver); + Ref custom_saver = _find_custom_resource_format_saver(script_path); + if (custom_saver.is_valid()) + remove_resource_format_saver(custom_saver); } void ResourceSaver::add_custom_savers() { diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 21ec5218b75..6c3b84d49a0 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -374,14 +374,14 @@ PoolVector AStar::get_point_path(int p_from_id, int p_to_id) { { PoolVector::Write w = path.write(); - Point *p = end_point; + Point *p2 = end_point; int idx = pc - 1; - while (p != begin_point) { - w[idx--] = p->pos; - p = p->prev_point; + while (p2 != begin_point) { + w[idx--] = p2->pos; + p2 = p2->prev_point; } - w[0] = p->pos; // Assign first + w[0] = p2->pos; // Assign first } return path; diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 61e5154f443..99251d80e30 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -1264,10 +1264,10 @@ Expression::ENode *Expression::_parse_expression() { } str_ofs = cofs; //revert //parse an expression - ENode *expr = _parse_expression(); - if (!expr) + ENode *subexpr = _parse_expression(); + if (!subexpr) return NULL; - dn->dict.push_back(expr); + dn->dict.push_back(subexpr); _get_token(tk); if (tk.type != TK_COLON) { @@ -1275,11 +1275,11 @@ Expression::ENode *Expression::_parse_expression() { return NULL; } - expr = _parse_expression(); - if (!expr) + subexpr = _parse_expression(); + if (!subexpr) return NULL; - dn->dict.push_back(expr); + dn->dict.push_back(subexpr); cofs = str_ofs; _get_token(tk); @@ -1308,10 +1308,10 @@ Expression::ENode *Expression::_parse_expression() { } str_ofs = cofs; //revert //parse an expression - ENode *expr = _parse_expression(); - if (!expr) + ENode *subexpr = _parse_expression(); + if (!subexpr) return NULL; - an->array.push_back(expr); + an->array.push_back(subexpr); cofs = str_ofs; _get_token(tk); @@ -1355,25 +1355,25 @@ Expression::ENode *Expression::_parse_expression() { while (true) { - int cofs = str_ofs; + int cofs2 = str_ofs; _get_token(tk); if (tk.type == TK_PARENTHESIS_CLOSE) { break; } - str_ofs = cofs; //revert + str_ofs = cofs2; //revert //parse an expression - ENode *expr = _parse_expression(); - if (!expr) + ENode *subexpr = _parse_expression(); + if (!subexpr) return NULL; - func_call->arguments.push_back(expr); + func_call->arguments.push_back(subexpr); - cofs = str_ofs; + cofs2 = str_ofs; _get_token(tk); if (tk.type == TK_COMMA) { //all good } else if (tk.type == TK_PARENTHESIS_CLOSE) { - str_ofs = cofs; + str_ofs = cofs2; } else { _set_error("Expected ',' or ')'"); } @@ -1444,11 +1444,11 @@ Expression::ENode *Expression::_parse_expression() { } str_ofs = cofs; //revert //parse an expression - ENode *expr = _parse_expression(); - if (!expr) + ENode *subexpr = _parse_expression(); + if (!subexpr) return NULL; - constructor->arguments.push_back(expr); + constructor->arguments.push_back(subexpr); cofs = str_ofs; _get_token(tk); @@ -1485,11 +1485,11 @@ Expression::ENode *Expression::_parse_expression() { } str_ofs = cofs; //revert //parse an expression - ENode *expr = _parse_expression(); - if (!expr) + ENode *subexpr = _parse_expression(); + if (!subexpr) return NULL; - bifunc->arguments.push_back(expr); + bifunc->arguments.push_back(subexpr); cofs = str_ofs; _get_token(tk); @@ -1584,25 +1584,25 @@ Expression::ENode *Expression::_parse_expression() { while (true) { - int cofs = str_ofs; + int cofs3 = str_ofs; _get_token(tk); if (tk.type == TK_PARENTHESIS_CLOSE) { break; } - str_ofs = cofs; //revert + str_ofs = cofs3; //revert //parse an expression - ENode *expr = _parse_expression(); - if (!expr) + ENode *subexpr = _parse_expression(); + if (!subexpr) return NULL; - func_call->arguments.push_back(expr); + func_call->arguments.push_back(subexpr); - cofs = str_ofs; + cofs3 = str_ofs; _get_token(tk); if (tk.type == TK_COMMA) { //all good } else if (tk.type == TK_PARENTHESIS_CLOSE) { - str_ofs = cofs; + str_ofs = cofs3; } else { _set_error("Expected ',' or ')'"); } @@ -1902,7 +1902,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression: Variant b; if (op->nodes[1]) { - bool ret = _execute(p_inputs, p_instance, op->nodes[1], b, r_error_str); + ret = _execute(p_inputs, p_instance, op->nodes[1], b, r_error_str); if (ret) return true; } @@ -2070,7 +2070,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression: for (int i = 0; i < call->arguments.size(); i++) { Variant value; - bool ret = _execute(p_inputs, p_instance, call->arguments[i], value, r_error_str); + ret = _execute(p_inputs, p_instance, call->arguments[i], value, r_error_str); if (ret) return true; diff --git a/core/math/face3.h b/core/math/face3.h index 1a00851eaba..184e80ff77e 100644 --- a/core/math/face3.h +++ b/core/math/face3.h @@ -241,13 +241,13 @@ bool Face3::intersects_aabb2(const AABB &p_aabb) const { real_t minT = 1e20, maxT = -1e20; for (int k = 0; k < 3; k++) { - real_t d = axis.dot(vertex[k]); + real_t vert_d = axis.dot(vertex[k]); - if (d > maxT) - maxT = d; + if (vert_d > maxT) + maxT = vert_d; - if (d < minT) - minT = d; + if (vert_d < minT) + minT = vert_d; } if (maxB < minT || maxT < minB) diff --git a/core/math/octree.h b/core/math/octree.h index 36a77663f4a..d6fc9776bcb 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -916,34 +916,34 @@ void Octree::move(OctreeElementID p_id, const AABB &p_aabb) { pass++; - for (typename List::Element *E = owners.front(); E;) { + for (typename List::Element *F = owners.front(); F;) { - Octant *o = E->get().octant; - typename List::Element *N = E->next(); + Octant *o = F->get().octant; + typename List::Element *N = F->next(); /* if (!use_pairs) - o->elements.erase( E->get().E ); + o->elements.erase( F->get().E ); */ if (use_pairs && e.pairable) - o->pairable_elements.erase(E->get().E); + o->pairable_elements.erase(F->get().E); else - o->elements.erase(E->get().E); + o->elements.erase(F->get().E); if (_remove_element_from_octant(&e, o, common_parent->parent)) { - owners.erase(E); + owners.erase(F); } - E = N; + F = N; } if (use_pairs) { //unpair child elements in anything that survived - for (typename List::Element *E = owners.front(); E; E = E->next()) { + for (typename List::Element *F = owners.front(); F; F = F->next()) { - Octant *o = E->get().octant; + Octant *o = F->get().octant; // erase children pairs, unref ONCE pass++; diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index 1aa345db1f4..bc2b4e6fe0b 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -438,12 +438,12 @@ Error QuickHull::build(const Vector &p_points, Geometry::MeshData &r_me } // remove all edge connections to this face - for (Map::Element *E = ret_edges.front(); E; E = E->next()) { - if (E->get().left == O) - E->get().left = NULL; + for (Map::Element *G = ret_edges.front(); G; G = G->next()) { + if (G->get().left == O) + G->get().left = NULL; - if (E->get().right == O) - E->get().right = NULL; + if (G->get().right == O) + G->get().right = NULL; } ret_edges.erase(F); //remove the edge diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 8d05d7cc74a..6b4895d6883 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -501,7 +501,7 @@ Error ProjectSettings::_load_settings_binary(const String p_path) { d.resize(vlen); f->get_buffer(d.ptrw(), vlen); Variant value; - Error err = decode_variant(value, d.ptr(), d.size()); + err = decode_variant(value, d.ptr(), d.size()); ERR_EXPLAIN("Error decoding property: " + key); ERR_CONTINUE(err != OK); set(key, value); @@ -656,7 +656,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Mapstore_string(key); int len; - Error err = encode_variant(p_custom_features, NULL, len); + err = encode_variant(p_custom_features, NULL, len); if (err != OK) { memdelete(file); ERR_FAIL_V(err); @@ -694,7 +694,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Mapstore_string(key); int len; - Error err = encode_variant(value, NULL, len); + err = encode_variant(value, NULL, len); if (err != OK) memdelete(file); ERR_FAIL_COND_V(err != OK, ERR_INVALID_DATA); diff --git a/core/script_language.cpp b/core/script_language.cpp index 2746c015d61..f0310ffc310 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -527,8 +527,8 @@ void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name, } bool found = false; - for (const List::Element *E = properties.front(); E; E = E->next()) { - if (E->get().name == p_name) { + for (const List::Element *F = properties.front(); F; F = F->next()) { + if (F->get().name == p_name) { found = true; break; } diff --git a/core/translation.cpp b/core/translation.cpp index a402df3eea7..6921f1d9f1b 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -1052,7 +1052,7 @@ StringName TranslationServer::translate(const StringName &p_message) const { if (fallback.length() >= 2) { const CharType *fptr = &fallback[0]; - bool near_match = false; + near_match = false; for (const Set >::Element *E = translations.front(); E; E = E->next()) { const Ref &t = E->get(); diff --git a/core/ustring.cpp b/core/ustring.cpp index 838907419e3..17b52035ddf 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -603,13 +603,13 @@ String String::camelcase_to_underscore(bool lowercase) const { is_next_number = cstr[i + 1] >= '0' && cstr[i + 1] <= '9'; } - const bool a = is_upper && !was_precedent_upper && !was_precedent_number; - const bool b = was_precedent_upper && is_upper && are_next_2_lower; - const bool c = is_number && !was_precedent_number; + const bool cond_a = is_upper && !was_precedent_upper && !was_precedent_number; + const bool cond_b = was_precedent_upper && is_upper && are_next_2_lower; + const bool cond_c = is_number && !was_precedent_number; const bool can_break_number_letter = is_number && !was_precedent_number && is_next_lower; const bool can_break_letter_number = !is_number && was_precedent_number && (is_next_lower || is_next_number); - bool should_split = a || b || c || can_break_number_letter || can_break_letter_number; + bool should_split = cond_a || cond_b || cond_c || can_break_number_letter || can_break_letter_number; if (should_split) { new_string += this->substr(start_index, i - start_index) + "_"; start_index = i; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index f6f4569dfae..32461f6584d 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1227,15 +1227,15 @@ bool Variant::has_method(const StringName &p_method) const { #endif } - const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[type]; - return fd.functions.has(p_method); + const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[type]; + return tf.functions.has(p_method); } Vector Variant::get_method_argument_types(Variant::Type p_type, const StringName &p_method) { - const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type]; + const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type]; - const Map::Element *E = fd.functions.find(p_method); + const Map::Element *E = tf.functions.find(p_method); if (!E) return Vector(); @@ -1244,9 +1244,9 @@ Vector Variant::get_method_argument_types(Variant::Type p_type, c bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method) { - const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type]; + const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type]; - const Map::Element *E = fd.functions.find(p_method); + const Map::Element *E = tf.functions.find(p_method); if (!E) return false; @@ -1255,9 +1255,9 @@ bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method) Vector Variant::get_method_argument_names(Variant::Type p_type, const StringName &p_method) { - const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type]; + const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type]; - const Map::Element *E = fd.functions.find(p_method); + const Map::Element *E = tf.functions.find(p_method); if (!E) return Vector(); @@ -1266,9 +1266,9 @@ Vector Variant::get_method_argument_names(Variant::Type p_type, cons Variant::Type Variant::get_method_return_type(Variant::Type p_type, const StringName &p_method, bool *r_has_return) { - const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type]; + const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type]; - const Map::Element *E = fd.functions.find(p_method); + const Map::Element *E = tf.functions.find(p_method); if (!E) return Variant::NIL; @@ -1280,9 +1280,9 @@ Variant::Type Variant::get_method_return_type(Variant::Type p_type, const String Vector Variant::get_method_default_arguments(Variant::Type p_type, const StringName &p_method) { - const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type]; + const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type]; - const Map::Element *E = fd.functions.find(p_method); + const Map::Element *E = tf.functions.find(p_method); if (!E) return Vector(); @@ -1291,9 +1291,9 @@ Vector Variant::get_method_default_arguments(Variant::Type p_type, cons void Variant::get_method_list(List *p_list) const { - const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[type]; + const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[type]; - for (const Map::Element *E = fd.functions.front(); E; E = E->next()) { + for (const Map::Element *E = tf.functions.front(); E; E = E->next()) { const _VariantCall::FuncData &fd = E->get(); @@ -1405,11 +1405,11 @@ Variant Variant::get_constant_value(Variant::Type p_type, const StringName &p_va Map::Element *E = cd.value.find(p_value); if (!E) { - Map::Element *E = cd.variant_value.find(p_value); - if (E) { + Map::Element *F = cd.variant_value.find(p_value); + if (F) { if (r_valid) *r_valid = true; - return E->get(); + return F->get(); } else { return -1; } diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 93654d33891..26851e4c23d 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -3496,15 +3496,15 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) case COLOR: { const Color *ca = reinterpret_cast(a._data._mem); const Color *cb = reinterpret_cast(b._data._mem); - float r = ca->r + cb->r * c; - float g = ca->g + cb->g * c; - float b = ca->b + cb->b * c; - float a = ca->a + cb->a * c; - r = r > 1.0 ? 1.0 : r; - g = g > 1.0 ? 1.0 : g; - b = b > 1.0 ? 1.0 : b; - a = a > 1.0 ? 1.0 : a; - r_dst = Color(r, g, b, a); + float new_r = ca->r + cb->r * c; + float new_g = ca->g + cb->g * c; + float new_b = ca->b + cb->b * c; + float new_a = ca->a + cb->a * c; + new_r = new_r > 1.0 ? 1.0 : new_r; + new_g = new_g > 1.0 ? 1.0 : new_g; + new_b = new_b > 1.0 ? 1.0 : new_b; + new_a = new_a > 1.0 ? 1.0 : new_a; + r_dst = Color(new_r, new_g, new_b, new_a); } return; default: { diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 84fb85e8122..716e5499e34 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -728,7 +728,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, bool at_key = true; String key; - Token token; + Token token2; bool need_comma = false; while (true) { @@ -740,11 +740,11 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, if (at_key) { - Error err = get_token(p_stream, token, line, r_err_str); + Error err = get_token(p_stream, token2, line, r_err_str); if (err != OK) return err; - if (token.type == TK_PARENTHESIS_CLOSE) { + if (token2.type == TK_PARENTHESIS_CLOSE) { Reference *reference = Object::cast_to(obj); if (reference) { value = REF(reference); @@ -756,7 +756,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, if (need_comma) { - if (token.type != TK_COMMA) { + if (token2.type != TK_COMMA) { r_err_str = "Expected '}' or ','"; return ERR_PARSE_ERROR; @@ -766,18 +766,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, } } - if (token.type != TK_STRING) { + if (token2.type != TK_STRING) { r_err_str = "Expected property name as string"; return ERR_PARSE_ERROR; } - key = token.value; + key = token2.value; - err = get_token(p_stream, token, line, r_err_str); + err = get_token(p_stream, token2, line, r_err_str); if (err != OK) return err; - if (token.type != TK_COLON) { + if (token2.type != TK_COLON) { r_err_str = "Expected ':'"; return ERR_PARSE_ERROR; @@ -785,12 +785,12 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, at_key = false; } else { - Error err = get_token(p_stream, token, line, r_err_str); + Error err = get_token(p_stream, token2, line, r_err_str); if (err != OK) return err; Variant v; - err = parse_value(token, v, p_stream, line, r_err_str, p_res_parser); + err = parse_value(token2, v, p_stream, line, r_err_str, p_res_parser); if (err) return err; obj->set(key, v); @@ -882,11 +882,11 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return ERR_PARSE_ERROR; } - String id = token.value; + String id2 = token.value; Ref ie; - if (id == "NONE") { + if (id2 == "NONE") { get_token(p_stream, token, line, r_err_str); @@ -895,7 +895,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return ERR_PARSE_ERROR; } - } else if (id == "KEY") { + } else if (id2 == "KEY") { Ref key; key.instance(); @@ -954,7 +954,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return ERR_PARSE_ERROR; } - } else if (id == "MBUTTON") { + } else if (id2 == "MBUTTON") { Ref mb; mb.instance(); @@ -980,7 +980,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return ERR_PARSE_ERROR; } - } else if (id == "JBUTTON") { + } else if (id2 == "JBUTTON") { Ref jb; jb.instance(); @@ -1006,7 +1006,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return ERR_PARSE_ERROR; } - } else if (id == "JAXIS") { + } else if (id2 == "JAXIS") { Ref jm; jm.instance(); diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp index a7345978e19..bf210ef2b2a 100644 --- a/drivers/gles2/rasterizer_canvas_gles2.cpp +++ b/drivers/gles2/rasterizer_canvas_gles2.cpp @@ -851,11 +851,11 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur int indices[num_points * 3]; - for (int i = 0; i < num_points; i++) { - points[i] = circle->pos + Vector2(Math::sin(i * Math_PI * 2.0 / num_points), Math::cos(i * Math_PI * 2.0 / num_points)) * circle->radius; - indices[i * 3 + 0] = i; - indices[i * 3 + 1] = (i + 1) % num_points; - indices[i * 3 + 2] = num_points; + for (int j = 0; j < num_points; j++) { + points[j] = circle->pos + Vector2(Math::sin(j * Math_PI * 2.0 / num_points), Math::cos(j * Math_PI * 2.0 / num_points)) * circle->radius; + indices[j * 3 + 0] = j; + indices[j * 3 + 1] = (j + 1) % num_points; + indices[j * 3 + 2] = num_points; } _bind_canvas_texture(RID(), RID()); @@ -913,13 +913,13 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id); } - for (int i = 0; i < VS::ARRAY_MAX - 1; i++) { - if (s->attribs[i].enabled) { - glEnableVertexAttribArray(i); - glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, (uint8_t *)0 + s->attribs[i].offset); + for (int k = 0; k < VS::ARRAY_MAX - 1; k++) { + if (s->attribs[k].enabled) { + glEnableVertexAttribArray(k); + glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, (uint8_t *)0 + s->attribs[k].offset); } else { - glDisableVertexAttribArray(i); - switch (i) { + glDisableVertexAttribArray(k); + switch (k) { case VS::ARRAY_NORMAL: { glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1); } break; @@ -939,8 +939,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur } } - for (int i = 1; i < VS::ARRAY_MAX - 1; i++) { - glDisableVertexAttribArray(i); + for (int j = 1; j < VS::ARRAY_MAX - 1; j++) { + glDisableVertexAttribArray(j); } } @@ -1002,13 +1002,13 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id); } - for (int i = 0; i < VS::ARRAY_MAX - 1; i++) { - if (s->attribs[i].enabled) { - glEnableVertexAttribArray(i); - glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, (uint8_t *)0 + s->attribs[i].offset); + for (int k = 0; k < VS::ARRAY_MAX - 1; k++) { + if (s->attribs[k].enabled) { + glEnableVertexAttribArray(k); + glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, (uint8_t *)0 + s->attribs[k].offset); } else { - glDisableVertexAttribArray(i); - switch (i) { + glDisableVertexAttribArray(k); + switch (k) { case VS::ARRAY_NORMAL: { glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1); } break; @@ -1021,8 +1021,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur } } - for (int i = 0; i < amount; i++) { - const float *buffer = base_buffer + i * stride; + for (int k = 0; k < amount; k++) { + const float *buffer = base_buffer + k * stride; { diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 03e6c185eea..3920a5f96a8 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -1120,10 +1120,10 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p int num_surfaces = mesh->surfaces.size(); - for (int i = 0; i < num_surfaces; i++) { - int material_index = instance->materials[i].is_valid() ? i : -1; + for (int j = 0; j < num_surfaces; j++) { + int material_index = instance->materials[j].is_valid() ? j : -1; - RasterizerStorageGLES2::Surface *surface = mesh->surfaces[i]; + RasterizerStorageGLES2::Surface *surface = mesh->surfaces[j]; _add_geometry(surface, instance, NULL, material_index, p_depth_pass, p_shadow_pass); } @@ -1143,8 +1143,8 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p int ssize = mesh->surfaces.size(); - for (int i = 0; i < ssize; i++) { - RasterizerStorageGLES2::Surface *s = mesh->surfaces[i]; + for (int j = 0; j < ssize; j++) { + RasterizerStorageGLES2::Surface *s = mesh->surfaces[j]; _add_geometry(s, instance, multi_mesh, -1, p_depth_pass, p_shadow_pass); } } break; diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index d00d572ccf1..0227cd2b345 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -4283,7 +4283,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) { glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); - GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { _render_target_clear(rt); ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE); diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 0cda8acba8e..227445ae5be 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -581,10 +581,10 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur #ifdef GLES_OVER_GL if (line->antialiased) { glEnable(GL_LINE_SMOOTH); - for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { Vector2 vertsl[2] = { - verts[i], - verts[(i + 1) % 4], + verts[j], + verts[(j + 1) % 4], }; _draw_gui_primitive(2, vertsl, NULL, NULL); } @@ -782,8 +782,8 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur } if (primitive->colors.size() == 1 && primitive->points.size() > 1) { - Color c = primitive->colors[0]; - glVertexAttrib4f(VS::ARRAY_COLOR, c.r, c.g, c.b, c.a); + Color col = primitive->colors[0]; + glVertexAttrib4f(VS::ARRAY_COLOR, col.r, col.g, col.b, col.a); } else if (primitive->colors.empty()) { glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1); @@ -1035,8 +1035,6 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, amount); } else { //split - - int stride = sizeof(float) * 4 * 6; int split = int(Math::ceil(particles->phase * particles->amount)); if (amount - split > 0) { @@ -1099,12 +1097,12 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur points[numpoints] = circle->pos; int indices[numpoints * 3]; - for (int i = 0; i < numpoints; i++) { + for (int j = 0; j < numpoints; j++) { - points[i] = circle->pos + Vector2(Math::sin(i * Math_PI * 2.0 / numpoints), Math::cos(i * Math_PI * 2.0 / numpoints)) * circle->radius; - indices[i * 3 + 0] = i; - indices[i * 3 + 1] = (i + 1) % numpoints; - indices[i * 3 + 2] = numpoints; + points[j] = circle->pos + Vector2(Math::sin(j * Math_PI * 2.0 / numpoints), Math::cos(j * Math_PI * 2.0 / numpoints)) * circle->radius; + indices[j * 3 + 0] = j; + indices[j * 3 + 1] = (j + 1) % numpoints; + indices[j * 3 + 2] = numpoints; } _bind_canvas_texture(RID(), RID()); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index d634f8ea764..c66f2ed6ec9 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -3178,10 +3178,10 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p int ssize = mesh->surfaces.size(); - for (int i = 0; i < ssize; i++) { + for (int j = 0; j < ssize; j++) { - int mat_idx = inst->materials[i].is_valid() ? i : -1; - RasterizerStorageGLES3::Surface *s = mesh->surfaces[i]; + int mat_idx = inst->materials[j].is_valid() ? j : -1; + RasterizerStorageGLES3::Surface *s = mesh->surfaces[j]; _add_geometry(s, inst, NULL, mat_idx, p_depth_pass, p_shadow_pass); } @@ -3202,9 +3202,9 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p int ssize = mesh->surfaces.size(); - for (int i = 0; i < ssize; i++) { + for (int j = 0; j < ssize; j++) { - RasterizerStorageGLES3::Surface *s = mesh->surfaces[i]; + RasterizerStorageGLES3::Surface *s = mesh->surfaces[j]; _add_geometry(s, inst, multi_mesh, -1, p_depth_pass, p_shadow_pass); } @@ -3222,9 +3222,9 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p RasterizerStorageGLES3::Particles *particles = storage->particles_owner.getptr(inst->base); ERR_CONTINUE(!particles); - for (int i = 0; i < particles->draw_passes.size(); i++) { + for (int j = 0; j < particles->draw_passes.size(); j++) { - RID pmesh = particles->draw_passes[i]; + RID pmesh = particles->draw_passes[j]; if (!pmesh.is_valid()) continue; RasterizerStorageGLES3::Mesh *mesh = storage->mesh_owner.get(pmesh); @@ -3233,9 +3233,9 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p int ssize = mesh->surfaces.size(); - for (int j = 0; j < ssize; j++) { + for (int k = 0; k < ssize; k++) { - RasterizerStorageGLES3::Surface *s = mesh->surfaces[j]; + RasterizerStorageGLES3::Surface *s = mesh->surfaces[k]; _add_geometry(s, inst, particles, -1, p_depth_pass, p_shadow_pass); } } @@ -5059,7 +5059,7 @@ void RasterizerSceneGLES3::initialize() { { //reflection cubemaps int max_reflection_cubemap_sampler_size = 512; - int cube_size = max_reflection_cubemap_sampler_size; + int rcube_size = max_reflection_cubemap_sampler_size; glActiveTexture(GL_TEXTURE0); @@ -5069,10 +5069,10 @@ void RasterizerSceneGLES3::initialize() { GLenum format = GL_RGBA; GLenum type = use_float ? GL_HALF_FLOAT : GL_UNSIGNED_INT_2_10_10_10_REV; - while (cube_size >= 32) { + while (rcube_size >= 32) { ReflectionCubeMap cube; - cube.size = cube_size; + cube.size = rcube_size; glGenTextures(1, &cube.depth); glBindTexture(GL_TEXTURE_2D, cube.depth); @@ -5111,7 +5111,7 @@ void RasterizerSceneGLES3::initialize() { reflection_cubemaps.push_back(cube); - cube_size >>= 1; + rcube_size >>= 1; } } diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ce34de1dd8a..51890174378 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -6049,9 +6049,9 @@ void RasterizerStorageGLES3::particles_set_amount(RID p_particles, int p_amount) glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[i]); glBufferData(GL_ARRAY_BUFFER, floats * sizeof(float), data, GL_STATIC_DRAW); - for (int i = 0; i < 6; i++) { - glEnableVertexAttribArray(i); - glVertexAttribPointer(i, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4 * 6, ((uint8_t *)0) + (i * 16)); + for (int j = 0; j < 6; j++) { + glEnableVertexAttribArray(j); + glVertexAttribPointer(j, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4 * 6, ((uint8_t *)0) + (j * 16)); } } diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 0d98b7fbc0e..aec3d27d692 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -420,7 +420,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { pa_operation *pa_op = pa_context_get_server_info(ad->pa_ctx, &AudioDriverPulseAudio::pa_server_info_cb, (void *)ad); if (pa_op) { while (ad->pa_status == 0) { - int ret = pa_mainloop_iterate(ad->pa_ml, 1, NULL); + ret = pa_mainloop_iterate(ad->pa_ml, 1, NULL); if (ret < 0) { ERR_PRINT("pa_mainloop_iterate error"); } diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index bee8ddcea08..d92b745e267 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -132,7 +132,7 @@ public: if (existing != -1) { Variant v = animation->track_get_key_value(track, existing); - float trans = animation->track_get_key_transition(track, existing); + trans = animation->track_get_key_transition(track, existing); undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, new_time, v, trans); } @@ -384,12 +384,12 @@ public: if (name == "animation") { - StringName name = p_value; + StringName anim_name = p_value; setting = true; undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS); StringName prev = animation->animation_track_get_key_animation(track, key); - undo_redo->add_do_method(animation.ptr(), "animation_track_set_key_animation", track, key, name); + undo_redo->add_do_method(animation.ptr(), "animation_track_set_key_animation", track, key, anim_name); undo_redo->add_undo_method(animation.ptr(), "animation_track_set_key_animation", track, key, prev); undo_redo->add_do_method(this, "_update_obj", animation); undo_redo->add_undo_method(this, "_update_obj", animation); @@ -2833,9 +2833,9 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p if (animation->track_get_path(i) == np) { value = p_value; //all good } else { - String path = animation->track_get_path(i); - if (NodePath(path.get_basename()) == np) { - String subindex = path.get_extension(); + String tpath = animation->track_get_path(i); + if (NodePath(tpath.get_basename()) == np) { + String subindex = tpath.get_extension(); value = p_value.get(subindex); } else { continue; @@ -2928,9 +2928,9 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari if (animation->track_get_path(i) == np) { value = p_value; //all good } else { - String path = animation->track_get_path(i); - if (NodePath(path.get_basename()) == np) { - String subindex = path.get_extension(); + String tpath = animation->track_get_path(i); + if (NodePath(tpath.get_basename()) == np) { + String subindex = tpath.get_extension(); value = p_value.get(subindex); } else { continue; @@ -4329,9 +4329,9 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { text = node->get_name(); Vector sn = path.get_subnames(); - for (int i = 0; i < sn.size(); i++) { + for (int j = 0; j < sn.size(); j++) { text += "."; - text += sn[i]; + text += sn[j]; } path = NodePath(node->get_path().get_names(), path.get_subnames(), true); //store full path instead for copying diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 8c2c2b7f385..bb0bd1b4581 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "animation_track_editor_plugins.h" + #include "editor/audio_stream_preview.h" #include "editor_resource_preview.h" #include "editor_scale.h" @@ -37,6 +38,7 @@ #include "scene/3d/sprite_3d.h" #include "scene/animation/animation_player.h" #include "servers/audio/audio_stream.h" + /// BOOL /// int AnimationTrackEditBool::get_key_height() const { @@ -247,9 +249,6 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x, return; } - Ref font = get_font("font", "Label"); - float fh = int(font->get_height() * 1.5); - bool play = get_animation()->track_get_key_value(get_track(), p_index); if (play) { float len = stream->get_length(); @@ -285,8 +284,9 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x, if (to_x <= from_x) return; - int h = get_size().height; - Rect2 rect = Rect2(from_x, (h - fh) / 2, to_x - from_x, fh); + Ref font = get_font("font", "Label"); + float fh = int(font->get_height() * 1.5); + Rect2 rect = Rect2(from_x, (get_size().height - fh) / 2, to_x - from_x, fh); draw_rect(rect, Color(0.25, 0.25, 0.25)); Vector lines; @@ -439,13 +439,13 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in return; } - int frame = get_animation()->track_get_key_value(get_track(), p_index); - Ref texture; Rect2 region; if (Object::cast_to(object) || Object::cast_to(object)) { + int frame = get_animation()->track_get_key_value(get_track(), p_index); + texture = object->call("get_texture"); if (!texture.is_valid()) { AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right); diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp index 2f80690ed16..94e6d4ded09 100644 --- a/editor/collada/collada.cpp +++ b/editor/collada/collada.cpp @@ -2071,17 +2071,17 @@ void Collada::_parse_library(XMLParser &parser) { } else if (name == "geometry") { String id = parser.get_attribute_value("id"); - String name = parser.get_attribute_value_safe("name"); + String name2 = parser.get_attribute_value_safe("name"); while (parser.read() == OK) { if (parser.get_node_type() == XMLParser::NODE_ELEMENT) { if (parser.get_node_name() == "mesh") { - state.mesh_name_map[id] = (name != "") ? name : id; - _parse_mesh_geometry(parser, id, name); + state.mesh_name_map[id] = (name2 != "") ? name2 : id; + _parse_mesh_geometry(parser, id, name2); } else if (parser.get_node_name() == "spline") { - state.mesh_name_map[id] = (name != "") ? name : id; - _parse_curve_geometry(parser, id, name); + state.mesh_name_map[id] = (name2 != "") ? name2 : id; + _parse_curve_geometry(parser, id, name2); } else if (!parser.is_empty()) parser.skip_section(); } else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END && parser.get_node_name() == "geometry") diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 7a5ebc5c00e..f775a0a14b2 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -766,7 +766,7 @@ void ConnectionsDock::update_tree() { while (base) { - List node_signals; + List node_signals2; Ref icon; String name; @@ -774,7 +774,7 @@ void ConnectionsDock::update_tree() { Ref