Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-20 13:47:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-20 13:47:05 +0400
commit8d6a554d7502029f04aca33efcdd004744b9bd84 (patch)
tree027f5dec3ea38784d3108f8d9b5c4a008bae7fb4 /source/blender/editors
parente02dfe4a79b3632b3143d5d45e0dee1463ff7aa6 (diff)
- add BLI_string_utf8.h for unicode functions.
- move font.c unicode functions into string_utf8.c and rename to fit with other BLI_string funcs.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/curve/editfont.c14
-rw-r--r--source/blender/editors/interface/interface_anim.c1
-rw-r--r--source/blender/editors/interface/interface_draw.c4
-rw-r--r--source/blender/editors/interface/interface_templates.c1
-rw-r--r--source/blender/editors/space_file/fsmenu.c1
5 files changed, 10 insertions, 11 deletions
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 60b1cc8f5cd..03e226e3a75 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -221,13 +221,13 @@ static void update_string(Curve *cu)
MEM_freeN(cu->str);
// Calculate the actual string length in UTF-8 variable characters
- len = wcsleninu8(ef->textbuf);
+ len = BLI_wstrlen_utf8(ef->textbuf);
// Alloc memory for UTF-8 variable char length string
cu->str = MEM_callocN(len + sizeof(wchar_t), "str");
// Copy the wchar to UTF-8
- wcs2utf8s(cu->str, ef->textbuf);
+ BLI_strncpy_wchar_as_utf8(cu->str, ef->textbuf, len + 1);
}
static int insert_into_textbuf(Object *obedit, uintptr_t c)
@@ -373,7 +373,7 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename)
if(cu->len+filelen<MAXTEXT) {
int tmplen;
wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
- tmplen = utf8towchar(mem, strp);
+ tmplen = BLI_strncpy_wchar_from_utf8(mem, strp, filelen + 1);
wcscat(ef->textbuf, mem);
MEM_freeN(mem);
cu->len += tmplen;
@@ -1241,10 +1241,10 @@ static int insert_text_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
inserted_utf8= RNA_string_get_alloc(op->ptr, "text", NULL, 0);
- len= strlen(inserted_utf8);
+ len= BLI_strlen_utf8(inserted_utf8);
inserted_text= MEM_callocN(sizeof(wchar_t)*(len+1), "FONT_insert_text");
- utf8towchar(inserted_text, inserted_utf8);
+ BLI_strncpy_wchar_from_utf8(inserted_text, inserted_utf8, len+1);
for(a=0; a<len; a++)
insert_into_textbuf(obedit, inserted_text[a]);
@@ -1348,7 +1348,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
/* store as utf8 in RNA string */
char inserted_utf8[8] = {0};
- wcs2utf8s(inserted_utf8, inserted_text);
+ BLI_strncpy_wchar_as_utf8(inserted_utf8, inserted_text, sizeof(inserted_utf8));
RNA_string_set(op->ptr, "text", inserted_utf8);
}
@@ -1478,7 +1478,7 @@ void make_editText(Object *obedit)
}
// Convert the original text to wchar_t
- utf8towchar(ef->textbuf, cu->str);
+ BLI_strncpy_wchar_from_utf8(ef->textbuf, cu->str, MAXTEXT+4); /* length is bogus */
wcscpy(ef->oldstr, ef->textbuf);
cu->len= wcslen(ef->textbuf);
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 545d60bfcb9..aeb8ad99dd2 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -38,6 +38,7 @@
#include "BLI_listbase.h"
#include "BLI_string.h"
+#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index a40900fb39b..aefe773fdad 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -600,13 +600,13 @@ static void ui_draw_but_CHARTAB(uiBut *but)
wstr[0] = cs;
if(strcmp(G.selfont->name, FO_BUILTIN_NAME))
{
- wcs2utf8s((char *)ustr, (wchar_t *)wstr);
+ BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr));
}
else
{
if(G.ui_international == TRUE)
{
- wcs2utf8s((char *)ustr, (wchar_t *)wstr);
+ BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr));
}
else
{
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 77a25307651..0375345afcc 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -38,7 +38,6 @@
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
-#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index aa2ea124fe0..bd9a38ab27e 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -44,7 +44,6 @@
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_dynstr.h"
-#include "BLI_string.h"
#ifdef WIN32
#include <windows.h> /* need to include windows.h so _WIN32_IE is defined */