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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-21 06:28:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-21 06:28:36 +0400
commit3fd388fb06e474a4e9e2f6816eb0a0b95ab433e7 (patch)
tree214a3ade3c842bc301aa6bedf7f3f826c873b2a6 /source
parent387bb73e4343be164f167565cefebbee613cdb7b (diff)
py api cleanup, replace use...
- PyLong_FromSsize_t --> PyLong_FromLong - PyLong_AsSsize_t --> PyLong_AsLong In all places except for those where python api expects PySsize_t (index lookups mainly). - use PyBool_FromLong in a few areas of the BGE. - fix incorrect assumption in the BGE that PySequence_Check() means PySequence_Fast_ functions can be used.
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c4
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c4
-rw-r--r--source/blender/python/generic/idprop_py_api.c8
-rw-r--r--source/blender/python/generic/py_capi_utils.c6
-rw-r--r--source/blender/python/intern/bpy_app.c4
-rw-r--r--source/blender/python/intern/bpy_rna.c18
-rw-r--r--source/blender/python/intern/bpy_rna_array.c6
-rw-r--r--source/gameengine/Expressions/IntValue.cpp5
-rw-r--r--source/gameengine/Expressions/ListValue.cpp10
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp28
-rw-r--r--source/gameengine/GameLogic/SCA_IController.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_ILogicBrick.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp8
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp16
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp15
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.cpp11
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp10
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.h2
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp10
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/BL_Shader.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.cpp22
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp20
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_VehicleWrapper.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.cpp4
-rw-r--r--source/gameengine/VideoTexture/FilterBlueScreen.cpp46
-rw-r--r--source/gameengine/VideoTexture/FilterColor.cpp4
-rw-r--r--source/gameengine/VideoTexture/FilterNormal.cpp2
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp9
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.cpp46
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.h4
-rw-r--r--source/gameengine/VideoTexture/VideoBase.cpp2
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.cpp2
46 files changed, 216 insertions, 196 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c
index 4457a8390e1..2b82826eb04 100644
--- a/source/blender/python/bmesh/bmesh_py_ops.c
+++ b/source/blender/python/bmesh/bmesh_py_ops.c
@@ -342,7 +342,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
item = PyBool_FromLong((BMO_SLOT_AS_BOOL(slot)));
break;
case BMO_OP_SLOT_INT:
- item = PyLong_FromSsize_t(BMO_SLOT_AS_INT(slot));
+ item = PyLong_FromLong(BMO_SLOT_AS_INT(slot));
break;
case BMO_OP_SLOT_FLT:
item = PyFloat_FromDouble((double)BMO_SLOT_AS_FLOAT(slot));
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 1fea12d105c..14132d08fe6 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -981,7 +981,7 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
}
case CD_PROP_INT:
{
- ret = PyLong_FromSsize_t((Py_ssize_t)(*(int *)value));
+ ret = PyLong_FromLong(*(int *)value);
break;
}
case CD_PROP_STR:
@@ -1060,7 +1060,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
}
case CD_PROP_INT:
{
- int tmp_val = PyLong_AsSsize_t(py_value);
+ int tmp_val = PyLong_AsLong(py_value);
if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
PyErr_Format(PyExc_TypeError, "expected an int, not a %.200s", Py_TYPE(py_value)->tp_name);
ret = -1;
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 8316d33ea38..b0870578f5a 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -527,7 +527,7 @@ static PyObject *bpy_bmdeformvert_keys(BPy_BMDeformVert *self)
ret = PyList_New(self->data->totweight);
for (i = 0; i < self->data->totweight; i++, dw++) {
- PyList_SET_ITEM(ret, i, PyLong_FromSsize_t(dw->def_nr));
+ PyList_SET_ITEM(ret, i, PyLong_FromLong(dw->def_nr));
}
return ret;
@@ -576,7 +576,7 @@ static PyObject *bpy_bmdeformvert_items(BPy_BMDeformVert *self)
for (i = 0; i < self->data->totweight; i++, dw++) {
item = PyTuple_New(2);
- PyTuple_SET_ITEM(item, 0, PyLong_FromSsize_t(dw->def_nr));
+ PyTuple_SET_ITEM(item, 0, PyLong_FromLong(dw->def_nr));
PyTuple_SET_ITEM(item, 1, PyFloat_FromDouble(dw->weight));
PyList_SET_ITEM(ret, i, item);
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 529b2e708ad..53112d46098 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -249,7 +249,7 @@ static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUS
#if 0
static PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
{
- return PyLong_FromSsize_t(self->prop->type);
+ return PyLong_FromLong(self->prop->type);
}
#endif
@@ -351,7 +351,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
prop = IDP_New(IDP_DOUBLE, &val, name);
}
else if (PyLong_Check(ob)) {
- val.i = (int) PyLong_AsSsize_t(ob);
+ val.i = (int)PyLong_AsLong(ob);
prop = IDP_New(IDP_INT, &val, name);
}
else if (PyUnicode_Check(ob)) {
@@ -409,7 +409,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
prop = IDP_New(IDP_ARRAY, &val, name);
for (i = 0; i < val.array.len; i++) {
item = PySequence_Fast_GET_ITEM(ob_seq_fast, i);
- ((int *)IDP_Array(prop))[i] = (int)PyLong_AsSsize_t(item);
+ ((int *)IDP_Array(prop))[i] = (int)PyLong_AsLong(item);
}
break;
case IDP_IDPARRAY:
@@ -1072,7 +1072,7 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
((double *)IDP_Array(self->prop))[index] = d;
break;
case IDP_INT:
- i = PyLong_AsSsize_t(value);
+ i = PyLong_AsLong(value);
if (i == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected an int type");
return -1;
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index b8537a1359f..f62fdaf09db 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -83,13 +83,13 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
/* could use is_double for 'long int' but no use now */
int *array_int = array;
for (i = 0; i < length; i++) {
- array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
+ array_int[i] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else if (type == &PyBool_Type) {
int *array_bool = array;
for (i = 0; i < length; i++) {
- array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
+ array_bool[i] = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
}
}
else {
@@ -567,7 +567,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
ret = PyObject_CallFunction(calcsize, (char *)"s", format);
if (ret) {
- sizes[i] = PyLong_AsSsize_t(ret);
+ sizes[i] = PyLong_AsLong(ret);
Py_DECREF(ret);
ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]);
}
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index a8aa7269b72..b1eeff8b3ae 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -195,12 +195,12 @@ PyDoc_STRVAR(bpy_app_debug_value_doc,
);
static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(closure))
{
- return PyLong_FromSsize_t(G.debug_value);
+ return PyLong_FromLong(G.debug_value);
}
static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
{
- int param = PyLong_AsSsize_t(value);
+ int param = PyLong_AsLong(value);
if (param == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index eaaced416fe..0a889ce7778 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1344,7 +1344,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
ret = PyBool_FromLong(RNA_property_boolean_get(ptr, prop));
break;
case PROP_INT:
- ret = PyLong_FromSsize_t((Py_ssize_t)RNA_property_int_get(ptr, prop));
+ ret = PyLong_FromLong(RNA_property_int_get(ptr, prop));
break;
case PROP_FLOAT:
ret = PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
@@ -2371,7 +2371,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
RNA_property_int_get_array(ptr, prop, values);
for (count = start; count < stop; count++)
- PyTuple_SET_ITEM(tuple, count - start, PyLong_FromSsize_t(values[count]));
+ PyTuple_SET_ITEM(tuple, count - start, PyLong_FromLong(values[count]));
if (values != values_stack) {
PyMem_FREE(values);
@@ -4077,7 +4077,7 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
}
else {
/* a bit strange but better then returning an empty list */
- PyTuple_SET_ITEM(item, 0, PyLong_FromSsize_t(i));
+ PyTuple_SET_ITEM(item, 0, PyLong_FromLong(i));
}
PyTuple_SET_ITEM(item, 1, pyrna_struct_CreatePyObject(&itemptr));
@@ -4256,7 +4256,7 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
}
RNA_PROP_END;
- return PyLong_FromSsize_t(index);
+ return PyLong_FromLong(index);
}
static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
@@ -4463,13 +4463,13 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
switch (raw_type) {
case PROP_RAW_CHAR:
- item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
+ item = PyLong_FromLong((long) ((char *)array)[i]);
break;
case PROP_RAW_SHORT:
- item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
+ item = PyLong_FromLong((long) ((short *)array)[i]);
break;
case PROP_RAW_INT:
- item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
+ item = PyLong_FromLong((long) ((int *)array)[i]);
break;
case PROP_RAW_FLOAT:
item = PyFloat_FromDouble((double) ((float *)array)[i]);
@@ -4756,7 +4756,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
case PROP_INT:
ret = PyTuple_New(len);
for (a = 0; a < len; a++)
- PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int *)data)[a]));
+ PyTuple_SET_ITEM(ret, a, PyLong_FromLong(((int *)data)[a]));
break;
case PROP_FLOAT:
switch (RNA_property_subtype(prop)) {
@@ -4797,7 +4797,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
ret = PyBool_FromLong(*(int *)data);
break;
case PROP_INT:
- ret = PyLong_FromSsize_t((Py_ssize_t)*(int *)data);
+ ret = PyLong_FromLong(*(int *)data);
break;
case PROP_FLOAT:
ret = PyFloat_FromDouble(*(float *)data);
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index e66d8f05309..62c0ced9eab 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -507,7 +507,7 @@ static void py_to_float(PyObject *py, char *data)
static void py_to_int(PyObject *py, char *data)
{
- *(int *)data = (int)PyLong_AsSsize_t(py);
+ *(int *)data = (int)PyLong_AsLong(py);
}
static void py_to_bool(PyObject *py, char *data)
@@ -609,7 +609,7 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
item = PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index));
break;
case PROP_INT:
- item = PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index));
+ item = PyLong_FromLong(RNA_property_int_get_index(ptr, prop, index));
break;
default:
PyErr_SetString(PyExc_TypeError, "not an array type");
@@ -766,7 +766,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
case PROP_BOOLEAN:
case PROP_INT:
{
- int value_i = PyLong_AsSsize_t(value);
+ int value_i = PyLong_AsLong(value);
if (value_i == -1 && PyErr_Occurred()) {
PyErr_Clear();
return 0;
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)
diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp
index 57f7dd64287..f922e617367 100644
--- a/source/gameengine/GameLogic/SCA_IController.cpp
+++ b/source/gameengine/GameLogic/SCA_IController.cpp
@@ -241,7 +241,7 @@ PyAttributeDef SCA_IController::Attributes[] = {
PyObject *SCA_IController::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_IController* self = static_cast<SCA_IController*>(self_v);
- return PyLong_FromSsize_t(self->m_statemask);
+ return PyLong_FromLong(self->m_statemask);
}
PyObject *SCA_IController::pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
index 4916d8a0a57..34fa1c98a73 100644
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
+++ b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
@@ -256,7 +256,7 @@ bool SCA_ILogicBrick::PyArgToBool(int boolArg)
PyObject *SCA_ILogicBrick::BoolToPyArg(bool boolarg)
{
- return PyLong_FromSsize_t(boolarg? KX_TRUE: KX_FALSE);
+ return PyLong_FromLong(boolarg ? KX_TRUE: KX_FALSE);
}
#endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index bfb78abef04..1cb17af8325 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -383,16 +383,16 @@ PyAttributeDef SCA_ISensor::Attributes[] = {
PyObject *SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- int retval = 0;
+ bool retval = false;
if (SCA_PythonController::m_sCurrentController)
retval = SCA_PythonController::m_sCurrentController->IsTriggered(self);
- return PyLong_FromSsize_t(retval);
+ return PyBool_FromLong(retval);
}
PyObject *SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- return PyLong_FromSsize_t(self->GetState());
+ return PyBool_FromLong(self->GetState());
}
PyObject *SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -414,7 +414,7 @@ PyObject *SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF
{
status = 3;
}
- return PyLong_FromSsize_t(status);
+ return PyLong_FromLong(status);
}
PyObject *SCA_ISensor::pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index 0c4dcae16f7..c7e31f75306 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -319,7 +319,7 @@ PyObject *SCA_JoystickSensor::PyGetButtonActiveList( )
if (joy) {
for (i=0; i < joy->GetNumberOfButtons(); i++) {
if (joy->aButtonPressIsPositive(i)) {
- value = PyLong_FromSsize_t(i);
+ value = PyLong_FromLong(i);
PyList_Append(ls, value);
Py_DECREF(value);
}
@@ -355,7 +355,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYAT
PyObject *list= PyList_New(axis_index);
while (axis_index--) {
- PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index)));
+ PyList_SET_ITEM(list, axis_index, PyLong_FromLong(joy->GetAxisPosition(axis_index)));
}
return list;
@@ -371,7 +371,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT
return NULL;
}
- return PyLong_FromSsize_t(joy->GetAxisPosition(self->m_axis-1));
+ return PyLong_FromLong(joy->GetAxisPosition(self->m_axis-1));
}
PyObject *SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -383,7 +383,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATT
PyObject *list= PyList_New(hat_index);
while (hat_index--) {
- PyList_SET_ITEM(list, hat_index, PyLong_FromSsize_t(joy->GetHat(hat_index)));
+ PyList_SET_ITEM(list, hat_index, PyLong_FromLong(joy->GetHat(hat_index)));
}
return list;
@@ -394,28 +394,28 @@ PyObject *SCA_JoystickSensor::pyattr_get_hat_single(void *self_v, const KX_PYATT
SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromSsize_t(joy->GetHat(self->m_hat-1));
+ return PyLong_FromLong(joy->GetHat(self->m_hat-1));
}
PyObject *SCA_JoystickSensor::pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromSsize_t( joy ? joy->GetNumberOfAxes() : 0 );
+ return PyLong_FromLong( joy ? joy->GetNumberOfAxes() : 0 );
}
PyObject *SCA_JoystickSensor::pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromSsize_t( joy ? joy->GetNumberOfButtons() : 0 );
+ return PyLong_FromLong( joy ? joy->GetNumberOfButtons() : 0 );
}
PyObject *SCA_JoystickSensor::pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromSsize_t( joy ? joy->GetNumberOfHats() : 0 );
+ return PyLong_FromLong( joy ? joy->GetNumberOfHats() : 0 );
}
PyObject *SCA_JoystickSensor::pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index b3346270b61..7005ea1ba5b 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -439,17 +439,18 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
return NULL;
}
- int keycode = PyLong_AsSsize_t(value);
+ SCA_IInputDevice::KX_EnumInputs keycode = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value);
- if ((keycode < SCA_IInputDevice::KX_BEGINKEY)
- || (keycode > SCA_IInputDevice::KX_ENDKEY)) {
+ if ((keycode < SCA_IInputDevice::KX_BEGINKEY) ||
+ (keycode > SCA_IInputDevice::KX_ENDKEY))
+ {
PyErr_SetString(PyExc_AttributeError, "sensor.getKeyStatus(int): Keyboard Sensor, invalid keycode specified!");
return NULL;
}
SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice();
- const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) keycode);
- return PyLong_FromSsize_t(inevent.m_status);
+ const SCA_InputEvent & inevent = inputdev->GetEventValue(keycode);
+ return PyLong_FromLong(inevent.m_status);
}
/* ------------------------------------------------------------------------- */
@@ -509,8 +510,8 @@ PyObject *SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
{
PyObject *keypair = PyList_New(2);
- PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i));
- PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status));
+ PyList_SET_ITEM(keypair,0,PyLong_FromLong(i));
+ PyList_SET_ITEM(keypair,1,PyLong_FromLong(inevent.m_status));
PyList_Append(resultlist,keypair);
}
}
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
index 51e0bc6550b..a7cf4963f04 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
@@ -250,17 +250,18 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
{
if (PyLong_Check(value))
{
- int button = PyLong_AsSsize_t(value);
+ SCA_IInputDevice::KX_EnumInputs button = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value);
- if ((button < SCA_IInputDevice::KX_LEFTMOUSE)
- || (button > SCA_IInputDevice::KX_RIGHTMOUSE)) {
+ if ((button < SCA_IInputDevice::KX_LEFTMOUSE) ||
+ (button > SCA_IInputDevice::KX_RIGHTMOUSE))
+ {
PyErr_SetString(PyExc_ValueError, "sensor.getButtonStatus(int): Mouse Sensor, invalid button specified!");
return NULL;
}
SCA_IInputDevice* mousedev = ((SCA_MouseManager *)m_eventmgr)->GetInputDevice();
- const SCA_InputEvent& event = mousedev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) button);
- return PyLong_FromSsize_t(event.m_status);
+ const SCA_InputEvent& event = mousedev->GetEventValue(button);
+ return PyLong_FromLong(event.m_status);
}
Py_RETURN_NONE;
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index ece9d7b6c8f..c2b1470ae7a 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -168,12 +168,16 @@ void SCA_PythonController::SetNamespace(PyObject* pythondictionary)
}
#endif
-int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
+bool SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
{
if (std::find(m_triggeredSensors.begin(), m_triggeredSensors.end(), sensor) !=
m_triggeredSensors.end())
- return 1;
- return 0;
+ {
+ return true;
+ }
+ else {
+ return false;
+ }
}
#ifdef WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h
index f1f10d22711..d2549318c2e 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.h
+++ b/source/gameengine/GameLogic/SCA_PythonController.h
@@ -90,7 +90,7 @@ class SCA_PythonController : public SCA_IController
void SetDebug(bool debug) { m_debug = debug; }
void AddTriggeredSensor(class SCA_ISensor* sensor)
{ m_triggeredSensors.push_back(sensor); }
- int IsTriggered(class SCA_ISensor* sensor);
+ bool IsTriggered(class SCA_ISensor* sensor);
bool Compile();
bool Import();
void ErrorPrint(const char *error_msg);
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
index 42cda9433b8..19aae46f2a3 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
@@ -117,7 +117,7 @@ PyObject *SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBU
{
const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
- PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+ PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;
@@ -134,7 +134,7 @@ PyObject *SCA_PythonKeyboard::pyattr_get_active_events(void *self_v, const KX_PY
const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
- PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+ PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
index 0806bda072b..1617f714113 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
@@ -100,7 +100,7 @@ PyObject *SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_
{
const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
- PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+ PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;
@@ -117,7 +117,7 @@ PyObject *SCA_PythonMouse::pyattr_get_active_events(void *self_v, const KX_PYATT
const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
- PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+ PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index 01995b13ad7..5568072abcf 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -363,17 +363,17 @@ PyAttributeDef SCA_RandomActuator::Attributes[] = {
PyObject *SCA_RandomActuator::pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
- return PyLong_FromSsize_t(act->m_base->GetSeed());
+ return PyLong_FromLong(act->m_base->GetSeed());
}
int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
- if (PyLong_Check(value)) {
- int ival = PyLong_AsSsize_t(value);
- act->m_base->SetSeed(ival);
+ if (PyLong_Check(value)) {
+ act->m_base->SetSeed(PyLong_AsLong(value));
return PY_SET_ATTR_SUCCESS;
- } else {
+ }
+ else {
PyErr_SetString(PyExc_TypeError, "actuator.seed = int: Random Actuator, expected an integer");
return PY_SET_ATTR_FAIL;
}
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
index 7199ee6cf22..4e93556453a 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
@@ -168,7 +168,7 @@ PyAttributeDef SCA_RandomSensor::Attributes[] = {
PyObject *SCA_RandomSensor::pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_RandomSensor* self = static_cast<SCA_RandomSensor*>(self_v);
- return PyLong_FromSsize_t(self->m_basegenerator->GetSeed());
+ return PyLong_FromLong(self->m_basegenerator->GetSeed());
}
int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
@@ -178,7 +178,7 @@ int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *at
PyErr_SetString(PyExc_TypeError, "sensor.seed = int: Random Sensor, expected an integer");
return PY_SET_ATTR_FAIL;
}
- self->m_basegenerator->SetSeed(PyLong_AsSsize_t(value));
+ self->m_basegenerator->SetSeed(PyLong_AsLong(value));
return PY_SET_ATTR_SUCCESS;
}
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index b047588df5a..4a74024b5bb 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -849,7 +849,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" )
KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" )
{
- return PyLong_FromSsize_t( ( mShader !=0 && mOk ) );
+ return PyBool_FromLong(( mShader !=0 && mOk ));
}
KX_PYMETHODDEF_DOC( BL_Shader, getVertexProg, "getVertexProg( )" )
@@ -1224,7 +1224,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2
for (unsigned int i=0; (i<list_size && i<4); i++)
{
PyObject *item = PySequence_GetItem(listPtr, i);
- array_data[i] = PyLong_AsSsize_t(item);
+ array_data[i] = PyLong_AsLong(item);
Py_DECREF(item);
}
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 88e26fd9a55..20c36c2cc44 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -849,7 +849,7 @@ PyObject *KX_BlenderMaterial::pyattr_get_shader(void *self_v, const KX_PYATTRIBU
PyObject *KX_BlenderMaterial::pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_BlenderMaterial* self = static_cast<KX_BlenderMaterial*>(self_v);
- return PyLong_FromSsize_t(self->GetMaterialIndex());
+ return PyLong_FromLong(self->GetMaterialIndex());
}
PyObject *KX_BlenderMaterial::pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -931,7 +931,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getMaterialIndex, "getMaterialIndex()")
{
- return PyLong_FromSsize_t( GetMaterialIndex() );
+ return PyLong_FromLong(GetMaterialIndex());
}
KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getTexture, "getTexture( index )" )
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 39b0a24865e..e56dbfdcac8 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -593,7 +593,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
MT_Point3 center;
if (PyVecTo(pycenter, center))
{
- return PyLong_FromSsize_t(SphereInsideFrustum(center, radius)); /* new ref */
+ return PyLong_FromLong(SphereInsideFrustum(center, radius)); /* new ref */
}
}
@@ -644,7 +644,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum,
return NULL;
}
- return PyLong_FromSsize_t(BoxInsideFrustum(box)); /* new ref */
+ return PyLong_FromLong(BoxInsideFrustum(box)); /* new ref */
}
KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
@@ -666,7 +666,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
MT_Point3 point;
if (PyVecTo(value, point))
{
- return PyLong_FromSsize_t(PointInsideFrustum(point)); /* new ref */
+ return PyLong_FromLong(PointInsideFrustum(point)); /* new ref */
}
PyErr_SetString(PyExc_TypeError, "camera.pointInsideFrustum(point): KX_Camera, expected point argument.");
@@ -869,11 +869,11 @@ PyObject *KX_Camera::pyattr_get_world_to_camera(void *self_v, const KX_PYATTRIBU
PyObject *KX_Camera::pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{ return PyLong_FromSsize_t(INSIDE); }
+{ return PyLong_FromLong(INSIDE); }
PyObject *KX_Camera::pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{ return PyLong_FromSsize_t(OUTSIDE); }
+{ return PyLong_FromLong(OUTSIDE); }
PyObject *KX_Camera::pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{ return PyLong_FromSsize_t(INTERSECT); }
+{ return PyLong_FromLong(INTERSECT); }
bool ConvertPythonToCamera(PyObject *value, KX_Camera **object, bool py_none_ok, const char *error_prefix)
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
index 662db974ee8..e09449c4f1d 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
@@ -52,7 +52,7 @@ KX_ConstraintWrapper::~KX_ConstraintWrapper()
PyObject *KX_ConstraintWrapper::PyGetConstraintId()
{
- return PyLong_FromSsize_t(m_constraintId);
+ return PyLong_FromLong(m_constraintId);
}
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index cfccb8e8ced..c7f6954fd6c 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -2475,13 +2475,13 @@ PyObject *KX_GameObject::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
int state = 0;
state |= self->GetState();
- return PyLong_FromSsize_t(state);
+ return PyLong_FromLong(state);
}
int KX_GameObject::pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
- int state_i = PyLong_AsSsize_t(value);
+ int state_i = PyLong_AsLong(value);
unsigned int state = 0;
if (state_i == -1 && PyErr_Occurred()) {
@@ -2897,7 +2897,7 @@ PyObject *KX_GameObject::PyGetPhysicsId()
{
physid= (uint_ptr)ctrl->GetUserData();
}
- return PyLong_FromSsize_t((long)physid);
+ return PyLong_FromLong((long)physid);
}
PyObject *KX_GameObject::PyGetPropertyNames()
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index a4e90cb1e83..cf58d18838a 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -372,11 +372,11 @@ PyObject *KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
const char* type = attrdef->m_name;
if (!strcmp(type, "SPOT")) {
- retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SPOT);
+ retvalue = PyLong_FromLong(RAS_LightObject::LIGHT_SPOT);
} else if (!strcmp(type, "SUN")) {
- retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SUN);
+ retvalue = PyLong_FromLong(RAS_LightObject::LIGHT_SUN);
} else if (!strcmp(type, "NORMAL")) {
- retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL);
+ retvalue = PyLong_FromLong(RAS_LightObject::LIGHT_NORMAL);
}
else {
/* should never happen */
@@ -390,13 +390,13 @@ PyObject *KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
PyObject *KX_LightObject::pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
- return PyLong_FromSsize_t(self->m_lightobj.m_type);
+ return PyLong_FromLong(self->m_lightobj.m_type);
}
int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
- int val = PyLong_AsSsize_t(value);
+ const int val = PyLong_AsLong(value);
if ((val==-1 && PyErr_Occurred()) || val<0 || val>2) {
PyErr_SetString(PyExc_ValueError, "light.type= val: KX_LightObject, expected an int between 0 and 2");
return PY_SET_ATTR_FAIL;
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index dbbf6bd8c2a..d83e98d4712 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -172,7 +172,7 @@ PyObject *KX_MeshProxy::PyGetVertexArrayLength(PyObject *args, PyObject *kwds)
length = m_meshobj->NumVertices(mat);
}
- return PyLong_FromSsize_t(length);
+ return PyLong_FromLong(length);
}
@@ -406,13 +406,13 @@ PyObject *KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_
PyObject * KX_MeshProxy::pyattr_get_numMaterials(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef)
{
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
- return PyLong_FromSsize_t(self->m_meshobj->NumMaterials());
+ return PyLong_FromLong(self->m_meshobj->NumMaterials());
}
PyObject * KX_MeshProxy::pyattr_get_numPolygons(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef)
{
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
- return PyLong_FromSsize_t(self->m_meshobj->NumPolygons());
+ return PyLong_FromLong(self->m_meshobj->NumPolygons());
}
/* a close copy of ConvertPythonToGameObject but for meshes */
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index e5f7ea22b36..931039bc54c 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -529,7 +529,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitX(void *self_v, const KX_PYATTRIBUTE
{
self->m_drot[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
self->m_dloc[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
- self->m_bitLocalFlag.Torque = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+ self->m_bitLocalFlag.Torque = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
if (!PyErr_Occurred())
{
@@ -565,7 +565,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitY(void *self_v, const KX_PYATTRIBUTE
{
self->m_drot[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
self->m_dloc[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
- self->m_bitLocalFlag.DLoc = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+ self->m_bitLocalFlag.DLoc = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
if (!PyErr_Occurred())
{
@@ -601,7 +601,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitZ(void *self_v, const KX_PYATTRIBUTE
{
self->m_drot[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
self->m_dloc[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
- self->m_bitLocalFlag.DRot = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+ self->m_bitLocalFlag.DRot = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
if (!PyErr_Occurred())
{
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index 465e91ffb32..840ffdde165 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -140,21 +140,21 @@ PyObject *KX_PolyProxy::pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *at
{
KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
- return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0));
+ return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0));
}
PyObject *KX_PolyProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
- return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1));
+ return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1));
}
PyObject *KX_PolyProxy::pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
- return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2));
+ return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2));
}
PyObject *KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -163,9 +163,9 @@ PyObject *KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *at
if (3 < self->m_polygon->VertexCount())
{
- return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3));
+ return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3));
}
- return PyLong_FromSsize_t(0);
+ return PyLong_FromLong(0);
}
PyObject *KX_PolyProxy::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -192,25 +192,25 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex,
// found it
break;
}
- return PyLong_FromSsize_t(matid);
+ return PyLong_FromLong(matid);
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getNumVertex,
"getNumVertex() : returns the number of vertex of the polygon, 3 or 4\n")
{
- return PyLong_FromSsize_t(m_polygon->VertexCount());
+ return PyLong_FromLong(m_polygon->VertexCount());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isVisible,
"isVisible() : returns whether the polygon is visible or not\n")
{
- return PyLong_FromSsize_t(m_polygon->IsVisible());
+ return PyLong_FromLong(m_polygon->IsVisible());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isCollider,
"isCollider() : returns whether the polygon is receives collision or not\n")
{
- return PyLong_FromSsize_t(m_polygon->IsCollider());
+ return PyLong_FromLong(m_polygon->IsCollider());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialName,
@@ -243,9 +243,9 @@ KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
}
if (index < m_polygon->VertexCount())
{
- return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, index));
+ return PyLong_FromLong(m_polygon->GetVertexOffsetAbs(m_mesh, index));
}
- return PyLong_FromSsize_t(0);
+ return PyLong_FromLong(0);
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMesh,
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index f89b918f31b..b02df7be26f 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -146,7 +146,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI
PyObject *ret = PyObject_CallMethod(m_pymaterial, (char *)"activate", (char *)"(NNO)", pyRasty, pyCachingInfo, (PyObject *) this->m_proxy);
if (ret)
{
- bool value = PyLong_AsSsize_t(ret);
+ bool value = PyLong_AsLong(ret);
Py_DECREF(ret);
dopass = value;
}
@@ -381,7 +381,7 @@ PyObject *KX_PolygonMaterial::pyattr_get_gl_texture(void *self_v, const KX_PYATT
if (self->m_tface.tpage)
bindcode= self->m_tface.tpage->bindcode;
- return PyLong_FromSsize_t(bindcode);
+ return PyLong_FromLong(bindcode);
}
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index 4475ac8ec96..a562b3ff682 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -51,7 +51,7 @@
#ifdef WITH_PYTHON
// macro copied from KX_PythonInit.cpp
-#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item)
+#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromLong(name2)); Py_DECREF(item)
// nasty glob variable to connect scripting language
// if there is a better way (without global), please do so!
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 7f6655861f1..5c4d1710e6f 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -193,10 +193,10 @@ static PyObject *gp_OrigPythonSysPath= NULL;
static PyObject *gp_OrigPythonSysModules= NULL;
/* Macro for building the keyboard translation */
-//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromSsize_t(SCA_IInputDevice::KX_##name))
-#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name)); Py_DECREF(item)
+//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromLong(SCA_IInputDevice::KX_##name))
+#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromLong(name)); Py_DECREF(item)
/* For the defines for types from logic bricks, we do stuff explicitly... */
-#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item)
+#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromLong(name2)); Py_DECREF(item)
// temporarily python stuff, will be put in another place later !
@@ -429,7 +429,7 @@ static PyObject *gPySetExitKey(PyObject *, PyObject *args)
static PyObject *gPyGetExitKey(PyObject *)
{
- return PyLong_FromSsize_t(KX_KetsjiEngine::GetExitKey());
+ return PyLong_FromLong(KX_KetsjiEngine::GetExitKey());
}
static PyObject *gPySetMaxLogicFrame(PyObject *, PyObject *args)
@@ -444,7 +444,7 @@ static PyObject *gPySetMaxLogicFrame(PyObject *, PyObject *args)
static PyObject *gPyGetMaxLogicFrame(PyObject *)
{
- return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxLogicFrame());
+ return PyLong_FromLong(KX_KetsjiEngine::GetMaxLogicFrame());
}
static PyObject *gPySetMaxPhysicsFrame(PyObject *, PyObject *args)
@@ -459,7 +459,7 @@ static PyObject *gPySetMaxPhysicsFrame(PyObject *, PyObject *args)
static PyObject *gPyGetMaxPhysicsFrame(PyObject *)
{
- return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxPhysicsFrame());
+ return PyLong_FromLong(KX_KetsjiEngine::GetMaxPhysicsFrame());
}
static PyObject *gPySetPhysicsTicRate(PyObject *, PyObject *args)
@@ -862,14 +862,14 @@ static struct PyMethodDef game_methods[] = {
static PyObject *gPyGetWindowHeight(PyObject *, PyObject *args)
{
- return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetHeight() : 0));
+ return PyLong_FromLong((gp_Canvas ? gp_Canvas->GetHeight() : 0));
}
static PyObject *gPyGetWindowWidth(PyObject *, PyObject *args)
{
- return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetWidth() : 0));
+ return PyLong_FromLong((gp_Canvas ? gp_Canvas->GetWidth() : 0));
}
@@ -1203,7 +1203,7 @@ static PyObject *gPyGetGLSLMaterialSetting(PyObject *,
}
enabled = ((gs->glslflag & flag) != 0);
- return PyLong_FromSsize_t(enabled);
+ return PyLong_FromLong(enabled);
}
#define KX_TEXFACE_MATERIAL 0
@@ -1246,7 +1246,7 @@ static PyObject *gPyGetMaterialType(PyObject *)
else
flag = KX_TEXFACE_MATERIAL;
- return PyLong_FromSsize_t(flag);
+ return PyLong_FromLong(flag);
}
static PyObject *gPySetAnisotropicFiltering(PyObject *, PyObject *args)
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index 6b4d88709e8..f0e11645bc1 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -100,7 +100,7 @@ static Py_ssize_t KX_PythonSeq_len( PyObject *self )
}
}
-static PyObject *KX_PythonSeq_getIndex(PyObject *self, int index)
+static PyObject *KX_PythonSeq_getIndex(PyObject *self, Py_ssize_t index)
{
PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
@@ -273,8 +273,8 @@ static PyObject * KX_PythonSeq_subscript(PyObject *self, PyObject *key)
return NULL;
}
- if (PyLong_Check(key)) {
- return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t( key ));
+ if (PyIndex_Check(key)) {
+ return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t(key));
}
else if ( PyUnicode_Check(key) ) {
const char *name = _PyUnicode_AsString(key);
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
index b5d6f11a2d5..9cc91a33886 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
@@ -126,13 +126,13 @@ PyObject *KX_VehicleWrapper::PyGetWheelOrientationQuaternion(PyObject *args)
PyObject *KX_VehicleWrapper::PyGetNumWheels(PyObject *args)
{
- return PyLong_FromSsize_t(m_vehicle->GetNumWheels());
+ return PyLong_FromLong(m_vehicle->GetNumWheels());
}
PyObject *KX_VehicleWrapper::PyGetConstraintId(PyObject *args)
{
- return PyLong_FromSsize_t(m_vehicle->GetUserConstraintId());
+ return PyLong_FromLong(m_vehicle->GetUserConstraintId());
}
@@ -263,7 +263,7 @@ PyObject *KX_VehicleWrapper::PySetSteeringValue(PyObject *args)
PyObject *KX_VehicleWrapper::PyGetConstraintType(PyObject *args)
{
- return PyLong_FromSsize_t(m_vehicle->GetUserConstraintType());
+ return PyLong_FromLong(m_vehicle->GetUserConstraintType());
}
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index 82e414d7c42..2354359af18 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -494,13 +494,13 @@ PyObject *KX_VertexProxy::PySetNormal(PyObject *value)
PyObject *KX_VertexProxy::PyGetRGBA()
{
int *rgba = (int *) m_vertex->getRGBA();
- return PyLong_FromSsize_t(*rgba);
+ return PyLong_FromLong(*rgba);
}
PyObject *KX_VertexProxy::PySetRGBA(PyObject *value)
{
if (PyLong_Check(value)) {
- int rgba = PyLong_AsSsize_t(value);
+ int rgba = PyLong_AsLong(value);
m_vertex->SetRGBA(rgba);
m_mesh->SetMeshModified(true);
Py_RETURN_NONE;
diff --git a/source/gameengine/VideoTexture/FilterBlueScreen.cpp b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
index 551694bf8c0..662ecabd283 100644
--- a/source/gameengine/VideoTexture/FilterBlueScreen.cpp
+++ b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
@@ -87,18 +87,21 @@ static PyObject *getColor (PyFilter *self, void *closure)
static int setColor (PyFilter *self, PyObject *value, void *closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 3
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
+ if (value == NULL ||
+ !(PyTuple_Check(value) || PyList_Check(value)) ||
+ PySequence_Fast_GET_SIZE(value) != 3 ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 3 ints");
return -1;
}
// set color
- getFilter(self)->setColor((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))));
+ getFilter(self)->setColor(
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2))));
// success
return 0;
}
@@ -114,16 +117,19 @@ static PyObject *getLimits (PyFilter *self, void *closure)
static int setLimits (PyFilter *self, PyObject *value, void *closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
+ if (value == NULL ||
+ !(PyTuple_Check(value) || PyList_Check(value)) ||
+ PySequence_Fast_GET_SIZE(value) != 2 ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
return -1;
}
// set limits
- getFilter(self)->setLimits((unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- (unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))));
+ getFilter(self)->setLimits(
+ (unsigned short)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ (unsigned short)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1))));
// success
return 0;
}
@@ -163,14 +169,14 @@ PyTypeObject FilterBlueScreenType =
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
"Filter for Blue Screen objects", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- NULL, /* tp_methods */
- 0, /* tp_members */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
filterBSGetSets, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
diff --git a/source/gameengine/VideoTexture/FilterColor.cpp b/source/gameengine/VideoTexture/FilterColor.cpp
index 75803e46516..e4101b5587d 100644
--- a/source/gameengine/VideoTexture/FilterColor.cpp
+++ b/source/gameengine/VideoTexture/FilterColor.cpp
@@ -151,7 +151,7 @@ static int setMatrix (PyFilter *self, PyObject *value, void *closure)
valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
// if it is valid, save it in matrix
if (valid)
- mat[r][c] = short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
+ mat[r][c] = short(PyLong_AsLong(PySequence_Fast_GET_ITEM(row, c)));
}
}
// if parameter is not valid, report error
@@ -284,7 +284,7 @@ static int setLevels (PyFilter *self, PyObject *value, void *closure)
valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
// if it is valid, save it in matrix
if (valid)
- lev[r][c] = (unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
+ lev[r][c] = (unsigned short)(PyLong_AsLong(PySequence_Fast_GET_ITEM(row, c)));
}
}
// if parameter is not valid, report error
diff --git a/source/gameengine/VideoTexture/FilterNormal.cpp b/source/gameengine/VideoTexture/FilterNormal.cpp
index 8499934d61b..ba963d93079 100644
--- a/source/gameengine/VideoTexture/FilterNormal.cpp
+++ b/source/gameengine/VideoTexture/FilterNormal.cpp
@@ -85,7 +85,7 @@ static int setColor (PyFilter *self, PyObject *value, void *closure)
return -1;
}
// set color index
- getFilter(self)->setColor((unsigned short)(PyLong_AsSsize_t(value)));
+ getFilter(self)->setColor((unsigned short)(PyLong_AsLong(value)));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index b8dd4ad4552..f778f840864 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -360,10 +360,11 @@ static int setBackground (PyImage *self, PyObject *value, void *closure)
return -1;
}
// set background color
- getImageRender(self)->setBackground((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 3))));
+ getImageRender(self)->setBackground(
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 3))));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp
index b221cb96624..5fc388bdefb 100644
--- a/source/gameengine/VideoTexture/ImageViewport.cpp
+++ b/source/gameengine/VideoTexture/ImageViewport.cpp
@@ -89,7 +89,7 @@ void ImageViewport::setWhole (bool whole)
setPosition();
}
-void ImageViewport::setCaptureSize (short * size)
+void ImageViewport::setCaptureSize (short size[2])
{
m_whole = false;
if (size == NULL)
@@ -109,7 +109,7 @@ void ImageViewport::setCaptureSize (short * size)
}
// set position of capture rectangle
-void ImageViewport::setPosition (GLint * pos)
+void ImageViewport::setPosition (GLint pos[2])
{
// if new position is not provided, use existing position
if (pos == NULL) pos = m_position;
@@ -258,25 +258,30 @@ int ImageViewport_setAlpha (PyImage *self, PyObject *value, void *closure)
// get position
static PyObject *ImageViewport_getPosition (PyImage *self, void *closure)
{
- return Py_BuildValue("(ii)", getImageViewport(self)->getPosition()[0],
- getImageViewport(self)->getPosition()[1]);
+ GLint *pos = getImageViewport(self)->getPosition();
+ PyObject *ret = PyTuple_New(2);
+ PyTuple_SET_ITEM(ret, 0, PyLong_FromLong(pos[0]));
+ PyTuple_SET_ITEM(ret, 1, PyLong_FromLong(pos[1]));
+ return ret;
}
// set position
static int ImageViewport_setPosition (PyImage *self, PyObject *value, void *closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
+ if (value == NULL ||
+ !(PyTuple_Check(value) || PyList_Check(value)) ||
+ PySequence_Fast_GET_SIZE(value) != 2 ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
return -1;
}
// set position
- GLint pos [] = {
- GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
+ GLint pos[2] = {
+ GLint(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ GLint(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
};
getImageViewport(self)->setPosition(pos);
// success
@@ -286,25 +291,30 @@ static int ImageViewport_setPosition (PyImage *self, PyObject *value, void *clos
// get capture size
PyObject *ImageViewport_getCaptureSize (PyImage *self, void *closure)
{
- return Py_BuildValue("(ii)", getImageViewport(self)->getCaptureSize()[0],
- getImageViewport(self)->getCaptureSize()[1]);
+ short *size = getImageViewport(self)->getCaptureSize();
+ PyObject *ret = PyTuple_New(2);
+ PyTuple_SET_ITEM(ret, 0, PyLong_FromLong(size[0]));
+ PyTuple_SET_ITEM(ret, 1, PyLong_FromLong(size[1]));
+ return ret;
}
// set capture size
int ImageViewport_setCaptureSize (PyImage *self, PyObject *value, void *closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
+ if (value == NULL ||
+ !(PyTuple_Check(value) || PyList_Check(value)) ||
+ PySequence_Fast_GET_SIZE(value) != 2 ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
return -1;
}
// set capture size
- short size [] = {
- short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
+ short size[2] = {
+ short(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ short(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
};
try
{
diff --git a/source/gameengine/VideoTexture/ImageViewport.h b/source/gameengine/VideoTexture/ImageViewport.h
index 2c2b2a26ec2..5afd4654d62 100644
--- a/source/gameengine/VideoTexture/ImageViewport.h
+++ b/source/gameengine/VideoTexture/ImageViewport.h
@@ -60,12 +60,12 @@ public:
/// get capture size in viewport
short * getCaptureSize (void) { return m_capSize; }
/// set capture size in viewport
- void setCaptureSize (short * size = NULL);
+ void setCaptureSize (short size[2] = NULL);
/// get position in viewport
GLint * getPosition (void) { return m_position; }
/// set position in viewport
- void setPosition (GLint * pos = NULL);
+ void setPosition (GLint pos[2] = NULL);
protected:
/// frame buffer rectangle
diff --git a/source/gameengine/VideoTexture/VideoBase.cpp b/source/gameengine/VideoTexture/VideoBase.cpp
index f723001fa5a..576e358fe75 100644
--- a/source/gameengine/VideoTexture/VideoBase.cpp
+++ b/source/gameengine/VideoTexture/VideoBase.cpp
@@ -184,7 +184,7 @@ int Video_setRepeat(PyImage *self, PyObject *value, void *closure)
return -1;
}
// set repeat
- getVideo(self)->setRepeat(int(PyLong_AsSsize_t(value)));
+ getVideo(self)->setRepeat(int(PyLong_AsLong(value)));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 937705c963e..8976a21376a 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -1142,7 +1142,7 @@ static int VideoFFmpeg_setPreseek(PyImage *self, PyObject *value, void *closure)
return -1;
}
// set preseek
- getFFmpeg(self)->setPreseek(PyLong_AsSsize_t(value));
+ getFFmpeg(self)->setPreseek(PyLong_AsLong(value));
// success
return 0;
}