summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/io/http_client_tcp.cpp26
-rw-r--r--core/io/image.cpp10
-rw-r--r--core/io/stream_peer_tls.cpp (renamed from core/io/stream_peer_ssl.cpp)34
-rw-r--r--core/io/stream_peer_tls.h (renamed from core/io/stream_peer_ssl.h)20
-rw-r--r--core/math/aabb.h8
-rw-r--r--core/math/math_funcs.h4
-rw-r--r--core/math/rect2.h4
-rw-r--r--core/math/rect2i.h4
-rw-r--r--core/object/object.cpp4
-rw-r--r--core/object/object.h2
-rw-r--r--core/register_core_types.cpp4
-rw-r--r--core/variant/variant_call.cpp8
-rw-r--r--core/variant/variant_utility.cpp6
13 files changed, 69 insertions, 65 deletions
diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp
index 9499a6f8e3..7afab9ea09 100644
--- a/core/io/http_client_tcp.cpp
+++ b/core/io/http_client_tcp.cpp
@@ -32,7 +32,7 @@
#include "http_client_tcp.h"
-#include "core/io/stream_peer_ssl.h"
+#include "core/io/stream_peer_tls.h"
#include "core/version.h"
HTTPClient *HTTPClientTCP::_create_func() {
@@ -94,6 +94,10 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_ss
} else {
// Host contains hostname and needs to be resolved to IP.
resolving = IP::get_singleton()->resolve_hostname_queue_item(server_host);
+ if (resolving == IP::RESOLVER_INVALID_ID) {
+ status = STATUS_CANT_RESOLVE;
+ return ERR_CANT_RESOLVE;
+ }
status = STATUS_RESOLVING;
}
@@ -104,8 +108,8 @@ void HTTPClientTCP::set_connection(const Ref<StreamPeer> &p_connection) {
ERR_FAIL_COND_MSG(p_connection.is_null(), "Connection is not a reference to a valid StreamPeer object.");
if (ssl) {
- ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerSSL>(p_connection.ptr()),
- "Connection is not a reference to a valid StreamPeerSSL object.");
+ ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerTLS>(p_connection.ptr()),
+ "Connection is not a reference to a valid StreamPeerTLS object.");
}
if (connection == p_connection) {
@@ -354,10 +358,10 @@ Error HTTPClientTCP::poll() {
} break;
}
} else if (ssl) {
- Ref<StreamPeerSSL> ssl;
+ Ref<StreamPeerTLS> ssl;
if (!handshaking) {
- // Connect the StreamPeerSSL and start handshaking.
- ssl = Ref<StreamPeerSSL>(StreamPeerSSL::create());
+ // Connect the StreamPeerTLS and start handshaking.
+ ssl = Ref<StreamPeerTLS>(StreamPeerTLS::create());
ssl->set_blocking_handshake_enabled(false);
Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, conn_host);
if (err != OK) {
@@ -369,7 +373,7 @@ Error HTTPClientTCP::poll() {
handshaking = true;
} else {
// We are already handshaking, which means we can use your already active SSL connection.
- ssl = static_cast<Ref<StreamPeerSSL>>(connection);
+ ssl = static_cast<Ref<StreamPeerTLS>>(connection);
if (ssl.is_null()) {
close();
status = STATUS_SSL_HANDSHAKE_ERROR;
@@ -379,13 +383,13 @@ Error HTTPClientTCP::poll() {
ssl->poll(); // Try to finish the handshake.
}
- if (ssl->get_status() == StreamPeerSSL::STATUS_CONNECTED) {
+ if (ssl->get_status() == StreamPeerTLS::STATUS_CONNECTED) {
// Handshake has been successful.
handshaking = false;
ip_candidates.clear();
status = STATUS_CONNECTED;
return OK;
- } else if (ssl->get_status() != StreamPeerSSL::STATUS_HANDSHAKING) {
+ } else if (ssl->get_status() != StreamPeerTLS::STATUS_HANDSHAKING) {
// Handshake has failed.
close();
status = STATUS_SSL_HANDSHAKE_ERROR;
@@ -418,9 +422,9 @@ Error HTTPClientTCP::poll() {
case STATUS_CONNECTED: {
// Check if we are still connected.
if (ssl) {
- Ref<StreamPeerSSL> tmp = connection;
+ Ref<StreamPeerTLS> tmp = connection;
tmp->poll();
- if (tmp->get_status() != StreamPeerSSL::STATUS_CONNECTED) {
+ if (tmp->get_status() != StreamPeerTLS::STATUS_CONNECTED) {
status = STATUS_CONNECTION_ERROR;
return ERR_CONNECTION_ERROR;
}
diff --git a/core/io/image.cpp b/core/io/image.cpp
index dee751eec5..812bfa8263 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -2671,7 +2671,7 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2i &p_src_rect, const P
Rect2i src_rect;
Rect2i dest_rect;
_get_clipped_src_and_dest_rects(p_src, p_src_rect, p_dest, src_rect, dest_rect);
- if (src_rect.has_no_area() || dest_rect.has_no_area()) {
+ if (!src_rect.has_area() || !dest_rect.has_area()) {
return;
}
@@ -2717,7 +2717,7 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co
Rect2i src_rect;
Rect2i dest_rect;
_get_clipped_src_and_dest_rects(p_src, p_src_rect, p_dest, src_rect, dest_rect);
- if (src_rect.has_no_area() || dest_rect.has_no_area()) {
+ if (!src_rect.has_area() || !dest_rect.has_area()) {
return;
}
@@ -2762,7 +2762,7 @@ void Image::blend_rect(const Ref<Image> &p_src, const Rect2i &p_src_rect, const
Rect2i src_rect;
Rect2i dest_rect;
_get_clipped_src_and_dest_rects(p_src, p_src_rect, p_dest, src_rect, dest_rect);
- if (src_rect.has_no_area() || dest_rect.has_no_area()) {
+ if (!src_rect.has_area() || !dest_rect.has_area()) {
return;
}
@@ -2802,7 +2802,7 @@ void Image::blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, c
Rect2i src_rect;
Rect2i dest_rect;
_get_clipped_src_and_dest_rects(p_src, p_src_rect, p_dest, src_rect, dest_rect);
- if (src_rect.has_no_area() || dest_rect.has_no_area()) {
+ if (!src_rect.has_area() || !dest_rect.has_area()) {
return;
}
@@ -2862,7 +2862,7 @@ void Image::fill_rect(const Rect2i &p_rect, const Color &p_color) {
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot fill rect in compressed or custom image formats.");
Rect2i r = Rect2i(0, 0, width, height).intersection(p_rect.abs());
- if (r.has_no_area()) {
+ if (!r.has_area()) {
return;
}
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_tls.cpp
index 5b90fb52a6..b1adde018a 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_tls.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* stream_peer_ssl.cpp */
+/* stream_peer_tls.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,42 +28,42 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "stream_peer_ssl.h"
+#include "stream_peer_tls.h"
#include "core/config/engine.h"
-StreamPeerSSL *(*StreamPeerSSL::_create)() = nullptr;
+StreamPeerTLS *(*StreamPeerTLS::_create)() = nullptr;
-StreamPeerSSL *StreamPeerSSL::create() {
+StreamPeerTLS *StreamPeerTLS::create() {
if (_create) {
return _create();
}
return nullptr;
}
-bool StreamPeerSSL::available = false;
+bool StreamPeerTLS::available = false;
-bool StreamPeerSSL::is_available() {
+bool StreamPeerTLS::is_available() {
return available;
}
-void StreamPeerSSL::set_blocking_handshake_enabled(bool p_enabled) {
+void StreamPeerTLS::set_blocking_handshake_enabled(bool p_enabled) {
blocking_handshake = p_enabled;
}
-bool StreamPeerSSL::is_blocking_handshake_enabled() const {
+bool StreamPeerTLS::is_blocking_handshake_enabled() const {
return blocking_handshake;
}
-void StreamPeerSSL::_bind_methods() {
- ClassDB::bind_method(D_METHOD("poll"), &StreamPeerSSL::poll);
- ClassDB::bind_method(D_METHOD("accept_stream", "stream", "private_key", "certificate", "chain"), &StreamPeerSSL::accept_stream, DEFVAL(Ref<X509Certificate>()));
- ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname", "valid_certificate"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String()), DEFVAL(Ref<X509Certificate>()));
- ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerSSL::get_status);
- ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerSSL::get_stream);
- ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerSSL::disconnect_from_stream);
- ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerSSL::set_blocking_handshake_enabled);
- ClassDB::bind_method(D_METHOD("is_blocking_handshake_enabled"), &StreamPeerSSL::is_blocking_handshake_enabled);
+void StreamPeerTLS::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("poll"), &StreamPeerTLS::poll);
+ ClassDB::bind_method(D_METHOD("accept_stream", "stream", "private_key", "certificate", "chain"), &StreamPeerTLS::accept_stream, DEFVAL(Ref<X509Certificate>()));
+ ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname", "valid_certificate"), &StreamPeerTLS::connect_to_stream, DEFVAL(false), DEFVAL(String()), DEFVAL(Ref<X509Certificate>()));
+ ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerTLS::get_status);
+ ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerTLS::get_stream);
+ ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerTLS::disconnect_from_stream);
+ ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerTLS::set_blocking_handshake_enabled);
+ ClassDB::bind_method(D_METHOD("is_blocking_handshake_enabled"), &StreamPeerTLS::is_blocking_handshake_enabled);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "blocking_handshake"), "set_blocking_handshake_enabled", "is_blocking_handshake_enabled");
diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_tls.h
index fe68667adc..ed7334fab3 100644
--- a/core/io/stream_peer_ssl.h
+++ b/core/io/stream_peer_tls.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* stream_peer_ssl.h */
+/* stream_peer_tls.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,17 +28,17 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef STREAM_PEER_SSL_H
-#define STREAM_PEER_SSL_H
+#ifndef STREAM_PEER_TLS_H
+#define STREAM_PEER_TLS_H
#include "core/crypto/crypto.h"
#include "core/io/stream_peer.h"
-class StreamPeerSSL : public StreamPeer {
- GDCLASS(StreamPeerSSL, StreamPeer);
+class StreamPeerTLS : public StreamPeer {
+ GDCLASS(StreamPeerTLS, StreamPeer);
protected:
- static StreamPeerSSL *(*_create)();
+ static StreamPeerTLS *(*_create)();
static void _bind_methods();
static bool available;
@@ -65,13 +65,13 @@ public:
virtual void disconnect_from_stream() = 0;
- static StreamPeerSSL *create();
+ static StreamPeerTLS *create();
static bool is_available();
- StreamPeerSSL() {}
+ StreamPeerTLS() {}
};
-VARIANT_ENUM_CAST(StreamPeerSSL::Status);
+VARIANT_ENUM_CAST(StreamPeerTLS::Status);
-#endif // STREAM_PEER_SSL_H
+#endif // STREAM_PEER_TLS_H
diff --git a/core/math/aabb.h b/core/math/aabb.h
index e88ba33531..acf903eeba 100644
--- a/core/math/aabb.h
+++ b/core/math/aabb.h
@@ -47,12 +47,12 @@ struct _NO_DISCARD_ AABB {
Vector3 size;
real_t get_volume() const;
- _FORCE_INLINE_ bool has_no_volume() const {
- return (size.x <= 0 || size.y <= 0 || size.z <= 0);
+ _FORCE_INLINE_ bool has_volume() const {
+ return size.x > 0.0f && size.y > 0.0f && size.z > 0.0f;
}
- _FORCE_INLINE_ bool has_no_surface() const {
- return (size.x <= 0 && size.y <= 0 && size.z <= 0);
+ _FORCE_INLINE_ bool has_surface() const {
+ return size.x > 0.0f || size.y > 0.0f || size.z > 0.0f;
}
const Vector3 &get_position() const { return position; }
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index cae76b182a..656fc9f798 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -371,8 +371,8 @@ public:
static _ALWAYS_INLINE_ double inverse_lerp(double p_from, double p_to, double p_value) { return (p_value - p_from) / (p_to - p_from); }
static _ALWAYS_INLINE_ float inverse_lerp(float p_from, float p_to, float p_value) { return (p_value - p_from) / (p_to - p_from); }
- static _ALWAYS_INLINE_ double range_lerp(double p_value, double p_istart, double p_istop, double p_ostart, double p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); }
- static _ALWAYS_INLINE_ float range_lerp(float p_value, float p_istart, float p_istop, float p_ostart, float p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); }
+ static _ALWAYS_INLINE_ double remap(double p_value, double p_istart, double p_istop, double p_ostart, double p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); }
+ static _ALWAYS_INLINE_ float remap(float p_value, float p_istart, float p_istop, float p_ostart, float p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); }
static _ALWAYS_INLINE_ double smoothstep(double p_from, double p_to, double p_s) {
if (is_equal_approx(p_from, p_to)) {
diff --git a/core/math/rect2.h b/core/math/rect2.h
index 679af933c2..2d1be3d4f3 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -140,8 +140,8 @@ struct _NO_DISCARD_ Rect2 {
((p_rect.position.y + p_rect.size.y) <= (position.y + size.y));
}
- _FORCE_INLINE_ bool has_no_area() const {
- return (size.x <= 0 || size.y <= 0);
+ _FORCE_INLINE_ bool has_area() const {
+ return size.x > 0.0f && size.y > 0.0f;
}
// Returns the instersection between two Rect2s or an empty Rect2 if there is no intersection
diff --git a/core/math/rect2i.h b/core/math/rect2i.h
index db1459a3e6..2b58dcdd98 100644
--- a/core/math/rect2i.h
+++ b/core/math/rect2i.h
@@ -83,8 +83,8 @@ struct _NO_DISCARD_ Rect2i {
((p_rect.position.y + p_rect.size.y) <= (position.y + size.y));
}
- _FORCE_INLINE_ bool has_no_area() const {
- return (size.x <= 0 || size.y <= 0);
+ _FORCE_INLINE_ bool has_area() const {
+ return size.x > 0 && size.y > 0;
}
// Returns the instersection between two Rect2is or an empty Rect2i if there is no intersection
diff --git a/core/object/object.cpp b/core/object/object.cpp
index 33208be539..c275164b14 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -1060,7 +1060,7 @@ Error Object::emit_signalp(const StringName &p_name, const Variant **p_args, int
}
}
- bool disconnect = c.flags & CONNECT_ONESHOT;
+ bool disconnect = c.flags & CONNECT_ONE_SHOT;
#ifdef TOOLS_ENABLED
if (disconnect && (c.flags & CONNECT_PERSIST) && Engine::get_singleton()->is_editor_hint()) {
//this signal was connected from the editor, and is being edited. just don't disconnect for now
@@ -1575,7 +1575,7 @@ void Object::_bind_methods() {
BIND_ENUM_CONSTANT(CONNECT_DEFERRED);
BIND_ENUM_CONSTANT(CONNECT_PERSIST);
- BIND_ENUM_CONSTANT(CONNECT_ONESHOT);
+ BIND_ENUM_CONSTANT(CONNECT_ONE_SHOT);
BIND_ENUM_CONSTANT(CONNECT_REFERENCE_COUNTED);
}
diff --git a/core/object/object.h b/core/object/object.h
index 97608c7938..8ade5a204a 100644
--- a/core/object/object.h
+++ b/core/object/object.h
@@ -537,7 +537,7 @@ public:
enum ConnectFlags {
CONNECT_DEFERRED = 1,
CONNECT_PERSIST = 2, // hint for scene to save this connection
- CONNECT_ONESHOT = 4,
+ CONNECT_ONE_SHOT = 4,
CONNECT_REFERENCE_COUNTED = 8,
};
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 7f734201e7..1b3f11ffab 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -58,7 +58,7 @@
#include "core/io/resource_format_binary.h"
#include "core/io/resource_importer.h"
#include "core/io/resource_uid.h"
-#include "core/io/stream_peer_ssl.h"
+#include "core/io/stream_peer_tls.h"
#include "core/io/tcp_server.h"
#include "core/io/translation_loader_po.h"
#include "core/io/udp_server.h"
@@ -202,7 +202,7 @@ void register_core_types() {
ClassDB::register_custom_instance_class<CryptoKey>();
ClassDB::register_custom_instance_class<HMACContext>();
ClassDB::register_custom_instance_class<Crypto>();
- ClassDB::register_custom_instance_class<StreamPeerSSL>();
+ ClassDB::register_custom_instance_class<StreamPeerTLS>();
ClassDB::register_custom_instance_class<PacketPeerDTLS>();
ClassDB::register_custom_instance_class<DTLSServer>();
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index 8f15a62f79..f09885b325 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -1650,7 +1650,7 @@ static void _register_variant_builtin_methods() {
bind_method(Rect2, get_center, sarray(), varray());
bind_method(Rect2, get_area, sarray(), varray());
- bind_method(Rect2, has_no_area, sarray(), varray());
+ bind_method(Rect2, has_area, sarray(), varray());
bind_method(Rect2, has_point, sarray("point"), varray());
bind_method(Rect2, is_equal_approx, sarray("rect"), varray());
bind_method(Rect2, intersects, sarray("b", "include_borders"), varray(false));
@@ -1667,7 +1667,7 @@ static void _register_variant_builtin_methods() {
bind_method(Rect2i, get_center, sarray(), varray());
bind_method(Rect2i, get_area, sarray(), varray());
- bind_method(Rect2i, has_no_area, sarray(), varray());
+ bind_method(Rect2i, has_area, sarray(), varray());
bind_method(Rect2i, has_point, sarray("point"), varray());
bind_method(Rect2i, intersects, sarray("b"), varray());
bind_method(Rect2i, encloses, sarray("b"), varray());
@@ -1938,8 +1938,8 @@ static void _register_variant_builtin_methods() {
bind_method(AABB, abs, sarray(), varray());
bind_method(AABB, get_center, sarray(), varray());
bind_method(AABB, get_volume, sarray(), varray());
- bind_method(AABB, has_no_volume, sarray(), varray());
- bind_method(AABB, has_no_surface, sarray(), varray());
+ bind_method(AABB, has_volume, sarray(), varray());
+ bind_method(AABB, has_surface, sarray(), varray());
bind_method(AABB, has_point, sarray("point"), varray());
bind_method(AABB, is_equal_approx, sarray("aabb"), varray());
bind_method(AABB, intersects, sarray("with"), varray());
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index 1be17405c7..7ff64c88f0 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -393,8 +393,8 @@ struct VariantUtilityFunctions {
return Math::inverse_lerp(from, to, weight);
}
- static inline double range_lerp(double value, double istart, double istop, double ostart, double ostop) {
- return Math::range_lerp(value, istart, istop, ostart, ostop);
+ static inline double remap(double value, double istart, double istop, double ostart, double ostop) {
+ return Math::remap(value, istart, istop, ostart, ostop);
}
static inline double smoothstep(double from, double to, double val) {
@@ -1434,7 +1434,7 @@ void Variant::_register_variant_utility_functions() {
FUNCBINDR(bezier_interpolate, sarray("start", "control_1", "control_2", "end", "t"), Variant::UTILITY_FUNC_TYPE_MATH);
FUNCBINDR(lerp_angle, sarray("from", "to", "weight"), Variant::UTILITY_FUNC_TYPE_MATH);
FUNCBINDR(inverse_lerp, sarray("from", "to", "weight"), Variant::UTILITY_FUNC_TYPE_MATH);
- FUNCBINDR(range_lerp, sarray("value", "istart", "istop", "ostart", "ostop"), Variant::UTILITY_FUNC_TYPE_MATH);
+ FUNCBINDR(remap, sarray("value", "istart", "istop", "ostart", "ostop"), Variant::UTILITY_FUNC_TYPE_MATH);
FUNCBINDR(smoothstep, sarray("from", "to", "x"), Variant::UTILITY_FUNC_TYPE_MATH);
FUNCBINDR(move_toward, sarray("from", "to", "delta"), Variant::UTILITY_FUNC_TYPE_MATH);