From: dmv Date: Tue, 30 Dec 2008 14:17:34 +0000 (+0000) Subject: 0020062: [CEA 295] Type coherence in *.i files X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e53784a79d4b6fc8f16565ccd3cf871888541a06;p=modules%2Fgui.git 0020062: [CEA 295] Type coherence in *.i files --- 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 9e895e2df..0c86c7ae1 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -22,6 +22,7 @@ // File : SALOME_PYQT_Module.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // + #include "SALOME_PYQT_Module.h" #include @@ -93,6 +94,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: @@ -854,7 +864,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 11eab7646..220b8e450 100644 --- a/src/SVTK/SVTK_Actor.cxx +++ b/src/SVTK/SVTK_Actor.cxx @@ -147,15 +147,13 @@ SVTK_Actor if(int aNbOfParts = theMapIndex.Extent()){ vtkPoints *aPoints = vtkPoints::New(); aPoints->SetNumberOfPoints(aNbOfParts); - vtkIdType iIdT; - 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); // Change the type from int to vtkIdType in order to avoid compilation errors while using VTK // from ParaView-3.4.0 compiled on 64-bit Debian platform with VTK_USE_64BIT_IDS = ON - iIdT = i; - myUnstructuredGrid->InsertNextCell(VTK_VERTEX,1,&iIdT); + 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 08fa404a3..1fbe9f749 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]; + vtkIdType PixelConvert[4]; // Change the type from int to vtkIdType in order to avoid compilation errors while using VTK // from ParaView-3.4.0 compiled on 64-bit Debian platform with VTK_USE_64BIT_IDS = ON vtkIdType aNewPts[VTK_CELL_SIZE];