From c7820d613d2e89f80b5a557bb9e15c1cbd89c40c Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 30 Dec 2008 14:06:19 +0000 Subject: [PATCH] 0020062: [CEA 295] Type coherence in *.i files --- .../SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx | 11 ++++++++++- src/SVTK/SVTK_Actor.cxx | 4 ++-- src/VTKViewer/VTKViewer_GeometryFilter.cxx | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx index 476296864..55171f8a4 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -78,6 +78,15 @@ const bool IsCallOldMethods = true; const bool IsCallOldMethods = false; #endif +/* Py_ssize_t for old Pythons */ +/* This code is as recommended by: */ +/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) +typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +#endif + // NB: Python requests. // General rule for Python requests created by SALOME_PYQT_Module: // all requests should be executed SYNCHRONOUSLY within the main GUI thread. @@ -770,7 +779,7 @@ void SALOME_PYQT_Module::init( CAM_Application* app ) if ( PyDict_Check( res1 ) ) { PyObject* key; PyObject* value; - int pos = 0; + Py_ssize_t pos = 0; while ( PyDict_Next( res1, &pos, &key, &value ) ) { // parse the return value // it should be a map: {integer:integer} diff --git a/src/SVTK/SVTK_Actor.cxx b/src/SVTK/SVTK_Actor.cxx index 40d275d3e..0f167b69f 100644 --- a/src/SVTK/SVTK_Actor.cxx +++ b/src/SVTK/SVTK_Actor.cxx @@ -145,11 +145,11 @@ SVTK_Actor if(int aNbOfParts = theMapIndex.Extent()){ vtkPoints *aPoints = vtkPoints::New(); aPoints->SetNumberOfPoints(aNbOfParts); - for(int i = 0; i < aNbOfParts; i++){ + for(vtkIdType i = 0; i < aNbOfParts; i++){ int aPartId = theMapIndex( i+1 ); if(vtkFloatingPointType* aCoord = theMapActor->GetNodeCoord(aPartId)){ aPoints->SetPoint(i,aCoord); - myUnstructuredGrid->InsertNextCell(VTK_VERTEX,1,&i); + myUnstructuredGrid->InsertNextCell(VTK_VERTEX,(vtkIdType) 1,&i); } } myUnstructuredGrid->SetPoints(aPoints); diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.cxx b/src/VTKViewer/VTKViewer_GeometryFilter.cxx index 4ed453c3f..47144dff2 100755 --- a/src/VTKViewer/VTKViewer_GeometryFilter.cxx +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -151,7 +151,7 @@ VTKViewer_GeometryFilter vtkIdType newCellId; int faceId, *faceVerts, numFacePts; vtkFloatingPointType *x; - int PixelConvert[4], aNewPts[VTK_CELL_SIZE]; + vtkIdType PixelConvert[4], aNewPts[VTK_CELL_SIZE]; // ghost cell stuff unsigned char updateLevel = (unsigned char)(output->GetUpdateGhostLevel()); unsigned char *cellGhostLevels = 0; -- 2.39.2