You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-21 14:57:09 +00:00
String[size()] should return a default constructed CharType
As per the C++ standard 21.3.4.1 for std::string: Returns: If pos < size(), returns data()[pos]. Otherwise, if pos == size(), the const version returns charT(). Otherwise, the behavior is undefined. Since the behavior is undefined Godot now does the same thing for const and non-const versions of operator[]. This fixes #21242 and fixes #22221.
This commit is contained in:
@@ -58,6 +58,9 @@
|
||||
#define IS_DIGIT(m_d) ((m_d) >= '0' && (m_d) <= '9')
|
||||
#define IS_HEX_DIGIT(m_d) (((m_d) >= '0' && (m_d) <= '9') || ((m_d) >= 'a' && (m_d) <= 'f') || ((m_d) >= 'A' && (m_d) <= 'F'))
|
||||
|
||||
const char CharString::_null = 0;
|
||||
const CharType String::_null = 0;
|
||||
|
||||
bool is_symbol(CharType c) {
|
||||
return c != '_' && ((c >= '!' && c <= '/') || (c >= ':' && c <= '@') || (c >= '[' && c <= '`') || (c >= '{' && c <= '~') || c == '\t' || c == ' ');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user