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:
Diffstat (limited to 'source/gameengine/Expressions')
-rw-r--r--source/gameengine/Expressions/IntValue.cpp5
-rw-r--r--source/gameengine/Expressions/ListValue.cpp10
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp28
3 files changed, 20 insertions, 23 deletions
diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp
index 0261a4a2d02..2cacea98467 100644
--- a/source/gameengine/Expressions/IntValue.cpp
+++ b/source/gameengine/Expressions/IntValue.cpp
@@ -323,9 +323,6 @@ void CIntValue::SetValue(CValue* newval)
#ifdef WITH_PYTHON
PyObject *CIntValue::ConvertValueToPython()
{
- if ((m_int > INT_MIN) && (m_int < INT_MAX))
- return PyLong_FromSsize_t(m_int);
- else
- return PyLong_FromLongLong(m_int);
+ return PyLong_FromLongLong(m_int);
}
#endif // WITH_PYTHON
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index 8cff5a01c0e..5f97b03fed4 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -365,7 +365,7 @@ static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *key)
}
}
else if (PyIndex_Check(key)) {
- int index = PyLong_AsSsize_t(key);
+ Py_ssize_t index = PyLong_AsSsize_t(key);
return listvalue_buffer_item(self, index); /* wont add a ref */
}
else if (PySlice_Check(key)) {
@@ -602,10 +602,10 @@ PyObject *CListValue::Pyindex(PyObject *value)
int numelem = GetCount();
for (int i=0;i<numelem;i++)
{
- CValue* elem = GetValue(i);
+ CValue* elem = GetValue(i);
if (checkobj==elem || CheckEqual(checkobj,elem))
{
- result = PyLong_FromSsize_t(i);
+ result = PyLong_FromLong(i);
break;
}
}
@@ -628,7 +628,7 @@ PyObject *CListValue::Pycount(PyObject *value)
if (checkobj==NULL) { /* in this case just return that there are no items in the list */
PyErr_Clear();
- return PyLong_FromSsize_t(0);
+ return PyLong_FromLong(0);
}
int numelem = GetCount();
@@ -642,7 +642,7 @@ PyObject *CListValue::Pycount(PyObject *value)
}
checkobj->Release();
- return PyLong_FromSsize_t(numfound);
+ return PyLong_FromLong(numfound);
}
/* Matches python dict.get(key, [default]) */
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 77c76ca8153..11b00b7bbf5 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -311,14 +311,14 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
{
bool *val = reinterpret_cast<bool*>(ptr);
ptr += sizeof(bool);
- PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
+ PyList_SET_ITEM(resultlist,i,PyBool_FromLong(*val));
break;
}
case KX_PYATTRIBUTE_TYPE_SHORT:
{
short int *val = reinterpret_cast<short int*>(ptr);
ptr += sizeof(short int);
- PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
+ PyList_SET_ITEM(resultlist,i,PyLong_FromLong(*val));
break;
}
case KX_PYATTRIBUTE_TYPE_ENUM:
@@ -333,7 +333,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
{
int *val = reinterpret_cast<int*>(ptr);
ptr += sizeof(int);
- PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
+ PyList_SET_ITEM(resultlist,i,PyLong_FromLong(*val));
break;
}
case KX_PYATTRIBUTE_TYPE_FLOAT:
@@ -381,17 +381,17 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
}
if (attrdef->m_imax)
bval = !bval;
- return PyLong_FromSsize_t(bval);
+ return PyBool_FromLong(bval);
}
case KX_PYATTRIBUTE_TYPE_BOOL:
{
bool *val = reinterpret_cast<bool*>(ptr);
- return PyLong_FromSsize_t(*val);
+ return PyBool_FromLong(*val);
}
case KX_PYATTRIBUTE_TYPE_SHORT:
{
short int *val = reinterpret_cast<short int*>(ptr);
- return PyLong_FromSsize_t(*val);
+ return PyLong_FromLong(*val);
}
case KX_PYATTRIBUTE_TYPE_ENUM:
// enum are like int, just make sure the field size is the same
@@ -403,7 +403,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
case KX_PYATTRIBUTE_TYPE_INT:
{
int *val = reinterpret_cast<int*>(ptr);
- return PyLong_FromSsize_t(*val);
+ return PyLong_FromLong(*val);
}
case KX_PYATTRIBUTE_TYPE_FLOAT:
{
@@ -583,7 +583,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
ptr += sizeof(bool);
if (PyLong_Check(item))
{
- *var = (PyLong_AsSsize_t(item) != 0);
+ *var = (PyLong_AsLong(item) != 0);
}
else if (PyBool_Check(item))
{
@@ -602,7 +602,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
ptr += sizeof(short int);
if (PyLong_Check(item))
{
- long val = PyLong_AsSsize_t(item);
+ int val = PyLong_AsLong(item);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -638,7 +638,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
ptr += sizeof(int);
if (PyLong_Check(item))
{
- long val = PyLong_AsSsize_t(item);
+ int val = PyLong_AsLong(item);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -786,7 +786,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
bool *var = reinterpret_cast<bool*>(ptr);
if (PyLong_Check(value))
{
- *var = (PyLong_AsSsize_t(value) != 0);
+ *var = (PyLong_AsLong(value) != 0);
}
else if (PyBool_Check(value))
{
@@ -804,7 +804,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
bool bval;
if (PyLong_Check(value))
{
- bval = (PyLong_AsSsize_t(value) != 0);
+ bval = (PyLong_AsLong(value) != 0);
}
else if (PyBool_Check(value))
{
@@ -847,7 +847,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
short int *var = reinterpret_cast<short int*>(ptr);
if (PyLong_Check(value))
{
- long val = PyLong_AsSsize_t(value);
+ int val = PyLong_AsLong(value);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -882,7 +882,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
int *var = reinterpret_cast<int*>(ptr);
if (PyLong_Check(value))
{
- long val = PyLong_AsSsize_t(value);
+ int val = PyLong_AsLong(value);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)