@@ -905,7 +905,7 @@ static void gdextension_string_new_with_wide_chars(GDExtensionUninitializedStrin
905
905
906
906
static void gdextension_string_new_with_latin1_chars_and_len (GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size) {
907
907
String *dest = memnew_placement (r_dest, String);
908
- dest->append_latin1 (Span (p_contents, p_contents ? _strlen_clipped (p_contents, p_size) : 0 ));
908
+ dest->append_latin1 (Span (p_contents, p_contents ? strnlen (p_contents, p_size) : 0 ));
909
909
}
910
910
911
911
static void gdextension_string_new_with_utf8_chars_and_len (GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size) {
@@ -930,7 +930,7 @@ static GDExtensionInt gdextension_string_new_with_utf16_chars_and_len2(GDExtensi
930
930
931
931
static void gdextension_string_new_with_utf32_chars_and_len (GDExtensionUninitializedStringPtr r_dest, const char32_t *p_contents, GDExtensionInt p_char_count) {
932
932
String *string = memnew_placement (r_dest, String);
933
- string->append_utf32 (Span (p_contents, p_contents ? _strlen_clipped (p_contents, p_char_count) : 0 ));
933
+ string->append_utf32 (Span (p_contents, p_contents ? strnlen (p_contents, p_char_count) : 0 ));
934
934
}
935
935
936
936
static void gdextension_string_new_with_wide_chars_and_len (GDExtensionUninitializedStringPtr r_dest, const wchar_t *p_contents, GDExtensionInt p_char_count) {
@@ -941,7 +941,7 @@ static void gdextension_string_new_with_wide_chars_and_len(GDExtensionUninitiali
941
941
} else {
942
942
// wchar_t is 32 bit (UTF-32).
943
943
String *string = memnew_placement (r_dest, String);
944
- string->append_utf32 (Span ((const char32_t *)p_contents, p_contents ? _strlen_clipped ((const char32_t *)p_contents, p_char_count) : 0 ));
944
+ string->append_utf32 (Span ((const char32_t *)p_contents, p_contents ? strnlen ((const char32_t *)p_contents, p_char_count) : 0 ));
945
945
}
946
946
}
947
947
0 commit comments