diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-11-22 18:26:54 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-11-22 18:27:34 +0300 |
commit | 177dfc6384b926dd19e3b7e98a995ccb4da9167c (patch) | |
tree | 865abe9f707bee039a506bfc17cb4cff218bd6c6 /source/blender/editors/curve/editfont_undo.c | |
parent | 1304cee920c5f01fd9f0474ea782db61ac031403 (diff) |
Fix T71273: Bad encoding of utf-8 for Text objects
`BLI_strncpy_wchar_from_utf8` internally assumes `wchar_t` is 32 bits
which is not the case on windows.
The solution is to replace `wchar_t` with `char32_t`.
Thanks to @robbott for compatibility on macOS.
Differential Revision: https://developer.blender.org/D6198
Diffstat (limited to 'source/blender/editors/curve/editfont_undo.c')
-rw-r--r-- | source/blender/editors/curve/editfont_undo.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/curve/editfont_undo.c b/source/blender/editors/curve/editfont_undo.c index 26c0e5cf6c9..f00c4731b0f 100644 --- a/source/blender/editors/curve/editfont_undo.c +++ b/source/blender/editors/curve/editfont_undo.c @@ -20,7 +20,6 @@ #include <stdlib.h> #include <string.h> -#include <wchar.h> #include "MEM_guardedalloc.h" @@ -58,7 +57,7 @@ * \{ */ typedef struct UndoFont { - wchar_t *textbuf; + char32_t *textbuf; struct CharInfo *textbufinfo; int len, pos, selstart, selend; @@ -233,7 +232,7 @@ static void undofont_to_editfont(UndoFont *uf, Curve *cu) uf_arraystore_expand(uf); #endif - final_size = sizeof(wchar_t) * (uf->len + 1); + final_size = sizeof(*ef->textbuf) * (uf->len + 1); memcpy(ef->textbuf, uf->textbuf, final_size); final_size = sizeof(CharInfo) * (uf->len + 1); @@ -259,7 +258,8 @@ static void *undofont_from_editfont(UndoFont *uf, Curve *cu) size_t final_size; - final_size = sizeof(wchar_t) * (ef->len + 1); + BLI_assert(sizeof(*uf->textbuf) == sizeof(*ef->textbuf)); + final_size = sizeof(*uf->textbuf) * (ef->len + 1); uf->textbuf = MEM_mallocN(final_size, __func__); memcpy(uf->textbuf, ef->textbuf, final_size); |