From 4afaae6eb26d55392167afea5af174f8995823e2 Mon Sep 17 00:00:00 2001 From: Menelaos Karavelas Date: Mon, 12 Jan 2015 15:52:17 +0200 Subject: [PATCH 1/3] [algorithms][closest_feature] initialize variable passed by reference to avoid maybe-uninitialized-warning produced by some compilers --- .../algorithms/detail/closest_feature/range_to_range.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp b/include/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp index 90248767e..ceba59b41 100644 --- a/include/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp +++ b/include/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp @@ -60,6 +60,7 @@ private: BOOST_ASSERT( queries_first != queries_last ); Distance const zero = Distance(0); + dist_min = zero; // create -- packing algorithm rtree_type rt(rtree_first, rtree_last); From ceb1102c4604429ef379252b9f1ad76f4aef678e Mon Sep 17 00:00:00 2001 From: Menelaos Karavelas Date: Mon, 12 Jan 2015 15:59:23 +0200 Subject: [PATCH 2/3] [test][algorithms][distance] explicitly initialize variable to avoid maybe-uninitialized-warning --- test/algorithms/distance/distance_brute_force.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/algorithms/distance/distance_brute_force.hpp b/test/algorithms/distance/distance_brute_force.hpp index ccea5cbac..e645ec524 100644 --- a/test/algorithms/distance/distance_brute_force.hpp +++ b/test/algorithms/distance/distance_brute_force.hpp @@ -98,7 +98,7 @@ struct one_to_many >::type distance_type; bool first = true; - distance_type d_min; + distance_type d_min(0); for (Iterator it = begin; it != end; ++it, first = false) { distance_type d = Policy::apply(geometry, *it, strategy); From 125707ca65910c544592b0cdac7c1dbdbcb84ab3 Mon Sep 17 00:00:00 2001 From: Menelaos Karavelas Date: Mon, 12 Jan 2015 16:02:19 +0200 Subject: [PATCH 3/3] [algorithms][distance] explicitly initialize variables to avoid maybe-uninitialized-warning produced by some compilers --- .../algorithms/detail/distance/geometry_to_segment_or_box.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp b/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp index 04d1095cb..63ebdd046 100644 --- a/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp +++ b/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp @@ -215,7 +215,7 @@ public: // consider all distances of the points in the geometry to the // segment or box - comparable_return_type cd_min1; + comparable_return_type cd_min1(0); point_iterator_type pit_min; seg_or_box_iterator_type it_min1 = seg_or_box_points.begin(); seg_or_box_iterator_type it_min2 = ++seg_or_box_points.begin(); @@ -246,7 +246,7 @@ public: // consider all distances of the points in the segment or box to the // segments of the geometry - comparable_return_type cd_min2; + comparable_return_type cd_min2(0); segment_iterator_type sit_min; typename std::vector::const_iterator it_min;