Merge pull request #111223 from Ivorforce/remove-iterator-include

Replace `std::size` usage with `std_size` to avoid `<iterator>` include.
This commit is contained in:
Thaddeus Crews 2025-10-06 09:06:49 -05:00
commit d1d28c0bcf
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
39 changed files with 67 additions and 66 deletions

View file

@ -30,7 +30,7 @@
#include "error_list.h" #include "error_list.h"
#include <iterator> #include "core/typedefs.h"
const char *error_names[] = { const char *error_names[] = {
"OK", // OK "OK", // OK
@ -84,4 +84,4 @@ const char *error_names[] = {
"Printer on fire", // ERR_PRINTER_ON_FIRE "Printer on fire", // ERR_PRINTER_ON_FIRE
}; };
static_assert(std::size(error_names) == ERR_MAX); static_assert(std_size(error_names) == ERR_MAX);

View file

@ -415,7 +415,7 @@ static const _BuiltinActionDisplayName _builtin_action_display_names[] = {
}; };
String InputMap::get_builtin_display_name(const String &p_name) const { String InputMap::get_builtin_display_name(const String &p_name) const {
constexpr int len = std::size(_builtin_action_display_names); constexpr int len = std_size(_builtin_action_display_names);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
if (_builtin_action_display_names[i].name == p_name) { if (_builtin_action_display_names[i].name == p_name) {

View file

@ -445,7 +445,7 @@ class CharBuffer {
public: public:
_FORCE_INLINE_ CharBuffer() : _FORCE_INLINE_ CharBuffer() :
buffer(stack_buffer), buffer(stack_buffer),
capacity(std::size(stack_buffer)) { capacity(std_size(stack_buffer)) {
} }
_FORCE_INLINE_ void push_back(char c) { _FORCE_INLINE_ void push_back(char c) {

View file

@ -47,7 +47,7 @@ String ResourceUID::get_cache_file() {
} }
static constexpr uint8_t uuid_characters[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', '0', '1', '2', '3', '4', '5', '6', '7', '8' }; static constexpr uint8_t uuid_characters[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', '0', '1', '2', '3', '4', '5', '6', '7', '8' };
static constexpr uint32_t uuid_characters_element_count = std::size(uuid_characters); static constexpr uint32_t uuid_characters_element_count = std_size(uuid_characters);
static constexpr uint8_t max_uuid_number_length = 13; // Max 0x7FFFFFFFFFFFFFFF (uid://d4n4ub6itg400) size is 13 characters. static constexpr uint8_t max_uuid_number_length = 13; // Max 0x7FFFFFFFFFFFFFFF (uid://d4n4ub6itg400) size is 13 characters.
String ResourceUID::id_to_text(ID p_id) const { String ResourceUID::id_to_text(ID p_id) const {

View file

@ -432,7 +432,7 @@ int Color::find_named_color(const String &p_name) {
} }
int Color::get_named_color_count() { int Color::get_named_color_count() {
return std::size(named_colors); return std_size(named_colors);
} }
String Color::get_named_color_name(int p_idx) { String Color::get_named_color_name(int p_idx) {

View file

@ -34,14 +34,12 @@
#include "char_range.inc" #include "char_range.inc"
#include <iterator>
static constexpr char hex_char_table_upper[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; static constexpr char hex_char_table_upper[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
static constexpr char hex_char_table_lower[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; static constexpr char hex_char_table_lower[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
#define BSEARCH_CHAR_RANGE(m_array) \ #define BSEARCH_CHAR_RANGE(m_array) \
int low = 0; \ int low = 0; \
int high = std::size(m_array) - 1; \ int high = std_size(m_array) - 1; \
int middle = (low + high) / 2; \ int middle = (low + high) / 2; \
\ \
while (low <= high) { \ while (low <= high) { \

View file

@ -182,7 +182,7 @@ const char32_t *TranslationDomain::_get_accented_version(char32_t p_character) c
return nullptr; return nullptr;
} }
for (unsigned int i = 0; i < std::size(_character_to_accented); i++) { for (unsigned int i = 0; i < std_size(_character_to_accented); i++) {
if (_character_to_accented[i].character == p_character) { if (_character_to_accented[i].character == p_character) {
return _character_to_accented[i].accented_character; return _character_to_accented[i].accented_character;
} }

View file

@ -144,6 +144,12 @@ constexpr auto CLAMP(const T m_a, const T2 m_min, const T3 m_max) {
#define SWAP(m_x, m_y) std::swap((m_x), (m_y)) #define SWAP(m_x, m_y) std::swap((m_x), (m_y))
#endif // SWAP #endif // SWAP
// Like std::size, but without requiring any additional includes.
template <typename T, size_t SIZE>
constexpr size_t std_size(const T (&)[SIZE]) {
return SIZE;
}
/* Functions to handle powers of 2 and shifting. */ /* Functions to handle powers of 2 and shifting. */
// Returns `true` if a positive integer is a power of 2, `false` otherwise. // Returns `true` if a positive integer is a power of 2, `false` otherwise.

View file

@ -52,7 +52,7 @@
using Microsoft::WRL::ComPtr; using Microsoft::WRL::ComPtr;
#define ARRAY_SIZE(a) std::size(a) #define ARRAY_SIZE(a) std_size(a)
class RenderingContextDriverD3D12 : public RenderingContextDriver { class RenderingContextDriverD3D12 : public RenderingContextDriver {
ComPtr<ID3D12DeviceFactory> device_factory; ComPtr<ID3D12DeviceFactory> device_factory;

View file

@ -3896,7 +3896,7 @@ void RasterizerSceneGLES3::_render_uv2(const PagedArray<RenderGeometryInstance *
GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT2,
GL_COLOR_ATTACHMENT3 GL_COLOR_ATTACHMENT3
}; };
glDrawBuffers(std::size(draw_buffers), draw_buffers); glDrawBuffers(std_size(draw_buffers), draw_buffers);
glClearColor(0.0, 0.0, 0.0, 0.0); glClearColor(0.0, 0.0, 0.0, 0.0);
RasterizerGLES3::clear_depth(0.0); RasterizerGLES3::clear_depth(0.0);

View file

@ -36,8 +36,6 @@
#include "core/os/time.h" #include "core/os/time.h"
#include "core/variant/dictionary.h" #include "core/variant/dictionary.h"
#include <iterator>
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <SDL3/SDL_error.h> #include <SDL3/SDL_error.h>
#include <SDL3/SDL_events.h> #include <SDL3/SDL_events.h>

View file

@ -46,7 +46,7 @@
#include "thirdparty/swappy-frame-pacing/swappyVk.h" #include "thirdparty/swappy-frame-pacing/swappyVk.h"
#endif #endif
#define ARRAY_SIZE(a) std::size(a) #define ARRAY_SIZE(a) std_size(a)
#define PRINT_NATIVE_COMMANDS 0 #define PRINT_NATIVE_COMMANDS 0

View file

@ -873,7 +873,7 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co
state_machine_draw->draw_line(p_from, p_from.lerp(p_to, p_fade_ratio), fade_line_color, 2); state_machine_draw->draw_line(p_from, p_from.lerp(p_to, p_fade_ratio), fade_line_color, 2);
} }
const int ICON_COUNT = std::size(theme_cache.transition_icons); const int ICON_COUNT = std_size(theme_cache.transition_icons);
int icon_index = p_mode + (p_auto_advance ? ICON_COUNT / 2 : 0); int icon_index = p_mode + (p_auto_advance ? ICON_COUNT / 2 : 0);
ERR_FAIL_COND(icon_index >= ICON_COUNT); ERR_FAIL_COND(icon_index >= ICON_COUNT);
Ref<Texture2D> icon = theme_cache.transition_icons[icon_index]; Ref<Texture2D> icon = theme_cache.transition_icons[icon_index];

View file

@ -8467,7 +8467,7 @@ EditorNode::EditorNode() {
default_layout->set_value(docks_section, "dock_5", "Inspector,Node,History"); default_layout->set_value(docks_section, "dock_5", "Inspector,Node,History");
int hsplits[] = { 0, 270, -270, 0 }; int hsplits[] = { 0, 270, -270, 0 };
DEV_ASSERT((int)std::size(hsplits) == editor_dock_manager->get_hsplit_count()); DEV_ASSERT((int)std_size(hsplits) == editor_dock_manager->get_hsplit_count());
for (int i = 0; i < editor_dock_manager->get_hsplit_count(); i++) { for (int i = 0; i < editor_dock_manager->get_hsplit_count(); i++) {
default_layout->set_value(docks_section, "dock_hsplit_" + itos(i + 1), hsplits[i]); default_layout->set_value(docks_section, "dock_hsplit_" + itos(i + 1), hsplits[i]);
} }

View file

@ -321,7 +321,7 @@ void EditorExportPlatformAppleEmbedded::get_export_options(List<ExportOption> *r
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "privacy/photolibrary_usage_description", PROPERTY_HINT_PLACEHOLDER_TEXT, "Provide a message if you need access to the photo library"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "privacy/photolibrary_usage_description", PROPERTY_HINT_PLACEHOLDER_TEXT, "Provide a message if you need access to the photo library"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::DICTIONARY, "privacy/photolibrary_usage_description_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary())); r_options->push_back(ExportOption(PropertyInfo(Variant::DICTIONARY, "privacy/photolibrary_usage_description_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary()));
for (uint64_t i = 0; i < std::size(api_info); ++i) { for (uint64_t i = 0; i < std_size(api_info); ++i) {
String prop_name = vformat("privacy/%s_access_reasons", api_info[i].prop_name); String prop_name = vformat("privacy/%s_access_reasons", api_info[i].prop_name);
String hint; String hint;
for (int j = 0; j < api_info[i].prop_flag_value.size(); j++) { for (int j = 0; j < api_info[i].prop_flag_value.size(); j++) {
@ -338,13 +338,13 @@ void EditorExportPlatformAppleEmbedded::get_export_options(List<ExportOption> *r
{ {
String hint; String hint;
for (uint64_t i = 0; i < std::size(data_collect_purpose_info); ++i) { for (uint64_t i = 0; i < std_size(data_collect_purpose_info); ++i) {
if (i != 0) { if (i != 0) {
hint += ","; hint += ",";
} }
hint += vformat("%s:%d", data_collect_purpose_info[i].prop_name, (1 << i)); hint += vformat("%s:%d", data_collect_purpose_info[i].prop_name, (1 << i));
} }
for (uint64_t i = 0; i < std::size(data_collect_type_info); ++i) { for (uint64_t i = 0; i < std_size(data_collect_type_info); ++i) {
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/collected", data_collect_type_info[i].prop_name)), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/collected", data_collect_type_info[i].prop_name)), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/linked_to_user", data_collect_type_info[i].prop_name)), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/linked_to_user", data_collect_type_info[i].prop_name)), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/used_for_tracking", data_collect_type_info[i].prop_name)), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/used_for_tracking", data_collect_type_info[i].prop_name)), false));
@ -640,7 +640,7 @@ String EditorExportPlatformAppleEmbedded::_process_config_file_line(const Ref<Ed
strnew += p_line.replace("$pbx_locale_build_reference", locale_files); strnew += p_line.replace("$pbx_locale_build_reference", locale_files);
} else if (p_line.contains("$priv_collection")) { } else if (p_line.contains("$priv_collection")) {
bool section_opened = false; bool section_opened = false;
for (uint64_t j = 0; j < std::size(data_collect_type_info); ++j) { for (uint64_t j = 0; j < std_size(data_collect_type_info); ++j) {
bool data_collected = p_preset->get(vformat("privacy/collected_data/%s/collected", data_collect_type_info[j].prop_name)); bool data_collected = p_preset->get(vformat("privacy/collected_data/%s/collected", data_collect_type_info[j].prop_name));
bool linked = p_preset->get(vformat("privacy/collected_data/%s/linked_to_user", data_collect_type_info[j].prop_name)); bool linked = p_preset->get(vformat("privacy/collected_data/%s/linked_to_user", data_collect_type_info[j].prop_name));
bool tracking = p_preset->get(vformat("privacy/collected_data/%s/used_for_tracking", data_collect_type_info[j].prop_name)); bool tracking = p_preset->get(vformat("privacy/collected_data/%s/used_for_tracking", data_collect_type_info[j].prop_name));
@ -669,7 +669,7 @@ String EditorExportPlatformAppleEmbedded::_process_config_file_line(const Ref<Ed
if (purposes != 0) { if (purposes != 0) {
strnew += "\t\t\t\t<key>NSPrivacyCollectedDataTypePurposes</key>\n"; strnew += "\t\t\t\t<key>NSPrivacyCollectedDataTypePurposes</key>\n";
strnew += "\t\t\t\t<array>\n"; strnew += "\t\t\t\t<array>\n";
for (uint64_t k = 0; k < std::size(data_collect_purpose_info); ++k) { for (uint64_t k = 0; k < std_size(data_collect_purpose_info); ++k) {
if (purposes & (1 << k)) { if (purposes & (1 << k)) {
strnew += vformat("\t\t\t\t\t<string>%s</string>\n", data_collect_purpose_info[k].type_name); strnew += vformat("\t\t\t\t\t<string>%s</string>\n", data_collect_purpose_info[k].type_name);
} }
@ -701,7 +701,7 @@ String EditorExportPlatformAppleEmbedded::_process_config_file_line(const Ref<Ed
} }
} else if (p_line.contains("$priv_api_types")) { } else if (p_line.contains("$priv_api_types")) {
strnew += "\t<array>\n"; strnew += "\t<array>\n";
for (uint64_t j = 0; j < std::size(api_info); ++j) { for (uint64_t j = 0; j < std_size(api_info); ++j) {
int api_access = p_preset->get(vformat("privacy/%s_access_reasons", api_info[j].prop_name)); int api_access = p_preset->get(vformat("privacy/%s_access_reasons", api_info[j].prop_name));
if (api_access != 0) { if (api_access != 0) {
strnew += "\t\t<dict>\n"; strnew += "\t\t<dict>\n";

View file

@ -1968,7 +1968,7 @@ CodeTextEditor::CodeTextEditor() {
zoom_button->set_accessibility_name(TTRC("Zoom Factor")); zoom_button->set_accessibility_name(TTRC("Zoom Factor"));
PopupMenu *zoom_menu = zoom_button->get_popup(); PopupMenu *zoom_menu = zoom_button->get_popup();
constexpr int preset_count = std::size(ZOOM_FACTOR_PRESETS); constexpr int preset_count = std_size(ZOOM_FACTOR_PRESETS);
for (int i = 0; i < preset_count; i++) { for (int i = 0; i < preset_count; i++) {
float z = ZOOM_FACTOR_PRESETS[i]; float z = ZOOM_FACTOR_PRESETS[i];

View file

@ -92,7 +92,7 @@ static FloatConstantDef float_constant_defs[] = {
{ "Sqrt2", Math::SQRT2, TTRC("Sqrt2 constant (1.414214). Square root of 2.") } { "Sqrt2", Math::SQRT2, TTRC("Sqrt2 constant (1.414214). Square root of 2.") }
}; };
constexpr int MAX_FLOAT_CONST_DEFS = std::size(float_constant_defs); constexpr int MAX_FLOAT_CONST_DEFS = std_size(float_constant_defs);
/////////////////// ///////////////////

View file

@ -159,7 +159,7 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
String noto_cjk_path; String noto_cjk_path;
String noto_cjk_bold_path; String noto_cjk_bold_path;
String var_suffix[] = { "HK", "KR", "SC", "TC", "JP" }; // Note: All Noto Sans CJK versions support all glyph variations, it should not match current locale. String var_suffix[] = { "HK", "KR", "SC", "TC", "JP" }; // Note: All Noto Sans CJK versions support all glyph variations, it should not match current locale.
for (size_t i = 0; i < std::size(var_suffix); i++) { for (size_t i = 0; i < std_size(var_suffix); i++) {
if (noto_cjk_path.is_empty()) { if (noto_cjk_path.is_empty()) {
noto_cjk_path = OS::get_singleton()->get_system_font_path("Noto Sans CJK " + var_suffix[i], 400, 100); noto_cjk_path = OS::get_singleton()->get_system_font_path("Noto Sans CJK " + var_suffix[i], 400, 100);
} }

View file

@ -222,7 +222,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
PNAME("navigation_3d/obstacles"), PNAME("navigation_3d/obstacles"),
#endif // NAVIGATION_3D_DISABLED #endif // NAVIGATION_3D_DISABLED
}; };
static_assert(std::size(names) == MONITOR_MAX); static_assert(std_size(names) == MONITOR_MAX);
return names[p_monitor]; return names[p_monitor];
} }

View file

@ -4241,7 +4241,7 @@ GDScriptParser::ParseRule *GDScriptParser::get_rule(GDScriptTokenizer::Token::Ty
}; };
/* clang-format on */ /* clang-format on */
// Avoid desync. // Avoid desync.
static_assert(std::size(rules) == GDScriptTokenizer::Token::TK_MAX, "Amount of parse rules don't match the amount of token types."); static_assert(std_size(rules) == GDScriptTokenizer::Token::TK_MAX, "Amount of parse rules don't match the amount of token types.");
// Let's assume this is never invalid, since nothing generates a TK_MAX. // Let's assume this is never invalid, since nothing generates a TK_MAX.
return &rules[p_token_type]; return &rules[p_token_type];

View file

@ -158,7 +158,7 @@ static const char *token_names[] = {
}; };
// Avoid desync. // Avoid desync.
static_assert(std::size(token_names) == GDScriptTokenizer::Token::TK_MAX, "Amount of token names don't match the amount of token types."); static_assert(std_size(token_names) == GDScriptTokenizer::Token::TK_MAX, "Amount of token names don't match the amount of token types.");
const char *GDScriptTokenizer::Token::get_name() const { const char *GDScriptTokenizer::Token::get_name() const {
ERR_FAIL_INDEX_V_MSG(type, TK_MAX, "<error>", "Using token type out of the enum."); ERR_FAIL_INDEX_V_MSG(type, TK_MAX, "<error>", "Using token type out of the enum.");

View file

@ -411,7 +411,7 @@ void (*type_init_function_table[])(Variant *) = {
&&OPCODE_LINE, \ &&OPCODE_LINE, \
&&OPCODE_END \ &&OPCODE_END \
}; \ }; \
static_assert(std::size(switch_table_ops) == (OPCODE_END + 1), "Opcodes in jump table aren't the same as opcodes in enum."); static_assert(std_size(switch_table_ops) == (OPCODE_END + 1), "Opcodes in jump table aren't the same as opcodes in enum.");
#define OPCODE(m_op) \ #define OPCODE(m_op) \
m_op: m_op:

View file

@ -248,7 +248,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
#endif #endif
}; };
static_assert(std::size(names) == WARNING_MAX, "Amount of warning types don't match the amount of warning names."); static_assert(std_size(names) == WARNING_MAX, "Amount of warning types don't match the amount of warning names.");
return names[(int)p_code]; return names[(int)p_code];
} }

View file

@ -155,7 +155,7 @@ public:
#endif #endif
}; };
static_assert(std::size(default_warning_levels) == WARNING_MAX, "Amount of default levels does not match the amount of warnings."); static_assert(std_size(default_warning_levels) == WARNING_MAX, "Amount of default levels does not match the amount of warnings.");
Code code = WARNING_MAX; Code code = WARNING_MAX;
int start_line = -1, end_line = -1; int start_line = -1, end_line = -1;

View file

@ -260,7 +260,7 @@ String _get_gles_tag() {
String _get_screen_sizes_tag(const Ref<EditorExportPreset> &p_preset) { String _get_screen_sizes_tag(const Ref<EditorExportPreset> &p_preset) {
String manifest_screen_sizes = " <supports-screens \n tools:node=\"replace\""; String manifest_screen_sizes = " <supports-screens \n tools:node=\"replace\"";
String sizes[] = { "small", "normal", "large", "xlarge" }; String sizes[] = { "small", "normal", "large", "xlarge" };
constexpr size_t num_sizes = std::size(sizes); constexpr size_t num_sizes = std_size(sizes);
for (size_t i = 0; i < num_sizes; i++) { for (size_t i = 0; i < num_sizes; i++) {
String feature_name = vformat("screen/support_%s", sizes[i]); String feature_name = vformat("screen/support_%s", sizes[i]);
String feature_support = bool_to_string(p_preset->get(feature_name)); String feature_support = bool_to_string(p_preset->get(feature_name));

View file

@ -95,7 +95,7 @@ void OS_LinuxBSD::alert(const String &p_alert, const String &p_title) {
String program; String program;
for (int i = 0; i < path_elems.size(); i++) { for (int i = 0; i < path_elems.size(); i++) {
for (uint64_t k = 0; k < std::size(message_programs); k++) { for (uint64_t k = 0; k < std_size(message_programs); k++) {
String tested_path = path_elems[i].path_join(message_programs[k]); String tested_path = path_elems[i].path_join(message_programs[k]);
if (FileAccess::exists(tested_path)) { if (FileAccess::exists(tested_path)) {
@ -777,7 +777,7 @@ Vector<String> OS_LinuxBSD::get_system_font_path_for_text(const String &p_font_n
Vector<String> ret; Vector<String> ret;
static const char *allowed_formats[] = { "TrueType", "CFF" }; static const char *allowed_formats[] = { "TrueType", "CFF" };
for (size_t i = 0; i < std::size(allowed_formats); i++) { for (size_t i = 0; i < std_size(allowed_formats); i++) {
FcPattern *pattern = FcPatternCreate(); FcPattern *pattern = FcPatternCreate();
if (pattern) { if (pattern) {
FcPatternAddBool(pattern, FC_SCALABLE, FcTrue); FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);

View file

@ -4200,7 +4200,7 @@ Atom DisplayServerX11::_process_selection_request_target(Atom p_target, Window p
32, 32,
PropModeReplace, PropModeReplace,
(unsigned char *)&data, (unsigned char *)&data,
std::size(data)); std_size(data));
return p_property; return p_property;
} else if (p_target == XInternAtom(x11_display, "SAVE_TARGETS", 0)) { } else if (p_target == XInternAtom(x11_display, "SAVE_TARGETS", 0)) {
// Request to check if SAVE_TARGETS is supported, nothing special to do. // Request to check if SAVE_TARGETS is supported, nothing special to do.

View file

@ -583,13 +583,13 @@ void EditorExportPlatformMacOS::get_export_options(List<ExportOption> *r_options
{ {
String hint; String hint;
for (uint64_t i = 0; i < std::size(data_collect_purpose_info); ++i) { for (uint64_t i = 0; i < std_size(data_collect_purpose_info); ++i) {
if (i != 0) { if (i != 0) {
hint += ","; hint += ",";
} }
hint += vformat("%s:%d", data_collect_purpose_info[i].prop_name, (1 << i)); hint += vformat("%s:%d", data_collect_purpose_info[i].prop_name, (1 << i));
} }
for (uint64_t i = 0; i < std::size(data_collect_type_info); ++i) { for (uint64_t i = 0; i < std_size(data_collect_type_info); ++i) {
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/collected", data_collect_type_info[i].prop_name)), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/collected", data_collect_type_info[i].prop_name)), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/linked_to_user", data_collect_type_info[i].prop_name)), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/linked_to_user", data_collect_type_info[i].prop_name)), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/used_for_tracking", data_collect_type_info[i].prop_name)), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, vformat("privacy/collected_data/%s/used_for_tracking", data_collect_type_info[i].prop_name)), false));
@ -693,7 +693,7 @@ void EditorExportPlatformMacOS::_make_icon(const Ref<EditorExportPreset> &p_pres
{ "is32", "s8mk", false, 16 } //16×16 24-bit RLE + 8-bit uncompressed mask { "is32", "s8mk", false, 16 } //16×16 24-bit RLE + 8-bit uncompressed mask
}; };
for (uint64_t i = 0; i < std::size(icon_infos); ++i) { for (uint64_t i = 0; i < std_size(icon_infos); ++i) {
Ref<Image> copy = p_icon->duplicate(); Ref<Image> copy = p_icon->duplicate();
copy->convert(Image::FORMAT_RGBA8); copy->convert(Image::FORMAT_RGBA8);
copy->resize(icon_infos[i].size, icon_infos[i].size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int())); copy->resize(icon_infos[i].size, icon_infos[i].size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int()));
@ -764,7 +764,7 @@ void EditorExportPlatformMacOS::_fix_privacy_manifest(const Ref<EditorExportPres
for (int i = 0; i < lines.size(); i++) { for (int i = 0; i < lines.size(); i++) {
if (lines[i].find("$priv_collection") != -1) { if (lines[i].find("$priv_collection") != -1) {
bool section_opened = false; bool section_opened = false;
for (uint64_t j = 0; j < std::size(data_collect_type_info); ++j) { for (uint64_t j = 0; j < std_size(data_collect_type_info); ++j) {
bool data_collected = p_preset->get(vformat("privacy/collected_data/%s/collected", data_collect_type_info[j].prop_name)); bool data_collected = p_preset->get(vformat("privacy/collected_data/%s/collected", data_collect_type_info[j].prop_name));
bool linked = p_preset->get(vformat("privacy/collected_data/%s/linked_to_user", data_collect_type_info[j].prop_name)); bool linked = p_preset->get(vformat("privacy/collected_data/%s/linked_to_user", data_collect_type_info[j].prop_name));
bool tracking = p_preset->get(vformat("privacy/collected_data/%s/used_for_tracking", data_collect_type_info[j].prop_name)); bool tracking = p_preset->get(vformat("privacy/collected_data/%s/used_for_tracking", data_collect_type_info[j].prop_name));
@ -793,7 +793,7 @@ void EditorExportPlatformMacOS::_fix_privacy_manifest(const Ref<EditorExportPres
if (purposes != 0) { if (purposes != 0) {
strnew += "\t\t\t\t<key>NSPrivacyCollectedDataTypePurposes</key>\n"; strnew += "\t\t\t\t<key>NSPrivacyCollectedDataTypePurposes</key>\n";
strnew += "\t\t\t\t<array>\n"; strnew += "\t\t\t\t<array>\n";
for (uint64_t k = 0; k < std::size(data_collect_purpose_info); ++k) { for (uint64_t k = 0; k < std_size(data_collect_purpose_info); ++k) {
if (purposes & (1 << k)) { if (purposes & (1 << k)) {
strnew += vformat("\t\t\t\t\t<string>%s</string>\n", data_collect_purpose_info[k].type_name); strnew += vformat("\t\t\t\t\t<string>%s</string>\n", data_collect_purpose_info[k].type_name);
} }

View file

@ -390,7 +390,7 @@ Key KeyMappingMacOS::remap_key(unsigned int p_key, unsigned int p_state, bool p_
LMGetKbdType(), LMGetKbdType(),
kUCKeyTranslateNoDeadKeysBit, kUCKeyTranslateNoDeadKeysBit,
&keys_down, &keys_down,
std::size(chars), std_size(chars),
&real_length, &real_length,
chars); chars);

View file

@ -43,7 +43,6 @@
#include <algorithm> #include <algorithm>
#include <csignal> #include <csignal>
#include <cstdlib> #include <cstdlib>
#include <iterator>
#include <string> #include <string>
#include <vector> #include <vector>

View file

@ -120,7 +120,7 @@ Error EditorExportPlatformWindows::_process_icon(const Ref<EditorExportPreset> &
Ref<Image> src_image = _load_icon_or_splash_image(p_src_path, &err); Ref<Image> src_image = _load_icon_or_splash_image(p_src_path, &err);
ERR_FAIL_COND_V(err != OK || src_image.is_null() || src_image->is_empty(), ERR_CANT_OPEN); ERR_FAIL_COND_V(err != OK || src_image.is_null() || src_image->is_empty(), ERR_CANT_OPEN);
for (size_t i = 0; i < std::size(icon_size); ++i) { for (size_t i = 0; i < std_size(icon_size); ++i) {
int size = (icon_size[i] == 0) ? 256 : icon_size[i]; int size = (icon_size[i] == 0) ? 256 : icon_size[i];
Ref<Image> res_image = src_image->duplicate(); Ref<Image> res_image = src_image->duplicate();
@ -131,7 +131,7 @@ Error EditorExportPlatformWindows::_process_icon(const Ref<EditorExportPreset> &
} }
uint16_t valid_icon_count = 0; uint16_t valid_icon_count = 0;
for (size_t i = 0; i < std::size(icon_size); ++i) { for (size_t i = 0; i < std_size(icon_size); ++i) {
if (images.has(icon_size[i])) { if (images.has(icon_size[i])) {
valid_icon_count++; valid_icon_count++;
} else { } else {
@ -153,7 +153,7 @@ Error EditorExportPlatformWindows::_process_icon(const Ref<EditorExportPreset> &
// Write ICONDIRENTRY. // Write ICONDIRENTRY.
uint32_t img_offset = 6 + 16 * valid_icon_count; uint32_t img_offset = 6 + 16 * valid_icon_count;
for (size_t i = 0; i < std::size(icon_size); ++i) { for (size_t i = 0; i < std_size(icon_size); ++i) {
if (images.has(icon_size[i])) { if (images.has(icon_size[i])) {
const IconData &di = images[icon_size[i]]; const IconData &di = images[icon_size[i]];
fw->store_8(icon_size[i]); // Width in pixels. fw->store_8(icon_size[i]); // Width in pixels.
@ -170,7 +170,7 @@ Error EditorExportPlatformWindows::_process_icon(const Ref<EditorExportPreset> &
} }
// Write image data. // Write image data.
for (size_t i = 0; i < std::size(icon_size); ++i) { for (size_t i = 0; i < std_size(icon_size); ++i) {
if (images.has(icon_size[i])) { if (images.has(icon_size[i])) {
const IconData &di = images[icon_size[i]]; const IconData &di = images[icon_size[i]];
fw->store_buffer(di.data.ptr(), di.data.size()); fw->store_buffer(di.data.ptr(), di.data.size());

View file

@ -851,7 +851,7 @@ bool OS_Windows::get_user_prefers_integrated_gpu() const {
GetCurrentApplicationUserModelIdPtr GetCurrentApplicationUserModelId = (GetCurrentApplicationUserModelIdPtr)(void *)GetProcAddress(kernel32, "GetCurrentApplicationUserModelId"); GetCurrentApplicationUserModelIdPtr GetCurrentApplicationUserModelId = (GetCurrentApplicationUserModelIdPtr)(void *)GetProcAddress(kernel32, "GetCurrentApplicationUserModelId");
if (GetCurrentApplicationUserModelId) { if (GetCurrentApplicationUserModelId) {
UINT32 length = std::size(value_name); UINT32 length = std_size(value_name);
LONG result = GetCurrentApplicationUserModelId(&length, value_name); LONG result = GetCurrentApplicationUserModelId(&length, value_name);
if (result == ERROR_SUCCESS) { if (result == ERROR_SUCCESS) {
is_packaged = true; is_packaged = true;

View file

@ -4190,7 +4190,7 @@ void Control::_bind_methods() {
StringBuilder builder; StringBuilder builder;
builder.append(TTRC("Custom")); builder.append(TTRC("Custom"));
builder.append(":-1"); builder.append(":-1");
for (size_t i = 0; i < std::size(anchors_presets); i++) { for (size_t i = 0; i < std_size(anchors_presets); i++) {
builder.append(","); builder.append(",");
builder.append(anchors_presets[i].name); builder.append(anchors_presets[i].name);
builder.append(":"); builder.append(":");

View file

@ -5282,7 +5282,7 @@ ShaderLanguage::DataType ShaderLanguage::get_scalar_type(DataType p_type) {
TYPE_VOID, TYPE_VOID,
}; };
static_assert(std::size(scalar_types) == TYPE_MAX); static_assert(std_size(scalar_types) == TYPE_MAX);
return scalar_types[p_type]; return scalar_types[p_type];
} }
@ -5324,7 +5324,7 @@ int ShaderLanguage::get_cardinality(DataType p_type) {
1, 1,
}; };
static_assert(std::size(cardinality_table) == TYPE_MAX); static_assert(std_size(cardinality_table) == TYPE_MAX);
return cardinality_table[p_type]; return cardinality_table[p_type];
} }
@ -11369,7 +11369,7 @@ Error ShaderLanguage::complete(const String &p_code, const ShaderCompileInfo &p_
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
// Adds context keywords. // Adds context keywords.
if (keyword_completion_context != CF_UNSPECIFIED) { if (keyword_completion_context != CF_UNSPECIFIED) {
constexpr int sz = std::size(keyword_list); constexpr int sz = std_size(keyword_list);
for (int i = 0; i < sz; i++) { for (int i = 0; i < sz; i++) {
if (keyword_list[i].flags == CF_UNSPECIFIED) { if (keyword_list[i].flags == CF_UNSPECIFIED) {
break; // Ignore hint keywords (parsed below). break; // Ignore hint keywords (parsed below).

View file

@ -97,7 +97,7 @@ String ShaderWarning::get_name_from_code(Code p_code) {
PNAME("MAGIC_POSITION_WRITE"), PNAME("MAGIC_POSITION_WRITE"),
}; };
static_assert(std::size(names) == WARNING_MAX, "Amount of warning types don't match the amount of warning names."); static_assert(std_size(names) == WARNING_MAX, "Amount of warning types don't match the amount of warning names.");
return names[(int)p_code]; return names[(int)p_code];
} }

View file

@ -1997,7 +1997,7 @@ TEST_CASE("[String] Is_*") {
static bool isflt[] = { true, true, true, false, true, true, false, false, false, false, false, false, false, true, true }; static bool isflt[] = { true, true, true, false, true, true, false, false, false, false, false, false, false, true, true };
static bool isaid[] = { false, false, false, false, false, false, false, false, true, true, false, false, false, false, false }; static bool isaid[] = { false, false, false, false, false, false, false, false, true, true, false, false, false, false, false };
static bool isuid[] = { false, false, false, false, false, false, false, false, true, true, false, false, true, false, false }; static bool isuid[] = { false, false, false, false, false, false, false, false, true, true, false, false, true, false, false };
for (unsigned int i = 0; i < std::size(data); i++) { for (unsigned int i = 0; i < std_size(data); i++) {
String s = String::utf8(data[i]); String s = String::utf8(data[i]);
CHECK(s.is_numeric() == isnum[i]); CHECK(s.is_numeric() == isnum[i]);
CHECK(s.is_valid_int() == isint[i]); CHECK(s.is_valid_int() == isint[i]);

View file

@ -220,7 +220,7 @@ TEST_CASE("[Vector] To byte array (variant call)") {
PackedInt32Array vector[] = { { 0, -1, 2008 }, {} }; PackedInt32Array vector[] = { { 0, -1, 2008 }, {} };
PackedByteArray out[] = { { /* 0 */ 0x00, 0x00, 0x00, 0x00, /* -1 */ 0xFF, 0xFF, 0xFF, 0xFF, /* 2008 */ 0xD8, 0x07, 0x00, 0x00 }, {} }; PackedByteArray out[] = { { /* 0 */ 0x00, 0x00, 0x00, 0x00, /* -1 */ 0xFF, 0xFF, 0xFF, 0xFF, /* 2008 */ 0xD8, 0x07, 0x00, 0x00 }, {} };
for (size_t i = 0; i < std::size(vector); i++) { for (size_t i = 0; i < std_size(vector); i++) {
Callable::CallError err; Callable::CallError err;
Variant v_ret; Variant v_ret;
Variant v_vector = vector[i]; Variant v_vector = vector[i];
@ -235,7 +235,7 @@ TEST_CASE("[Vector] To byte array (variant call)") {
PackedInt64Array vector[] = { { 0, -1, 2008 }, {} }; PackedInt64Array vector[] = { { 0, -1, 2008 }, {} };
PackedByteArray out[] = { { /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* -1 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 2008 */ 0xD8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, {} }; PackedByteArray out[] = { { /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* -1 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 2008 */ 0xD8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, {} };
for (size_t i = 0; i < std::size(vector); i++) { for (size_t i = 0; i < std_size(vector); i++) {
Callable::CallError err; Callable::CallError err;
Variant v_ret; Variant v_ret;
Variant v_vector = vector[i]; Variant v_vector = vector[i];
@ -250,7 +250,7 @@ TEST_CASE("[Vector] To byte array (variant call)") {
PackedFloat32Array vector[] = { { 0.0, -1.0, 200e24 }, {} }; PackedFloat32Array vector[] = { { 0.0, -1.0, 200e24 }, {} };
PackedByteArray out[] = { { /* 0.0 */ 0x00, 0x00, 0x00, 0x00, /* -1.0 */ 0x00, 0x00, 0x80, 0xBF, /* 200e24 */ 0xA6, 0x6F, 0x25, 0x6B }, {} }; PackedByteArray out[] = { { /* 0.0 */ 0x00, 0x00, 0x00, 0x00, /* -1.0 */ 0x00, 0x00, 0x80, 0xBF, /* 200e24 */ 0xA6, 0x6F, 0x25, 0x6B }, {} };
for (size_t i = 0; i < std::size(vector); i++) { for (size_t i = 0; i < std_size(vector); i++) {
Callable::CallError err; Callable::CallError err;
Variant v_ret; Variant v_ret;
Variant v_vector = vector[i]; Variant v_vector = vector[i];
@ -264,7 +264,7 @@ TEST_CASE("[Vector] To byte array (variant call)") {
PackedFloat64Array vector[] = { { 0.0, -1.0, 200e24 }, {} }; PackedFloat64Array vector[] = { { 0.0, -1.0, 200e24 }, {} };
PackedByteArray out[] = { { /* 0.0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* -1.0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xBF, /* 200e24 */ 0x35, 0x03, 0x32, 0xB7, 0xF4, 0xAD, 0x64, 0x45 }, {} }; PackedByteArray out[] = { { /* 0.0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* -1.0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xBF, /* 200e24 */ 0x35, 0x03, 0x32, 0xB7, 0xF4, 0xAD, 0x64, 0x45 }, {} };
for (size_t i = 0; i < std::size(vector); i++) { for (size_t i = 0; i < std_size(vector); i++) {
Callable::CallError err; Callable::CallError err;
Variant v_ret; Variant v_ret;
Variant v_vector = vector[i]; Variant v_vector = vector[i];
@ -279,7 +279,7 @@ TEST_CASE("[Vector] To byte array (variant call)") {
PackedStringArray vector[] = { { "test", "string" }, {}, { "", "test" } }; PackedStringArray vector[] = { { "test", "string" }, {}, { "", "test" } };
PackedByteArray out[] = { { /* test */ 0x74, 0x65, 0x73, 0x74, /* null */ 0x00, /* string */ 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67, /* null */ 0x00 }, {}, { /* null */ 0x00, /* test */ 0x74, 0x65, 0x73, 0x74, /* null */ 0x00 } }; PackedByteArray out[] = { { /* test */ 0x74, 0x65, 0x73, 0x74, /* null */ 0x00, /* string */ 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67, /* null */ 0x00 }, {}, { /* null */ 0x00, /* test */ 0x74, 0x65, 0x73, 0x74, /* null */ 0x00 } };
for (size_t i = 0; i < std::size(vector); i++) { for (size_t i = 0; i < std_size(vector); i++) {
Callable::CallError err; Callable::CallError err;
Variant v_ret; Variant v_ret;
Variant v_vector = vector[i]; Variant v_vector = vector[i];
@ -298,7 +298,7 @@ TEST_CASE("[Vector] To byte array (variant call)") {
PackedByteArray out[] = { { /* X=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Y=0.0 */ 0x00, 0x00, 0x00, 0x00, /* X=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* Y=-1.0 */ 0x00, 0x00, 0x80, 0xBF }, {} }; PackedByteArray out[] = { { /* X=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Y=0.0 */ 0x00, 0x00, 0x00, 0x00, /* X=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* Y=-1.0 */ 0x00, 0x00, 0x80, 0xBF }, {} };
#endif #endif
for (size_t i = 0; i < std::size(vector); i++) { for (size_t i = 0; i < std_size(vector); i++) {
Callable::CallError err; Callable::CallError err;
Variant v_ret; Variant v_ret;
Variant v_vector = vector[i]; Variant v_vector = vector[i];
@ -317,7 +317,7 @@ TEST_CASE("[Vector] To byte array (variant call)") {
PackedByteArray out[] = { { /* X=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Y=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Z=0.0 */ 0x00, 0x00, 0x00, 0x00, /* X=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* Y=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* Z=-1.0 */ 0x00, 0x00, 0x80, 0xBF }, {} }; PackedByteArray out[] = { { /* X=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Y=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Z=0.0 */ 0x00, 0x00, 0x00, 0x00, /* X=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* Y=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* Z=-1.0 */ 0x00, 0x00, 0x80, 0xBF }, {} };
#endif #endif
for (size_t i = 0; i < std::size(vector); i++) { for (size_t i = 0; i < std_size(vector); i++) {
Callable::CallError err; Callable::CallError err;
Variant v_ret; Variant v_ret;
Variant v_vector = vector[i]; Variant v_vector = vector[i];
@ -332,7 +332,7 @@ TEST_CASE("[Vector] To byte array (variant call)") {
PackedColorArray vector[] = { { Color(), Color(1, 1, 1) }, {} }; PackedColorArray vector[] = { { Color(), Color(1, 1, 1) }, {} };
PackedByteArray out[] = { { /* R=0.0 */ 0x00, 0x00, 0x00, 0x00, /* G=0.0 */ 0x00, 0x00, 0x00, 0x00, /* B=0.0 */ 0x00, 0x00, 0x00, 0x00, /* A=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* R=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* G=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* B=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* A=1.0 */ 0x00, 0x00, 0x80, 0x3F }, {} }; PackedByteArray out[] = { { /* R=0.0 */ 0x00, 0x00, 0x00, 0x00, /* G=0.0 */ 0x00, 0x00, 0x00, 0x00, /* B=0.0 */ 0x00, 0x00, 0x00, 0x00, /* A=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* R=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* G=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* B=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* A=1.0 */ 0x00, 0x00, 0x80, 0x3F }, {} };
for (size_t i = 0; i < std::size(vector); i++) { for (size_t i = 0; i < std_size(vector); i++) {
Callable::CallError err; Callable::CallError err;
Variant v_ret; Variant v_ret;
Variant v_vector = vector[i]; Variant v_vector = vector[i];
@ -351,7 +351,7 @@ TEST_CASE("[Vector] To byte array (variant call)") {
PackedByteArray out[] = { { /* X=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Y=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Z=0.0 */ 0x00, 0x00, 0x00, 0x00, /* W 0.0 */ 0x00, 0x00, 0x00, 0x00, /* X 1.0 */ 0x00, 0x00, 0x80, 0x3F, /* Y=-1.0 */ 0x00, 0x00, 0x80, 0xBF, /* Z=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* W=-1.0 */ 0x00, 0x00, 0x80, 0xBF }, {} }; PackedByteArray out[] = { { /* X=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Y=0.0 */ 0x00, 0x00, 0x00, 0x00, /* Z=0.0 */ 0x00, 0x00, 0x00, 0x00, /* W 0.0 */ 0x00, 0x00, 0x00, 0x00, /* X 1.0 */ 0x00, 0x00, 0x80, 0x3F, /* Y=-1.0 */ 0x00, 0x00, 0x80, 0xBF, /* Z=1.0 */ 0x00, 0x00, 0x80, 0x3F, /* W=-1.0 */ 0x00, 0x00, 0x80, 0xBF }, {} };
#endif #endif
for (size_t i = 0; i < std::size(vector); i++) { for (size_t i = 0; i < std_size(vector); i++) {
Callable::CallError err; Callable::CallError err;
Variant v_ret; Variant v_ret;
Variant v_vector = vector[i]; Variant v_vector = vector[i];

View file

@ -59,8 +59,8 @@ PackedByteArray raw_to_pba(const uint8_t *arr, size_t len) {
TEST_CASE("[Crypto] PackedByteArray constant time compare") { TEST_CASE("[Crypto] PackedByteArray constant time compare") {
const uint8_t hm1[] = { 144, 140, 176, 38, 88, 113, 101, 45, 71, 105, 10, 91, 248, 16, 117, 244, 189, 30, 238, 29, 219, 134, 82, 130, 212, 114, 161, 166, 188, 169, 200, 106 }; const uint8_t hm1[] = { 144, 140, 176, 38, 88, 113, 101, 45, 71, 105, 10, 91, 248, 16, 117, 244, 189, 30, 238, 29, 219, 134, 82, 130, 212, 114, 161, 166, 188, 169, 200, 106 };
const uint8_t hm2[] = { 80, 30, 144, 228, 108, 38, 188, 125, 150, 64, 165, 127, 221, 118, 144, 232, 45, 100, 15, 248, 193, 244, 245, 34, 116, 147, 132, 200, 110, 27, 38, 75 }; const uint8_t hm2[] = { 80, 30, 144, 228, 108, 38, 188, 125, 150, 64, 165, 127, 221, 118, 144, 232, 45, 100, 15, 248, 193, 244, 245, 34, 116, 147, 132, 200, 110, 27, 38, 75 };
PackedByteArray p1 = raw_to_pba(hm1, std::size(hm1)); PackedByteArray p1 = raw_to_pba(hm1, std_size(hm1));
PackedByteArray p2 = raw_to_pba(hm2, std::size(hm2)); PackedByteArray p2 = raw_to_pba(hm2, std_size(hm2));
_MockCrypto crypto; _MockCrypto crypto;
bool equal = crypto.constant_time_compare(p1, p1); bool equal = crypto.constant_time_compare(p1, p1);
CHECK(equal); CHECK(equal);

View file

@ -497,7 +497,7 @@ TEST_SUITE("[TextServer]") {
{ U"test\r test", { 0, 5, 5, 10 } }, { U"test\r test", { 0, 5, 5, 10 } },
{ U"test\r test \r test", { 0, 5, 5, 12, 12, 17 } }, { U"test\r test \r test", { 0, 5, 5, 12, 12, 17 } },
}; };
for (size_t j = 0; j < std::size(cases); j++) { for (size_t j = 0; j < std_size(cases); j++) {
RID ctx = ts->create_shaped_text(); RID ctx = ts->create_shaped_text();
CHECK_FALSE_MESSAGE(ctx == RID(), "Creating text buffer failed."); CHECK_FALSE_MESSAGE(ctx == RID(), "Creating text buffer failed.");
bool ok = ts->shaped_text_add_string(ctx, cases[j].text, font, 16); bool ok = ts->shaped_text_add_string(ctx, cases[j].text, font, 16);