GDExtension: change to_string signature to accept GDNativeStringPtr instead of returning const char*

This commit is contained in:
Jan Haller 2022-03-27 21:31:00 +02:00
parent a5eed70fa2
commit f88bdac403
2 changed files with 4 additions and 2 deletions

View File

@ -208,7 +208,7 @@ typedef struct {
typedef const GDNativePropertyInfo *(*GDNativeExtensionClassGetPropertyList)(GDExtensionClassInstancePtr p_instance, uint32_t *r_count);
typedef void (*GDNativeExtensionClassFreePropertyList)(GDExtensionClassInstancePtr p_instance, const GDNativePropertyInfo *p_list);
typedef void (*GDNativeExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what);
typedef const char *(*GDNativeExtensionClassToString)(GDExtensionClassInstancePtr p_instance);
typedef void (*GDNativeExtensionClassToString)(GDExtensionClassInstancePtr p_instance, GDNativeStringPtr p_out);
typedef void (*GDNativeExtensionClassReference)(GDExtensionClassInstancePtr p_instance);
typedef void (*GDNativeExtensionClassUnreference)(GDExtensionClassInstancePtr p_instance);
typedef void (*GDNativeExtensionClassCallVirtual)(GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret);

View File

@ -865,7 +865,9 @@ String Object::to_string() {
}
}
if (_extension && _extension->to_string) {
return _extension->to_string(_extension_instance);
String ret;
_extension->to_string(_extension_instance, &ret);
return ret;
}
return "[" + get_class() + ":" + itos(get_instance_id()) + "]";
}