[Bf-blender-cvs] [19c7b5f45a5] master: Fix error using 'char32_t' as 'wchar_t' on windows

Harley Acheson noreply at git.blender.org
Mon Jun 22 09:14:34 CEST 2020


Commit: 19c7b5f45a515df84337adf90dbce790b14f503a
Author: Harley Acheson
Date:   Mon Jun 22 17:10:50 2020 +1000
Branches: master
https://developer.blender.org/rB19c7b5f45a515df84337adf90dbce790b14f503a

Fix error using 'char32_t' as 'wchar_t' on windows

FONT_OT_text_insert failed on Windows.

This change was missing from D6198.

===================================================================

M	source/blender/editors/curve/editfont.c

===================================================================

diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index dc5dc71106f..000b05e7a31 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1635,7 +1635,7 @@ static int insert_text_exec(bContext *C, wmOperator *op)
 {
   Object *obedit = CTX_data_edit_object(C);
   char *inserted_utf8;
-  wchar_t *inserted_text;
+  char32_t *inserted_text;
   int a, len;
 
   if (!RNA_struct_property_is_set(op->ptr, "text")) {
@@ -1645,8 +1645,8 @@ static int insert_text_exec(bContext *C, wmOperator *op)
   inserted_utf8 = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
   len = BLI_strlen_utf8(inserted_utf8);
 
-  inserted_text = MEM_callocN(sizeof(wchar_t) * (len + 1), "FONT_insert_text");
-  BLI_strncpy_wchar_from_utf8(inserted_text, inserted_utf8, len + 1);
+  inserted_text = MEM_callocN(sizeof(char32_t) * (len + 1), "FONT_insert_text");
+  len = BLI_str_utf8_as_utf32(inserted_text, inserted_utf8, MAXTEXT);
 
   for (a = 0; a < len; a++) {
     insert_into_textbuf(obedit, inserted_text[a]);



More information about the Bf-blender-cvs mailing list