diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/color.cpp | 2 | ||||
-rw-r--r-- | core/hash_map.h | 19 | ||||
-rw-r--r-- | core/io/config_file.cpp | 4 | ||||
-rw-r--r-- | core/io/http_client.cpp | 6 | ||||
-rw-r--r-- | core/io/xml_parser.cpp | 2 | ||||
-rw-r--r-- | core/math/vector3.h | 2 | ||||
-rw-r--r-- | core/os/os.h | 2 | ||||
-rw-r--r-- | core/project_settings.cpp | 10 | ||||
-rw-r--r-- | core/sort_array.h | 6 | ||||
-rw-r--r-- | core/ustring.cpp | 22 | ||||
-rw-r--r-- | core/variant_call.cpp | 6 | ||||
-rw-r--r-- | core/vector.h | 2 |
12 files changed, 33 insertions, 50 deletions
diff --git a/core/color.cpp b/core/color.cpp index efd2941b47..8959fce4e3 100644 --- a/core/color.cpp +++ b/core/color.cpp @@ -525,7 +525,7 @@ Color Color::from_hsv(float p_h, float p_s, float p_v, float p_a) const { float Color::gray() const { ERR_EXPLAIN("Color.gray() is deprecated and will be removed in a future version. Use Color.get_v() for a better grayscale approximation."); - WARN_DEPRECATED + WARN_DEPRECATED; return (r + g + b) / 3.0; } diff --git a/core/hash_map.h b/core/hash_map.h index 44459a3080..31332991de 100644 --- a/core/hash_map.h +++ b/core/hash_map.h @@ -162,20 +162,21 @@ private: new_hash_table[i] = 0; } - for (int i = 0; i < (1 << hash_table_power); i++) { + if (hash_table) { + for (int i = 0; i < (1 << hash_table_power); i++) { - while (hash_table[i]) { + while (hash_table[i]) { - Element *se = hash_table[i]; - hash_table[i] = se->next; - int new_pos = se->hash & ((1 << new_hash_table_power) - 1); - se->next = new_hash_table[new_pos]; - new_hash_table[new_pos] = se; + Element *se = hash_table[i]; + hash_table[i] = se->next; + int new_pos = se->hash & ((1 << new_hash_table_power) - 1); + se->next = new_hash_table[new_pos]; + new_hash_table[new_pos] = se; + } } - } - if (hash_table) memdelete_arr(hash_table); + } hash_table = new_hash_table; hash_table_power = new_hash_table_power; } diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 414742deeb..871e21df3e 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -198,10 +198,6 @@ Error ConfigFile::load(const String &p_path) { section = next_tag.name; } } - - memdelete(f); - - return OK; } void ConfigFile::_bind_methods() { diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index ce2054db36..891fb7b0ca 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -346,6 +346,12 @@ Error HTTPClient::poll() { } else { // We are already handshaking, which means we can use your already active SSL connection ssl = static_cast<Ref<StreamPeerSSL> >(connection); + if (ssl.is_null()) { + close(); + status = STATUS_SSL_HANDSHAKE_ERROR; + return ERR_CANT_CONNECT; + } + ssl->poll(); // Try to finish the handshake } diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 4638ddcc09..f55af5a96a 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -348,7 +348,7 @@ uint64_t XMLParser::get_node_offset() const { Error XMLParser::seek(uint64_t p_pos) { - ERR_FAIL_COND_V(!data, ERR_FILE_EOF) + ERR_FAIL_COND_V(!data, ERR_FILE_EOF); ERR_FAIL_COND_V(p_pos >= length, ERR_FILE_EOF); P = data + p_pos; diff --git a/core/math/vector3.h b/core/math/vector3.h index 6423147282..811a207138 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -224,7 +224,7 @@ Vector3 Vector3::slerp(const Vector3 &p_b, real_t p_t) const { #endif real_t theta = angle_to(p_b); - return rotated(cross(p_b), theta * p_t); + return rotated(cross(p_b).normalized(), theta * p_t); } real_t Vector3::distance_to(const Vector3 &p_b) const { diff --git a/core/os/os.h b/core/os/os.h index 4f6a539e78..b128e6424c 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -104,7 +104,6 @@ public: bool maximized; bool always_on_top; bool use_vsync; - bool layered_splash; bool layered; float get_aspect() const { return (float)width / (float)height; } VideoMode(int p_width = 1024, int p_height = 600, bool p_fullscreen = false, bool p_resizable = true, bool p_borderless_window = false, bool p_maximized = false, bool p_always_on_top = false, bool p_use_vsync = false) { @@ -117,7 +116,6 @@ public: always_on_top = p_always_on_top; use_vsync = p_use_vsync; layered = false; - layered_splash = false; } }; diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 4c37142ffd..0508806a35 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -489,7 +489,7 @@ Error ProjectSettings::_load_settings_binary(const String p_path) { memdelete(f); ERR_EXPLAIN("Corrupted header in binary project.binary (not ECFG)"); - ERR_FAIL_V(ERR_FILE_CORRUPT;) + ERR_FAIL_V(ERR_FILE_CORRUPT); } uint32_t count = f->get_32(); @@ -579,10 +579,6 @@ Error ProjectSettings::_load_settings_text(const String p_path) { section = next_tag.name; } } - - memdelete(f); - - return OK; } Error ProjectSettings::_load_settings_text_or_binary(const String p_text_path, const String p_bin_path) { @@ -640,7 +636,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str if (err != OK) { ERR_EXPLAIN("Couldn't save project.binary at " + p_file); - ERR_FAIL_COND_V(err, err) + ERR_FAIL_COND_V(err, err); } uint8_t hdr[4] = { 'E', 'C', 'F', 'G' }; @@ -732,7 +728,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin if (err) { ERR_EXPLAIN("Couldn't save project.godot - " + p_file); - ERR_FAIL_COND_V(err, err) + ERR_FAIL_COND_V(err, err); } file->store_line("; Engine configuration file."); diff --git a/core/sort_array.h b/core/sort_array.h index 0f258aec3e..8660ee3333 100644 --- a/core/sort_array.h +++ b/core/sort_array.h @@ -179,14 +179,14 @@ public: while (true) { while (compare(p_array[p_first], p_pivot)) { if (Validate) { - ERR_BAD_COMPARE(p_first == unmodified_last - 1) + ERR_BAD_COMPARE(p_first == unmodified_last - 1); } p_first++; } p_last--; while (compare(p_pivot, p_array[p_last])) { if (Validate) { - ERR_BAD_COMPARE(p_last == unmodified_first) + ERR_BAD_COMPARE(p_last == unmodified_first); } p_last--; } @@ -259,7 +259,7 @@ public: int next = p_last - 1; while (compare(p_value, p_array[next])) { if (Validate) { - ERR_BAD_COMPARE(next == 0) + ERR_BAD_COMPARE(next == 0); } p_array[p_last] = p_array[next]; p_last = next; diff --git a/core/ustring.cpp b/core/ustring.cpp index f62e1b381b..7ed23fa2c2 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -2956,26 +2956,12 @@ String String::replace(const char *p_key, const char *p_with) const { String String::replace_first(const String &p_key, const String &p_with) const { - String new_string; - int search_from = 0; - int result = 0; - - while ((result = find(p_key, search_from)) >= 0) { - - new_string += substr(search_from, result - search_from); - new_string += p_with; - search_from = result + p_key.length(); - break; + int pos = find(p_key); + if (pos >= 0) { + return substr(0, pos) + p_with + substr(pos + p_key.length(), length()); } - if (search_from == 0) { - - return *this; - } - - new_string += substr(search_from, length() - search_from); - - return new_string; + return *this; } String String::replacen(const String &p_key, const String &p_with) const { diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 24f12df5db..b3a4a13b08 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1519,9 +1519,9 @@ void register_variant_methods() { ADDFUNC2R(STRING, STRING, String, replacen, STRING, "what", STRING, "forwhat", varray()); ADDFUNC2R(STRING, STRING, String, insert, INT, "position", STRING, "what", varray()); ADDFUNC0R(STRING, STRING, String, capitalize, varray()); - ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, split, STRING, "divisor", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); - ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, rsplit, STRING, "divisor", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); - ADDFUNC2R(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "divisor", BOOL, "allow_empty", varray(true)); + ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, split, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); + ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, rsplit, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); + ADDFUNC2R(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "delimiter", BOOL, "allow_empty", varray(true)); ADDFUNC0R(STRING, STRING, String, to_upper, varray()); ADDFUNC0R(STRING, STRING, String, to_lower, varray()); diff --git a/core/vector.h b/core/vector.h index 93ee003519..e6bb4a96fc 100644 --- a/core/vector.h +++ b/core/vector.h @@ -150,7 +150,7 @@ template <class T> bool Vector<T>::push_back(const T &p_elem) { Error err = resize(size() + 1); - ERR_FAIL_COND_V(err, true) + ERR_FAIL_COND_V(err, true); set(size() - 1, p_elem); return false; |