summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-11-21 02:49:41 -0500
committerDavid Robillard <d@drobilla.net>2014-11-22 00:46:15 -0500
commit01493b14cfa215c61e3a99e6d4687b6d37453ab6 (patch)
tree297aa50b249b0cb5641ef62797c48e62a45abff4 /libs
parent24f7eccc867a5817765be9ae70acf1ed9be1ddfd (diff)
Fix const violation warnings in tempo.cc.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/tempo.h2
-rw-r--r--libs/ardour/tempo.cc40
2 files changed, 38 insertions, 4 deletions
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h
index 15cd1662f0..19fe5b0b12 100644
--- a/libs/ardour/ardour/tempo.h
+++ b/libs/ardour/ardour/tempo.h
@@ -359,7 +359,9 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
framecnt_t bbt_duration_at_unlocked (const Timecode::BBT_Time& when, const Timecode::BBT_Time& bbt, int dir);
const MeterSection& first_meter() const;
+ MeterSection& first_meter();
const TempoSection& first_tempo() const;
+ TempoSection& first_tempo();
void do_insert (MetricSection* section);
};
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index e775092066..57bf9fe674 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -475,7 +475,7 @@ TempoMap::do_insert (MetricSection* section)
void
TempoMap::replace_tempo (const TempoSection& ts, const Tempo& tempo, const BBT_Time& where)
{
- const TempoSection& first (first_tempo());
+ TempoSection& first (first_tempo());
if (ts.start() != first.start()) {
remove_tempo (ts, false);
@@ -484,7 +484,7 @@ TempoMap::replace_tempo (const TempoSection& ts, const Tempo& tempo, const BBT_T
{
Glib::Threads::RWLock::WriterLock lm (lock);
/* cannot move the first tempo section */
- *((Tempo*)&first) = tempo;
+ *static_cast<Tempo*>(&first) = tempo;
recompute_map (false);
}
}
@@ -545,7 +545,7 @@ TempoMap::add_tempo (const Tempo& tempo, BBT_Time where)
void
TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const BBT_Time& where)
{
- const MeterSection& first (first_meter());
+ MeterSection& first (first_meter());
if (ms.start() != first.start()) {
remove_meter (ms, false);
@@ -554,7 +554,7 @@ TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const BBT_T
{
Glib::Threads::RWLock::WriterLock lm (lock);
/* cannot move the first meter section */
- *((Meter*)&first) = meter;
+ *static_cast<Meter*>(&first) = meter;
recompute_map (true);
}
}
@@ -681,6 +681,22 @@ TempoMap::first_meter () const
return *m;
}
+MeterSection&
+TempoMap::first_meter ()
+{
+ MeterSection *m = 0;
+
+ for (Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) {
+ if ((m = dynamic_cast<MeterSection *> (*i)) != 0) {
+ return *m;
+ }
+ }
+
+ fatal << _("programming error: no tempo section in tempo map!") << endmsg;
+ abort(); /*NOTREACHED*/
+ return *m;
+}
+
const TempoSection&
TempoMap::first_tempo () const
{
@@ -697,6 +713,22 @@ TempoMap::first_tempo () const
return *t;
}
+TempoSection&
+TempoMap::first_tempo ()
+{
+ TempoSection *t = 0;
+
+ for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
+ if ((t = dynamic_cast<TempoSection *> (*i)) != 0) {
+ return *t;
+ }
+ }
+
+ fatal << _("programming error: no tempo section in tempo map!") << endmsg;
+ abort(); /*NOTREACHED*/
+ return *t;
+}
+
void
TempoMap::require_map_to (framepos_t pos)
{