From 8d6a554d7502029f04aca33efcdd004744b9bd84 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 09:47:05 +0000 Subject: - 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. --- source/blender/python/generic/py_capi_utils.c | 4 ++-- source/blender/python/intern/bpy_interface.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/python') diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index e658532db24..575495e186e 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -30,7 +30,7 @@ #include "py_capi_utils.h" -#include "BKE_font.h" /* only for utf8towchar, should replace with py funcs but too late in release now */ +#include "BLI_string_utf8.h" /* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */ #ifdef _WIN32 /* BLI_setenv */ #include "BLI_path_util.h" @@ -478,7 +478,7 @@ void PyC_SetHomePath(const char *py_path_bundle) /* cant use this, on linux gives bug: #23018, TODO: try LANG="en_US.UTF-8" /usr/bin/blender, suggested 22008 */ /* mbstowcs(py_path_bundle_wchar, py_path_bundle, FILE_MAXDIR); */ - utf8towchar(py_path_bundle_wchar, py_path_bundle); + BLI_strncpy_wchar_from_utf8(py_path_bundle_wchar, py_path_bundle, sizeof(py_path_bundle_wchar) / sizeof(wchar_t)); Py_SetPythonHome(py_path_bundle_wchar); // printf("found python (wchar_t) '%ls'\n", py_path_bundle_wchar); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index aaa813137c6..ddbd557375c 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -52,12 +52,12 @@ #include "BLI_path_util.h" #include "BLI_math_base.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_text.h" -#include "BKE_font.h" /* only for utf8towchar */ #include "BKE_main.h" #include "BKE_global.h" /* only for script checking */ @@ -194,7 +194,7 @@ void BPY_python_start(int argc, const char **argv) /* not essential but nice to set our name */ static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */ - utf8towchar(bprogname_wchar, bprogname); + BLI_strncpy_wchar_from_utf8(bprogname_wchar, bprogname, sizeof(bprogname_wchar) / sizeof(wchar_t)); Py_SetProgramName(bprogname_wchar); /* must run before python initializes */ -- cgit v1.2.3