From 084d534949be2f3d843852c1b886c5eca0efc69d Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 4 Sep 2019 10:36:17 +0200 Subject: [PATCH] Fix conversion warnings in the Surface_mesher testsuite --- CGAL_ImageIO/include/CGAL/read_vtk_image_data.h | 6 +++--- Surface_mesher/demo/Surface_mesher/values_list.cpp | 6 +++--- Surface_mesher/demo/Surface_mesher/volume.cpp | 6 +++--- Surface_mesher/demo/Surface_mesher/volume.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h b/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h index 158f020c28d..1b54ef99ea0 100644 --- a/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h +++ b/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h @@ -72,9 +72,9 @@ read_vtk_image_data(vtkImageData* vtk_image, Image_3::Own owning = Image_3::OWN_ image->vx = spacing[0]; image->vy = spacing[1]; image->vz = spacing[2]; - image->tx = offset[0]; - image->ty = offset[1]; - image->tz = offset[2]; + image->tx = static_cast(offset[0]); + image->ty = static_cast(offset[1]); + image->tz = static_cast(offset[2]); image->endianness = ::_getEndianness(); int vtk_type = vtk_image->GetScalarType(); if(vtk_type == VTK_SIGNED_CHAR) vtk_type = VTK_CHAR; diff --git a/Surface_mesher/demo/Surface_mesher/values_list.cpp b/Surface_mesher/demo/Surface_mesher/values_list.cpp index e0c7c8ccfb1..3d9be65c92f 100644 --- a/Surface_mesher/demo/Surface_mesher/values_list.cpp +++ b/Surface_mesher/demo/Surface_mesher/values_list.cpp @@ -162,14 +162,14 @@ QString Values_list::name(const int i) const bool Values_list::enabled(const int i) const { if(i < 0 || i > treeWidget->topLevelItemCount()) - return 0.; + return false; else - return treeWidget->topLevelItem(i)->data(Value, Qt::CheckStateRole).toDouble(); + return treeWidget->topLevelItem(i)->data(Value, Qt::CheckStateRole).toInt() > 0; } bool Values_list::enabled(const QTreeWidgetItem* item) const { - return item->data(Value, Qt::CheckStateRole).toDouble(); + return item->data(Value, Qt::CheckStateRole).toInt() > 0; } const QTreeWidgetItem* Values_list::item(const int i) const diff --git a/Surface_mesher/demo/Surface_mesher/volume.cpp b/Surface_mesher/demo/Surface_mesher/volume.cpp index 60c671675a8..1c7491b31ca 100644 --- a/Surface_mesher/demo/Surface_mesher/volume.cpp +++ b/Surface_mesher/demo/Surface_mesher/volume.cpp @@ -88,7 +88,7 @@ public: } result_type result = 0; // std::cerr << "isovalues: "; - for(int i = 1, end = static_cast(isovalues->size()); i <= end; ++i) + for(result_type i = 1, end = static_cast(isovalues->size()); i <= end; ++i) { // std::cerr << (*isovalues)[i-1] << ", "; if(value >= (*isovalues)[i-1].first && @@ -479,7 +479,7 @@ bool Volume::open_xt(const QString& filename) return false; } vtk_reader->SetHeaderSize(header_size); - vtk_reader->SetDataExtent(1, dimx, 1, dimy, 1, dimz); + vtk_reader->SetDataExtent(1, int(dimx), 1, int(dimy), 1, int(dimz)); vtk_reader->SetDataSpacing(1., 1., 1.); vtk_reader->SetFileDimensionality(3); vtk_reader->Update(); @@ -1421,7 +1421,7 @@ void Volume::gl_draw_surface() } else { - const unsigned char volume_index = values_list->value(i); + const auto volume_index = static_cast(values_list->value(i)); ::glBegin(GL_TRIANGLES); unsigned int counter = 0; diff --git a/Surface_mesher/demo/Surface_mesher/volume.h b/Surface_mesher/demo/Surface_mesher/volume.h index 1b33d244ca9..233a5bb1f7f 100644 --- a/Surface_mesher/demo/Surface_mesher/volume.h +++ b/Surface_mesher/demo/Surface_mesher/volume.h @@ -287,7 +287,7 @@ void Volume::search_for_connected_components(PointsOutputIterator it, * Second pass is a BFS initialized with all voxel of the border. * The last voxel of that BFS is used as the seed. */ - int pass = 1; // pass will be equal to 2 in second pass + Marker pass = 1; // pass will be equal to 2 in second pass Indices bbox_min = indices; Indices bbox_max = indices;