aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-06-15 13:01:21 -0400
committerDavid Robillard <d@drobilla.net>2022-07-17 17:08:36 -0400
commitf723513288fe2cd3a5b59a94b470bc43e456e7a3 (patch)
treee3637f463714364932fc684dbb76a18550da28d6
parent7ee4fa3fe15a2057541bf35534a2f94f77c19d5d (diff)
downloadlv2-f723513288fe2cd3a5b59a94b470bc43e456e7a3.tar.xz
Make potentially lossy type conversions explicit
-rw-r--r--lv2/event/event-helpers.h2
-rw-r--r--plugins/eg-metro.lv2/metro.c4
-rw-r--r--plugins/eg-midigate.lv2/midigate.c2
-rw-r--r--plugins/eg-sampler.lv2/peaks.h4
4 files changed, 6 insertions, 6 deletions
diff --git a/lv2/event/event-helpers.h b/lv2/event/event-helpers.h
index 1e19e58..bf1b885 100644
--- a/lv2/event/event-helpers.h
+++ b/lv2/event/event-helpers.h
@@ -51,7 +51,7 @@ LV2_DISABLE_DEPRECATION_WARNINGS
static inline uint16_t
lv2_event_pad_size(uint16_t size)
{
- return (uint16_t)(size + 7U) & (uint16_t)(~7U);
+ return (uint16_t)((size + 7U) & ~7U);
}
/** Initialize (empty, reset..) an existing event buffer.
diff --git a/plugins/eg-metro.lv2/metro.c b/plugins/eg-metro.lv2/metro.c
index 264f2c7..354934b 100644
--- a/plugins/eg-metro.lv2/metro.c
+++ b/plugins/eg-metro.lv2/metro.c
@@ -313,7 +313,7 @@ run(LV2_Handle instance, uint32_t sample_count)
!lv2_atom_sequence_is_end(&in->body, in->atom.size, ev);
ev = lv2_atom_sequence_next(ev)) {
// Play the click for the time slice from last_t until now
- play(self, last_t, ev->time.frames);
+ play(self, last_t, (uint32_t)ev->time.frames);
// Check if this event is an Object
// (or deprecated Blank to tolerate old hosts)
@@ -327,7 +327,7 @@ run(LV2_Handle instance, uint32_t sample_count)
}
// Update time for next iteration and move to next event
- last_t = ev->time.frames;
+ last_t = (uint32_t)ev->time.frames;
}
// Play for remainder of cycle
diff --git a/plugins/eg-midigate.lv2/midigate.c b/plugins/eg-midigate.lv2/midigate.c
index 5379440..7b77079 100644
--- a/plugins/eg-midigate.lv2/midigate.c
+++ b/plugins/eg-midigate.lv2/midigate.c
@@ -186,7 +186,7 @@ run(LV2_Handle instance, uint32_t sample_count)
}
}
- write_output(self, offset, ev->time.frames - offset);
+ write_output(self, offset, (uint32_t)(ev->time.frames - offset));
offset = (uint32_t)ev->time.frames;
}
diff --git a/plugins/eg-sampler.lv2/peaks.h b/plugins/eg-sampler.lv2/peaks.h
index ca5328d..7a5f3e3 100644
--- a/plugins/eg-sampler.lv2/peaks.h
+++ b/plugins/eg-sampler.lv2/peaks.h
@@ -153,11 +153,11 @@ peaks_sender_send(PeaksSender* sender,
// eg:offset = OFFSET
lv2_atom_forge_key(forge, uris->peaks_offset);
- lv2_atom_forge_int(forge, sender->current_offset);
+ lv2_atom_forge_int(forge, (int32_t)sender->current_offset);
// eg:total = TOTAL
lv2_atom_forge_key(forge, uris->peaks_total);
- lv2_atom_forge_int(forge, sender->n_peaks);
+ lv2_atom_forge_int(forge, (int32_t)sender->n_peaks);
// eg:magnitudes = Vector<Float>(PEAK, PEAK, ...)
lv2_atom_forge_key(forge, uris->peaks_magnitudes);