>From d14506cc2b98634be4fed45f142e0fb09bdff311 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 19 May 2012 07:33:17 +0200 Subject: [PATCH] Fix 2546: Prefix incrementers may be preferred for non-primitive types See http://en.allexperts.com/q/C-1040/Increment-operators.htm for some explanation --- lily/dot-column.cc | 2 +- lily/dot-configuration.cc | 10 +++++----- lily/note-spacing-engraver.cc | 2 +- lily/skyline.cc | 14 +++++++------- lily/tie-engraver.cc | 4 ++-- lily/tie-formatting-problem.cc | 2 +- lily/tie-performer.cc | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 1aa0b72..81b8124 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -194,7 +194,7 @@ Dot_column::calc_positioning_done (SCM smob) problem.register_configuration (cfg); for (Dot_configuration::const_iterator i (cfg.begin ()); - i != cfg.end (); i++) + i != cfg.end (); ++i) { /* Junkme? diff --git a/lily/dot-configuration.cc b/lily/dot-configuration.cc index 940420c..d6c04c5 100644 --- a/lily/dot-configuration.cc +++ b/lily/dot-configuration.cc @@ -27,7 +27,7 @@ Dot_configuration::badness () const { int t = 0; for (Dot_configuration::const_iterator i (begin ()); - i != end (); i++) + i != end (); ++i) { int p = i->first; int demerit = sqr (p - i->second.pos_) * 2; @@ -50,7 +50,7 @@ Dot_configuration::print () const { printf ("dotconf { "); for (Dot_configuration::const_iterator i (begin ()); - i != end (); i++) + i != end (); ++i) printf ("%d, ", i->first); printf ("}\n"); } @@ -71,7 +71,7 @@ Dot_configuration::shifted (int k, Direction d) const if (d > 0) { for (Dot_configuration::const_iterator i (begin ()); - i != end (); i++) + i != end (); ++i) { int p = i->first; if (p == k) @@ -98,7 +98,7 @@ Dot_configuration::shifted (int k, Direction d) const Dot_configuration::const_iterator i (end ()); do { - i--; + --i; int p = i->first; if (p == k) @@ -157,7 +157,7 @@ Dot_configuration::x_offset () const { Real off = 0.0; for (Dot_configuration::const_iterator i (begin ()); - i != end (); i++) + i != end (); ++i) off = max (off, problem_->head_skyline_.height ((*i).first)); return off; diff --git a/lily/note-spacing-engraver.cc b/lily/note-spacing-engraver.cc index 8cb1b35..c1d2405 100644 --- a/lily/note-spacing-engraver.cc +++ b/lily/note-spacing-engraver.cc @@ -51,7 +51,7 @@ void Note_spacing_engraver::derived_mark () const { for (Last_spacing_map::const_iterator i = last_spacings_.begin (); - i != last_spacings_.end (); i++) + i != last_spacings_.end (); ++i) scm_gc_mark (i->first->self_scm ()); } diff --git a/lily/skyline.cc b/lily/skyline.cc index 0250fc0..2a3a369 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -62,7 +62,7 @@ static void print_buildings (list const &b) { - for (list::const_iterator i = b.begin (); i != b.end (); i++) + for (list::const_iterator i = b.begin (); i != b.end (); ++i) i->print (); } @@ -375,7 +375,7 @@ Skyline::Skyline (Skyline const &src) /* doesn't a list's copy constructor do this? -- jneem */ for (list::const_iterator i = src.buildings_.begin (); - i != src.buildings_.end (); i++) + i != src.buildings_.end (); ++i) { buildings_.push_back (Building ((*i))); } @@ -492,7 +492,7 @@ void Skyline::raise (Real r) { list::iterator end = buildings_.end (); - for (list::iterator i = buildings_.begin (); i != end; i++) + for (list::iterator i = buildings_.begin (); i != end; ++i) i->y_intercept_ += sky_ * r; } @@ -500,7 +500,7 @@ void Skyline::shift (Real s) { list::iterator end = buildings_.end (); - for (list::iterator i = buildings_.begin (); i != end; i++) + for (list::iterator i = buildings_.begin (); i != end; ++i) { i->end_ += s; i->y_intercept_ -= s * i->slope_; @@ -563,9 +563,9 @@ Skyline::internal_distance (Skyline const &other, Real horizon_padding, Real *to touch = start; if (i->end_ <= j->end_) - i++; + ++i; else - j++; + ++j; start = end; } @@ -585,7 +585,7 @@ Skyline::height (Real airplane) const assert (!isinf (airplane)); list::const_iterator i; - for (i = buildings_.begin (); i != buildings_.end (); i++) + for (i = buildings_.begin (); i != buildings_.end (); ++i) { if (i->end_ >= airplane) return sky_ * i->height (airplane); diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 40da0d3..fe948ec 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -237,7 +237,7 @@ Tie_engraver::stop_translation_timestep () if (!wait) { vector::iterator it = heads_to_tie_.begin (); - for (; it < heads_to_tie_.end (); it++) + for (; it != heads_to_tie_.end (); ++it) report_unterminated_tie (*it); heads_to_tie_.clear (); } @@ -322,7 +322,7 @@ Tie_engraver::stop_translation_timestep () if (!wait && new_heads_to_tie.size ()) { vector::iterator it = heads_to_tie_.begin (); - for (; it < heads_to_tie_.end (); it++) + for (; it != heads_to_tie_.end (); ++it) report_unterminated_tie (*it); heads_to_tie_.clear (); } diff --git a/lily/tie-formatting-problem.cc b/lily/tie-formatting-problem.cc index e2c3736..54af9ad 100644 --- a/lily/tie-formatting-problem.cc +++ b/lily/tie-formatting-problem.cc @@ -80,7 +80,7 @@ Tie_formatting_problem::Tie_formatting_problem () Tie_formatting_problem::~Tie_formatting_problem () { for (Tie_configuration_map::const_iterator i (possibilities_.begin ()); - i != possibilities_.end (); i++) + i != possibilities_.end (); ++i) delete (*i).second; } diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index 9ef199d..061c51b 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -96,7 +96,7 @@ Tie_performer::acknowledge_audio_element (Audio_element_info inf) Stream_event *right_mus = inf.event_; for (it = heads_to_tie_.begin (); !found && (it != heads_to_tie_.end ()); - it++) + ++it) { Audio_element_info et = (*it).head_; Audio_note *th = dynamic_cast (et.elem_); -- 1.7.10