From 7dbc756d42b0d7eedbe8f8ca9b4740122cc4c237 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 29 Sep 2016 14:39:01 +0200 Subject: [PATCH] Mesh_3: Fix other conversion warnings --- CGAL_ImageIO/include/CGAL/ImageIO_impl.h | 2 +- CGAL_ImageIO/include/CGAL/Image_3.h | 12 ++++++------ .../include/CGAL/Image_3_vtk_interface.h | 18 +++++++++--------- .../CGAL/Mesh_3/Mesh_global_optimizer.h | 2 +- .../include/CGAL/Mesh_3/vertex_perturbation.h | 2 +- .../include/CGAL/IO/File_header_OFF_impl.h | 2 +- .../CGAL/IO/File_header_extended_OFF_impl.h | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/CGAL_ImageIO/include/CGAL/ImageIO_impl.h b/CGAL_ImageIO/include/CGAL/ImageIO_impl.h index ff1b83a4d0e..4836bf300de 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO_impl.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO_impl.h @@ -1622,7 +1622,7 @@ float triLinInterp(const _image* image, posz = static_cast(posz /(image->vz)); //patch suggested by J.Cugnoni to prevent integer overflow - if(posz >= dimz-1 || posy >= dimy-1 || posx >= dimx-1) + if(posz >= float(dimz-1) || posy >= float(dimy-1) || posx >= float(dimx-1)) return value_outside; const int i1 = (int)(posz); diff --git a/CGAL_ImageIO/include/CGAL/Image_3.h b/CGAL_ImageIO/include/CGAL/Image_3.h index 069ef4e3d53..602ec4944b9 100644 --- a/CGAL_ImageIO/include/CGAL/Image_3.h +++ b/CGAL_ImageIO/include/CGAL/Image_3.h @@ -257,9 +257,9 @@ Image_3::trilinear_interpolation(const Coord_type& x, if(lx < 0 || ly < 0 || lz < 0 || - lz >= dimz-1 || - ly >= dimy-1 || - lx >= dimx-1) + lz >= Coord_type(dimz-1) || + ly >= Coord_type(dimy-1) || + lx >= Coord_type(dimx-1)) { return value_outside; } @@ -448,9 +448,9 @@ Image_3::labellized_trilinear_interpolation if( lx < 0 || ly < 0 || lz < 0 || - lz >= dimz-1 || - ly >= dimy-1 || - lx >= dimx-1) + lz >= Coord_type(dimz-1) || + ly >= Coord_type(dimy-1) || + lx >= Coord_type(dimx-1)) { return value_outside; } diff --git a/CGAL_ImageIO/include/CGAL/Image_3_vtk_interface.h b/CGAL_ImageIO/include/CGAL/Image_3_vtk_interface.h index dd88ed8e93d..f232d0bc3fe 100644 --- a/CGAL_ImageIO/include/CGAL/Image_3_vtk_interface.h +++ b/CGAL_ImageIO/include/CGAL/Image_3_vtk_interface.h @@ -46,49 +46,49 @@ struct VTK_type_generator { template <> struct VTK_type_generator { - static const vtkIdType type = VTK_DOUBLE; + static const int type = VTK_DOUBLE; typedef vtkDoubleArray ArrayType; }; template <> struct VTK_type_generator { - static const vtkIdType type = VTK_FLOAT; + static const int type = VTK_FLOAT; typedef vtkFloatArray ArrayType; }; template <> struct VTK_type_generator { - static const vtkIdType type = VTK_CHAR; + static const int type = VTK_CHAR; typedef vtkCharArray ArrayType; }; template <> struct VTK_type_generator { - static const vtkIdType type = VTK_UNSIGNED_CHAR; + static const int type = VTK_UNSIGNED_CHAR; typedef vtkUnsignedCharArray ArrayType; }; template <> struct VTK_type_generator { - static const vtkIdType type = VTK_SHORT; + static const int type = VTK_SHORT; typedef vtkShortArray ArrayType; }; template <> struct VTK_type_generator { - static const vtkIdType type = VTK_UNSIGNED_SHORT; + static const int type = VTK_UNSIGNED_SHORT; typedef vtkUnsignedShortArray ArrayType; }; template <> struct VTK_type_generator { - static const vtkIdType type = VTK_INT; + static const int type = VTK_INT; typedef vtkIntArray ArrayType; }; template <> struct VTK_type_generator { - static const vtkIdType type = VTK_UNSIGNED_INT; + static const int type = VTK_UNSIGNED_INT; typedef vtkUnsignedIntArray ArrayType; }; @@ -96,7 +96,7 @@ struct VTK_type_generator { { vtkImageData* vtk_image = vtkImageData::New(); vtkDataArray* data_array = 0; - vtkIdType type = 0; + int type = 0; _image* image_ptr = image.image(); diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h index 9b10e14a085..f739c798235 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h @@ -733,7 +733,7 @@ operator()(int nb_iterations, Visitor visitor) //Pb with Freeze : sometimes a few vertices continue moving indefinitely //if the nb of moving vertices is < 1% of total nb AND does not decrease if(do_freeze_ - && nb_vertices_moved < 0.005 * double(initial_vertices_nb) + && double(nb_vertices_moved) < 0.005 * double(initial_vertices_nb) && nb_vertices_moved == moving_vertices.size()) { // we should stop because we are diff --git a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h index 380259656c3..e9f1df8ce16 100644 --- a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h +++ b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h @@ -342,7 +342,7 @@ public: double time() const { return timer().time(); } int total_counter() const { return total_counter_ + counter(); } std::size_t total_time() const - { return static_cast(total_time_ + 1000*time()); } + { return static_cast(double(total_time_) + 1000*time()); } virtual std::string perturbation_name() const = 0; private: CGAL::Timer &timer() const diff --git a/Stream_support/include/CGAL/IO/File_header_OFF_impl.h b/Stream_support/include/CGAL/IO/File_header_OFF_impl.h index 0355e4da518..051d4fde048 100644 --- a/Stream_support/include/CGAL/IO/File_header_OFF_impl.h +++ b/Stream_support/include/CGAL/IO/File_header_OFF_impl.h @@ -393,7 +393,7 @@ std::istream& operator>>( std::istream& in, File_header_OFF& h) { // facets and we do not know the genus of the surface. // So we add 12 and a factor of 5 percent. if ( h.size_of_halfedges() == 0 - || h.size_of_halfedges() > double(h.size_of_vertices() + || double(h.size_of_halfedges()) > double(h.size_of_vertices() + h.size_of_facets() - 2 + 12) * 2.1 || h.size_of_halfedges() < (h.size_of_vertices() + h.size_of_facets() - 2) * 2 diff --git a/Stream_support/include/CGAL/IO/File_header_extended_OFF_impl.h b/Stream_support/include/CGAL/IO/File_header_extended_OFF_impl.h index 0fad299f811..78c8492518f 100644 --- a/Stream_support/include/CGAL/IO/File_header_extended_OFF_impl.h +++ b/Stream_support/include/CGAL/IO/File_header_extended_OFF_impl.h @@ -63,7 +63,7 @@ int File_header_extended_OFF:: is_CBPn() const { if ( is_POL() && triangulated() && non_empty_facets() && normalized_to_sphere() && rounded() && - (radius() <= ( 1l << rounded_bits()))) + (radius() <= double( 1l << rounded_bits()))) return rounded_bits(); else return 0;