olena: olena-2.0-899-gd92a1e5 Address compiler warnings in Scribo.

* scribo/debug/logger.hh (scribo::debug::internal::logger_::log) [!SCRIBO_NDEBUG]: Avoid warnings about unused arguments in non-debug mode. * scribo/layout/xy_cut.hh (scribo::layout::internal::compute_hist_info_h) (scribo::layout::internal::compute_hist_info_v): Use `def::coord' instead of `int' as coordinate type, to avoid comparisons between signed and unsigned values. * src/misc/rectangularity.cc (main) * tests/binarization/global_threshold.cc (main) * tests/layout/xy_cut.cc (main): Avoid warnings about unused arguments. * tests/core/object_groups.cc (main): Likewise. Use `unsigned' instead of `int' as count/id type, to avoid comparisons between signed and unsigned values. --- scribo/ChangeLog | 20 ++++++++++++++++++++ scribo/scribo/debug/logger.hh | 8 ++++++-- scribo/scribo/layout/xy_cut.hh | 10 +++++----- scribo/src/misc/rectangularity.cc | 2 +- scribo/tests/binarization/global_threshold.cc | 6 +++--- scribo/tests/core/object_groups.cc | 16 +++++++++------- scribo/tests/layout/xy_cut.cc | 4 ++-- 7 files changed, 46 insertions(+), 20 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index cdcb6c0..5b70ce7 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,23 @@ +2014-06-27 Roland Levillain <roland@lrde.epita.fr> + + Address compiler warnings in Scribo. + + * scribo/debug/logger.hh + (scribo::debug::internal::logger_::log) [!SCRIBO_NDEBUG]: + Avoid warnings about unused arguments in non-debug mode. + * scribo/layout/xy_cut.hh + (scribo::layout::internal::compute_hist_info_h) + (scribo::layout::internal::compute_hist_info_v): + Use `def::coord' instead of `int' as coordinate type, to avoid + comparisons between signed and unsigned values. + * src/misc/rectangularity.cc (main) + * tests/binarization/global_threshold.cc (main) + * tests/layout/xy_cut.cc (main): + Avoid warnings about unused arguments. + * tests/core/object_groups.cc (main): Likewise. + Use `unsigned' instead of `int' as count/id type, to avoid + comparisons between signed and unsigned values. + 2014-06-26 Roland Levillain <roland@lrde.epita.fr> Make Scribo more compatible with BSD Make. diff --git a/scribo/scribo/debug/logger.hh b/scribo/scribo/debug/logger.hh index ab283c3..25e5ade 100644 --- a/scribo/scribo/debug/logger.hh +++ b/scribo/scribo/debug/logger.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2011, 2012, 2013 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2011, 2012, 2013, 2014 EPITA Research and Development +// Laboratory (LRDE). // // This file is part of Olena. // @@ -334,6 +334,10 @@ namespace scribo void logger_::log(VerboseMode mode, const std::string& text) { + // Avoid warnings about unused arguments in non-debug mode. + (void) mode; + (void) text; + # ifndef SCRIBO_NDEBUG if (verbose_mode_ < mode) return; diff --git a/scribo/scribo/layout/xy_cut.hh b/scribo/scribo/layout/xy_cut.hh index b55d51c..75a3d00 100644 --- a/scribo/scribo/layout/xy_cut.hh +++ b/scribo/scribo/layout/xy_cut.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2013, 2014 EPITA Research and Development Laboratory (LRDE). // // This file is part of Olena. // @@ -92,10 +92,10 @@ namespace scribo unsigned accumulator = 0; - for (unsigned i = geom::min_row(input); i <= geom::max_row(input); ++i) + for (def::coord i = geom::min_row(input); i <= geom::max_row(input); ++i) { accumulator = 0; - for (unsigned j = geom::min_col(input); j <= geom::max_col(input); ++j) + for (def::coord j = geom::min_col(input); j <= geom::max_col(input); ++j) { if (input.at_(i, j)) ++accumulator; @@ -124,10 +124,10 @@ namespace scribo unsigned accumulator = 0; - for (unsigned j = geom::min_col(input); j <= geom::max_col(input); ++j) + for (def::coord j = geom::min_col(input); j <= geom::max_col(input); ++j) { accumulator = 0; - for (unsigned i = geom::min_row(input); i <= geom::max_row(input); ++i) + for (def::coord i = geom::min_row(input); i <= geom::max_row(input); ++i) { if (input.at_(i, j)) ++accumulator; diff --git a/scribo/src/misc/rectangularity.cc b/scribo/src/misc/rectangularity.cc index 016f687..84a1c8c 100644 --- a/scribo/src/misc/rectangularity.cc +++ b/scribo/src/misc/rectangularity.cc @@ -50,7 +50,7 @@ #include <scribo/make/debug_filename.hh> -int main(int argc, char *argv[]) +int main(int /* argc */, char *argv[]) { using namespace mln; diff --git a/scribo/tests/binarization/global_threshold.cc b/scribo/tests/binarization/global_threshold.cc index 879ee95..7da4a73 100644 --- a/scribo/tests/binarization/global_threshold.cc +++ b/scribo/tests/binarization/global_threshold.cc @@ -1,5 +1,5 @@ -// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2010, 2011, 2014 EPITA Research and Development +// Laboratory (LRDE). // // This file is part of Olena. // @@ -32,7 +32,7 @@ #include <scribo/binarization/global_threshold.hh> -int main(int argc, char *argv[]) +int main() { using namespace mln; diff --git a/scribo/tests/core/object_groups.cc b/scribo/tests/core/object_groups.cc index 33e408f..90fa09f 100644 --- a/scribo/tests/core/object_groups.cc +++ b/scribo/tests/core/object_groups.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2014 EPITA Research and Development Laboratory (LRDE). // // This file is part of Olena. // @@ -38,15 +38,16 @@ #include "tests/data.hh" -int main(int argc, char *argv[]) +int main() { using namespace mln; using namespace scribo; std::string img = SCRIBO_IMG_DIR "/the_valleys.pbm"; - static const int comp_to_group_ref[] = { 0, 1, 4, 2, 3, 2, 2, 4, 4, 2, 2, 2, 2 }; - static const int pixel_area_ref[] = { 0, 3, 973, 39, 426 }; + static const unsigned comp_to_group_ref[] = + { 0, 1, 4, 2, 3, 2, 2, 4, 4, 2, 2, 2, 2 }; + static const unsigned pixel_area_ref[] = { 0, 3, 973, 39, 426 }; static const box2d bbox_ref[] = { box2d(), make::box2d(0,91, 1,92), @@ -55,7 +56,7 @@ int main(int argc, char *argv[]) make::box2d(9,12, 36,64) }; - static const int comp_ids_count_ref[] = { 0, 1, 7, 1, 3 }; + static const unsigned comp_ids_count_ref[] = { 0, 1, 7, 1, 3 }; static const int comp_ids_ref[][7] = { { 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0 }, @@ -81,7 +82,7 @@ int main(int argc, char *argv[]) mln_assertion(group.comp_to_group().nelements() == 13); // Checking comp_to_group() - for (int i = 0; i < group.comp_to_group().nelements(); ++i) + for (unsigned i = 0; i < group.comp_to_group().nelements(); ++i) mln_assertion(group.comp_to_group()[i] == comp_to_group_ref[i]); // Checking group info data. @@ -91,7 +92,8 @@ int main(int argc, char *argv[]) mln_assertion(group(g).is_valid()); mln_assertion(group(g).pixel_area() == pixel_area_ref[g]); mln_assertion(group(g).bbox() == bbox_ref[g]); - mln_assertion(group(g).component_ids().nelements() == comp_ids_count_ref[g]); + mln_assertion(group(g).component_ids().nelements() + == comp_ids_count_ref[g]); for_all_elements(e, group(g).component_ids()) mln_assertion(group(g).component_ids()[e] == comp_ids_ref[g][e]); diff --git a/scribo/tests/layout/xy_cut.cc b/scribo/tests/layout/xy_cut.cc index 3601d64..1ae94c5 100644 --- a/scribo/tests/layout/xy_cut.cc +++ b/scribo/tests/layout/xy_cut.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2013, 2014 EPITA Research and Development Laboratory (LRDE). // // This file is part of Olena. // @@ -34,7 +34,7 @@ using namespace mln; -int main(int argc, char** argv) +int main() { image2d<bool> input; -- 1.7.10.4
participants (1)
-
Roland Levillain