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>2009-09-02 07:14:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-09-02 07:14:38 +0400
commita0229b21cb5cfc6e263cc2396d5b1e8530d9d38d (patch)
tree1f1c5e6401d0fe14458db6762886ba31fe1129f8 /source/gameengine/Expressions/PyObjectPlus.cpp
parent32b2b1f544661f6dee4a81428b562fe7a3bc3f13 (diff)
text display (debug info) in the game engine working again & other minor changes.
Diffstat (limited to 'source/gameengine/Expressions/PyObjectPlus.cpp')
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 99c943d4f24..1d1d9e6103b 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -751,16 +751,17 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
STR_String *var = reinterpret_cast<STR_String*>(ptr);
if (PyUnicode_Check(value))
{
- char *val = _PyUnicode_AsString(value);
+ Py_ssize_t val_len;
+ char *val = _PyUnicode_AsStringAndSize(value, &val_len);
if (attrdef->m_clamp)
{
- if (strlen(val) < attrdef->m_imin)
+ if (val_len < attrdef->m_imin)
{
// can't increase the length of the string
PyErr_Format(PyExc_ValueError, "string length too short for attribute \"%s\"", attrdef->m_name);
goto FREE_AND_ERROR;
}
- else if (strlen(val) > attrdef->m_imax)
+ else if (val_len > attrdef->m_imax)
{
// trim the string
char c = val[attrdef->m_imax];
@@ -769,7 +770,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
val[attrdef->m_imax] = c;
break;
}
- } else if (strlen(val) < attrdef->m_imin || strlen(val) > attrdef->m_imax)
+ } else if (val_len < attrdef->m_imin || val_len > attrdef->m_imax)
{
PyErr_Format(PyExc_ValueError, "string length out of range for attribute \"%s\"", attrdef->m_name);
goto FREE_AND_ERROR;