From 9848699fb98eba3f7d570c14379270c06262290c Mon Sep 17 00:00:00 2001 From: YuriiOlenych Date: Mon, 9 Jul 2018 17:53:56 +0300 Subject: [PATCH] Added static_cast and additional braces to fix compilation warnings. (#1405) --- dlib/cuda/tensor_tools.cpp | 4 ++-- dlib/geometry/line.h | 24 ++++++++++++------------ dlib/image_transforms/interpolation.h | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dlib/cuda/tensor_tools.cpp b/dlib/cuda/tensor_tools.cpp index c0f7fd69d..1099f4b4f 100644 --- a/dlib/cuda/tensor_tools.cpp +++ b/dlib/cuda/tensor_tools.cpp @@ -118,7 +118,7 @@ namespace dlib { namespace tt if (m.size() == 0 && v.size() == 0) return; DLIB_CASSERT(m.size() != 0); - DLIB_CASSERT(m.num_samples() == v.size()); + DLIB_CASSERT(m.num_samples() == static_cast(v.size())); #ifdef DLIB_USE_CUDA cuda::scale_rows(out, m, v); @@ -140,7 +140,7 @@ namespace dlib { namespace tt DLIB_CASSERT(have_same_dimensions(out,m2)); DLIB_CASSERT(have_same_dimensions(v1,v2)); DLIB_CASSERT(is_vector(mat(v1))); - DLIB_CASSERT(v1.size() == m1.num_samples()); + DLIB_CASSERT(static_cast(v1.size()) == m1.num_samples()); #ifdef DLIB_USE_CUDA cuda::scale_rows2(beta, out, m1, m2, v1, v2); diff --git a/dlib/geometry/line.h b/dlib/geometry/line.h index c540e1f37..014630e22 100644 --- a/dlib/geometry/line.h +++ b/dlib/geometry/line.h @@ -210,20 +210,20 @@ namespace dlib const auto& v31 = v13; const auto& v32 = v23; - if (is_convex_quadrilateral({v01, v12, v23, v30})) - return {v01, v12, v23, v30}; - if (is_convex_quadrilateral({v01, v13, v32, v20})) - return {v01, v13, v32, v20}; + if (is_convex_quadrilateral({{v01, v12, v23, v30}})) + return {{v01, v12, v23, v30}}; + if (is_convex_quadrilateral({{v01, v13, v32, v20}})) + return {{v01, v13, v32, v20}}; - if (is_convex_quadrilateral({v02, v23, v31, v10})) - return {v02, v23, v31, v10}; - if (is_convex_quadrilateral({v02, v21, v13, v30})) - return {v02, v21, v13, v30}; + if (is_convex_quadrilateral({{v02, v23, v31, v10}})) + return {{v02, v23, v31, v10}}; + if (is_convex_quadrilateral({{v02, v21, v13, v30}})) + return {{v02, v21, v13, v30}}; - if (is_convex_quadrilateral({v03, v32, v21, v10})) - return {v03, v32, v21, v10}; - if (is_convex_quadrilateral({v03, v31, v12, v20})) - return {v03, v31, v12, v20}; + if (is_convex_quadrilateral({{v03, v32, v21, v10}})) + return {{v03, v32, v21, v10}}; + if (is_convex_quadrilateral({{v03, v31, v12, v20}})) + return {{v03, v31, v12, v20}}; throw no_convex_quadrilateral(); } diff --git a/dlib/image_transforms/interpolation.h b/dlib/image_transforms/interpolation.h index b9eb5297c..eef353865 100644 --- a/dlib/image_transforms/interpolation.h +++ b/dlib/image_transforms/interpolation.h @@ -2169,8 +2169,8 @@ namespace dlib for (auto& p : pts) bounding_box += p; - const std::array corners = {bounding_box.tl_corner(), bounding_box.tr_corner(), - bounding_box.bl_corner(), bounding_box.br_corner()}; + const std::array corners = {{bounding_box.tl_corner(), bounding_box.tr_corner(), + bounding_box.bl_corner(), bounding_box.br_corner()}}; matrix dists(4,4); for (long r = 0; r < dists.nr(); ++r)