From 4e8bcd25264d3efd8f12bc43f36d6efd2b2cb1c3 Mon Sep 17 00:00:00 2001 From: Davis King Date: Fri, 1 Mar 2013 02:29:54 -0500 Subject: [PATCH] Fixing yet more compiler warnings on older versions of gcc --- dlib/image_transforms/segment_image.h | 4 ++-- dlib/test/object_detector.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dlib/image_transforms/segment_image.h b/dlib/image_transforms/segment_image.h index f8574a36c..217ebb70b 100644 --- a/dlib/image_transforms/segment_image.h +++ b/dlib/image_transforms/segment_image.h @@ -483,8 +483,8 @@ namespace dlib if (set1 != set2) { const diff_type diff = sorted_edges[i].diff; - const diff_type tau1 = k/data[set1].component_size; - const diff_type tau2 = k/data[set2].component_size; + const diff_type tau1 = static_cast(k/data[set1].component_size); + const diff_type tau2 = static_cast(k/data[set2].component_size); const diff_type mint = std::min(data[set1].internal_diff + tau1, data[set2].internal_diff + tau2); diff --git a/dlib/test/object_detector.cpp b/dlib/test/object_detector.cpp index 26c25d68d..d922a51c8 100644 --- a/dlib/test/object_detector.cpp +++ b/dlib/test/object_detector.cpp @@ -258,7 +258,9 @@ namespace { for (long c = 0; c < images[i].nc(); ++c) { - images[i][r][c] = put_in_range(0,255,images[i][r][c] + 10*rnd.get_random_gaussian()); + typedef typename image_array_type::type image_type; + typedef typename image_type::type type; + images[i][r][c] = (type)put_in_range(0,255,images[i][r][c] + 10*rnd.get_random_gaussian()); } } } @@ -356,7 +358,9 @@ namespace { for (long c = 0; c < images[i].nc(); ++c) { - images[i][r][c] = put_in_range(0,255,images[i][r][c] + 40*rnd.get_random_gaussian()); + typedef typename image_array_type::type image_type; + typedef typename image_type::type type; + images[i][r][c] = (type)put_in_range(0,255,images[i][r][c] + 40*rnd.get_random_gaussian()); } } }