mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Fixed unsafe casts
This commit is contained in:
parent
2907ca3a41
commit
56ae5bbafb
@ -315,7 +315,8 @@ constexpr Key operator-(uint32_t a, Key b) {
|
||||
}
|
||||
|
||||
constexpr Key &operator-=(Key &a, int b) {
|
||||
return (Key &)((int &)a -= b);
|
||||
a = static_cast<Key>(static_cast<int>(a) - static_cast<int>(b));
|
||||
return a;
|
||||
}
|
||||
|
||||
constexpr Key operator+(Key a, int b) {
|
||||
@ -339,15 +340,18 @@ constexpr Key operator|(Key a, Key b) {
|
||||
}
|
||||
|
||||
constexpr Key &operator|=(Key &a, Key b) {
|
||||
return (Key &)((int &)a |= (int)b);
|
||||
a = static_cast<Key>(static_cast<int>(a) | static_cast<int>(b));
|
||||
return a;
|
||||
}
|
||||
|
||||
constexpr Key &operator|=(Key &a, KeyModifierMask b) {
|
||||
return (Key &)((int &)a |= (int)b);
|
||||
a = static_cast<Key>(static_cast<int>(a) | static_cast<int>(b));
|
||||
return a;
|
||||
}
|
||||
|
||||
constexpr Key &operator&=(Key &a, KeyModifierMask b) {
|
||||
return (Key &)((int &)a &= (int)b);
|
||||
a = static_cast<Key>(static_cast<int>(a) & static_cast<int>(b));
|
||||
return a;
|
||||
}
|
||||
|
||||
constexpr Key operator|(Key a, KeyModifierMask b) {
|
||||
|
Loading…
Reference in New Issue
Block a user