Skip to content

Commit

Permalink
Issue 5703: Run scripts/auxiliar/fixcc.py
Browse files Browse the repository at this point in the history
Run

    scripts/auxiliar/fixcc.py --sloppy $(git ls-files '*.cc' '*.hh' '*.icc' '*.tcc')

in order to reformat C++ source files.
  • Loading branch information
dakhubgit committed Mar 22, 2020
1 parent 2ddc627 commit 786c366
Show file tree
Hide file tree
Showing 296 changed files with 1,607 additions and 1,671 deletions.
1 change: 0 additions & 1 deletion flower/file-name.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <unistd.h>
#include <limits.h>


#include "config.hh"

#if HAVE_SYS_STAT_H
Expand Down
2 changes: 1 addition & 1 deletion flower/file-path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ File_path::parse_path (const string &p)
inline int
workaround_wrapper_stat (const char *f, STRUCT_STAT *s)
{
#if !defined(__MINGW32__) || defined(_UCRT)
#if !defined (__MINGW32__) || defined (_UCRT)
return FUNCTION_STAT (f, s);
#else
// Workaround for MinGW UTF-8 stat issue:
Expand Down
6 changes: 3 additions & 3 deletions flower/include/file-path.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public:
std::string find (const std::string &name, char const *extensions[]);
std::string to_string () const;
bool try_append (std::string str);
void append (const std::string&);
void parse_path (const std::string&);
void prepend (const std::string&);
void append (const std::string &);
void parse_path (const std::string &);
void prepend (const std::string &);
};

bool is_file (const std::string &file_name);
Expand Down
2 changes: 1 addition & 1 deletion flower/include/matrix.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public:
}

Matrix<T, A> (vsize rows, vsize columns, T const &t)
: data_ (rows *columns, t)
: data_ (rows * columns, t)
{
rank_ = rows;
}
Expand Down
1 change: 0 additions & 1 deletion flower/include/offset.hh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,5 @@ cross_product (Offset o1, Offset o2)
return o1[X_AXIS] * o2[Y_AXIS] - o1[Y_AXIS] * o2[X_AXIS];
}


#endif /* OFFSET_HH */

1 change: 0 additions & 1 deletion flower/include/std-string.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include <string>


typedef size_t ssize;
#define NPOS std::string::npos

Expand Down
17 changes: 8 additions & 9 deletions flower/include/std-vector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <cassert>
#include <string>


template<typename T>
int default_compare (T const &a, T const &b)
{
Expand Down Expand Up @@ -115,9 +114,9 @@ lower_bound (std::vector<T> const &v,
if (e == VPOS)
e = v.size ();
typename std::vector<T>::const_iterator i = lower_bound (v.begin () + b,
v.begin () + e,
key,
less);
v.begin () + e,
key,
less);

return i - v.begin ();
}
Expand All @@ -133,9 +132,9 @@ upper_bound (std::vector<T> const &v,
e = v.size ();

typename std::vector<T>::const_iterator i = upper_bound (v.begin () + b,
v.begin () + e,
key,
less);
v.begin () + e,
key,
less);

return i - v.begin ();
}
Expand Down Expand Up @@ -169,8 +168,8 @@ vector_sort (std::vector<T> &v,
template<typename T, typename Compare>
void
vector_stable_sort (std::vector<T> &v,
Compare less,
vsize b = 0, vsize e = VPOS)
Compare less,
vsize b = 0, vsize e = VPOS)
{
if (e == VPOS)
e = v.size ();
Expand Down
2 changes: 1 addition & 1 deletion flower/include/warn.hh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extern bool warning_as_error;
/* output messages, in decreasing order of importance */
void error (std::string s, const std::string &location = ""); // Fatal error, exits lilypond!
void programming_error (const std::string &s, const std::string &location = "");
void non_fatal_error (const std::string&, const std::string &location = "");
void non_fatal_error (const std::string &, const std::string &location = "");
void warning (const std::string &s, const std::string &location = "");
void basic_progress (const std::string &s, const std::string &location = "");
/* progress_indication does by default *NOT* start on a new line */
Expand Down
1 change: 0 additions & 1 deletion flower/libc-extension.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <cctype>
#include <cassert>


#include "libc-extension.hh"

char *
Expand Down
33 changes: 16 additions & 17 deletions flower/offset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,27 @@ Offset::angle_degrees () const
// NAN angles.
if (y < 0.0)
{
if (2*x < -y)
if (-x > -2*y) // x < 0, y < 0, |x| > |2y|
if (2 * x < -y)
if (-x > -2 * y) // x < 0, y < 0, |x| > |2y|
return -180 + atan2d (-y, -x);
else if (-2*x >= -y) // x < 0, y < 0, |y| < |2x| <= |4y|
else if (-2 * x >= -y) // x < 0, y < 0, |y| < |2x| <= |4y|
return -135 + atan2d (x - y, -y - x);
else // y < 0, |y| >= |2x|
return -90 + atan2d (x, -y);
else if (x <= -2*y) // x > 0, y < 0, |y| <= |2x| < |4y|
else if (x <= -2 * y) // x > 0, y < 0, |y| <= |2x| < |4y|
return -45 + atan2d (x + y, x - y);
// Drop through for y < 0, x > |2y|
}
else if (y > 0.0)
{
if (2*x < y)
if (-x > 2*y) // x < 0, y >= 0, |x| > |2y|
if (2 * x < y)
if (-x > 2 * y) // x < 0, y >= 0, |x| > |2y|
return 180 - atan2d (y, -x);
else if (-2*x >= y) // x < 0, y >= 0, |y| < |2x| <= |4y|
else if (-2 * x >= y) // x < 0, y >= 0, |y| < |2x| <= |4y|
return 135 - atan2d (x + y, y - x);
else // y >= 0, |y| >= |2x|
return 90 - atan2d (x, y);
else if (x <= 2*y) // x >= 0, y >= 0, |y| < |2x| < |4y|
else if (x <= 2 * y) // x >= 0, y >= 0, |y| < |2x| < |4y|
return 45 - atan2d (x - y, x + y);
// Drop through for y > 0, x > |2y|
}
Expand All @@ -113,7 +113,6 @@ Offset::angle_degrees () const
return atan2d (y, x);
}


/**
euclidian vector length / complex modulus
*/
Expand Down Expand Up @@ -180,15 +179,15 @@ offset_directed (Real angle)

if (angle > 0)
if (angle > 90)
return Offset (sin ((90 - angle) * M_PI/180.0),
sin ((180 - angle) * M_PI/180.0));
return Offset (sin ((90 - angle) * M_PI / 180.0),
sin ((180 - angle) * M_PI / 180.0));
else
return Offset (sin ((90 - angle) * M_PI/180.0),
sin (angle * M_PI/180.0));
return Offset (sin ((90 - angle) * M_PI / 180.0),
sin (angle * M_PI / 180.0));
else if (angle < -90)
return Offset (sin ((90 + angle) * M_PI/180.0),
sin ((-180 - angle) * M_PI/180.0));
return Offset (sin ((90 + angle) * M_PI / 180.0),
sin ((-180 - angle) * M_PI / 180.0));
else
return Offset (sin ((90 + angle) * M_PI/180.0),
sin (angle * M_PI/180.0));
return Offset (sin ((90 + angle) * M_PI / 180.0),
sin (angle * M_PI / 180.0));
}
2 changes: 1 addition & 1 deletion flower/rational.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Rational::operator double () const
I64 inum = num_;
I64 iden = den_;
return static_cast<double> (sign_) *
static_cast<double> (inum) / static_cast<double> (iden);
static_cast<double> (inum) / static_cast<double> (iden);
}
#else
return (double)sign_ * (double)num_ / (double)den_;
Expand Down
4 changes: 2 additions & 2 deletions flower/string-convert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ String_convert::pad_to (const string &s, size_t n)
string
String_convert::to_upper (string s)
{
return strnupr (const_cast<char*>(s.c_str ()), s.length ());
return strnupr (const_cast<char *>(s.c_str ()), s.length ());
}

string
String_convert::to_lower (string s)
{
return strnlwr (const_cast<char*>(s.c_str ()), s.length ());
return strnlwr (const_cast<char *>(s.c_str ()), s.length ());
}
2 changes: 1 addition & 1 deletion flower/test-file-path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TEST (File_path, Find)
{
char const *extensions[] = {"ly", "", 0};
string file = "init";
if (get_working_directory().empty())
if (get_working_directory ().empty ())
{
std::cerr << "Could not get current work directory\n";
exit (1);
Expand Down
4 changes: 2 additions & 2 deletions lily/acceptance-set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Acceptance_set::accept (SCM item)
{
// insert the new item after the default
SCM rest = scm_cdr (accepted_);
scm_set_cdr_x(accepted_, scm_cons (item, rest));
scm_set_cdr_x (accepted_, scm_cons (item, rest));
}
else
{
Expand All @@ -49,7 +49,7 @@ Acceptance_set::accept (SCM item)
void
Acceptance_set::accept_default (SCM item)
{
accepted_ = scm_cons(item, scm_delete_x (item, accepted_));
accepted_ = scm_cons (item, scm_delete_x (item, accepted_));
default_ = item;
}

Expand Down
7 changes: 3 additions & 4 deletions lily/accidental-engraver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ Accidental_engraver::make_standard_accidental (Stream_event * /* note */,
// but may break in subtle corner cases.
intmax_t context_hash = reinterpret_cast<intmax_t>(trans);
Accidental_placement::add_accidental
(accidental_placement_, a,
scm_is_eq (get_property ("accidentalGrouping"), ly_symbol2scm ("voice")),
static_cast<long>(context_hash));
(accidental_placement_, a,
scm_is_eq (get_property ("accidentalGrouping"), ly_symbol2scm ("voice")),
static_cast<long>(context_hash));

note_head->set_object ("accidental-grob", a->self_scm ());

Expand Down Expand Up @@ -523,7 +523,6 @@ Accidental_engraver::process_music ()
update_local_key_signature (sig);
}


void
Accidental_engraver::boot ()
{
Expand Down
2 changes: 1 addition & 1 deletion lily/accidental-placement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ stagger_apes (vector<unique_ptr<Accidental_placement_entry>> *apes)
}

static vector<unique_ptr<Accidental_placement_entry>>
build_apes (SCM accs)
build_apes (SCM accs)
{
vector<unique_ptr<Accidental_placement_entry>> apes;
for (SCM s = accs; scm_is_pair (s); s = scm_cdr (s))
Expand Down
10 changes: 5 additions & 5 deletions lily/accidental.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ Accidental_interface::horizontal_skylines (SCM smob)
return Skyline_pair ().smobbed_copy ();

SCM rot = me->get_property ("rotation");
Skyline_pair *sky =
unsmob<Skyline_pair>
Skyline_pair *sky
= unsmob<Skyline_pair>
(Stencil::skylines_from_stencil
(my_stencil->smobbed_copy (), 0.0, rot, Y_AXIS));
(my_stencil->smobbed_copy (), 0.0, rot, Y_AXIS));

SCM alist = me->get_property ("glyph-name-alist");
SCM alt = me->get_property ("alteration");
string glyph_name = robust_scm2string (ly_assoc_get (alt, alist, SCM_BOOL_F),
"");
"");
if (glyph_name == "accidentals.flat"
|| glyph_name == "accidentals.flatflat")
{
Expand Down Expand Up @@ -115,7 +115,7 @@ Accidental_interface::remove_tied (SCM smob)
if (tie
&& !to_boolean (me->get_property ("forced"))
&& (to_boolean (me->get_property ("hide-tied-accidental-after-break"))
|| !tie->original()))
|| !tie->original ()))
me->suicide ();

return SCM_UNSPECIFIED;
Expand Down
4 changes: 2 additions & 2 deletions lily/align-interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Align_interface::internal_get_minimum_translations (Grob *me,
&spaceable_padding,
ly_symbol2scm ("padding"));
dy = std::max (dy, (last_spaceable_skyline.distance (skyline[-stacking_dir])
+ stacking_dir * (last_spaceable_element_pos - where) + spaceable_padding));
+ stacking_dir * (last_spaceable_element_pos - where) + spaceable_padding));

Real spaceable_min_distance = 0;
if (Page_layout_problem::read_spacing_spec (spec,
Expand All @@ -261,7 +261,7 @@ Align_interface::internal_get_minimum_translations (Grob *me,
dy = std::max (dy, spaceable_min_distance + stacking_dir * (last_spaceable_element_pos - where));

dy = std::max (dy, Page_layout_problem::get_fixed_spacing (last_spaceable_element, elems[j], spaceable_count,
pure, start, end));
pure, start, end));
}
}

Expand Down
2 changes: 1 addition & 1 deletion lily/all-font-metrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ All_font_metrics::find_otf (const string &name)
unsmob<Font_metric> (val)->file_name_ = file_name;
SCM name_string = ly_string2scm (name);
unsmob<Font_metric> (val)->description_ = scm_cons (name_string,
scm_from_double (1.0));
scm_from_double (1.0));
otf_dict_->set (sname, val);
unsmob<Font_metric> (val)->unprotect ();
}
Expand Down
1 change: 0 additions & 1 deletion lily/arpeggio-engraver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ Arpeggio_engraver::stop_translation_timestep ()
arpeggio_event_ = 0;
}


void
Arpeggio_engraver::boot ()
{
Expand Down
8 changes: 4 additions & 4 deletions lily/audio-item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void
Audio_note::tie_to (Audio_note *t, Moment skip)
{
tied_ = t;
Audio_note *first = tie_head();
Audio_note *first = tie_head ();
// Add the skip to the tied note and the length of the appended note
// to the full duration of the tie...
first->length_mom_ += skip + length_mom_;
Expand All @@ -83,12 +83,12 @@ string
Audio_note::to_string () const
{
string s = "#<Audio_note pitch ";
s += pitch_.to_string();
s += pitch_.to_string ();
s += " len ";
s += length_mom_.to_string();
s += length_mom_.to_string ();
if (tied_)
{
s += " tied to " + tied_->to_string();
s += " tied to " + tied_->to_string ();
}
if (tie_event_)
{
Expand Down
11 changes: 5 additions & 6 deletions lily/auto-beam-engraver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ bool
Auto_beam_engraver::test_moment (Direction dir, Moment test_mom, Moment dur)
{
return scm_is_true (scm_call_4 (get_property ("autoBeamCheck"),
context ()->self_scm (),
scm_from_int (dir),
test_mom.smobbed_copy (),
dur.smobbed_copy ()));
context ()->self_scm (),
scm_from_int (dir),
test_mom.smobbed_copy (),
dur.smobbed_copy ()));
}

void
Expand Down Expand Up @@ -271,7 +271,6 @@ Auto_beam_engraver::is_same_grace_state (Moment start, Moment now)
return bool (start.grace_part_) == bool (now.grace_part_);
}


void
Auto_beam_engraver::end_beam ()
{
Expand Down Expand Up @@ -634,7 +633,7 @@ Grace_auto_beam_engraver::test_moment (Direction dir, Moment test_mom, Moment)
return false;
// Autobeam start only when at the start of the grace group.
if (dir == START)
return last_grace_position_ == test_mom;
return last_grace_position_ == test_mom;
// Autobeam end only when the grace part is finished.
return !test_mom.grace_part_;
}
Expand Down

0 comments on commit 786c366

Please sign in to comment.