aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-12-24 16:49:44 +0000
committerDavid Robillard <d@drobilla.net>2013-12-24 16:49:44 +0000
commita6521f912b24bcf40c204303139eb2a104d5f85d (patch)
treefa101a658cc926b5387e9896667ca6658a5a62d1 /plugins
parent391dd35265d03f3d4ebfcc2e2da28e2db6c75306 (diff)
downloadlv2-a6521f912b24bcf40c204303139eb2a104d5f85d.tar.xz
Fix several const violations.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/eg03-metro.lv2/metro.c4
-rw-r--r--plugins/eg04-sampler.lv2/sampler.c2
-rw-r--r--plugins/eg04-sampler.lv2/sampler_ui.c8
-rw-r--r--plugins/eg04-sampler.lv2/uris.h2
-rw-r--r--plugins/eg05-scope.lv2/examploscope.c13
-rw-r--r--plugins/eg05-scope.lv2/examploscope_ui.c32
6 files changed, 31 insertions, 30 deletions
diff --git a/plugins/eg03-metro.lv2/metro.c b/plugins/eg03-metro.lv2/metro.c
index 51125af..c2e18af 100644
--- a/plugins/eg03-metro.lv2/metro.c
+++ b/plugins/eg03-metro.lv2/metro.c
@@ -301,7 +301,7 @@ run(LV2_Handle instance, uint32_t sample_count)
// Work forwards in time frame by frame, handling events as we go
const LV2_Atom_Sequence* in = self->ports.control;
uint32_t last_t = 0;
- for (LV2_Atom_Event* ev = lv2_atom_sequence_begin(&in->body);
+ for (const LV2_Atom_Event* ev = lv2_atom_sequence_begin(&in->body);
!lv2_atom_sequence_is_end(&in->body, in->atom.size, ev);
ev = lv2_atom_sequence_next(ev)) {
@@ -309,7 +309,7 @@ run(LV2_Handle instance, uint32_t sample_count)
play(self, last_t, ev->time.frames);
if (ev->body.type == uris->atom_Blank) {
- const LV2_Atom_Object* obj = (LV2_Atom_Object*)&ev->body;
+ const LV2_Atom_Object* obj = (const LV2_Atom_Object*)&ev->body;
if (obj->body.otype == uris->time_Position) {
// Received position information, update
update_position(self, obj);
diff --git a/plugins/eg04-sampler.lv2/sampler.c b/plugins/eg04-sampler.lv2/sampler.c
index 9353d48..70f31c5 100644
--- a/plugins/eg04-sampler.lv2/sampler.c
+++ b/plugins/eg04-sampler.lv2/sampler.c
@@ -343,7 +343,7 @@ run(LV2_Handle instance,
break;
}
} else if (is_object_type(uris, ev->body.type)) {
- const LV2_Atom_Object* obj = (LV2_Atom_Object*)&ev->body;
+ const LV2_Atom_Object* obj = (const LV2_Atom_Object*)&ev->body;
if (obj->body.otype == uris->patch_Set) {
// Received a set message, send it to the worker.
lv2_log_trace(&self->logger, "Queueing set message\n");
diff --git a/plugins/eg04-sampler.lv2/sampler_ui.c b/plugins/eg04-sampler.lv2/sampler_ui.c
index 40922ae..2184fbf 100644
--- a/plugins/eg04-sampler.lv2/sampler_ui.c
+++ b/plugins/eg04-sampler.lv2/sampler_ui.c
@@ -155,16 +155,16 @@ port_event(LV2UI_Handle handle,
{
SamplerUI* ui = (SamplerUI*)handle;
if (format == ui->uris.atom_eventTransfer) {
- LV2_Atom* atom = (LV2_Atom*)buffer;
+ const LV2_Atom* atom = (const LV2_Atom*)buffer;
if (atom->type == ui->uris.atom_Blank) {
- LV2_Atom_Object* obj = (LV2_Atom_Object*)atom;
- const LV2_Atom* file_uri = read_set_file(&ui->uris, obj);
+ const LV2_Atom_Object* obj = (const LV2_Atom_Object*)atom;
+ const LV2_Atom* file_uri = read_set_file(&ui->uris, obj);
if (!file_uri) {
fprintf(stderr, "Unknown message sent to UI.\n");
return;
}
- const char* uri = (const char*)LV2_ATOM_BODY(file_uri);
+ const char* uri = (const char*)LV2_ATOM_BODY_CONST(file_uri);
gtk_label_set_text(GTK_LABEL(ui->label), uri);
} else {
fprintf(stderr, "Unknown message type.\n");
diff --git a/plugins/eg04-sampler.lv2/uris.h b/plugins/eg04-sampler.lv2/uris.h
index e2ec6d0..1c00280 100644
--- a/plugins/eg04-sampler.lv2/uris.h
+++ b/plugins/eg04-sampler.lv2/uris.h
@@ -120,7 +120,7 @@ read_set_file(const SamplerURIs* uris,
} else if (property->type != uris->atom_URID) {
fprintf(stderr, "Malformed set message has non-URID property.\n");
return NULL;
- } else if (((LV2_Atom_URID*)property)->body != uris->eg_sample) {
+ } else if (((const LV2_Atom_URID*)property)->body != uris->eg_sample) {
fprintf(stderr, "Set message for unknown property.\n");
return NULL;
}
diff --git a/plugins/eg05-scope.lv2/examploscope.c b/plugins/eg05-scope.lv2/examploscope.c
index 13281ab..ff64866 100644
--- a/plugins/eg05-scope.lv2/examploscope.c
+++ b/plugins/eg05-scope.lv2/examploscope.c
@@ -242,13 +242,14 @@ run(LV2_Handle handle, uint32_t n_samples)
// Process incoming events from GUI
if (self->control) {
- LV2_Atom_Event* ev = lv2_atom_sequence_begin(&(self->control)->body);
+ const LV2_Atom_Event* ev = lv2_atom_sequence_begin(
+ &(self->control)->body);
// For each incoming message...
while (!lv2_atom_sequence_is_end(
&self->control->body, self->control->atom.size, ev)) {
// If the event is an atom:Blank object
if (ev->body.type == self->uris.atom_Blank) {
- const LV2_Atom_Object* obj = (LV2_Atom_Object*)&ev->body;
+ const LV2_Atom_Object* obj = (const LV2_Atom_Object*)&ev->body;
if (obj->body.otype == self->uris.ui_On) {
// If the object is a ui-on, the UI was activated
self->ui_active = true;
@@ -264,10 +265,10 @@ run(LV2_Handle handle, uint32_t n_samples)
self->uris.ui_amp, &amp,
0);
if (spp) {
- self->ui_spp = ((LV2_Atom_Int*)spp)->body;
+ self->ui_spp = ((const LV2_Atom_Int*)spp)->body;
}
if (amp) {
- self->ui_amp = ((LV2_Atom_Float*)amp)->body;
+ self->ui_amp = ((const LV2_Atom_Float*)amp)->body;
}
}
}
@@ -343,14 +344,14 @@ state_restore(LV2_Handle instance,
const void* spp = retrieve(
handle, self->uris.ui_spp, &size, &type, &valflags);
if (spp && size == sizeof(uint32_t) && type == self->uris.atom_Int) {
- self->ui_spp = *((uint32_t*)spp);
+ self->ui_spp = *((const uint32_t*)spp);
self->send_settings_to_ui = true;
}
const void* amp = retrieve(
handle, self->uris.ui_amp, &size, &type, &valflags);
if (amp && size == sizeof(float) && type == self->uris.atom_Float) {
- self->ui_amp = *((float*)amp);
+ self->ui_amp = *((const float*)amp);
self->send_settings_to_ui = true;
}
diff --git a/plugins/eg05-scope.lv2/examploscope_ui.c b/plugins/eg05-scope.lv2/examploscope_ui.c
index ffbe573..3e014f0 100644
--- a/plugins/eg05-scope.lv2/examploscope_ui.c
+++ b/plugins/eg05-scope.lv2/examploscope_ui.c
@@ -527,10 +527,10 @@ cleanup(LV2UI_Handle handle)
}
static int
-recv_raw_audio(EgScopeUI* ui, LV2_Atom_Object* obj)
+recv_raw_audio(EgScopeUI* ui, const LV2_Atom_Object* obj)
{
- LV2_Atom* chan_val = NULL;
- LV2_Atom* data_val = NULL;
+ const LV2_Atom* chan_val = NULL;
+ const LV2_Atom* data_val = NULL;
const int n_props = lv2_atom_object_get(
obj,
ui->uris.channelID, &chan_val,
@@ -546,8 +546,8 @@ recv_raw_audio(EgScopeUI* ui, LV2_Atom_Object* obj)
}
// Get the values we need from the body of the property value atoms
- const int32_t chn = ((LV2_Atom_Int*)chan_val)->body;
- LV2_Atom_Vector* vec = (LV2_Atom_Vector*)data_val;
+ const int32_t chn = ((const LV2_Atom_Int*)chan_val)->body;
+ const LV2_Atom_Vector* vec = (const LV2_Atom_Vector*)data_val;
if (vec->body.child_type != ui->uris.atom_Float) {
return 1; // Vector has incorrect element type
}
@@ -557,7 +557,7 @@ recv_raw_audio(EgScopeUI* ui, LV2_Atom_Object* obj)
/ sizeof(float));
// Float elements immediately follow the vector body header
- const float* data = (float*)(&vec->body + 1);
+ const float* data = (const float*)(&vec->body + 1);
// Update display
update_scope(ui, chn, n_elem, data);
@@ -565,11 +565,11 @@ recv_raw_audio(EgScopeUI* ui, LV2_Atom_Object* obj)
}
static int
-recv_ui_state(EgScopeUI* ui, LV2_Atom_Object* obj)
+recv_ui_state(EgScopeUI* ui, const LV2_Atom_Object* obj)
{
- LV2_Atom* spp_val = NULL;
- LV2_Atom* amp_val = NULL;
- LV2_Atom* rate_val = NULL;
+ const LV2_Atom* spp_val = NULL;
+ const LV2_Atom* amp_val = NULL;
+ const LV2_Atom* rate_val = NULL;
const int n_props = lv2_atom_object_get(
obj,
ui->uris.ui_spp, &spp_val,
@@ -587,9 +587,9 @@ recv_ui_state(EgScopeUI* ui, LV2_Atom_Object* obj)
}
// Get the values we need from the body of the property value atoms
- const int32_t spp = ((LV2_Atom_Int*)spp_val)->body;
- const float amp = ((LV2_Atom_Float*)amp_val)->body;
- const float rate = ((LV2_Atom_Float*)rate_val)->body;
+ const int32_t spp = ((const LV2_Atom_Int*)spp_val)->body;
+ const float amp = ((const LV2_Atom_Float*)amp_val)->body;
+ const float rate = ((const LV2_Atom_Float*)rate_val)->body;
// Update UI
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->spb_speed), spp);
@@ -614,8 +614,8 @@ port_event(LV2UI_Handle handle,
uint32_t format,
const void* buffer)
{
- EgScopeUI* ui = (EgScopeUI*)handle;
- LV2_Atom* atom = (LV2_Atom*)buffer;
+ EgScopeUI* ui = (EgScopeUI*)handle;
+ const LV2_Atom* atom = (const LV2_Atom*)buffer;
/* Check type of data received
* - format == 0: Control port event (float)
@@ -623,7 +623,7 @@ port_event(LV2UI_Handle handle,
*/
if (format == ui->uris.atom_eventTransfer &&
atom->type == ui->uris.atom_Blank) {
- LV2_Atom_Object* obj = (LV2_Atom_Object*)atom;
+ const LV2_Atom_Object* obj = (const LV2_Atom_Object*)atom;
if (obj->body.otype == ui->uris.RawAudio) {
recv_raw_audio(ui, obj);
} else if (obj->body.otype == ui->uris.ui_State) {