mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Merge commit godotengine/godot@6a6a1168a5
This commit is contained in:
@@ -45,8 +45,6 @@
|
||||
#include "core/variant/variant.h"
|
||||
#include "core/version.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
class CallableCustomExtension : public CallableCustom {
|
||||
void *userdata;
|
||||
void *token;
|
||||
@@ -919,8 +917,9 @@ static void gdextension_string_new_with_wide_chars(GDExtensionUninitializedStrin
|
||||
}
|
||||
|
||||
static void gdextension_string_new_with_latin1_chars_and_len(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size) {
|
||||
const size_t string_length = p_contents ? (p_size < 0 ? strlen(p_contents) : strnlen(p_contents, p_size)) : 0;
|
||||
String *dest = memnew_placement(r_dest, String);
|
||||
dest->append_latin1(Span(p_contents, p_contents ? _strlen_clipped(p_contents, p_size) : 0));
|
||||
dest->append_latin1(Span(p_contents, string_length));
|
||||
}
|
||||
|
||||
static void gdextension_string_new_with_utf8_chars_and_len(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size) {
|
||||
@@ -944,8 +943,9 @@ static GDExtensionInt gdextension_string_new_with_utf16_chars_and_len2(GDExtensi
|
||||
}
|
||||
|
||||
static void gdextension_string_new_with_utf32_chars_and_len(GDExtensionUninitializedStringPtr r_dest, const char32_t *p_contents, GDExtensionInt p_char_count) {
|
||||
const size_t string_length = p_contents ? (p_char_count < 0 ? strlen(p_contents) : strnlen(p_contents, p_char_count)) : 0;
|
||||
String *string = memnew_placement(r_dest, String);
|
||||
string->append_utf32(Span(p_contents, p_contents ? _strlen_clipped(p_contents, p_char_count) : 0));
|
||||
string->append_utf32(Span(p_contents, string_length));
|
||||
}
|
||||
|
||||
static void gdextension_string_new_with_wide_chars_and_len(GDExtensionUninitializedStringPtr r_dest, const wchar_t *p_contents, GDExtensionInt p_char_count) {
|
||||
@@ -955,8 +955,9 @@ static void gdextension_string_new_with_wide_chars_and_len(GDExtensionUninitiali
|
||||
dest->append_utf16((const char16_t *)p_contents, p_char_count);
|
||||
} else {
|
||||
// wchar_t is 32 bit (UTF-32).
|
||||
const size_t string_length = p_contents ? (p_char_count < 0 ? strlen(p_contents) : strnlen((const char32_t *)p_contents, p_char_count)) : 0;
|
||||
String *string = memnew_placement(r_dest, String);
|
||||
string->append_utf32(Span((const char32_t *)p_contents, p_contents ? _strlen_clipped((const char32_t *)p_contents, p_char_count) : 0));
|
||||
string->append_utf32(Span((const char32_t *)p_contents, string_length));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,15 +36,16 @@
|
||||
* Together with the JSON file, you should be able to generate any binder.
|
||||
*/
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef uint32_t char32_t;
|
||||
typedef uint16_t char16_t;
|
||||
#endif
|
||||
#else
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user