diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-23 17:52:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-23 17:52:51 +0400 |
commit | e89107927bcc8297c74f9a8cb10562e6defc867c (patch) | |
tree | 7925d6bba50b803ab1ff5080e9b44b2e98a3059f /source/blender/blenlib/intern | |
parent | 66ef02aaa332039c2338bd4680aba34c748fb319 (diff) |
- fix for error with utf8 textinput for buttons
- ensure input is valid utf8 from ghost and NULL then complain if its not.
- added function to get utf8 size BLI_str_utf8_size()
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/string_utf8.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index b1ad04eb70d..b4c58d3bab4 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -312,6 +312,18 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size } +/* uses glib functions but not from glib */ +/* gets the size of a single utf8 char */ +int BLI_str_utf8_size(const char *p) +{ + int mask = 0, len; + unsigned char c = (unsigned char) *p; + + UTF8_COMPUTE (c, mask, len); + + return len; +} + /* was g_utf8_get_char */ /** * BLI_str_utf8_as_unicode: |