X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSUITApp%2FSUITApp_init_python.cxx;h=3724dd562f3ecacc73f235f0909820712faed73c;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=7f5d7021c615fdec6cdc78e318dec148ba076a59;hpb=b9116a1142083f73047cf93f4c97447e5656a1d2;p=modules%2Fgui.git diff --git a/src/SUITApp/SUITApp_init_python.cxx b/src/SUITApp/SUITApp_init_python.cxx index 7f5d7021c..3724dd562 100644 --- a/src/SUITApp/SUITApp_init_python.cxx +++ b/src/SUITApp/SUITApp_init_python.cxx @@ -24,31 +24,15 @@ #include #if PY_VERSION_HEX < 0x03050000 +static char* +Py_EncodeLocale(const wchar_t *arg, size_t *size) +{ + return _Py_wchar2char(arg, size); +} static wchar_t* Py_DecodeLocale(const char *arg, size_t *size) { - wchar_t *res; - unsigned char *in; - wchar_t *out; - size_t argsize = strlen(arg) + 1; - - if (argsize > PY_SSIZE_T_MAX/sizeof(wchar_t)) - return NULL; - res = (wchar_t*) PyMem_RawMalloc(argsize*sizeof(wchar_t)); - if (!res) - return NULL; - - in = (unsigned char*)arg; - out = res; - while(*in) - if(*in < 128) - *out++ = *in++; - else - *out++ = 0xdc00 + *in++; - *out = 0; - if (size != NULL) - *size = out - res; - return res; + return _Py_char2wchar(arg, size); } #endif