last-svn-commit-464-g696503d Fix warnings with g++-4.1 in Milena.

* mln/fun/v2v/saturate.hh, * mln/subsampling/antialiased.hh, * mln/value/rgb.hh: Use convert::from_to for type conversions. --- milena/ChangeLog | 8 +++++ milena/mln/fun/v2v/saturate.hh | 8 ++++- milena/mln/subsampling/antialiased.hh | 2 +- milena/mln/value/rgb.hh | 54 ++++++++++++++++---------------- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index e853813..2aec6aa 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,13 @@ 2010-08-11 Guillaume Lazzara <z@lrde.epita.fr> + Fix warnings with g++-4.1 in Milena. + + * mln/fun/v2v/saturate.hh, + * mln/subsampling/antialiased.hh, + * mln/value/rgb.hh: Use convert::from_to for type conversions. + +2010-08-11 Guillaume Lazzara <z@lrde.epita.fr> + * mln/core/point.hh: Fix a warning. 2010-08-11 Guillaume Lazzara <z@lrde.epita.fr> diff --git a/milena/mln/fun/v2v/saturate.hh b/milena/mln/fun/v2v/saturate.hh index b26eb09..0b73269 100644 --- a/milena/mln/fun/v2v/saturate.hh +++ b/milena/mln/fun/v2v/saturate.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -112,7 +113,10 @@ namespace mln return min_; if (w > max_W) return max_; - return mln::value::cast<W>(w); + + V output; + convert::from_to(w, output); + return output; } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/subsampling/antialiased.hh b/milena/mln/subsampling/antialiased.hh index 80975bd..f6f2c1d 100644 --- a/milena/mln/subsampling/antialiased.hh +++ b/milena/mln/subsampling/antialiased.hh @@ -194,7 +194,7 @@ namespace mln for (unsigned k = 0; k < factor; ++k) s += *ptrs[j]++; - *po++ = (s + factor_round) / factor_2; + convert::from_to((s + factor_round) / factor_2, *po++); } for (unsigned j = 0; j < factor; ++j) diff --git a/milena/mln/value/rgb.hh b/milena/mln/value/rgb.hh index 82e98d6..89ffce6 100644 --- a/milena/mln/value/rgb.hh +++ b/milena/mln/value/rgb.hh @@ -446,9 +446,9 @@ namespace mln inline rgb<n>::rgb(const algebra::vec<3, float>& v) { - this->v_[0] = v[0]; - this->v_[1] = v[1]; - this->v_[2] = v[2]; + convert::from_to(v[0], this->v_[0]); + convert::from_to(v[1], this->v_[1]); + convert::from_to(v[2], this->v_[2]); } template <unsigned n> @@ -488,27 +488,27 @@ namespace mln inline rgb<n>::rgb(const mln::literal::light_gray_t&) { - this->v_[0] = mln_max(int_u<n>) * 0.75; - this->v_[1] = mln_max(int_u<n>) * 0.75; - this->v_[2] = mln_max(int_u<n>) * 0.75; + convert::from_to(mln_max(int_u<n>) * 0.75, this->v_[0]); + convert::from_to(mln_max(int_u<n>) * 0.75, this->v_[1]); + convert::from_to(mln_max(int_u<n>) * 0.75, this->v_[2]); } template <unsigned n> inline rgb<n>::rgb(const mln::literal::medium_gray_t&) { - this->v_[0] = mln_max(int_u<n>) * 0.50; - this->v_[1] = mln_max(int_u<n>) * 0.50; - this->v_[2] = mln_max(int_u<n>) * 0.50; + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[0]); + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[1]); + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[2]); } template <unsigned n> inline rgb<n>::rgb(const mln::literal::dark_gray_t&) { - this->v_[0] = mln_max(int_u<n>) * 0.25; - this->v_[1] = mln_max(int_u<n>) * 0.25; - this->v_[2] = mln_max(int_u<n>) * 0.25; + convert::from_to(mln_max(int_u<n>) * 0.25, this->v_[0]); + convert::from_to(mln_max(int_u<n>) * 0.25, this->v_[1]); + convert::from_to(mln_max(int_u<n>) * 0.25, this->v_[2]); } template <unsigned n> @@ -542,16 +542,16 @@ namespace mln inline rgb<n>::rgb(const mln::literal::brown_t&) { - this->v_[0] = mln_max(int_u<n>) * 0.75; - this->v_[1] = mln_max(int_u<n>) * 0.50; - this->v_[2] = mln_max(int_u<n>) * 0.25; + convert::from_to(mln_max(int_u<n>) * 0.75, this->v_[0]); + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[1]); + convert::from_to(mln_max(int_u<n>) * 0.25, this->v_[2]); } template <unsigned n> inline rgb<n>::rgb(const mln::literal::lime_t&) { - this->v_[0] = mln_max(int_u<n>) * 0.75; + convert::from_to(mln_max(int_u<n>) * 0.75, this->v_[0]); this->v_[1] = mln_max(int_u<n>); this->v_[2] = 0; } @@ -561,7 +561,7 @@ namespace mln rgb<n>::rgb(const mln::literal::orange_t&) { this->v_[0] = mln_max(int_u<n>); - this->v_[1] = mln_max(int_u<n>) * 0.50; + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[1]); this->v_[2] = 0; } @@ -570,17 +570,17 @@ namespace mln rgb<n>::rgb(const mln::literal::pink_t&) { this->v_[0] = mln_max(int_u<n>); - this->v_[1] = mln_max(int_u<n>) * 0.75; - this->v_[2] = mln_max(int_u<n>) * 0.75; + convert::from_to(mln_max(int_u<n>) * 0.75, this->v_[1]); + convert::from_to(mln_max(int_u<n>) * 0.75, this->v_[2]); } template <unsigned n> inline rgb<n>::rgb(const mln::literal::purple_t&) { - this->v_[0] = mln_max(int_u<n>) * 0.75; + convert::from_to(mln_max(int_u<n>) * 0.75, this->v_[0]); this->v_[1] = 0; - this->v_[2] = mln_max(int_u<n>) * 0.25; + convert::from_to(mln_max(int_u<n>) * 0.25, this->v_[2]); } template <unsigned n> @@ -588,17 +588,17 @@ namespace mln rgb<n>::rgb(const mln::literal::teal_t&) { this->v_[0] = 0; - this->v_[1] = mln_max(int_u<n>) * 0.50; - this->v_[2] = mln_max(int_u<n>) * 0.50; + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[1]); + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[2]); } template <unsigned n> inline rgb<n>::rgb(const mln::literal::violet_t&) { - this->v_[0] = mln_max(int_u<n>) * 0.50; + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[0]); this->v_[1] = 0; - this->v_[2] = mln_max(int_u<n>) * 0.50; + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[2]); } template <unsigned n> @@ -632,8 +632,8 @@ namespace mln inline rgb<n>::rgb(const mln::literal::olive_t&) { - this->v_[0] = mln_max(int_u<n>) * 0.50; - this->v_[1] = mln_max(int_u<n>) * 0.50; + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[0]); + convert::from_to(mln_max(int_u<n>) * 0.50, this->v_[1]); this->v_[2] = 0; } -- 1.5.6.5
participants (1)
-
Guillaume Lazzara