4033: Fix some g++-3.3 compilation warnings and errors.

https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Fix some g++-3.3 compilation warnings and errors. * mln/debug/histo.hh (h): Disambiguate type. * mln/data/sort_psites.hh (to_p_array): Qualify to disambiguate. * mln/value/shell.hh (operator): Remove inherited cast operator. * mln/value/glf.hh: Upgrade doc style. * mln/make/win_chamfer.hh (sqrt): Remove useless cast. * tests/data/fill_with_image.cc, * tests/data/transform.cc, * tests/data/paste.cc (iota): Fix ambiguity; declare then use. * tests/data/transform.cc: Avoid sqrt. * tests/data/replace.cc: Layout. * tests/value/graylevel.cc (test_conversion): Fix ambiguity. * tests/morpho/graph_image_wst.cc, * tests/morpho/graph_image_morpho.cc, * tests/labeling/foreground.cc (mln_VAR): Get rid of it. * tests/norm/l2.cc (sqrt): Remove useless return cast. Disambiguate argument. mln/data/sort_psites.hh | 9 +++++---- mln/debug/histo.hh | 6 +++--- mln/make/win_chamfer.hh | 8 ++++---- mln/value/glf.hh | 10 +++++----- mln/value/shell.hh | 15 ++++----------- tests/data/fill_with_image.cc | 11 ++++++----- tests/data/paste.cc | 6 +++--- tests/data/replace.cc | 1 - tests/data/transform.cc | 22 +++++++++++----------- tests/labeling/foreground.cc | 2 +- tests/morpho/graph_image_morpho.cc | 7 +++---- tests/morpho/graph_image_wst.cc | 4 ++-- tests/norm/l2.cc | 6 +++--- tests/value/graylevel.cc | 23 ++++++++++++----------- 14 files changed, 62 insertions(+), 68 deletions(-) Index: mln/debug/histo.hh --- mln/debug/histo.hh (revision 4032) +++ mln/debug/histo.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/debug/histo.hh /// -/// Save a histogram to a plot data file. +/// \brief Save a histogram to a plot data file. /// /// \todo Move to io::histo::save. @@ -53,7 +53,7 @@ template <typename T> void - histo(const histo::array<T>& h, const std::string& filename); + histo(const mln::histo::array<T>& h, const std::string& filename); @@ -61,7 +61,7 @@ template <typename T> void - histo(const histo::array<T>& h, const std::string& filename) + histo(const mln::histo::array<T>& h, const std::string& filename) { std::ofstream file(filename.c_str()); if (! file) Index: mln/data/sort_psites.hh --- mln/data/sort_psites.hh (revision 4032) +++ mln/data/sort_psites.hh (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Milena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -30,6 +30,7 @@ # define MLN_LEVEL_SORT_PSITES_HH /// \file mln/data/sort_psites.hh +/// /// \brief Sort_Psites the contents of an image into another one. /// /// \todo Factor code + optimize. @@ -130,7 +131,7 @@ sort_psites_increasing_(trait::image::quant::any, // general case const I& input) { - p_array<mln_psite(I)> v = convert::to_p_array(input.domain()); + p_array<mln_psite(I)> v = mln::convert::to_p_array(input.domain()); std::sort(v.hook_std_vector_().begin(), v.hook_std_vector_().end(), value_psite_less_<I>(input)); return v; @@ -174,7 +175,7 @@ sort_psites_decreasing_(trait::image::quant::any, // general case const I& input) { - p_array<mln_psite(I)> v = convert::to_p_array(input.domain()); + p_array<mln_psite(I)> v = mln::convert::to_p_array(input.domain()); std::sort(v.hook_std_vector_().begin(), v.hook_std_vector_().end(), value_psite_greater_<I>(input)); return v; Index: mln/value/shell.hh --- mln/value/shell.hh (revision 4032) +++ mln/value/shell.hh (working copy) @@ -29,6 +29,10 @@ #ifndef MLN_CORE_VALUE_SHELL_HH # define MLN_CORE_VALUE_SHELL_HH +/// \file mln/core/value/shell.hh +/// +/// \brief Define a shell type that encloses a value. + # include <mln/core/concept/proxy.hh> # include <mln/core/concept/function.hh> # include <mln/core/concept/image.hh> @@ -73,9 +77,6 @@ // Ctor shell(Image<I> &ima, const mln_site(I) &s); - // Read - operator value () const; - // Write value operator=(value); @@ -113,14 +114,6 @@ { } - - // Read for everyone - template <typename F, typename I> - shell<F,I>::operator value() const - { - return v_; - } - // Write for everyone template <typename F, typename I> typename F::result Index: mln/value/glf.hh --- mln/value/glf.hh (revision 4032) +++ mln/value/glf.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Milena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -28,10 +29,9 @@ #ifndef MLN_VALUE_GLF_HH # define MLN_VALUE_GLF_HH -/*! \file mln/value/glf.hh - * - * \brief Define the alias value::glf. - */ +/// \file mln/value/glf.hh +/// +/// \brief Define the alias value::glf. # include <mln/value/graylevel_f.hh> Index: mln/make/win_chamfer.hh --- mln/make/win_chamfer.hh (revision 4032) +++ mln/make/win_chamfer.hh (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2006, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2006, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Milena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -31,7 +31,7 @@ /// \file mln/make/win_chamfer.hh /// -/// Routine to create chamfer mln::w_window2d_int. +/// \brief Routine to create chamfer mln::w_window2d_int. /// /// \todo Revamp! @@ -121,7 +121,7 @@ mln::w_window2d_float mk_chamfer_exact() { - float r2 = static_cast<float>(std::sqrt(2.0f)); + float r2 = std::sqrt(2.0f); float ws[] = { r2, 1, r2, 1, 0, 0, 0, 0, 0 }; Index: tests/data/fill_with_image.cc --- tests/data/fill_with_image.cc (revision 4032) +++ tests/data/fill_with_image.cc (working copy) @@ -26,9 +26,9 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/// \file tests/data/fill_with_value.cc +/// \file tests/data/fill_with_image.cc /// -/// Tests on mln::data::fill_with_value +/// \brief Tests on mln::data::fill_with_image. #include <mln/data/fill_with_value.hh> #include <mln/data/fill_with_image.hh> @@ -145,8 +145,8 @@ // pw image test { - const pw::image<fun::p2v::iota, box2d> ima(fun::p2v::iota(), - make::box2d(-2,-2, 15,15)); + fun::p2v::iota f; + const pw::image<fun::p2v::iota, mln::box2d> ima(f, make::box2d(-2,-2, 15,15)); image2d<short unsigned int> out(8, 8); data::fill(out, (short unsigned int)0); @@ -155,7 +155,7 @@ // flat image test { - flat_image<short, box2d> ima(5, make::box2d(size, size)); + flat_image<short, box2d> ima(5, mln::make::box2d(size, size)); image2d<unsigned short> out(size, size); data::fill_with_value(ima, 51); @@ -233,4 +233,5 @@ mln_assertion(out == extend_ima); } + } Index: tests/data/transform.cc --- tests/data/transform.cc (revision 4032) +++ tests/data/transform.cc (working copy) @@ -28,7 +28,7 @@ /// \file tests/data/transform.cc /// -/// Tests on mln::data::transform. +/// \brief Tests on mln::data::transform. #include <cmath> @@ -83,7 +83,7 @@ box_fwd_piter_<point1d> p(out.domain()); for_all(p) - mln_assertion((unsigned short)std::sqrt(ima(p)) == out(p)); + mln_assertion(ima(p) == out(p) * out(p)); } @@ -97,7 +97,7 @@ box_fwd_piter_<point2d> p(out.domain()); for_all(p) - mln_assertion((unsigned short)std::sqrt(ima(p)) == out(p)); + mln_assertion(ima(p) == out(p) * out(p)); } /// Another image2d test @@ -119,13 +119,13 @@ box_fwd_piter_<point3d> p(out.domain()); for_all(p) - mln_assertion((unsigned short)std::sqrt(ima(p)) == out(p)); + mln_assertion(ima(p) == out(p) * out(p)); } /// pw image test { - const pw::image<fun::p2v::iota, box2d> ima(fun::p2v::iota(), - make::box2d(2,2, 5,5)); + fun::p2v::iota f; + const pw::image<fun::p2v::iota, box2d> ima(f, make::box2d(2,2, 5,5)); image2d<unsigned short> out(8, 8); data::fill(out, (short unsigned int)0); @@ -142,7 +142,7 @@ box2d::piter p(out.domain()); for_all(p) - mln_assertion((unsigned short)std::sqrt(ima(p)) == out(p)); + mln_assertion(ima(p) == out(p) * out(p)); } // image if test @@ -159,7 +159,7 @@ II::piter p(ima_if.domain()); for_all(p) - mln_assertion((unsigned short)std::sqrt(ima_if(p)) == out(p)); + mln_assertion(ima_if(p) == out(p) * out(p)); } // cast image test @@ -179,7 +179,7 @@ II::piter p(cast.domain()); for_all(p) - mln_assertion((unsigned short)std::sqrt(cast(p)) == out(p)); + mln_assertion(cast(p) == out(p) * out(p)); } // sub_image test @@ -196,7 +196,7 @@ II::piter p(sub_ima.domain()); for_all(p) - mln_assertion((unsigned short)std::sqrt(sub_ima(p)) == out(p)); + mln_assertion(sub_ima(p) == out(p) * out(p)); } // extended image test @@ -213,6 +213,6 @@ II::piter p(extend_ima.domain()); for_all(p) - mln_assertion((unsigned short)std::sqrt(extend_ima(p)) == out(p)); + mln_assertion(extend_ima(p) == out(p) * out(p)); } } Index: tests/data/replace.cc --- tests/data/replace.cc (revision 4032) +++ tests/data/replace.cc (working copy) @@ -59,5 +59,4 @@ }; mln_assertion(make::image(vs_ref) == rhs); - } Index: tests/data/paste.cc --- tests/data/paste.cc (revision 4032) +++ tests/data/paste.cc (working copy) @@ -28,7 +28,7 @@ /// \file tests/data/paste.cc /// -/// Tests on mln::data::paste. +/// \brief Tests on mln::data::paste. #include <mln/core/image/image1d.hh> #include <mln/core/image/image2d.hh> @@ -109,8 +109,8 @@ /// pw image test { - const pw::image<fun::p2v::iota, box2d> ima(fun::p2v::iota(), - make::box2d(2,2, 5,5)); + fun::p2v::iota f; + const pw::image<fun::p2v::iota, box2d> ima(f, make::box2d(2,2, 5,5)); image2d<short unsigned int> out(8, 8); data::fill(out, (short unsigned int)0); Index: tests/value/graylevel.cc --- tests/value/graylevel.cc (revision 4032) +++ tests/value/graylevel.cc (working copy) @@ -28,8 +28,7 @@ /// \file tests/value/graylevel.cc /// -/// \brief Tests on mln::value::graylevel. Tests operations between -/// graylevel of different encodings. +/// \brief Tests on mln::value::graylevel. #include <mln/value/gl8.hh> #include <mln/value/gl16.hh> @@ -58,9 +57,9 @@ #define test_conversion(T1, T2, VAL) \ { \ - T1(T2(VAL)); \ - T1 test = T2(VAL); \ - test = T2(VAL); \ + (T1)(T2)(VAL); \ + T1 test = (T2)(VAL); \ + test = (T2)(VAL); \ } int main() @@ -146,20 +145,22 @@ { // Conversions. - test_conversion(gl8, gray_<8>, 255); + typedef mln::value::internal::gray_<8> i_gray_8; + test_conversion(gl8, i_gray_8, 255); + test_conversion(gl8, gray_f, 0.4); test_conversion(gl8, glf, 0.4); - test_conversion(glf, gray_<8>, 255); + test_conversion(glf, i_gray_8, 255); test_conversion(glf, gray_f, 0.4); test_conversion(glf, gl8, 142); - test_conversion(gray_f, gray_<8>, 4); + test_conversion(gray_f, i_gray_8, 4); test_conversion(glf, gray_f, 0.4); } - { - // FIXME: comparison with literals doesn't work +// { +// // FIXME: comparison with literals doesn't work // c = a; // mln_assertion(c == white); @@ -167,7 +168,7 @@ // mln_assertion(c == white); // c = c / 6; - } +// } // { // gl8 c = white; Index: tests/morpho/graph_image_wst.cc --- tests/morpho/graph_image_wst.cc (revision 4032) +++ tests/morpho/graph_image_wst.cc (working copy) @@ -107,11 +107,11 @@ nbh_t nbh; unsigned nbasins; - mln_const_VAR(wshed, morpho::meyer_wst(ima, nbh, nbasins)); + ima_t wshed = morpho::meyer_wst(ima, nbh, nbasins); std::cout << "nbasins = " << nbasins << std::endl; // Manual iteration over the domain of WSHED. - mln_piter_(wshed_t) pw(wshed.domain()); + mln_piter_(ima_t) pw(wshed.domain()); for_all (pw) std::cout << "wshed (" << pw << ") = " << wshed(pw) << std::endl; } Index: tests/morpho/graph_image_morpho.cc --- tests/morpho/graph_image_morpho.cc (revision 4032) +++ tests/morpho/graph_image_morpho.cc (working copy) @@ -28,7 +28,7 @@ /// \file tests/morpho/graph_image_morpho.cc /// -/// Tests on mln::graph_image with morphological filters. +/// \brief Tests on mln::graph_image with morphological filters. #include <mln/accu/bbox.hh> #include <mln/core/alias/box2d.hh> @@ -39,7 +39,6 @@ /// Required for graph images. #include <mln/core/image/vertex_image.hh> -#include <mln/core/var.hh> #include <mln/fun/i2v/array.hh> #include <mln/util/graph.hh> #include <mln/make/vertex_image.hh> @@ -144,11 +143,11 @@ ima_t::win_t win; - mln_const_VAR(ima_dil, morpho::dilation(ima, win)); + ima_t ima_dil = morpho::dilation(ima, win); debug::draw_graph(ima_rep, ima_dil.domain(), pw::cst(9), pw::cst(2)); debug::println(ima_rep); - mln_const_VAR(ima_ero, morpho::erosion(ima, win)); + ima_t ima_ero = morpho::erosion(ima, win); debug::draw_graph(ima_rep, ima_ero.domain(), pw::cst(9), pw::cst(2)); debug::println(ima_rep); } Index: tests/norm/l2.cc --- tests/norm/l2.cc (revision 4032) +++ tests/norm/l2.cc (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Milena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -65,7 +65,7 @@ typedef mln::algebra::vec<3, int> vec_t; // Reference value. - float d = float(std::sqrt((4 - 2) * (4 - 2) + + float d = std::sqrt(float((4 - 2) * (4 - 2) + (1 + 2) * (1 + 2) + (0 - 3) * (0 - 3))); Index: tests/labeling/foreground.cc --- tests/labeling/foreground.cc (revision 4032) +++ tests/labeling/foreground.cc (working copy) @@ -45,7 +45,7 @@ using namespace mln; typedef image2d<bool> I; - mln_VAR(nbh, c4()); + neighb2d nbh = c4(); I pic = io::pbm::load(MLN_IMG_DIR "/picasso.pbm"); image2d<unsigned> out, ref;
participants (1)
-
Thierry Geraud