summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/input/input.cpp4
-rw-r--r--core/input/input.h3
-rw-r--r--core/string/ustring.cpp15
-rw-r--r--core/variant/variant.cpp4
4 files changed, 14 insertions, 12 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp
index beb61f039f..b3a68bb98c 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -1409,8 +1409,8 @@ String Input::get_joy_guid(int p_device) const {
return joy_names[p_device].uid;
}
-Array Input::get_connected_joypads() {
- Array ret;
+TypedArray<int> Input::get_connected_joypads() {
+ TypedArray<int> ret;
HashMap<int, Joypad>::Iterator elem = joy_names.begin();
while (elem) {
if (elem->value.connected) {
diff --git a/core/input/input.h b/core/input/input.h
index d65b585749..f02f2abae5 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -36,6 +36,7 @@
#include "core/os/keyboard.h"
#include "core/os/thread_safe.h"
#include "core/templates/rb_set.h"
+#include "core/variant/typed_array.h"
class Input : public Object {
GDCLASS(Input, Object);
@@ -259,7 +260,7 @@ public:
float get_joy_axis(int p_device, JoyAxis p_axis) const;
String get_joy_name(int p_idx);
- Array get_connected_joypads();
+ TypedArray<int> get_connected_joypads();
Vector2 get_joy_vibration_strength(int p_device);
float get_joy_vibration_duration(int p_device);
uint64_t get_joy_vibration_timestamp(int p_device);
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index 44df349613..d189f3224b 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -3712,18 +3712,15 @@ String String::uri_encode() const {
const CharString temp = utf8();
String res;
for (int i = 0; i < temp.length(); ++i) {
- char ord = temp[i];
+ uint8_t ord = temp[i];
if (ord == '.' || ord == '-' || ord == '~' || is_ascii_identifier_char(ord)) {
res += ord;
} else {
- char h_Val[3];
-#if defined(__GNUC__) || defined(_MSC_VER)
- snprintf(h_Val, 3, "%02hhX", ord);
-#else
- sprintf(h_Val, "%02hhX", ord);
-#endif
- res += "%";
- res += h_Val;
+ char p[4] = { '%', 0, 0, 0 };
+ static const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+ p[1] = hex[ord >> 4];
+ p[2] = hex[ord & 0xF];
+ res += p;
}
}
return res;
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index e69bd88413..2b4e777865 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -3102,6 +3102,10 @@ bool Variant::hash_compare(const Variant &p_variant, int recursion_count) const
return *reinterpret_cast<const String *>(_data._mem) == *reinterpret_cast<const String *>(p_variant._data._mem);
} break;
+ case STRING_NAME: {
+ return *reinterpret_cast<const StringName *>(_data._mem) == *reinterpret_cast<const StringName *>(p_variant._data._mem);
+ } break;
+
case VECTOR2: {
const Vector2 *l = reinterpret_cast<const Vector2 *>(_data._mem);
const Vector2 *r = reinterpret_cast<const Vector2 *>(p_variant._data._mem);