diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-07 03:46:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-07 03:46:20 +0400 |
commit | 9161d3ce4bdd7c838751462b47eb045ea33a686e (patch) | |
tree | 8ce7ec347331f641b7fb53647b66a102235cd2bc /source/gameengine/Ketsji | |
parent | 9baff83d72ccb287e2e6011c648877b96790e9a9 (diff) |
use Py_ssize_t rather than int when dealing with list sizes (original patch from Fedora but applied changes elsewhere too), also replace PyList_Size with PyList_GET_SIZE where typechecking is already done.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 6 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 395e2048cb7..f14d73cb990 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -725,7 +725,7 @@ static PyObject *gLibNew(PyObject*, PyObject* args) if(idcode==ID_ME) { PyObject *ret= PyList_New(0); PyObject *item; - for(int i= 0; i < PyList_GET_SIZE(names); i++) { + for(Py_ssize_t i= 0; i < PyList_GET_SIZE(names); i++) { name= _PyUnicode_AsString(PyList_GET_ITEM(names, i)); if(name) { RAS_MeshObject *meshobj= kx_scene->GetSceneConverter()->ConvertMeshSpecial(kx_scene, maggie, name); @@ -1751,7 +1751,7 @@ static void initPySysObjects(Main *maggie) initPySysObjects__append(sys_path, gp_GamePythonPath); -// fprintf(stderr, "\nNew Path: %d ", PyList_Size(sys_path)); +// fprintf(stderr, "\nNew Path: %d ", PyList_GET_SIZE(sys_path)); // PyObject_Print(sys_path, stderr, 0); } @@ -1775,7 +1775,7 @@ static void restorePySysObjects(void) gp_OrigPythonSysModules= NULL; -// fprintf(stderr, "\nRestore Path: %d ", PyList_Size(sys_path)); +// fprintf(stderr, "\nRestore Path: %d ", PyList_GET_SIZE(sys_path)); // PyObject_Print(sys_path, stderr, 0); } diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 06e343cedb2..7c76ab01e93 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1916,7 +1916,7 @@ void KX_Scene::Render2DFilters(RAS_ICanvas* canvas) void KX_Scene::RunDrawingCallbacks(PyObject* cb_list) { - int len; + Py_ssize_t len; if (cb_list && (len=PyList_GET_SIZE(cb_list))) { @@ -1925,7 +1925,7 @@ void KX_Scene::RunDrawingCallbacks(PyObject* cb_list) PyObject* ret; // Iterate the list and run the callbacks - for (int pos=0; pos < len; pos++) + for (Py_ssize_t pos=0; pos < len; pos++) { func= PyList_GET_ITEM(cb_list, pos); ret= PyObject_Call(func, args, NULL); |