mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
wchar_t might not be two bytes wide
This commit is contained in:
parent
a2009c81cb
commit
3804f89682
@ -2062,15 +2062,18 @@ void InterfaceMakerPythonNative::write_function_instance(ostream &out, Interface
|
|||||||
parameter_list += ", &" + param_name;
|
parameter_list += ", &" + param_name;
|
||||||
|
|
||||||
} else if (TypeManager::is_wstring(orig_type)) {
|
} else if (TypeManager::is_wstring(orig_type)) {
|
||||||
indent(out,indent_level) << "Py_UNICODE *" << param_name
|
indent(out,indent_level) << "PyUnicodeObject *" << param_name << "\n";
|
||||||
<< "_str; int " << param_name << "_len";
|
format_specifiers += "U";
|
||||||
format_specifiers += "u#";
|
parameter_list += ", &" + param_name;
|
||||||
parameter_list += ", &" + param_name
|
|
||||||
+ "_str, &" + param_name + "_len";
|
extra_convert += " int " + param_name + "_len = PyUnicode_GetSize((PyObject *)" + param_name + "); wchar_t *" + param_name + "_str = new wchar_t[" + param_name + "_len]; PyUnicode_AsWideChar(" + param_name + ", " + param_name + "_str, " + param_name + "_len);";
|
||||||
|
|
||||||
pexpr_string = "basic_string<wchar_t>((wchar_t *)" +
|
pexpr_string = "basic_string<wchar_t>((wchar_t *)" +
|
||||||
param_name + "_str, " +
|
param_name + "_str, " +
|
||||||
param_name + "_len)";
|
param_name + "_len)";
|
||||||
|
|
||||||
|
extra_cleanup += " delete[] " + param_name + "_str;";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
indent(out,indent_level) << "char *" << param_name
|
indent(out,indent_level) << "char *" << param_name
|
||||||
<< "_str; int " << param_name << "_len";
|
<< "_str; int " << param_name << "_len";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user