diff options
author | David Robillard <d@drobilla.net> | 2024-10-06 13:57:47 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-10-06 13:57:47 -0400 |
commit | 5309d0fcc9ef1a01ce9d0e3631ae45eb86a28740 (patch) | |
tree | d4b73d4903b3a196a365968a1ab3d3a9ed9849f4 | |
parent | 447b44c67368a4e1686d1db2688e5624a63cd0f4 (diff) | |
download | lv2-5309d0fcc9ef1a01ce9d0e3631ae45eb86a28740.tar.xz |
Add missing const qualifiers
-rw-r--r-- | include/lv2/event/event-helpers.h | 3 | ||||
-rw-r--r-- | plugins/eg-fifths.lv2/fifths.c | 4 | ||||
-rw-r--r-- | plugins/eg-params.lv2/params.c | 2 | ||||
-rw-r--r-- | plugins/eg-sampler.lv2/sampler.c | 6 | ||||
-rw-r--r-- | plugins/eg-sampler.lv2/sampler_ui.c | 2 | ||||
-rw-r--r-- | plugins/eg-scope.lv2/examploscope.c | 10 | ||||
-rw-r--r-- | plugins/eg-scope.lv2/examploscope_ui.c | 14 | ||||
-rw-r--r-- | test/test_atom.c | 2 |
8 files changed, 22 insertions, 21 deletions
diff --git a/include/lv2/event/event-helpers.h b/include/lv2/event/event-helpers.h index a9eb423..5ec9a84 100644 --- a/include/lv2/event/event-helpers.h +++ b/include/lv2/event/event-helpers.h @@ -107,7 +107,8 @@ lv2_event_increment(LV2_Event_Iterator* iter) return false; } - LV2_Event* const ev = (LV2_Event*)(iter->buf->data + iter->offset); + const LV2_Event* const ev = + (const LV2_Event*)(iter->buf->data + iter->offset); iter->offset += lv2_event_pad_size((uint16_t)((uint16_t)sizeof(LV2_Event) + ev->size)); diff --git a/plugins/eg-fifths.lv2/fifths.c b/plugins/eg-fifths.lv2/fifths.c index 9f6a388..d2400b4 100644 --- a/plugins/eg-fifths.lv2/fifths.c +++ b/plugins/eg-fifths.lv2/fifths.c @@ -90,8 +90,8 @@ cleanup(LV2_Handle instance) static void run(LV2_Handle instance, uint32_t sample_count) { - Fifths* self = (Fifths*)instance; - FifthsURIs* uris = &self->uris; + Fifths* self = (Fifths*)instance; + const FifthsURIs* uris = &self->uris; // Struct for a 3 byte MIDI event, used for writing notes typedef struct { diff --git a/plugins/eg-params.lv2/params.c b/plugins/eg-params.lv2/params.c index af96fc8..742c48b 100644 --- a/plugins/eg-params.lv2/params.c +++ b/plugins/eg-params.lv2/params.c @@ -320,7 +320,7 @@ save(LV2_Handle instance, LV2_State_Status st = LV2_STATE_SUCCESS; for (unsigned i = 0; i < N_PROPS; ++i) { - StateMapItem* prop = &self->props[i]; + const StateMapItem* prop = &self->props[i]; store_prop(self, map_path, &st, store, handle, prop->urid, prop->value); } diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index d2d480d..4c5a92a 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -249,9 +249,9 @@ work(LV2_Handle instance, static LV2_Worker_Status work_response(LV2_Handle instance, uint32_t size, const void* data) { - Sampler* self = (Sampler*)instance; - Sample* old_sample = self->sample; - Sample* new_sample = *(Sample* const*)data; + Sampler* self = (Sampler*)instance; + Sample* old_sample = self->sample; + const Sample* new_sample = *(Sample* const*)data; // Install the new sample self->sample = *(Sample* const*)data; diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c index 16a8c71..fc879eb 100644 --- a/plugins/eg-sampler.lv2/sampler_ui.c +++ b/plugins/eg-sampler.lv2/sampler_ui.c @@ -421,7 +421,7 @@ ui_hide(LV2UI_Handle handle) static int ui_idle(LV2UI_Handle handle) { - SamplerUI* ui = (SamplerUI*)handle; + const SamplerUI* ui = (const SamplerUI*)handle; if (ui->window) { gtk_main_iteration_do(false); } diff --git a/plugins/eg-scope.lv2/examploscope.c b/plugins/eg-scope.lv2/examploscope.c index e3bb53b..918fca2 100644 --- a/plugins/eg-scope.lv2/examploscope.c +++ b/plugins/eg-scope.lv2/examploscope.c @@ -169,11 +169,11 @@ connect_port(LV2_Handle handle, uint32_t port, void* data) http://lv2plug.in/ns/ext/atom#Float[Float]. */ static void -tx_rawaudio(LV2_Atom_Forge* forge, - ScoLV2URIs* uris, - const int32_t channel, - const size_t n_samples, - const float* data) +tx_rawaudio(LV2_Atom_Forge* forge, + const ScoLV2URIs* uris, + const int32_t channel, + const size_t n_samples, + const float* data) { LV2_Atom_Forge_Frame frame; diff --git a/plugins/eg-scope.lv2/examploscope_ui.c b/plugins/eg-scope.lv2/examploscope_ui.c index 5684406..7b49967 100644 --- a/plugins/eg-scope.lv2/examploscope_ui.c +++ b/plugins/eg-scope.lv2/examploscope_ui.c @@ -167,7 +167,7 @@ send_ui_enable(LV2UI_Handle handle) static gboolean on_cfg_changed(GtkWidget* widget, gpointer data) { - EgScopeUI* ui = (EgScopeUI*)data; + const EgScopeUI* ui = (const EgScopeUI*)data; if (!ui->updating) { // Only send UI state if the change is from user interaction send_ui_state(data); @@ -327,12 +327,12 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) and https://github.com/x42/sisco.lv2 */ static int -process_channel(EgScopeUI* ui, - ScoChan* chn, - const size_t n_elem, - float const* data, - uint32_t* idx_start, - uint32_t* idx_end) +process_channel(const EgScopeUI* ui, + ScoChan* chn, + const size_t n_elem, + float const* data, + uint32_t* idx_start, + uint32_t* idx_end) { int overflow = 0; *idx_start = chn->idx; diff --git a/test/test_atom.c b/test/test_atom.c index 421063e..ffe73a1 100644 --- a/test/test_atom.c +++ b/test/test_atom.c @@ -186,7 +186,7 @@ main(void) LV2_Atom_Vector* vector = (LV2_Atom_Vector*)lv2_atom_forge_deref( &forge, lv2_atom_forge_vector(&forge, sizeof(int32_t), forge.Int, 4, elems)); - void* vec_body = LV2_ATOM_CONTENTS(LV2_Atom_Vector, vector); + const void* vec_body = LV2_ATOM_CONTENTS_CONST(LV2_Atom_Vector, vector); if (!!memcmp(elems, vec_body, sizeof(elems))) { return test_fail("Corrupt vector\n"); } |